# \submaincmpdplain and \subcmpdplain not working correctly when sub-labels initiated with \initcmpd

I have come across something weird with the chemnum package. I am trying to have my compound numbers in the pdf bookmarks. So I am using \texorpdfstring{}{} within my section titles. However, the sub-labels are not being printed when using \submaincmpdplain{}{} or \subcmpdplain{}{}. This only occurs when the compounds have been initiated with sub-labels within \initcmpd{}. For my document it is vital I use this.

Any ideas for a fix?

MWE:

\documentclass{article}

\usepackage{chemnum}
\initcmpd{%
cmpd.{aa,bb},
cmpd.cc,
}

\begin{document}
\cmpd{cmpd.aa}, \submaincmpdplain{cmpd}{aa}.

\cmpd{cmpd.bb}, \submaincmpdplain{cmpd}{bb}.

\cmpd{cmpd.cc}, \submaincmpdplain{cmpd}{cc}.

\cmpd{cmpd.dd}, \submaincmpdplain{cmpd}{dd}.

\cmpd{cmpd.ee}, \submaincmpdplain{cmpd}{ee}.

\cmpd{cmpd.ff}, \submaincmpdplain{cmpd}{ff}.
\end{document}


PS: I have already reported this on GitHub.

This is a bug which is fixed in the currrent version v1.2c (2019/10/02):

\documentclass{article}

\initcmpd{
cmpd.{aa,bb} ,
cmpd.cc ,
}

\begin{document}

\cmpd{cmpd.aa}, \submaincmpdplain{cmpd}{aa}.

\cmpd{cmpd.bb}, \submaincmpdplain{cmpd}{bb}.

\cmpd{cmpd.cc}, \submaincmpdplain{cmpd}{cc}.

\cmpd{cmpd.dd}, \submaincmpdplain{cmpd}{dd}.

\cmpd{cmpd.ee}, \submaincmpdplain{cmpd}{ee}.

\cmpd{cmpd.ff}, \submaincmpdplain{cmpd}{ff}.

\end{document}


I ran into this as well. No matter what I did, I couldn't get the sublabels to work when initiated in the preamble. I used a little workaround instead:

in the preamble:

\initcmpd{%
cmpd
}


and right after \begin{document}:

\cmpd*{cmpd.{aa,bb,...}}


Still doesn't fix the main issue, but works for now...