Underleaf Logo
Underleaf
BlogPricing
Log InTry Free

How to Write Chemistry in LaTeX with mhchem

August 1, 2026

How to Write Chemistry in LaTeX with mhchem

Typing chemistry by hand in LaTeX is miserable — H_2SO_4 italicises the elements, charges collide with subscripts, and arrows never sit right. The mhchem package fixes all of it with one command. This guide covers formulae, charges, reaction arrows, states of matter, isotopes and the chemistry-heavy tables that show up in real papers.

Why plain math mode is wrong for chemistry

Written as $H_2SO_4$, LaTeX treats every letter as a variable and sets it in italic. Element symbols are upright by convention, so that is typographically incorrect before you even get to spacing. mhchem handles the conventions for you:

Everything then goes inside \ce{...}, and subscripts need no underscores at all — digits after an element are recognised automatically:

Compiled output

H2SO4, CH3COOH and Ca(OH)2 typeset with upright element symbols and lowered subscripts

Charges and oxidation states

Write the charge exactly as you would say it. mhchem raises it and keeps it clear of the subscripts:

Compiled output

Sulfate, sodium, actinyl and iron(III) ions with raised charges clear of the subscripts

Reaction arrows

Arrows are typed as ASCII art and rendered properly. The common ones:

  • -> forward reaction
  • <-> resonance
  • <=> equilibrium
  • <=>> and <<=> equilibrium favouring one side

Compiled output

A forward reaction arrow and an equilibrium arrow between chemical species

Conditions go above and below the arrow in square brackets and parentheses respectively:

Compiled output

The Haber process with an iron catalyst above the arrow and 450 degrees Celsius below it

States, isotopes and precipitates

Compiled output

A precipitation reaction with aqueous state labels, and thorium-227 with mass and atomic numbers

v marks a precipitate and ^ a gas evolving. Isotope mass and atomic numbers go in braces before the symbol.

The real pain: chemistry tables

Formulae are the easy part. What actually costs an afternoon is a journal table — merged row headers, superscript footnote markers, subscripted formulae in every cell and a block of footnotes underneath.

Two things make these tables hard by hand. Row headers spanning several rows need multirow, and footnote markers inside a tabular do not work with plain \footnote — you need \textsuperscript markers with the notes written out below, or the threeparttable package.

Units alongside your chemistry

Pair mhchem with siunitx so quantities are consistent too. Write \SI{450}{\celsius} rather than typing the degree symbol, and the spacing between number and unit is handled for you. Units siunitx does not know — such as kcal — need declaring once with \DeclareSIUnit:

Compiled output

0.22 volts and 44 kilocalories per mole, with correct spacing between number and unit

Quick reference

  • \usepackage[version=4]{mhchem} once in the preamble
  • Everything chemical goes inside \ce{...} — no underscores needed for subscripts
  • Charges as ^2-, magnitude before sign
  • ->, <=> for arrows; conditions in [ ] above and [ ] below
  • multirow plus \textsuperscript markers for journal tables

See also our guides on subscripts and superscripts and building LaTeX tables.

Try it free

Skip retyping the chemistry.

Reaction schemes, data tables and supporting information, converted from the page instead of retyped. Every value stays where it was.

Convert your page
A handwritten page of chemistry converted into a typeset reaction with subscripts and a reaction arrow
Underleaf Logo
Underleaf

Empowering students and researchers with AI-powered tools for academic writing.

Go to appContact us

Company

PricingBlogTutorialsAffiliate Program

Free Tools

Image to LaTeXExcel to LaTeXArXiv to LaTeXTikZ GeneratorThesis GeneratorChrome ExtensionAll Tools

© 2026 Underleaf. All rights reserved.