Pi in LaTeX (\pi)
- LaTeX command
\pi- Package
- No package needed: built into LaTeX
- Mode
- Math mode only
- Copy the Unicode character
- π
U+03C0
Where it is used
Lowercase Greek pi, the circle constant 3.14159…, also used for permutations and policies.
\pi is the ratio of a circle's circumference to its diameter, appearing in A = \pi r^2, e^{i\pi} + 1 = 0, and radian angles like \pi/2. Reinforcement learning uses \pi for a policy \pi(a \mid s), combinatorics uses it for a permutation, and number theory writes \pi(x) for the prime-counting function. The variant \varpi is a different glyph. When pi is a constant some style guides prefer an upright form, but standard LaTeX gives an italic \pi. Do not use the large operator \prod in place of \pi, or vice versa.
Also listed under: Trigonometry, Geometry
Minimal compilable example
Paste this into an empty .tex file and compile it with pdfLaTeX, XeLaTeX or LuaLaTeX.
\documentclass{article}
\begin{document}
Pi: $\pi$
\[ e^{i\pi} + 1 = 0, \quad A = \pi r^2 \]
\end{document}Related symbols
All Greek Symbols →Frequently asked questions
- How do I write Pi in LaTeX?
- Type \pi in math mode, for example $e^{i\pi} + 1 = 0, \quad A = \pi r^2$. It works in plain LaTeX without loading any package.
- Which package do I need for \pi?
- None. \pi is part of standard LaTeX, so it compiles with nothing in the preamble but the document class.
- Can I use \pi in text mode, or only in math mode?
- Only in math mode. Outside $...$ LaTeX stops with "Missing $ inserted", so write $\pi$ in running text. If you only need the glyph in text, paste the Unicode character π instead (with XeLaTeX or LuaLaTeX and a font that has it).
Best AI LaTeX Editor, Overleaf Alternative
Octree helps researchers from 15+ universities write research papers faster using AI
- Generate beautiful TikZ diagrams using AI
- Upload image and convert it to LaTeX seamlessly
- Get instant assistance with writing and formatting research papers