[Tex/LaTex] How to refer in the text to a molecule drawn with chemfig


I just found chemfig fantastic for drawing even difficult molecules. Now, I have a question: how can I put under the molecule a line with a caption like "Figure #: captiontext" and, even more important, how can I refer in the text to the drawn molecule?

Best Answer

I must confess the question is a bit unclear to me but it seems like you simply want a {figure} environment. If by Ā»refer to the [...] moleculeĀ« you mean the practice of refering to molecules with numbers in the text you may want to have a look at the chemnum package.


  \caption{The sceletal formula of ethanol (\cmpd{ethanol}) drawn with

The formula of \cmpd{ethanol} is shown in figure~\ref{fig:ethanol}.


enter image description here

Caution: the number of the molecule is determined by the first use of the corresponding \cmpd. This means it may haben in the \listoffigures if you use \cmpd in a caption. For cases like this there is \cmpd+ which only fetches the number:

  \caption{... ethanol (\cmpd+{ethanol}) ...}

The formula of \cmpd{ethanol} ...
Related Question