# Placement of caption in \chemfig via \chemname command - how to reset spacing

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.

Thomas

\documentclass{article}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{chemfig}
\begin{document}
\chemname{\chemfig{-[7]-[1]P(=[2]O)(-[6]-[7])-[7]-[1]}}{Triethylphosphine oxide}

\chemname{\chemfig{-[1](-[2]OH)-[7]}}{Isopropanol}

\chemname{\chemfig{H_2N-[1](=[2]O)-[7]NH_2}}{Urea}
\end{document}

-
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.

-
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