Algebra Boolean

Get logik, AND, OR, NOT, XOR, NAND, dan operasi boolean.

Boolean algebra symbols in LaTeX: AND, OR, XOR

The boolean algebra symbols in LaTeX reuse the logic connectives: the AND symbol is \land (∧), the OR symbol is \lor (∨) and NOT is \lnot (¬). XOR in LaTeX is \oplus (⊕), or \veebar from amssymb. Implication and equivalence are \Rightarrow and \iff, the constants true and false are \top and \bot, and the quantifiers are \forall and \exists. All of them go in math mode. The table lists the commands people use most, with the package each one needs; the full list of logic gate symbols follows below.

SymbolCommandUsePackageCopy
∧\land
\landAND (alias \wedge)built in
∨\lor
\lorOR (alias \vee)built in
¬\lnot
\lnotNOT (alias \neg)built in
A‾\overline{A}
\overline{A}NOT, bar notationbuilt in
⊕\oplus
\oplusXOR (exclusive or)built in
⊻\veebar
\veebarXOR, logic styleamssymb
⊼\barwedge
\barwedgeNANDamssymb
⇒\Rightarrow
\RightarrowImpliesbuilt in
  ⟺  \iff
\iffIf and only if (equivalence)built in
⊤\top
\topTrue, 1built in
⊥\bot
\botFalse, 0built in
∀x ∃y\forall x \, \exists y
\forall x \, \exists yFor all, there existsbuilt in

Circuit-style notation

Digital-design and circuit texts prefer the algebraic style: A \cdot B or just AB for AND, A + B for OR, and a bar for negation, written \overline{A} for a whole expression or \bar{A} for a single letter. De Morgan’s law then reads \overline{A \cdot B} = \overline{A} + \overline{B}. The Sheffer stroke and Peirce arrow can be written as \uparrow and \downarrow, and the Boolean domain is \mathbb{B} = \{0, 1\}.

Add \usepackage{amsmath, amssymb} to the preamble for \veebar, \barwedge, \implies and \mathbb. For truth tables, the tabular environment with $\land$ in the header row is enough. See our guide to mathematical expressions in LaTeX for spacing and alignment, and the logic symbols page for quantifiers and turnstiles.

Frequently asked questions

How do I write the AND and OR symbols in LaTeX?
AND (∧) is \land or its alias \wedge, and OR (∨) is \lor or \vee. Both are built in and go in math mode: $A \land B$, $A \lor B$. NOT is \lnot or \neg. In circuit notation you can instead write A \cdot B for AND, A + B for OR and \overline{A} for NOT.
How do I write XOR in LaTeX?
Use \oplus (⊕), which is built in: $A \oplus B$. Logic texts sometimes use \veebar (⊻), which needs \usepackage{amssymb}. XNOR is usually written \odot or \overline{A \oplus B}.
Which package do I need for boolean algebra symbols in LaTeX?
None for the common ones: \land, \lor, \lnot, \oplus, \Rightarrow, \iff, \top, \bot, \forall and \exists are built in. Load amssymb for \veebar and \barwedge, and amsmath for \implies.
∧\land

AND

\land
∨\lor

OR

\lor
¬\neg

NOT

\neg
⊕\oplus

XOR

\oplus
⊼\barwedge

NAND

\barwedge
∨ˉ\bar{\vee}

NOR

\bar{\vee}
⊙\odot

XNOR

\odot
⇒\Rightarrow

Implies

\Rightarrow
⇔\Leftrightarrow

If and Only If

\Leftrightarrow
⊤\top

True

\top
⊥\bot

False

\bot
A⋅BA \cdot B

Boolean AND

A \cdot B
A+BA + B
A‾\overline{A}

Boolean NOT

\overline{A}
A′A'
A⋅B‾=A‾+B‾\overline{A \cdot B} = \overline{A} + \overline{B}

De Morgan

\overline{A \cdot B} = \overline{A} + \overline{B}