4

Possible Duplicate:
Chemcompound package : how to avoid the listoffigures scan ?

I am writing my chemistry dissertation with LaTeX, and I am using the chemstyle package to automatically number compounds. I want the numbering to start in the main body of the dissertation and the numbering to follow the order that they appear in the main body. However, before that I have the table of contents and lists of schemes, figures, and tables. Since these contain some compound names with numbers and the numbering is starting from the beginning of the entire document, the numbering ends up being out of order with respect to the main body of the document. How do I make the numbering start in the main body of the document?


In case my original question was unclear, here is a simple document showing what I was talking about:

\documentclass{article}

\usepackage{chemstyle}

\begin{document}

\tableofcontents

\section{Section}
Compounds \compound{A} and \compound{B}.

\section{Compound \compound{B}}

text

\end{document}

This gives the result that the compound I want numbered first, compound{A}, ends up as compound 2.

Thanks @cgnieder for your help! Both of the options you gave work great. I went with the second option since it helps me keep track of all my compounds, and I don't have to remember to include the plus sign for captions and section titles. I noticed that I need to have have

\usepackage[noimplicit]{chemcompounds}

before

\usepackage{chemstyle}

or I get the error message "Option clash for package chemcompounds."

I have a question regarding your suggestion to look at the chemnum package. I am also using the chemstyle package to create the type of float "scheme," create a list of schemes, and to automatically update numbering within my structure images (well, I'm still figuring out the image updating part, having trouble allowing reading of eps images). Would chemnum allow me to do these things? I looked it up, and it looks like it doesn't, but maybe I'm missing something.

2
  • 1
    Can you please add to your question a simple minimal document illustrating the undesired behaviour? Sep 16, 2012 at 4:18
  • Regarding your additional questions see my edited answer
    – cgnieder
    Sep 17, 2012 at 17:04

1 Answer 1

6

The chemstyle package doesn't do the numbering but the chemcompounds package which is loaded by the former. If you don't want to let the compound numbers to start with the ones in the ToC you have two possibilites:

  1. Use \compound+{<label>} in section headings and captions - this command variant will not declare a label but look it up from an auxiliary file. It thus needs two compilations.

    \documentclass{article}
    \usepackage{chemcompounds}
    
    \begin{document}
    
    \tableofcontents
    
    \section{Test A}
    A compound with number one \compound{A} and two \compound{B}.
    
    \section{Test \compound+{B}}
    
    \end{document}
    
  2. Don't use chemcompounds in implicit mode. This is less comfortable as you'd have to use \declarecompound for each compound but it gives you full control:

    \documentclass{article}
    
    \usepackage[noimplicit]{chemcompounds}
    \declarecompound{A}
    \declarecompound{B}
    
    \begin{document}
    
    \tableofcontents
    
    \section{Test A}
    A compound with number one \compound{A} and two \compound{B}.
    
    \section{Test \compound{B}}
    
    \end{document}
    

BTW: you also might be interested in the chemnum package.

Edit: regarding the additional questions:

The chemnum package can be used together with the chemstyle package so you can still use it for the scheme environment and the list of schemes. Similar to chemstyle's \schemeref chemnum provides \cmpdref for adding compound numbers to the eps figures. Examples for this are documented in the manual, see section 8.3. Both commands use psfrag's \psfrag command internally for the task. In order to use it with pdflatex you might want to use the auto-pst-pdf package.

chemnum also allows to declare labels explicitly, similar to chemcompounds' \declarecompound, see section 6 of the manual.

Not the answer you're looking for? Browse other questions tagged .