TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I google this, it seems that \XOR is how you would get an XOR symbol in LaTeX, however that is giving me the 'undefined control sequence' error. How does one get the xor symbol?

share|improve this question
You probably need to load some package. However, symbols does not list \xor, so I can’t help you without knowing what the symbol looks like. Have a look at “How to look up a math symbol?” for ideas how you can easily find a particular symbol. – Caramdir Oct 9 '10 at 4:07
Shouldn't you accept A T's answer instead of TH.'s? Since \oplus is clearly superior to \mathbin{\oplus} or \newcommand*\xor{\mathbin{\oplus}}. – Eric Feb 18 at 7:51
up vote 18 down vote accepted

How about \newcommand*\xor{\mathbin{\oplus}}?

share|improve this answer
I think the \mathbin isn't strictly necessary because \oplus is already a binary operator. – Philipp Oct 9 '10 at 9:31

Another way of representing the XOR connective is by using a W-like symbol (as in p W q), also used in Set Theory to refer to disjunctive union. Since this symbol does not seem to appear in the Comprehensive LaTeX symbol list, you can create it by joining two "or" connectives together through the following command:


that however doesn't work on second levels subscripts/superscripts

Full example:




$A\xor B_{x \xor y}$


enter image description here

share|improve this answer
Welcome! Please provide a complete example. What defines \mspace? It is not a default LaTeX command. – cfr Apr 21 at 1:38
Thanks for the notice! I changed \mspace for \hspace – Maxime Sainte-Marie Apr 21 at 1:44
Thanks! It would still be better to give a complete example even though other answers to this question don't. Also, I'm pretty sure this can't possibly be a good way to do it, but I've up-voting anyway as I appreciate the effort ;). (It can't be right to add space like that in maths mode and shouldn't this be declared as a maths symbol?) – cfr Apr 21 at 1:50
You're right about the example, the spaces and the symbol declaration. The command still needs some fine-tuning. Thanks for the feedback and advice! – Maxime Sainte-Marie Apr 21 at 5:15
I've taken the liberty of turning your good idea into working code; \DeclareMathOperator was not the correct tool and \ooalign did nothing; using \mspace and mu units allows for making it work also in sub/superscripts (alas, not in second level ones). – egreg Apr 21 at 8:01

What you're looking for is \veebar in amssymb.



If you like, you can create a new command \lxor, named to match \lor and \land:

share|improve this answer
Hey, just added some code tags for you :) – Scott H. Oct 15 '12 at 1:18

I use this one \overline{\vee}.

share|improve this answer

\oplus worked for me :)

I found this in List of logic symbols :P

share|improve this answer

I found a bit lame solution, but it works for me. Just do:

share|improve this answer
what about \veebar from the mathabx package? – jon Nov 30 '11 at 16:01

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.