LaTeX and Chemistry

I recent had the need to draw some chemical equation in a LaTeX document. In the past I’ve used ChemDraw and loaded the image into my document as a png file. Last time I used ChemDraw was on my old computer and I didn’t have it on my new machine. So rather than download a copy and remind myself how to use it, I decided to see what was going on in the LaTeX community with respect to chemistry support. The answer is, a lot. What I found was a number of new packages. One particular package, chemfig, written by Christian Tellechea, caught my attention. One needs to read the documentation before using this package but its mode of operation is fairly straight forward. Other related tools can be found at Clemens Niederberger

For those who are curious, chemfig is built on tikz, an excellent general purpose drawing package. The main command in chemfig is:

   \chemfig{atom1 bond type[angle,coeff,tikz code]atom2}

Atoms can continue to be added to the list. A very simple example is:


\setatomsep just set the bond length which I made a little longer compared to the default.

or expressed in a different way using the angle option:


For my purpose I need to draw a transaminase reaction, for this I used the following code:


which yielded:

It could probably be tuned up a bit, for example the molecules are a bit close to the addition symbols. One thing I couldn’t get working very well was coloring atoms and groups of atoms.

If you use MiKTeX on windows all you have to do is include the following line at the start of your document:


and MiTeX will automatically download the package. Further details of the package including the fairly long manual can be found at CTAN.

This entry was posted in Chemistry, General Science Interest, LaTeX, Programming. Bookmark the permalink.

3 Responses to LaTeX and Chemistry

  1. kathleen says:

    This is a reversible reaction.

  2. hsauro says:

    Many apologies, I’ve updated the blog to reflect this change.

  3. Christian Tellechea says:

    I am the author of chemfig. Clemens wrote several other packages for chemistry but chemfig is not one of them.

Leave a Reply

Your email address will not be published.