# chemnum: label-format not affecting \cmpd definition globally?

When compiling the code

\documentclass{article}
\usepackage{chemnum}
\begin{document}

\cmpd*[label-format=\bfseries\textsuperscript,pre-label-code=\textbf{Me\textsubscript{2}L}]{Me2bdc}
\resetcmpd[1]
\cmpd*[label-format=\bfseries\textsuperscript,pre-label-code=\textbf{H\textsubscript{2}L}]{H2bdc}

\cmpd{Me2bdc} and \cmpd{H2bdc}

\cmpd[format=\bfseries\textsuperscript]{Me2bdc} and \cmpd[format=\bfseries\textsuperscript]{H2bdc}

\end{document}


using pdflatex, the following will be rendered:

where the second line represents what was intended here.

According to the chemnum manual, label-format should be used to alter a label's property, while format is used where the display of individual instances of \cmpd is to be altered locally. However, the definition of label-format=\bfseries\textsuperscript seems to have no effect on the diplay of 1 (see first line). Only when format=\bfseries\textsuperscript is used during calling the respective compound, the formatting will take place (second line). What am I getting wrong here? Using chemnum 1.2c from an up-to-date TeX Live 2019.

## 1 Answer

This is a misinterpretation or misunderstanding of the manual.

label-format is a property of a compound but not an option which can be set. Compound properties cannot be set directly by a user.

The option is called format and acts globally when used with \setchemnum and locally when used as option to \cmpd.

So the answer is: use \setchemnum{format=\bfseries\textsuperscript}.

If you want to restrict this to only a few compounds you either need to set the format again after declaring the compounds or use a group: this works because option setting is local to grouping but compounds are always defined globally.

\documentclass{article}
\usepackage{chemnum}

\begin{document}

\begingroup
\setchemnum{format=\bfseries\textsuperscript}
\cmpd*[pre-label-code=\textbf{Me\textsubscript{2}L}]{Me2bdc}
\resetcmpd
\cmpd*[pre-label-code=\textbf{H\textsubscript{2}L}]{H2bdc}
\endgroup

\cmpd{Me2bdc} and \cmpd{H2bdc}

\end{document}


It might be reasonable to be able to set the property label-format compoundwise when the the label is declared. For this an option would probably be useful (and it could be called label-format). If this sounds like a useful feature to you please feel free to open a feature request on github.

• Thanks for clarifying. I've added a feature request here. While the rendering of labels within text works as intended now using the grouping approach suggested by you, I'm still having trouble to realize differently styled labels generated by replacing tags in eps files. – tstone-1 Feb 7 '20 at 21:31