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?

  • Something like \newcommand*\cmpdformat[1]{(\textbf{#1})} and \setchemnum{format=\cmpdformat} should work. – cgnieder May 9 '16 at 23:42
  • @clemens: OK, I'll remove my comment. – Bernard May 10 '16 at 0:00
  • My idea works but only for labels without sublabels… – cgnieder May 10 '16 at 8:09
  • @clemens That works. You should make it an answer so I can accept it. Thank you! – Canageek May 10 '16 at 18:41
  • 1
    @Canageek I already added a (better) answer :) My suggestion in the comment will not work for labels with sublabels like \cmpd{main.sub} – cgnieder May 10 '16 at 18:43

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:



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

  pre-label-code = ( ,
  post-label-code = )







enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.