[Tex/LaTex] Can you make chemical structure diagrams in LaTeX


Can you create diagrams of chemical structures in LaTeX?

Example(s) of "chemical structure diagrams":

Example 1

Example 2

Best Answer

The answer is: yes. There is actually more than one package to do that:

I have used all but XyMTeX and PPCHTeX myself but nowadays only use chemfig any more.

XyMTeX is in my opinion far from being intuitive so I never bothered learning it. It also is not regularly updated to CTAN and not part of TeX Live. CTAN has v4.06 but the newest version is v5.00.

ochem nearly offers all one needs but 1) is not available from either major free distribution and 2) the work is done by a Perl script that translates formulae and reaction schemes into PostScript, which means it doesn't work with pdflatex.

streeTeX is just too limited in its capabilities besides the fact that it is rather old, is not available from either major free distribution and also doesn't work with pdflatex.

chemfig is a rather new and actively maintained package that not only allows to draw skeletal formulae but also has commands for creating whole reaction schemes. It uses TikZ for the drawing.

PPCHTeX is ConTeXt's chemistry module but it can actually be used with LaTeX, too. I have never used it before and trying to typeset the examples below with it has proven to be more complicated than I thought. That's why I simply copied an example from the conTeXtgarden.

So if you want to draw your formulas and schemes with LaTeX rather than an external program like ChemDraw I can only recommend chemfig.

A chemfig example:


  HO-[2,.5,2]?<[7,.7](-[2,.5]OH)-[,,,,line width=2.4pt](-[6,.5]OH)>[1,.7]
      -[,,,,line width=2.4pt](-[2,.5,,2]HO)>[:60,.707](-[6,.5]CH_2OH)-[:162,.9]O?[b])



chemfig demo

An ochem example:


          0: bond(r,=C) atom("O") ;
          3: atom("N") bond(r) atom("C",C,R) atom("H$_3$",L) ;
          4: bond(r,=C) atom("O") ;
          5: atom("N") bond(r) atom("CH$_3$",L) ;
              1: atom("N") bond(r) atom("C",C,L) atom("H$_3$",R) ;
              3: atom("N") ;
            } ;


ochem demo

A streetex example:




streetex demo

A XyMTeX example:




XyMTeX demo

A PPCHTeX example

\usepackage{m-ch-en}% or `m-ch-de' if you like a German interface




PPCHTeX demo

Related Question