# Typesetting chemical element names

What is the 'best' package for typesetting names of chemical element? (I don't need anything but the names of the chemical elements.)

Assume I want to typeset

The dissociation of a AgBr molecure requires an energy of $E = \SI{123456789}{\J}$.

I am using the siunitx package for the physical quantity but what about AgBr?

The answer depends a bit on what you actually need. If all your formulae are as simple as AgBr or FeO there is no need for any package and you can just type them as they are. If you want some macro for marking the formulae in your source something like

\newcommand*\chem[1]{\textup{#1}}


would suffice. Or - if you plan to use it in math mode, too -

\newcommand*\chem[1]{\ensuremath{\mathrm{#1}}}


The second version would even allow you to typeset formulae like AlBr3 and even simple reaction equations:

\documentclass{article}
\newcommand*\chem[1]{\ensuremath{\mathrm{#1}}}
\begin{document}

\chem{AlBr_3}

$\chem{H_2} + (1/2)\,\chem{O_2} = \chem{H_2O}$

$2\,\chem{H_2} + \chem{O_2} \to 2\,\chem{H_2O}$

\end{document}


Only if you need more complicated features or if you have to type a lot of those formulae and not just some ten or twenty then one of the chemistry packages will start to bring you benefits. There are two packages to consider:

The differences between both of them are

• subtle differences in the syntax,
• differences in the layout of the equations, e.g., regarding spacing,
• a different set of options for customization,
• probably more I have forgotten right now.
\documentclass{article}
\usepackage[version=4]{mhchem}
\begin{document}

\ce{AlBr3}

\ce{H2 + (1/2) O2 = H2O}

\ce{2H2 +  O2 -> 2H2O}

\end{document}


\documentclass{article}
\usepackage{chemformula}
\begin{document}

\ch{AlBr3}

\ch{H2 + (1/2) O2 == H2O}

\ch{2 H2 +  O2 -> 2 H2O}

\end{document}


• I'd avoid using any kind of "hack" if there is a good package to do something in a simple manner. I would recommend something like mchem (which I use) right away. – DetlevCM Nov 19 '13 at 19:03
• Thank you, Clement. Great answer. (Of course you mean \newcommand*\chem[1]{\ensuremath{\mathrm{#1}}}; you forgot \chem.) – Svend Tveskæg Nov 19 '13 at 19:06
• @DetlevCM I wouldn't consider a small macro a “hack” but rather good LaTeX practice... Although I actually wrote the chemmacros bundle I rather wanted to give an overview over the various possibilities (and my answer isn't even complete!) to present a choice to the OP any anyone interested. Of course mhchem is a great package if you have some more serious chemistry in your documents :) – clemens Nov 19 '13 at 19:14
• @cgnieder in a loose definition, any modification is a hack - which includes a small macro. My key worry with doing these things is, that in the end you start defining more and more as you go along and end up with a mess or several months later have forgotten what you did. I use mchem because it is what I found when I searched for a package one or two years ago - I had a look at the chemmacros manual and it looks very good. – DetlevCM Nov 20 '13 at 6:42
• @DetlevCM However you call it: writing own macros is the very heart of LaTeX's philosophy IMHO. Regarding »in the end you start defining more and more as you go along and end up with a mess« - that's how most of my packages were born :) – clemens Nov 20 '13 at 7:57