# How to typeset 2pii in LaTeX

Using LaTex, how can I typeset 2pii in the following formula (as shown on the MathJax's home page but they are using MathML). I tried 2\pii and 2\pi\i but, as suspected, that did not work.

• 2\pi i ........ – JPi Aug 7 '17 at 14:31
• @JPi This one worked (thank you). I noticed you created space between pi and i. Are there any rules for this that I should be aware of? – nam Aug 7 '17 at 14:37
• The usual rules for macros. If you add a space the macro has ended, if not the letter counts for the macro name (and \pii is not defined). – TeXnician Aug 7 '17 at 14:42

TeX and LaTeX macros whose names consist of a backslash character (\) followed by one or more letters (i.e., a thru z and A thru Z -- known in TeX jargon as category-code-11 characters) -- such as \pi -- must be followed by a non-category-11 character if TeX is to figure out when the end of the macro's name is reached. Thus, expressions such as \pi\approx3.14159, \pi/2, {\pi}i and \pi{}i are valid syntactically, but \pii is not.

How to typeset "2pii" in LaTeX?

The simplest solution is to write 2\pi i. This is valid because whitespace has category code 10, not 11.

\documentclass{article}
\begin{document}
$f(a)=\frac{1}{2\pi i}\oint_{\gamma}\frac{f(z)}{z-a}dz$
\end{document}


• +1. I've taken the liberty of editing your write-up to sharpen the discussion of how TeX can tell when the end of a control word is reached. Feel free to revert if you disagree. – Mico Aug 7 '17 at 19:34
• @Mico, you are in the correct way, your edition is more explanatory than mine. Thanks! – skpblack Aug 7 '17 at 19:37