[texhax] Units and chemistry

Martin Heller mr_heller at yahoo.dk
Thu Dec 29 11:34:35 CET 2011

Simmie, John wrote, on 29-12-2011 11:00:
> You might not have problems writing chemistry in math mode
> and having chemical formulae in math italic but all
> professional chemists would have problems including
> the International Union of Pure and Applied Chemists IUPAC
> who set the global standards.
>
> So, in math mode you must use \mathrm{CH_3CH_2OH}
>
> Ditto for units these must be in upright/roman and the slash symbol
> is deprecated; so velocity in meters per second is written
> m s$^{-1}$ and not m/s.  This is because if you are labelling the axis
> of a graph with velocity the correct usage is "$v$ / m s$^{-1}$"
> the whole thing is properly dimensionless.  Also using the / is
> extremely
> cumbersome in expressing, for example, the gravitational constant
> G whose units are newtons meter squared per kilogram squared
> $\mathrm{G} = 6.673 \times 10^{-11}$ N m$^2$ kg$^{-2}$

The mhchem package can aid in writing chemistry correctly.

Specifying and configuring complex units becomes easier when using the
siunitx package. In particular you do not need to go in and out of math
mode.

\documentclass{article}
\usepackage[version=3]{mhchem}
\usepackage{siunitx}

\begin{document}

\ce{CH3CH2OH}

\section{Unit of Velocity}

\subsection{Default Setup}
\si{\meter\per\second}\\
\si{m/s}\\
\si{m.s^{-1}}

\subsection{Unit Slash}
{\sisetup{per-mode=symbol}
\si{\meter\per\second}\\
\si{m/s}\\
\si{m.s^{-1}}
}

\subsection{Unit Fraction}
{\sisetup{per-mode=fraction}
\si{\meter\per\second}\\
\si{m/s}\\
\si{m.s^{-1}}
}

\section{The Gravitational Constant}

\subsection{Default Setup}
$G = \SI{6.673e-11}{\newton\meter\squared\per\kilo\gram\squared}$\\
$G = \SI{6.673e-11}{N.m^2/kg^2}$\\
$G = \SI{6.673e-11}{N.m^2.kg^{-2}}$

\subsection{Unit Slash}
{\sisetup{per-mode=symbol}
$G = \SI{6.673e-11}{\newton\meter\squared\per\kilo\gram\squared}$\\
$G = \SI{6.673e-11}{N.m^2/kg^2}$\\
$G = \SI{6.673e-11}{N.m^2.kg^{-2}}$
}

\subsection{Unit Fraction}
{\sisetup{per-mode=fraction}
$G = \SI{6.673e-11}{\newton\meter\squared\per\kilo\gram\squared}$\\
$G = \SI{6.673e-11}{N.m^2/kg^2}$\\
$G = \SI{6.673e-11}{N.m^2.kg^{-2}}$
}

\end{document}