# Upright Lowercase $\pi$

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?

-
Welcome to TeX.sx! A tip: You can use backticks  to mark your inline code as I did in my edit. – Tobi May 2 '12 at 23:49
Is there a well-known math book that actually does this? – Dylan Moreland Jun 1 '12 at 0:25
Probably, although I don't know of one off the top of my head. Mostly I've seen this (inconsistently) used on Wikipedia. Personally, I think it looks like shit, especially the i, but it makes sense that there be consistent rules to distinguish these special constants from variables named $e$, indices involving $i$, and functions named $\pi$, etc. – Jonathan Gleason Jun 1 '12 at 1:04
Is 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 1 '12 at 1:05
@JonathanGleason: See meta.tex.stackexchange.com/questions/1272/… – Caramdir Jun 1 '12 at 3:31

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}


-
The two options for upright π that upgreek.sty provides 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 2 '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}

-
Using the textgreek package is easier. – egreg May 3 '12 at 6:33

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 \DeclareSymbolFont and \DeclareMathSymbol.

• Same as the above, but using the font bodoni instead. 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.

-

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}

-
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 bodoni should also match pretty well with Computer Modern since they are both Didone typefaces. – kahen May 2 '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{lmoder‌​n,amsmath,xspace} \def\PI{\ensuremath{\text{\foreignlanguage{greek}{p}}}\xspace} – kahen May 2 '12 at 23:53
@kahen: You should post an answer. – Peter Grill May 2 '12 at 23:55

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}


-
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 3 '13 at 10:29

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:

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