On pg. 144 of Kopka and Daily's A Guide to LaTeX, they mention that the symbols $e$, $i$, $d$, and $\pi$ should be displayed upright in math mode (for their usual uses). This is easy to do for $e$, $i$, and $d$: just use \mathrm. However, this does nothing to \pi. How exactly do you generate an upright \pi in math mode?
- 4,664
-
1Welcome to TeX.sx! A tip: You can use backticks ``` to mark your inline code as I did in my edit. – Tobi May 02 '12 at 23:49
-
6Is there a well-known math book that actually does this? – Dylan Moreland Jun 01 '12 at 00:25
-
1Is MathJax not activated on this website? The inline LaTeX wasn't typetset. I would have thought that inline LaTeX would be functional on, you know, a QA site for TeX . . . (I know it t works on Mathematics StackExchange and Physics StackExchange. Why not here?) – Jonathan Gleason Jun 01 '12 at 01:05
-
2@JonathanGleason: See http://meta.tex.stackexchange.com/questions/1272/why-doesnt-maths-render-as-maths – Caramdir Jun 01 '12 at 03:31
-
Related - https://tex.stackexchange.com/q/145926/128462 – Apoorv Potnis Sep 06 '17 at 12:28
-
@DylanMoreland, I don't know how I would quantify well-known-ness, but The Princeton Companion to Mathematics (JSTOR, zbMATH) sets Euler's number ‘e’, the imaginary ‘i’, and the differential ‘d’ in upright type, although it doesn't seem to do this with ‘π’. – user570286 Nov 16 '20 at 03:00
6 Answers
One option could be to use \uppi from the upgreek package:
\documentclass{article}
\usepackage{upgreek}
\begin{document}
$\uppi$
$\pi$
\end{document}

Here's the upright symbol using the Symbol package option:
\documentclass{article}
\usepackage[Symbol]{upgreek}
\begin{document}
$\uppi$
$\pi$
\end{document}

and now using the Symbolsmallscale package option:
\documentclass{article}
\usepackage[Symbolsmallscale]{upgreek}
\begin{document}
$\uppi$
$\pi$
\end{document}

- 505,128
-
6The two options for upright π that
upgreek.styprovides don't match Computer Modern too well in my opinion. For example the π above looks far too wide in comparison to the italic greek one. – kahen May 02 '12 at 23:50
Without upgreek, babel supports upright Greek characters:

\documentclass{article}
\usepackage[greek,english]{babel}
\begin{document}
\newcommand{\gpi}{\textrm{\greektext p}}
$\gpi \theta$
\end{document}
(Taken from Upright Greek letters in text mode (not upgreek).)
With Xe/LuaLaTeX, unicode-math and a proper OpenType Math font, upright πs (and many other symbols) are built in:
% compile with xelatex or lualatex
\documentclass{article}
\usepackage{unicode-math}
\setmathfont{lmmath-regular.otf}
\begin{document}
$π\ \mathrm{π}$
\end{document}

- 89,023
- 26
- 255
- 291
-
And of course for old pi-syntax:
$\pi \mathup{\pi}$. Just in case you don't want to copy the uni-code symbol somewhere. – LaRiFaRi Sep 03 '13 at 10:29
While upgreek works well for some fonts, it doesn't match perfectly with Computer Modern. Here are some alternatives:
Use a different typeface for the document. For example BT Charter from
mathdesign(1):\usepackage[T1]{fontenc} \usepackage[charter,cal=cmcal]{mathdesign}Use the text pi that you get when typing Greek text with e.g. babel:
\usepackage[greek,english]{babel} % english = default \usepackage[LGR,T1]{fontenc} \usepackage{lmodern,amsmath,xspace} \def\PI{\ensuremath{\text{\foreignlanguage{greek}{p}}}\xspace} % Similar definitions can be made for the rest of the greek alphabet. % Here's a conversion table: % Latin: a b g d e z h j i k l m n x o p r s t u f q y w % Greek: α β γ δ ε ζ η θ ι κ λ μ ν ξ ο π ρ σ τ υ φ χ ψ ωWhile this works it's really ugly and should obviously be done with
\DeclareSymbolFontand\DeclareMathSymbol.Same as the above, but using the font
bodoniinstead. It's a Didone typeface, so it should match pretty well with Computer Modern.
(1): Note that mathdesign has some other design issues such as imperfect kerning, poorly drawn glyphs for blackboard bold letters and \middle\vert usually ends up being too high.
- 2,165
From Will Robertson's blog one way is to use the mathpazo. Here is a comparison of the two:

\documentclass{article}
\usepackage{mathpazo}
\DeclareSymbolFont{euler}{U}{eur}{m}{n}
\DeclareMathSymbol \uppi \mathalpha {euler} {"19}
\begin{document}
$\pi \quad \uppi$
\end{document}
- 223,288
-
It's also possible to use π from the default Greek text font, but I'm not sure which font the symbol is from nor what its number in it is. π from
bodonishould also match pretty well with Computer Modern since they are both Didone typefaces. – kahen May 02 '12 at 23:46 -
Expanding on my previous comment on using the Greek text font, one can achieve that like this, but it's a really roundabout (and brittle) way of doing it:
\usepackage[greek,english]{babel}\usepackage[LGR,T1]{fontenc}\usepackage{lmodern,amsmath,xspace} \def\PI{\ensuremath{\text{\foreignlanguage{greek}{p}}}\xspace}– kahen May 02 '12 at 23:53 -
Besides the solutions above, I have recently come across the isomath package and found that page 6 of its manual provides a fairly good summary for available ways to get upright small greek letters.
(One of) the link to the manual itself is: http://ctan.math.utah.edu/ctan/tex-archive/macros/latex/contrib/isomath/isomath.pdf
And I take the liberty of taking a screenshot of the relevant page for your convenience:

- 133
-
even more options: look at the
chemgreekpackage (another use case but it lists quite a few packages…) – cgnieder Jul 14 '15 at 22:54