Chemistry (mhchem/chemfig)

Chemistry needs three things plain LaTeX does not do: formulae and equations (mhchem’s \ce), molecular structure diagrams (chemfig), and a broader chemistry toolkit (chemmacros — nomenclature, oxidation states, units, …). This page covers all three.

Formulae & equations — mhchem’s \ce

Load \usepackage{mhchem} and write all chemistry inside \ce{...}. Numbers auto-subscript (\ce{H2O} → H₂O), a +/- after an element becomes a charge superscript (\ce{SO4^2-}), and -> / <=> become reaction / equilibrium arrows (with optional labels in brackets, and states like (aq)). The easiest way to set chemistry, inline or displayed.

latex
\usepackage{mhchem}
...
\ce{2 H2 + O2 -> 2 H2O}   % 反応式 / a reaction
\ce{SO4^2-}               % イオンと電荷 / ion with charge
\ce{CaCO3 ->[\Delta] CaO + CO2}  % 矢印にラベル / labeled arrow

Structure diagrams — chemfig

chemfig (by Christian Tellechea) draws skeletal structures with \chemfig{...}. Bonds are - (single), = (double), ~ (triple); angles use the numbers 0–7 (45° steps) or [:abs] / [::rel]; branches go in parentheses; and rings are written like *6(...). It is built on TikZ.

latex
\usepackage{chemfig}
...
\chemfig{H-C(-[2]H)(-[6]H)-H}   % メタン / methane
\chemfig{*6(-=-=-=)}           % ベンゼン環 / benzene ring

The broader toolkit — chemmacros

For full chemistry typesetting, reach for chemmacros (by Clemens Niederberger) — a modular bundle covering nomenclature, oxidation numbers, redox, Newman projections, thermodynamics, units, and much more. Underneath it uses chemformula (its own mhchem-like \ch{...} for formulae) plus chemgreek and ghsystem. Turn to it when you need more than formulae and structures.