# Defining own labels with chemnum 1.0

When using:

\documentclass{standalone}
\usepackage{graphicx,auto-pst-pdf,chemnum}
\begin{document}
\cmpd[counter-representation=bar]{foo}
\end{document}

I get "1" as label output. I would like to define an own label with foo being the internal descriptor and bar being the label's output when called. Pre-1.0 I was using \cmpd[cmpd-label=foo]{bar} which did what I wanted.

There is no option counter-representation so your code can't work. An invalid/unknown option to \cmpd is simply ignored.

I haven't added an equivalent of cmpd-label in v1.0 because I didn't deem it a very useful option but maybe I'm mistaken. (I hadn't thought that there was an actual use case for it...)

There is a workaround you can use: it's easy to add a command which overwrites the label that is assigned per default. For this the compound property counter-representation needs to be reset after the label has been declared (this needs expl3 syntax):

\NewDocumentCommand \setcmpdlabel {mm}
{ \chemnum_compound_set_property:nnn {#1} {counter-representation} {#2} }


A complete example could look like this

\documentclass{article}
\usepackage{chemnum}

\ExplSyntaxOn
\NewDocumentCommand \setcmpdlabel {mm}
{ \chemnum_compound_set_property:nnn {#1} {counter-representation} {#2} }
\ExplSyntaxOff

\begin{document}

\cmpd*{foo}\setcmpdlabel{foo}{bar}\cmpd{foo} and again \cmpd{foo}

\end{document}


• Thanks for your help. I found the pre-1.0 behaviour with \cmpd[cmpd-label=foo]{bar} very useful as some compounds just require to be referenced to with their common names: like d4T, AZT, ABC when you look at antiretroviral nucleoside analogous drugs or MOF-5, HKUST-1, UiO-66 when talking about metal organic frameworks - just to name two examples. Apr 8, 2014 at 7:50
• I see. Myself I'd probably use an acronym package for those... nevertheless it should be easy to add a corresponding option to v1.0 Apr 8, 2014 at 8:18