5

My supervisor would like my compounds refrences in the form (1), (2), (3).

Using numbers is easy: drop \setchemnum{counter-format=arabic} in the preamble. But I can't figure out brackets. The manual has an example on pg 18 that gives exactly the output I want:

\cmpd[pre-label-code=(,post-label-code=)]{x, y, z.one }

But, as per pg 12--13, these are "cmpd" options, and thus I'd have to specify them for each and every compound, the first time I reference it. Is there a way to specify this globally that I'm not seeing, so I don't have to worry about which reference is the first one, and worry about missing one, assigning it each time, and so on?

Canageek
  • 17,935

1 Answers1

3

Actually I don't know any more why I didn't make pre-label-code and post-label-code generally available. I'll change this in future versions. For the time being you can make the change yourself and then just set them via \setchemnum:

\documentclass{article}

\usepackage{chemnum}

% adding the pre- and post- options to the `general' group makes
% them generally available; they should keep the `compound' group,
% though, too:
\ExplSyntaxOn
\keys_define:nn {chemnum}
  {
    pre-label-code  .groups:n = {compound,general} ,
    post-label-code .groups:n = {compound,general}
  }
\ExplSyntaxOff

\setchemnum{
  pre-label-code = ( ,
  post-label-code = )
}


\begin{document}

\cmpd+{a,h}

\cmpd{a,b,c,d.1,e,f.{1,2},g}

\cmpd[pre-label-code=,post-label-code=]{h}

\cmpd{a,h}

\end{document}

enter image description here

cgnieder
  • 66,645