Technical Writing

Chemical Graphics

Drawing 2D chemical structures, bonds, rings, and skeletal diagrams directly in LaTeX using chemfig.

Typesetting chemical structures and graphics is fully supported in LaTeX. While legacy packages required external compilers, the modern package chemfig draws chemical structures using standard TikZ graphics commands.

Getting Started

Load the package in your preamble:

\usepackage{chemfig}

The core drawing command is \chemfig{...}.

Basic Syntax

The syntax maps connections and angles from atom to atom:

\chemfig{<atom1><bond type>[<angle>,<length coeff>]<atom2>}

Bond Types

SymbolBond Type
-Single bond
=Double bond
~Triple bond
>Cram wedge bond
<Cram hollow bond
:Dotted bond

Bond Angles

Default angles rotate by 30° increments. Override with:

\chemfig{A-[:30]B-[:-30]C}

Example: Methane

\chemfig{C(-[:0]H)(-[:90]H)(-[:180]H)(-[:270]H)}

Skeletal Diagrams

Skeletal diagrams omit explicit carbon and hydrogen labels. Bonds are linked with relative angles:

\chemfig{-[:30]-[:-30]-[:30]} % Butane
\chemfig{-[:30]=[:-30]-[:30]} % Butene

Rings

Rings are declared using *N( ... ) where N is the number of sides:

\chemfig{*6(-=-=-=)} % Benzene ring
\chemfig{*5(-B-C-D-E-)} % 5-membered heterocyclic ring

Reaction Arrows

Use \arrow for reaction arrows between structures:

\chemfig{A} \arrow{->}[0,2] \chemfig{B}

Arrow types: ->, <-, <->, <<-, ->>, -|, |-, etc.

Functional Groups

\chemfig{C(-[:0]OH)(-[:90]H)(-[:180]H)(-[:270]H)} % Methanol
\chemfig{C(-[:0]COOH)(-[:90]H)(-[:180]H)(-[:270]H)} % Formic acid

Multi-Step Reactions

\chemfig{A} \arrow{->}[0,1.5] \chemfig{B} \arrow{->}[0,1.5] \chemfig{C}

Customization

\setatomstyle{sansserif}  % Change atom font
\setcrambond{2pt}{1pt}{0.8pt}  % Cram bond dimensions
\setbondoffset{0.5pt}  % Gap between atom and bond

Further Reading

  • chemfig documentation: texdoc chemfig
  • CTAN: chemfig
Copyright © 2026