# double hyphens in \SIrange when used in math mode

I am experiencing a strange behaviour of \SIrange in math mode: If I have in text:

\SIrange{600}{620}{\celsius}


it gives

but if it is:

$\SIrange{600}{620}{\celsius}$


it gives:

Is it just me or is there a bug?

• Could you please provide an MWE? I get a different output.
– user121799
Mar 13 '18 at 3:51
• you probably some where determine range-phrase={ -- } . this is in math environment convert to to two minus signs. i would consider this as bug in siunitx. range phrase should stay in text mode. Mar 13 '18 at 8:20
• Does the provided answer solve your problem? If yes, consider accepting it (this is normal in this community). The same is true for your other questions. Mar 2 '20 at 18:28

I agree with Zarko that the “range phrase” should be typeset as text also in math mode. Here's an example, the last \sisetup shows how to properly define the “range phrase” so it doesn't give unexpected results when in math mode:

\documentclass{article}
\usepackage{amsmath}
\usepackage{siunitx}

\begin{document}

Text: \SIrange{600}{620}{\celsius}

Math: $\SIrange{600}{620}{\celsius}$

\sisetup{range-phrase=--} % not so good

Text: \SIrange{600}{620}{\celsius}

Math: $\SIrange{600}{620}{\celsius}$

\sisetup{range-phrase=\textup{--}} % better

Text: \SIrange{600}{620}{\celsius}

Math: $\SIrange{600}{620}{\celsius}$

\end{document}


• I am trying to use range-phrase=\textup{--} as package option when loading siunitx, e.g. \usepackage[range-phrase=\textup{--}]{siunitx}, but I get errors like Missing \endcsname inserted.. Do you have any idea how to avoid this? Using \sisetup{range-phrase=\textup{--}} after loading the package works fine. Apr 21 '20 at 14:16