List of Compounds

Issue #8 wontfix
Former user created an issue

Hello, is there a way to automatically generate a list of all the numbered chemical compounds in my text? Like the one you can get via \tableofcontents or \listoffigures? There is an option in the chemstyle package, but this package doesn't work properly on my system and I like the chemnum better.

Thanks for any suggestions and help, Daniel

Comments (4)

  1. Clemens Niederberger repo owner

    There isn't right now otherwise it would be documented. You may be able to build something yourself, though. At the end of the document all the label IDs are available stored in a sequence, sublabels in the form main_sub.

    \documentclass{article}
    \usepackage{chemnum}
    \begin{document}
    
    \cmpd{a,b.1,c,b.2,d,e,f.{1,2,3},g}
    
    \ExplSyntaxOn\makeatletter
    
    \cs_new:Npn \daniel_write_label:n #1
      {
        \tl_if_in:nnTF { #1 } { _ }
          { \daniel_write_main_sub:w #1 \q_stop }
          { \use:c { chemnum_cmpd_#1: } }
      }
    
    \cs_new:Npn \daniel_write_main_sub:w #1_#2 \q_stop
      {
        \use:c { chemnum_cmpd_#1: }
        \use:c { chemnum_cmpd_#1_#2: }
      }
    
    \begin{itemize}
      \seq_map_inline:Nn \g__chemnum_cmpd_saved_seq
        { \item Label:~\daniel_write_label:n { #1 },~ (ID:~#1) }
    \end{itemize}
    
    \ExplSyntaxOff
    \end{document}
    

    Be aware that the sequence variable \g__chemnum_cmpd_saved_seq is a private variable and cannot be relied upon to survive any package updates...

  2. Log in to comment