LaTeX Science Packages Typesetting Chemistry with mhchem

Typesetting Chemistry with mhchem

AS
Aman Saurav
| Jan 20, 2025 |
5 min read
#chemistry #equations

The mhchem package is the standard for typesetting chemical formulae and reactions in LaTeX. It provides the powerful \ce command.

Installation

In your preamble, include:

\usepackage[version=4]{mhchem}

Basic Formulas

You can write simple formulas intuitively:

  1. Water: \ce{H2O}
  2. Sulfuric Acid: \ce{H2SO4}
  3. Ions: \ce{Ag+}

Chemical Reactions

You can create complex arrow reactions easily.

  • Precipitate Reaction:
    \ce{Ag+ + Cl- -> AgCl v}
    

Example Output

Here is what the rendered output looks like in a document:

mhchem output example
mhchem output example

Video Tutorial

For a deep dive, check out this tutorial: Mastering mhchem in 10 Minutes

The space inside the \ce{} command is significant. Use it to separate species.