0
$\begingroup$

How do I write a chevron/circum (^) in MathJax? A backslash doesn't work as an escape character.

(Specific context: using x^y to mean XOR as in $x\oplus y$. It's not my choice of notation so don't tell me that I can just use a different symbol.)

$\endgroup$
1
  • 2
    $\begingroup$ Basically all possibles ways (with LaTeX, not with MathJax) are in this answer: tex.stackexchange.com/a/77647. $\endgroup$ – Saad May 14 '20 at 10:47
1
$\begingroup$

Is $x\hat{}y$ acceptable? Gotten with $x\hat{}y$. In-line I have used $x$^$y$ which produces $x$^$y$. To get that effect in a displayed formula, an obvious work around is to wrap it in a text box $$ \text{$x$^$y$} $$ produced with the snippet $$\text{$x$^$y$}$$.

$\endgroup$
1
  • $\begingroup$ I'm sure TeXperts know of better ways, but tweaks like that were common in the plainTeX-era. $\endgroup$ – Jyrki Lahtonen May 14 '20 at 9:28
4
$\begingroup$

I'd imagine $\land$ would be the right symbol here as an operator, so \land (logical and) or \wedge will produce $\land$ (and $\wedge$).

But it might not be the same as $x$^$y$ if you write $x\land y$. It's up to you to decide if you like it or not. In either case, be sure to clarify the notation, which normally means "and" rather than "xor".

You can try $x^\land y$ as well.

$\endgroup$
5
  • $\begingroup$ I can see a typeset version of the symbol (but not its source) and it's definitely a superscript rather than an infix. $\endgroup$ – A.M. May 14 '20 at 10:58
  • $\begingroup$ @Adam: How about the edit? $\endgroup$ – Asaf Karagila May 14 '20 at 10:58
  • 1
    $\begingroup$ Ah, using a superscript and \land hadn't occurred to me. Good idea. $\endgroup$ – A.M. May 14 '20 at 12:16
  • $\begingroup$ The spacing above bothers me, as the caret is being parsed as a superscript on $x$. Perhaps $x\mathbin{{}^\land} y$ would work? This is typeset as $x\mathbin{{}^\land} y$. I also think that \land should probably be replaced by \wedge (they are synonymous and are typeset identically, but \wedge feels more general). $\endgroup$ – Xander Henderson May 14 '20 at 23:56
  • $\begingroup$ @Xander: Yes, I was also bothered by this. I'd think you suggest the right approach here. Or with a lack of spacing, $x{{}^\wedge\!}y$. $\endgroup$ – Asaf Karagila May 15 '20 at 0:01
0
$\begingroup$

The first time you use MathJax in a post, use this command:

\newcommand{\^}{\text{^}}

If you apply it by itself, it will just make a tiny blank space: $\newcommand{\^}{\text{^}}$.

Thenceforth, every time you use \^, you will get a chevron: $x\^y$.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .