TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to put a number of different molecule structures into one document with the help of the chemfig package. The package also allows to add the name of the compound to the structure as a caption via the chemname command. As far as I understand the distance of the label from the structure is measured by the package and to avoid overlaps the largest spacing found is used for all subsequent labels. This leads to the effect of a large distance if the following molecule structure is small.

Is there a way to reset the distance measured between the \chemname commands?

Thank you very much for your help and please also see the example code below.


\chemname{\chemfig{-[7]-[1]P(=[2]O)(-[6]-[7])-[7]-[1]}}{Triethylphosphine oxide}


share|improve this question
Welcome to TeX.SE! and thanks for the (MWE). – percusse Nov 18 '12 at 19:50

The \chemname command takes an optional argument for vertical spacing:

\chemname[<dim>]{\chemfig{<code of the molecule>}}{<name>}

However, since your problem is a common one chemfig gives you the possibility to initialize the space. Quoting the manual:

In fact, to draw the <name> the command \chemname inserts 1.5ex + the largest of the depths of the molecules thus far below the baseline of each molecule (light grey for the examples in this manual). The command \chenameinit{<stuff>} initializes this largest depth with the <stuff>. Therefore one should:

  • write \chemnameinit{<deepest molecule>} before using the \chemname command in a reaction, unless the reaction begins with the deepest molecule;
  • write \chemnameinit{} after having written all the names in a chemical reaction lest the greatest depth in this reaction interfere with a future reaction.

So there's your answer: use \chemnameinit{} to reset the behaviour of \chemname.

share|improve this answer
ok thank you so I must have overlooked or misunderstood the manual then will give it a try. – Thomas Feldmann Nov 18 '12 at 20:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.