Most computer science symbols in LaTeX are ordinary math commands. Big O notation in LaTeX is O(n \log n) or, in many papers, the calligraphic \mathcal{O}(n); its relatives are \Omega(n), \Theta(n) and little-o o(n). Floor and ceiling are \lfloor x \rfloor and \lceil x \rceil, XOR is \oplus, assignment in pseudocode is \gets, and a definition with := is cleanest as \coloneqq from mathtools. The table lists the computer science symbols people use most, with the package each one needs; the full list follows below.
| Symbol | Command | Use | Package | Copy |
|---|---|---|---|---|
O(n \log n) | Big O (upper bound) | built in | ||
\mathcal{O}(n) | Big O, calligraphic style | built in | ||
\Omega(n) | Big Omega (lower bound) | built in | ||
\Theta(n^2) | Big Theta (tight bound) | built in | ||
o(n) | Little-o | built in | ||
\lfloor \log_2 n \rfloor | Floor of log base 2 | built in | ||
\lceil n/2 \rceil | Ceiling | built in | ||
a \bmod n | Modulo as a binary operator | built in | ||
\oplus | XOR | built in | ||
x \gets x + 1 | Assignment in pseudocode | built in | ||
\coloneqq | Defined as (:=) | mathtools | ||
\{0,1\}^* | All binary strings (Kleene star) | built in |
For pseudocode itself, use the algorithm and algpseudocode packages, which provide \State, \If and \For and use \gets for assignment, rather than building it from math symbols. Logic operators are listed on the Boolean algebra symbols page.
O(n)\Omega(n)\Theta(n)o(n)\omega(n)\mapsto\triangleq\equiv\neq\oplus\land\lor\neg\lfloor x \rfloor\lceil x \rceil\bmod\mid\nmid\ast\star\log\ln