I'm trying to typeset a chemistry document (my thesis) and I have a list of labels using chemnum. I want to refer to compounds 106-111 exactly like that: "106-111". When I use \cmpd[a,b,c,d,e,f] or \refcmpd[a,b,c,d,e,f] it will print as "106, 107, 108, 109, 110 and 111" instead of compressing the list to "106-111". I've checked the chemnum v1.2 manual but it's not been helpful. It says that there is an option for compress, but this seems to only work for sublabels: eg. 10a,10b,10c becomes 10a-c, but I can't find a way to get "106, 107, 108, 109, 110 and 111" to compress to "106-111".

There is no explicitly stated way of doing what I'm trying to achieve in the chemnum 1.2 manual (unless I've missed it). I've tried making a blank document using only the chemnum package, but even with a blank document I'm unable to get this to work...

Hope someone can help, I'm happy to provide more details for this.

I've tried the \setchemnum{compress=true} in both the preamble and directly in front of the \cmpd{a,b,c,d,e,f} list, and encompassing the \cmpd{a,b,c,d,e,f} in {} brackets. The chemnum manual says \setchemnum{compress=true} only works locally and I can't seem to get this to do anything not matter where I put it. Also in the manual there is only reference to compressing sublabels (10a,10b,10c becomes 10a-c) and there's no mention of what I'm trying to achieve.

I don't know if I need to correct the \cmpd[]{a,b,c,d,e,f} or if I should add something to \usepackage[]{chemnum} or if I need to use an entirely separate command (like \setchemnum{"options"}).

Apparently compress=true by default. But merge=false. I wonder if I need to change the merge instead and how these two affect eachother (if at all). The manual says both merge and compress are local.

Chemnum says I should use replacecmpd but I've not found this command useful and just using cmpd and refcmpd so far have allowed me to automatically number and refer back to compounds throughout my thesis. Currently compressing lists of compounds is the only issue I'm having.

  • 1
    That is not implemented for main labels but only for sublabels
    – cgnieder
    May 19, 2020 at 13:12
  • Wow, the author himself! Thanks for your reply and thanks so much for your hard work on all your packages. Any idea how to achieve what I'm trying to do? "natbib" can do this with references, it has an option for "sort&compress". The fact that chemnum can print "106, 107, 108, 109, 110 and 111" means it recognises the list, it just doesn't know to then apply the "sort&compress" part that I want... Seems like it should be possible to just amalgamate the "sort&compress" option from natbib with what chemnum is already doing but I'm very much a noob at LaTeX so not sure how.
    – Jozef
    May 19, 2020 at 13:30


Your Answer

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

Browse other questions tagged or ask your own question.