Chemical formulas in LaTeX
The mhchem package turns plain reaction notation into a properly typeset formula: digits after an element symbol become subscripts and charges become superscripts. No manual underscores needed.
Preamble
\usepackage[version=4]{mhchem}Reaction equation
\ce{2H2 + O2 -> 2H2O}Ions and equilibrium
\ce{CH3COOH <=> CH3COO- + H+}Common mistakes
- H_2O in math mode: the letters come out in italics, while chemical formulas are set upright.
See also
Don't want to memorize commands?
Draw a formula or paste a screenshot, and CamteX turns it into ready LaTeX.