# Different prefixes in SIrange

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.

• Would this be ok? \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:51
• The exponent-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:59
• @hbaderts You can also give the option zero-decimal-to-integer to make sure it is displayed as 8 MHz rather than 8.0 MHz or 8.00 MHz. – sodd Aug 18 '15 at 11:18
• Indeed, your two comments combined (+ round-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

I think the shortest form for what you want would be:

% arara: pdflatex

\documentclass{article}
\usepackage{siunitx}
\sisetup{%
,exponent-to-prefix = true
,zero-decimal-to-integer
}

\begin{document}
\begin{tabular}{l}
\SIrange[scientific-notation = engineering]{150}{8000}{\kilo\hertz}\\
\SIrange[scientific-notation = engineering]{100}{50000}{\tesla}\\
\num{1234.1245345}
\end{tabular}
\end{document}


You have to set the scientific notation locally in order not to change the normal numbers. You will have to decide, which options can be taken globally and which don't.