O'Reilly logo

LaTeX Cookbook by Stefan Kottwitz

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Drawing molecules

In the previous recipe, we already encountered formulae for molecules. Now let's see how to draw them. This means drawing a group of atoms and connecting them by lines of various kinds.

How to do it...

This rather complex seeming task becomes manageable using the chemfig package. It provides a compact syntax for drawing molecules. Let's draw some:

  1. Start with any document class:
    \documentclass{article}
  2. Load the chemfig package:
    \usepackage{chemfig}
  3. Let's write molecules in a table. For this, we stretch the rows a bit and start a tabular environment with a right-aligned column and a left-aligned one.
    \renewcommand{\arraystretch}{1.5}
    \begin{tabular}{rl}
  4. For molecules, use the \chemfig command. Write atoms as letters and a single bond using ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required