[texhax] how to draw chemical structure?

Ryan Van Wagoner whiteviz at gmail.com
Thu Apr 26 15:36:03 CEST 2007


>>>>> "anhnmncb" == anhnmncb  <anhnmncb at gmail.com> writes:

 anhnmncb> What's the best method of drawing chemical structures for
 anhnmncb> latex?  MetaPost?

It is possible to do it using MetaPost, but it takes a lot of effort.  I
ended up writing my own macro package to do just this, and while the
output looks decent, the interface is anything but intuitive (even to
me, and I wrote the damn thing).  If I am ever able to come up with a
better and more useful set of front end macros, I would consider
uploading it to CTAN.



 anhnmncb> PPCHTeX? Seems I have to learn context, but I think
 anhnmncb> firstthing I must to learn is latex ...

The last time I looked, it was not easy to get ACS style drawings from
PPCHTeX, or I would have used it.

 anhnmncb> xymtex? Not a good choice.  

I agree.  Although the package is very powerful, it is not the type of
interface that I prefer.

 anhnmncb> Now I have to do it thru ``chemdraw -> export xxx.png ->
 anhnmncb> includegraphic{xxx.png}'' ...

This may be the easiest route, with a slight modification.  Of course,
the quality of drawings from ChemDraw is top notch and it is very easy
to match the style requirements of journals using it.  You may want to
look into installing a PostScript driver to export the ChemDraw figures
as postscript.  You can then convert this into an encapsulated
postscript (EPS) file using any of several freely available converters,
depending on your platform.  I run Debian Linux (Sid) and I use
`epstool' to do this.  If you have a lot of drawings it is easy to batch
the conversion.  The EPS files have the advantage over PNG that they are
vector graphic files rather than raster files.  This means that you can
zoom in on a graphic or enlarge it to an arbitrary extent without seeing
pixelation of the lines and text.  If you prefer to use pdflatex, you
may also convert the EPS files to PDF using epstopdf which I believe is
part of texlive.

Another option is to use ACDLabs ChemSketch which is free for individual
use and is about as powerful as ChemDraw for drawing 99% of the types of
figures used in chemistry journal articles.  It can also export to CDX.

There are several free chemical structure drawing programs as well such
as BKChem, XDrawChem, chemtool, gchempaint, jchempaint, etc.  They all
vary in the quality of their interface, the quality of their output, and
flexibility in achieving the styles needed for different journals.  My
main gripe with most of these programs is that they deal with atom
labels by placing white boxes behind the labels but in front of the
bonds.  This is done to make the bonds appear as if they terminate at
the label rather than being superimposed on it.  Most people will never
notice the difference, but me being who I am decided instead to make a
MetaPost macro package for control freaks.  This problem does not exist
in ChemDraw or ChemSketch, however.

Some other more latex-oriented possibilities include:

http://www.ctan.org/tex-archive/macros/latex/contrib/streetex/

streetex is a very low level set of macros for creating chemical
structures using dvips specials.  I preferred this over xymtex because
of the greater degree of control it allows.  It is also fairly slow and
cumbersome to use, however, and requires frequent recompilations and
adjustments to get things just right.

http://www.ctan.org/tex-archive/support/ochem/

ochem also allows you to put the instructions for drawing the molecules
directly in your latex source.  It uses a perl script to extract the
information and create the eps files for inclusion.  From what I recall,
it was not too bad to work with and produced good results.

So depending on your wants and needs, you may want to experiment with
one or more of the above options to see what works best for you.

Good luck,

-- 

Ryan Van Wagoner


More information about the texhax mailing list