I use the siunitx package for typesetting numbers, units and ranges.
When typesetting large ranges of numbers, for example "150 kHz to 8 MHz", I prefer the notation with different prefixes, i.e. "kilo" for the first number and "mega" for the second. However, I have not been able to typeset such a range using the siunitx macro \SIrange
.
So far I have found two possibilities: Simply using "kHz" for both numbers. This leads to the (in my opinion) not very nice format "150 kHz to 8000 kHz", which I want to avoid.
The only alternative I found was to manually create the two numbers using \SI
, as illustrated in the following example.
\documentclass{article}
\usepackage{siunitx}
\begin{document}
\SIrange{150}{8000}{\kilo\hertz}
\SI{150}{\kilo\hertz} to \SI{8}{\mega\hertz}
\end{document}
Is there any way to get an output similar to the second version (separate \SI
's), but using \SIrange
? This would be nice, as it allows to globally change e.g. the range phrase ("to") and has a consistent spacing.
\SIrange[scientific-notation = engineering,exponent-to-prefix = true, round-mode=figures]{150}{8000}{\kilo\hertz}
. You can define that globally as well. – LaRiFaRi Aug 18 '15 at 10:51exponent-to-prefix
option is somehow what I'm looking for. Though I am not 100% happy with the "8.0 MHz". Especially if one needs a precision of 3 (e.g. for "125 kHz"), it would be "8.00 MHz" which isn't really what I want. – hbaderts Aug 18 '15 at 10:59zero-decimal-to-integer
to make sure it is displayed as8 MHz
rather than8.0 MHz
or8.00 MHz
. – sodd Aug 18 '15 at 11:18round-precision=3
) gives the desired results! Not very short, but exactly what I need. Thanks for your help @LaRiFaRi and @nordev. Does anybody of you want to post this as an answer? – hbaderts Aug 18 '15 at 11:25