Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I show a caret (^) in math mode in LaTeX? [closed]

I'm trying to display a caret (^) in math mode in LaTeX to represent the exclusive or operation implemented in the "C languages". By default, ^ is for creating a superscript in math mode. The closest I can seem to get is by using \wedge, which isn't the same.

like image 958
Anthony Cramp Avatar asked Dec 01 '08 03:12

Anthony Cramp


People also ask

How do you put a hat over a letter in LaTeX?

It is straightforward to insert the hat symbol in your document; you begin with the command that only requires one value (the character) between {}, denoted by the command \hat{}. The command is built-in, you don't need external packages.

How do I type mathematical symbols in LaTeX?

Display math mode Use one of these constructions to typeset maths in display mode: \[...\] \begin{displaymath}...\end{displaymath} \begin{equation}...\end{equation}

How do you type the power symbol in LaTeX?

Hypertext Help with LaTeX To get an expression, exp, to appear as a superscript, you just type ^{exp}. should display as "x3 is the third power of x". Note that the braces around the argument may be omitted if the superscript is a single character.


1 Answers

You might want to use the common symbol for exclusive or instead, \oplus (but give it a proper name with something like \newcommand\XOR{\oplus}).

The caret is a bit too small to be noticeable as a binary operator. However, if you do insist using a caret instead, use this:

\newcommand\XOR{\mathbin{\char`\^}}
$x \XOR y$

The \mathbin puts the right spacing around the symbol for a binary operator, and the \char ensures that the glyph is obtained from the roman font.

like image 94
Will Robertson Avatar answered Oct 18 '22 17:10

Will Robertson