Units
Jump to navigation
Jump to search
< Math | Sciences | Dimensions >
Use the built-in \unit command to parse units. Some examples of this are shown below:
10 \unit{km/h} \unit{10 km/h} \unit{~1 km/h} \unit{KiloMeter/Hour} \unit{10 cubic meter / second} \unit{kilo pascal square meter / second} \unit{kilo pascal square meter / kelvin second }$ \unit{10 AC} $\frac{10 \unit{m/s}}{20 \unit{m/s}}$ {\ss 30 \unit{kilo pascal square meter / second kelvin}} \unit{123.22^-3 km/s} \unit{123.22e-3 km/s}
ConTeXt will take care of spacing and formatting. The parser is fairly flexible, and the following all work and give the same output.
\unit{10 kg} \unit{10kg} \unit{10 kilo gram} \unit{10 kilogram} \unit{10 Kilo Gram} \unit{10 KiloGram} |
The command works in text as well as in math mode and spaces are normally ignored. You can define your own command:
\defineunits[un][alternative=text,separator=medium]
Valid separators are cdot
, big
, medium
, and space
with the first being the default. You can later tune the rendering with
\setupunits[un][separator=cdot]
Numbers are formatted cf the \digits mechanism (not discussed here).
Additional documentation is available in the Units manual.