Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
1  
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
3  
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
1  
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
1  
@JonathanGleason: See meta.tex.stackexchange.com/questions/1272/… –  Caramdir Jun 1 '12 at 3:31
add comment

5 Answers

up vote 17 down vote accepted

One option could be to use \uppi from the upgreek package:

\documentclass{article}
\usepackage{upgreek}

\begin{document}

$\uppi$

$\pi$

\end{document}

enter image description here

Here's the upright symbol using the Symbol package option:

\documentclass{article}
\usepackage[Symbol]{upgreek}

\begin{document}

$\uppi$

$\pi$

\end{document}

enter image description here

and now using the Symbolsmallscale package option:

\documentclass{article}
\usepackage[Symbolsmallscale]{upgreek}

\begin{document}

$\uppi$

$\pi$

\end{document}

enter image description here

share|improve this answer
2  
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
add comment

Without upgreek, babel supports upright Greek characters:

enter image description here

\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).)

share|improve this answer
2  
Using the textgreek package is easier. –  egreg May 3 '12 at 6:33
add comment

From Will Robertson's blog one way is to use the mathpazo. Here is a comparison of the two:

enter image description here

\documentclass{article} 
\usepackage{mathpazo}
\DeclareSymbolFont{euler}{U}{eur}{m}{n}
\DeclareMathSymbol \uppi \mathalpha {euler} {"19}

\begin{document}
    $\pi \quad \uppi$
\end{document}
share|improve this answer
    
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
add comment

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.

share|improve this answer
add comment

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}

result

share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.