Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This MWE fails to compile the first time you run pdflatex on it, but works every time after that. #16

Closed
Canageek opened this issue Nov 10, 2020 · 2 comments
Labels

Comments

@Canageek
Copy link

\documentclass{article}
\usepackage{chemnum}
\begin{document}
\cmpd{peroxo.meoh} \cmpd{peroxo.etoh} \cmpd{peroxo.ppn} \refcmpd{peroxo.{meoh,etoh,ppn}}
\end{document}

Gives the following error:

! Missing number, treated as zero.
<to be read again>
                   \__int_eval_end:
l.4 ...eroxo.ppn} \refcmpd{peroxo.{meoh,etoh,ppn}}

However, if you hit r, then run pdflatex again, it compiles fine.

@Canageek
Copy link
Author

Canageek commented Nov 18, 2020

Ulrike Fischer has found a workaround:

\usepackage{chemnum}
\ExplSyntaxOn
\cs_set_protected:Npn \chemnum_sort_subcompounds:NNNnnNN #1#2#3#4#5#6#7
  {
    \seq_clear:N #6
    \seq_clear:N #7
    \bool_if:NF #1
      {
        \seq_if_exist:cTF {g__chemnum_compound_#5_subcompounds_seq}
          {
            \seq_map_inline:Nn #3
              {
                \seq_if_in:cnTF {g__chemnum_compound_#5_subcompounds_seq} {##1}
                  {
                    \seq_put_right:Nn #6
                      { \chemnum_write_subcompound:NNnnn #1 #2 {#4} {#5} {##1} }
                    \bool_if:NTF #2
                      {
                        \seq_put_right:Nx #7
                          {
                            \int_eval:n{0\chemnum_expandable_get_subcompound_property:nnn
                              {#5} {##1} {previous-number}}
                          }
                      }
                      {
                        \seq_put_right:Nx #7
                          {
                            \chemnum_expandable_get_subcompound_property:nnn
                              {#5} {##1} {number}
                          }
                      }
                  }
                  { \__chemnum_nothing_here:nn {##1} {#5} }
              }
          }
          { \__chemnum_nothing_here:xn { \seq_use:Nnnn #3 {,~} {,~} {,~} } {#5} }
      }
  }
\ExplSyntaxOff

cgnieder added a commit that referenced this issue Dec 6, 2020
@cgnieder cgnieder added the bug label Dec 6, 2020
@cgnieder
Copy link
Owner

cgnieder commented Dec 6, 2020

Thanks. Fixed for the next update.

@cgnieder cgnieder closed this as completed Dec 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants