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?
-
3IIRC, the correct way of typesetting ranges according to the guidelines of the SI is to include the unit for both numbers, so instead of 10-20 cm you should use 10cm - 20cm.– SkillmonOct 20, 2021 at 18:39
-
10 cm to 20 cm. BIPM says: The numerical value always precedes the unit and a space is always used to separate the unit from the number. Thus the value of the quantity is the product of the number and the unit. The space between the number and the unit is regarded as a multiplication sign (just as a space between units implies multiplication). The only exceptions to this rule are for the unit symbols for degree, minute and second for plane angle, °, ′ and ″, respectively, for which no space is left between the numerical value and the unit symbol. www.bipm.org/en/publications/si-brochure/– D DuckJan 16 at 12:18
2 Answers
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
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}
Problem: This looks like a minus and I'd say the result is -10 cm.
-
-
@Bukaida of course you don't have to type
\centi\metre
everytime,\cm
will work just as fine (andsiunitx
is smart enough to also parse\qtyrange{10}{20}{cm}
correctly, but I'd prefer using\cm
if you have to be short).– SkillmonOct 20, 2021 at 18:51 -
@Skillmon On the 'to do' list is to parse
cm
to\centi\metre
to allow manipulation ;)– Joseph Wright ♦Oct 20, 2021 at 19:00 -
Just wanted to add that in less recent versions, the equivalent command is
\SIrange
. (Yes, I should update from TL 2020...) Feb 9 at 10:51
Use \numrange[range-phrase=--]{10}{20}\,\unit{\cm}͵
.
-
-
-
Not at all. On my system, it didn't yield exactly the expected result for some reason.– BernardOct 20, 2021 at 18:43