4.9 Formatting SI Units
If you need to typeset numbers and units then I strongly recommend that you use the siunitx package. This section just provides a brief introduction to that package. You will need to read the siunitx package documentation [20] if you want further details.
This command typesets <number>, adding appropriate spacing between number groups where necessary. It also adds a leading zero if omitted before the decimal point and identifies exponents. Note that the command recognises both “.” and “,” as the decimal marker. If you want one of these characters between number groups (instead of the default space) you can change the settings, but it's best to stick to the default settings unless instructed to do otherwise.
Example:
\num
{12890} experiments, \num
{1289} of them had a mean
squared error of \num
{.346} and \num
{128} of them had a mean squared
error of \num
{1.23e-6}.
Result:
This command typesets an angle. The argument <angle> may be a single number or three (some possibly empty) values separated by semi-colons.
Example:
Result:
This command typesets a unit. The <unit> can be formed from
commands like \metre
, \gram
, \second
or \kilo
.
(See the siunitx documentation [20] for the full
list.)
Example:
\si
{\kilo
\metre
} and the
area in \si
{\kilo
\metre
\squared
}.
The acceleration was given in \si
{\metre
\per
\square
\second
}.
Result:
This combines the functionality of \num
and \si
so
that you can typeset both a number and a unit.
Example:
Result:
This book is also available as A4 PDF or 12.8cm x 9.6cm PDF or paperback (ISBN 978-1-909440-02-9).