Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am using the siunitx package to typeset my numbers, but sometimes I find situations in which I have numbers without units (when the units are not nearby) and units without numbers. E.g.:

The bird can fly 40 to 50 km per hour.

The data in the table above uses kg.

What is the prefered way to typeset these?

The bird can fly $40$ to $\SI{50}{\kilo\meter\per\hour}$.

The bird can fly \num{40} to \SI{50}{\kilo\meter\per\hour}.

The bird can fly \SI{40}{} to \SI{50}{\kilo\meter\per\hour}.

The data in the table above uses kg.

The data in the table above uses \SI{}{\kilo\gram}.

If find achieving visual consistency and correctness in the output is more important than having consistent, context-intelligent code.

share|improve this question
add comment

1 Answer 1

up vote 6 down vote accepted

To typeset units without numbers, you can use \si{<unit>} (note the lower case).

The mathematically correct way to typeset ranges of values with units is to include the unit with each of the numbers. This is what the command \SIrange{<lower>}{<upper>} does. If you don't want to repeat the units, you can set [range-units = single].

Note that the most common units can be accessed using abbreviations (like \km for \kilo\metre).

\documentclass{article}
\usepackage{siunitx}

\begin{document}
The bird can fly \SIrange{40}{50}{\km\per\hour}.

The bird can fly \SIrange[range-units=single]{40}{50}{\km\per\hour}.

The data table above uses \si{\kg}.
\end{document}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.