# mathpazo + siunitx: π turns into ß

When I use mathpazo and siunitx (version 2.3h) together, if I use \pi inside the numerical argument to \SI, it will show up in the output as "ß".

\documentclass{article}
\usepackage{mathpazo, siunitx}
\begin{document}
$\pi + \SI{\pi}{\ohm}$
\end{document}


Produces:

But when I don't use mathpazo:

Why does this happen and how can I fix it?

-

As others have observed, the issue here is the way the mathpazo treats \pi. I would go with

\documentclass{article}
\usepackage{mathpazo, siunitx}
\protected\def\numpi{\text{\ensuremath{\pi}}}
\sisetup{input-symbols = \numpi}
\begin{document}
$\pi + \SI{\numpi}{\ohm}$
\end{document}


The idea here is that this approach forces the use of the 'standard' font for \pi in all cases (it's safe in both math and text mode). There are reasons that siunitx uses \mathrm rather than \mathnormal as the standard math mode font: try

\documentclass{article}
\begin{document}
$\mathnormal{123}$
\end{document}


to see why!

-
Thank you! That all makes sense, except for why mathpazo treats \pi weirdly inside mathrm in the first place in the first place... – jtbandes Oct 30 '11 at 22:12

The problem is that mathpazo defines \pi as \mathalpha, that is it adds "7000 to its code and that siunitx uses by default \mathrm in the arguments of \SI:

\sisetup{number-math-rm=\mathnormal}


would be wrong; use

\SI[number-math-rm=\mathnormal]{\pi}{\ohm}

-

• \pi without siunitx or mathpazo is defined as \mathchar"119;
• \pi under only siunitx remains the same (\mathchar"119);
• \pi under only mathpazo is defined as \mathchar"7119.

Since siunitx does not touch the definition of \pi and the load order does not correct for this, redefining \pi works:

\documentclass{article}
\usepackage{siunitx,mathpazo}
\begin{document}
$\pi + \SI{\pi}{\ohm}$ \par
\renewcommand{\pi}{\mathchar"119}% Revert to original mathchar definition for \pi
$\pi + \SI{\pi}{\ohm}$ \par
\end{document}

-
Why does the output differ between math mode and inside the \SI command, with both siunitx and mathpazo? – jtbandes Oct 30 '11 at 18:50
@jtbandes: I am not sure. Perhaps @JosephWright (siunitx maintainer) has some insight on this. This has been raised on chat. – Werner Oct 30 '11 at 20:30