SI units in LaTeX
The siunitx package takes care of the space between a number and its unit, the upright font of units and the decimal marker. You always type a point in the source; the output-decimal-marker option switches the printed marker if a journal or course asks for a comma.
Preamble
\usepackage{siunitx}
\sisetup{separate-uncertainty=true}Number with a unit
\SI{9.81}{\metre\per\second\squared}Result with uncertainty
\SI{2.45 +- 0.03}{\ohm}Number only
\num{6.022e23}Common mistakes
- A comma as the decimal separator in math mode: $1,5$ prints as "1, 5" with a space after the comma.
- Italic units: $9.81 m/s^2$ sets m and s as variables.
See also
Don't want to memorize commands?
Draw a formula or paste a screenshot, and CamteX turns it into ready LaTeX.