# Problem with slanted numerals when combining siunitx and arev

There is a strange interaction between the siunitx and arev packages, whereby all the numerals appear slanted when using commands such as \num or \SI.

\documentclass{article}
\usepackage{siunitx}
\usepackage{arev}
\begin{document}
\begin{itemize}
\item This is is some normal math: $$1 + 1 = 2$$. Looks OK.
\item This is using the \verb|\num| macro from \texttt{siunitx}: \num{1.23e45}. Why are the numbers slanted? The problem only occurs with the \texttt{arev} font.
\item It is only the numerals that appear slanted, the units themselves are OK: \SI{20}{km/s}
\end{itemize}
\end{document}

Is there a simple way to fix this?

-

What is happening here is that, for sans serif fonts, siunitx picks up the change of style at the start of the document and switches to use \mathsf in math mode and \sffamily in text mode. However, the arev font has slanted numerals in its \mathsf font, which leads to the weird result you see. If you put

\sisetup{math-rm = \mathrm}

after \begin{document} the problem will go away. Alternatively, wait until tomorrow and a fix will be available on CTAN: I'll get it done in a second!

-
I don't understand why my detect-mode=true solution works, then... – Seamus Apr 3 '11 at 16:38
@Seamus: Because the font is fine in text mode, so your \num use is typeset using \textsf. – Joseph Wright Apr 3 '11 at 16:46
Thanks @Joseph - the fix works perfectly. I had tried setting \sisetup{math-rm = \mathrm} but only in the preamble, where of course it has no effect – deprecated Apr 3 '11 at 18:41
So if you don't detect-mode=true all numbers are set with the mathmode font, is that right? – Seamus Apr 3 '11 at 19:29
@Seamus: The standard settings in v2 of siunitx use the math font for numbers and the text font for units. (See the number-mode and unit-mode options.) – Joseph Wright Apr 3 '11 at 20:31
\documentclass{article}
\usepackage{siunitx}
\sisetup{detect-all=true}
\usepackage{arev}
\begin{document}
\begin{itemize}
\item This is is some normal math: $$1 + 1 = 2$$. Looks OK.
\item This is using the \verb|\num| macro from \texttt{siunitx}: \num{1.23e45}. Why are the numbers slanted? The problem only occurs with the \texttt{arev} font.
\item It is only the numerals that appear slanted, the units themselves are OK: \SI{20}{km/s}
\end{itemize}
\end{document}

The detect-all=true option will detect the current mode and font family and use them.

Actually, all you need is detect-mode=true which detects whether you're in mathmode or text mode. Strangely though, this will still set things italic if you're in mathmode: $\SI{20}{\kilo\metre\per\second}$ would still be italic. Weird. I think this is to do with siunitx's assumptions about mathmode default being italic.

-
You might want to email Joseph Wright about this. Or wait until he reads this question... – Seamus Apr 3 '11 at 12:29