Tracking chemical compounds with chemcompounds

As a chemist, one of the things I want to do is track compound numbers (which are normally given as bold numbers, 1, 2, etc.). The traditional way to do that is by hand, which works but does require some concentration. Recent versions of ChemDraw have included an add-in for Word to do things automatically, and of course there is LaTeX support for the same idea.

In LaTeX there is a choice between two packages for tracking what is what. First, there is the bpchem package. It provides for the idea of subdivisions, so you can have 1a, 1b, 1c and so forth. However, I find the interface in bpchem is a bit awkward. The alternative is the chemcompounds package. It has a very easy to use approach to tracking, but does not have built-in support for subdivisions. So I’ve been working on how to achieve this easily in some stuff I’m writing at the moment. It turns out to be quite easy when you think about it.

The first stage is of course to load the package.

\usepackage[noimplicit]{chemcompounds}

I’ve decided to go with the option to turn off automatically creating new compound references, which means I have to declare each one separately. This requires a block of declarations in the preamble, but I actually find this easier than doing things ad hoc. The subdivisions I want are all about R groups (chemists will understand!). So I’ve started by setting up some simple R group letters (I have a family of compounds, and so it makes sense to use the same letter for the same R group in each case):

\declarecompound[a]{Mes}
\declarecompound[b]{iPr}

Hopefully you can see how this works: the optional argument sets up the label that will print, and the mandatory one is the label I’ll use to refer to the compound.
Then I need to set up the general compounds (the ones that will be 1, 2 and so on). I can let chemcompounds do the numbering, so this is easy:

\declarecompound{imidazole}
\declarecompound{pincer:salt}
\declarecompound{pincer:carbene}

The last stage in the preamble is to create the subdivided compounds. Rather than have to track the numbers and letter myself, I’ve found that I can simply refer back to the existing labels:

\declarecompound[\compound{imidazole}\compound{Mes}]
  {imidazole:Mes}
\declarecompound[\compound{imidazole}\compound{iPr}]
  {imidazole:iPr}
\declarecompound[\compound{pincer:salt}\compound{Mes}]
  {pincer:salt:Mes}
\declarecompound[\compound{pincer:salt}\compound{iPr}]
  {pincer:salt:iPr}
\declarecompound[\compound{pincer:carbene}\compound{Mes}]
  {pincer:carbene:Mes}
\declarecompound[\compound{pincer:carbene}\compound{iPr}]
  {pincer:carbene:iPr}

In the document body, things are now very easy. I just use the \compound macro. So for the general case I’ll have

\compound{imidazole}

(printing say 4) whereas for a single case I might have

\compound{imidazole:Mes}

(printing say 4a). This keeps my source easy to follow (I don’t have to remember numbers and letters, only labels), and avoids mistakes on my part.

1 thought on “Tracking chemical compounds with chemcompounds

  1. I have a significant amount of compounds in my reports and as the document grows–with hope of being a dissertation one day–I have hard time tracking compounds names. Your solution is an interesting way to deal with R groups. Also, I agree that declaring compounds at the preamble stage is probably the best way to keep track of them or at least have the list in one place. The issue I ran into was the fact that I had couple of compounds numbered in a scheme but not all of them were mentioned in text and it seemed easier to do it ad hoc. It was a while ago and I learned more since then. I need to go back and try to declare at the preamble stage and see how it works.

    Great post. Thank you.

Leave a Reply