4

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?

2 Answers 2

3

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!

5
  • I don't understand why my detect-mode=true solution works, then...
    – Seamus
    Apr 3, 2011 at 16:38
  • @Seamus: Because the font is fine in text mode, so your \num use is typeset using \textsf.
    – Joseph Wright
    Apr 3, 2011 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, 2011 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, 2011 at 19:29
  • 1
    @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, 2011 at 20:31
1
\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.

1
  • 1
    You might want to email Joseph Wright about this. Or wait until he reads this question...
    – Seamus
    Apr 3, 2011 at 12:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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