Specify a range value in \SI

siunitx

I like to print something like 10-20 cm using \SI option. I have tried
\SI{10-20}{\cm} which is giving error. How to write it properly?

Best Answer

The correct command in recent versions of siunitx is \qtyrange:

\documentclass[border=3.14]{standalone}

\usepackage{siunitx}

\begin{document}
\qtyrange{10}{20}{\centi\metre}
\end{document}

This will result in

enter image description here

Just like in @Bernard's answer you can change the used phrase to an en-dash using range-phrase (for which I'd add non-breaking spaces using ~):

\documentclass[border=3.14]{standalone}

\usepackage{siunitx}

\begin{document}
\qtyrange[range-phrase=~--~]{10}{20}{\cm}
\end{document}

enter image description here

Problem: This looks like a minus and I'd say the result is -10 cm.

Related Question