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.

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:

wrong output

But when I don't use mathpazo:

correct output

Why does this happen and how can I fix it?

share|improve this question
add comment

3 Answers

up vote 6 down vote accepted

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!

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

The following rectifies your problem:

  • \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:

enter image description here

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

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}
share|improve this answer
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.