2

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

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

it gives enter image description here

but if it is:

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

it gives: enter image description here

Is it just me or is there a bug?

3
  • 2
    Could you please provide an MWE? I get a different output.
    – user121799
    Mar 13 '18 at 3:51
  • 1
    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.
    – Zarko
    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
5

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}

enter image description here

1
  • 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.
    – DigNative
    Apr 21 '20 at 14:16

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.