From 78e6fe88d0c53daeeebc6f215039f7a363490829 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 20 Jan 2013 23:43:08 +0000 Subject: chemnum 0.6 (20jan13) git-svn-id: svn://tug.org/texlive/trunk@28883 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/chemnum/chemnum.sty | 1308 +++++++++++------------ 1 file changed, 653 insertions(+), 655 deletions(-) (limited to 'Master/texmf-dist/tex/latex/chemnum') diff --git a/Master/texmf-dist/tex/latex/chemnum/chemnum.sty b/Master/texmf-dist/tex/latex/chemnum/chemnum.sty index 5d3525cddd2..83885ea3f14 100644 --- a/Master/texmf-dist/tex/latex/chemnum/chemnum.sty +++ b/Master/texmf-dist/tex/latex/chemnum/chemnum.sty @@ -8,7 +8,7 @@ % - If you have any ideas, questions, suggestions or bugs to report, please % - feel free to contact me. % ----------------------------------------------------------------------------- -% - Copyright 2011-2012 Clemens Niederberger +% - Copyright 2011-2013 Clemens Niederberger % - % - This work may be distributed and/or modified under the % - conditions of the LaTeX Project Public License, either version 1.3 @@ -32,8 +32,8 @@ \ProvidesExplPackage {chemnum} - {2012/12/29} - {0.5f} + {2013/01/20} + {0.6} {a comprehensive approach for the numbering of chemical compounds} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -93,10 +93,10 @@ } % textgreek support and package options: -\bool_new:N \l_chemnum_textgreek_bool -\bool_set_false:N \l_chemnum_textgreek_bool +\bool_new:N \l__chemnum_textgreek_bool +\bool_set_false:N \l__chemnum_textgreek_bool -\cs_new_nopar:Npn \chemnum_load_textgreek:n #1 +\cs_new_nopar:Npn \__chemnum_load_textgreek:n #1 { \AtEndPreamble { @@ -105,155 +105,155 @@ \@ifpackageloaded { textgreek } { \msg_warning:nnx { chemnum } { textgreek-loaded } { #1 } } { \RequirePackage [ #1 ] { textgreek } } - \bool_set_true:N \l_chemnum_textgreek_bool + \bool_set_true:N \l__chemnum_textgreek_bool } { \msg_warning:nnx { chemnum } { support-missing } { textgreek } - \bool_set_false:N \l_chemnum_textgreek_bool + \bool_set_false:N \l__chemnum_textgreek_bool } } } -\cs_new:Npn \chemnum_package_options:n #1 +\cs_new:Npn \__chemnum_package_options:n #1 { \keys_set:nn { chemnum / package } { #1 } } \keys_define:nn { chemnum / package } { textgreek .choice: , - textgreek / artemisia .code:n = \chemnum_load_textgreek:n { #1 } , - textgreek / cbgreek .code:n = \chemnum_load_textgreek:n { #1 } , - textgreek / euler .code:n = \chemnum_load_textgreek:n { #1 } , + textgreek / artemisia .code:n = \__chemnum_load_textgreek:n { #1 } , + textgreek / cbgreek .code:n = \__chemnum_load_textgreek:n { #1 } , + textgreek / euler .code:n = \__chemnum_load_textgreek:n { #1 } , textgreek / false .code:n = - { \bool_set_false:N \l_chemnum_textgreek_bool } , + { \bool_set_false:N \l__chemnum_textgreek_bool } , textgreek .default:n = cbgreek } \ProcessKeysOptions { chemnum / package } \AtBeginDocument{ -\bool_if:NTF \l_chemnum_textgreek_bool +\bool_if:NTF \l__chemnum_textgreek_bool { - \cs_new_eq:NN \chemnum_alpha: \textalpha - \cs_new_eq:NN \chemnum_beta: \textbeta - \cs_new_eq:NN \chemnum_gamma: \textgamma - \cs_new_eq:NN \chemnum_delta: \textdelta - \cs_new_eq:NN \chemnum_epsilon: \textepsilon - \cs_new_eq:NN \chemnum_zeta: \textzeta - \cs_new_eq:NN \chemnum_eta: \texteta - \cs_new_eq:NN \chemnum_theta: \texttheta - \cs_new_eq:NN \chemnum_iota: \textiota - \cs_new_eq:NN \chemnum_kappa: \textkappa - \cs_new_eq:NN \chemnum_lambda: \textlambda - \cs_new_eq:NN \chemnum_mu: \textmugreek - \cs_new_eq:NN \chemnum_nu: \textnu - \cs_new_eq:NN \chemnum_xi: \textxi - \cs_new_eq:NN \chemnum_omikron: \textomikron - \cs_new_eq:NN \chemnum_pi: \textpi - \cs_new_eq:NN \chemnum_rho: \textrho - \cs_new_eq:NN \chemnum_sigma: \textsigma - \cs_new_eq:NN \chemnum_tau: \texttau - \cs_new_eq:NN \chemnum_upsilon: \textupsilon - \cs_new_eq:NN \chemnum_phi: \textphi - \cs_new_eq:NN \chemnum_chi: \textchi - \cs_new_eq:NN \chemnum_psi: \textpsi - \cs_new_eq:NN \chemnum_omega: \textomega - \cs_new_eq:NN \chemnum_Alpha: \textAlpha - \cs_new_eq:NN \chemnum_Beta: \textBeta - \cs_new_eq:NN \chemnum_Gamma: \textGamma - \cs_new_eq:NN \chemnum_Delta: \textDelta - \cs_new_eq:NN \chemnum_Epsilon: \textEpsilon - \cs_new_eq:NN \chemnum_Zeta: \textZeta - \cs_new_eq:NN \chemnum_Eta: \textEta - \cs_new_eq:NN \chemnum_Theta: \textTheta - \cs_new_eq:NN \chemnum_Iota: \textIota - \cs_new_eq:NN \chemnum_Kappa: \textKappa - \cs_new_eq:NN \chemnum_Lambda: \textLambda - \cs_new_eq:NN \chemnum_Mu: \textMugreek - \cs_new_eq:NN \chemnum_Nu: \textNu - \cs_new_eq:NN \chemnum_Xi: \textXi - \cs_new_eq:NN \chemnum_Omikron: \textOmikron - \cs_new_eq:NN \chemnum_Pi: \textPi - \cs_new_eq:NN \chemnum_Rho: \textRho - \cs_new_eq:NN \chemnum_Sigma: \textSigma - \cs_new_eq:NN \chemnum_Tau: \textTau - \cs_new_eq:NN \chemnum_Upsilon: \textUpsilon - \cs_new_eq:NN \chemnum_Phi: \textPhi - \cs_new_eq:NN \chemnum_Chi: \textChi - \cs_new_eq:NN \chemnum_Psi: \textPsi - \cs_new_eq:NN \chemnum_Omega: \textOmega + \cs_new_eq:NN \__chemnum_alpha: \textalpha + \cs_new_eq:NN \__chemnum_beta: \textbeta + \cs_new_eq:NN \__chemnum_gamma: \textgamma + \cs_new_eq:NN \__chemnum_delta: \textdelta + \cs_new_eq:NN \__chemnum_epsilon: \textepsilon + \cs_new_eq:NN \__chemnum_zeta: \textzeta + \cs_new_eq:NN \__chemnum_eta: \texteta + \cs_new_eq:NN \__chemnum_theta: \texttheta + \cs_new_eq:NN \__chemnum_iota: \textiota + \cs_new_eq:NN \__chemnum_kappa: \textkappa + \cs_new_eq:NN \__chemnum_lambda: \textlambda + \cs_new_eq:NN \__chemnum_mu: \textmugreek + \cs_new_eq:NN \__chemnum_nu: \textnu + \cs_new_eq:NN \__chemnum_xi: \textxi + \cs_new_eq:NN \__chemnum_omikron: \textomikron + \cs_new_eq:NN \__chemnum_pi: \textpi + \cs_new_eq:NN \__chemnum_rho: \textrho + \cs_new_eq:NN \__chemnum_sigma: \textsigma + \cs_new_eq:NN \__chemnum_tau: \texttau + \cs_new_eq:NN \__chemnum_upsilon: \textupsilon + \cs_new_eq:NN \__chemnum_phi: \textphi + \cs_new_eq:NN \__chemnum_chi: \textchi + \cs_new_eq:NN \__chemnum_psi: \textpsi + \cs_new_eq:NN \__chemnum_omega: \textomega + \cs_new_eq:NN \__chemnum_Alpha: \textAlpha + \cs_new_eq:NN \__chemnum_Beta: \textBeta + \cs_new_eq:NN \__chemnum_Gamma: \textGamma + \cs_new_eq:NN \__chemnum_Delta: \textDelta + \cs_new_eq:NN \__chemnum_Epsilon: \textEpsilon + \cs_new_eq:NN \__chemnum_Zeta: \textZeta + \cs_new_eq:NN \__chemnum_Eta: \textEta + \cs_new_eq:NN \__chemnum_Theta: \textTheta + \cs_new_eq:NN \__chemnum_Iota: \textIota + \cs_new_eq:NN \__chemnum_Kappa: \textKappa + \cs_new_eq:NN \__chemnum_Lambda: \textLambda + \cs_new_eq:NN \__chemnum_Mu: \textMugreek + \cs_new_eq:NN \__chemnum_Nu: \textNu + \cs_new_eq:NN \__chemnum_Xi: \textXi + \cs_new_eq:NN \__chemnum_Omikron: \textOmikron + \cs_new_eq:NN \__chemnum_Pi: \textPi + \cs_new_eq:NN \__chemnum_Rho: \textRho + \cs_new_eq:NN \__chemnum_Sigma: \textSigma + \cs_new_eq:NN \__chemnum_Tau: \textTau + \cs_new_eq:NN \__chemnum_Upsilon: \textUpsilon + \cs_new_eq:NN \__chemnum_Phi: \textPhi + \cs_new_eq:NN \__chemnum_Chi: \textChi + \cs_new_eq:NN \__chemnum_Psi: \textPsi + \cs_new_eq:NN \__chemnum_Omega: \textOmega } { \RequirePackage { bm }% abhängig machen von textoption bold - \cs_new_nopar:Npn \chemnum_bm:n #1 + \cs_new_nopar:Npn \__chemnum_bm:n #1 { - \bool_if:NTF \l_chemnum_cmpd_bold_bool + \bool_if:NTF \l__chemnum_cmpd_bold_bool { \bm { #1 } } { #1 } } - \cs_new_nopar:Npn \chemnum_alpha: { \ensuremath { \chemnum_bm:n { \mathrm { \alpha } } } } - \cs_new_nopar:Npn \chemnum_beta: { \ensuremath { \chemnum_bm:n { \mathrm { \beta } } } } - \cs_new_nopar:Npn \chemnum_gamma: { \ensuremath { \chemnum_bm:n { \mathrm { \gamma } } } } - \cs_new_nopar:Npn \chemnum_delta: { \ensuremath { \chemnum_bm:n { \mathrm { \delta } } } } - \cs_new_nopar:Npn \chemnum_epsilon: { \ensuremath { \chemnum_bm:n { \mathrm { \varepsilon } } } } - \cs_new_nopar:Npn \chemnum_zeta: { \ensuremath { \chemnum_bm:n { \mathrm { \zeta } } } } - \cs_new_nopar:Npn \chemnum_eta: { \ensuremath { \chemnum_bm:n { \mathrm { \eta } } } } - \cs_new_nopar:Npn \chemnum_theta: { \ensuremath { \chemnum_bm:n { \mathrm { \theta } } } } - \cs_new_nopar:Npn \chemnum_iota: { \ensuremath { \chemnum_bm:n { \mathrm { \iota } } } } - \cs_new_nopar:Npn \chemnum_kappa: { \ensuremath { \chemnum_bm:n { \mathrm { \kappa } } } } - \cs_new_nopar:Npn \chemnum_lambda: { \ensuremath { \chemnum_bm:n { \mathrm { \lampda } } } } - \cs_new_nopar:Npn \chemnum_mu: { \ensuremath { \chemnum_bm:n { \mathrm { \mu } } } } - \cs_new_nopar:Npn \chemnum_nu: { \ensuremath { \chemnum_bm:n { \mathrm { \nu } } } } - \cs_new_nopar:Npn \chemnum_xi: { \ensuremath { \chemnum_bm:n { \mathrm { \xi } } } } - \cs_new_nopar:Npn \chemnum_omikron: { \ensuremath { \chemnum_bm:n { \mathrm { o } } } } - \cs_new_nopar:Npn \chemnum_pi: { \ensuremath { \chemnum_bm:n { \mathrm { \pi } } } } - \cs_new_nopar:Npn \chemnum_rho: { \ensuremath { \chemnum_bm:n { \mathrm { \rho } } } } - \cs_new_nopar:Npn \chemnum_sigma: { \ensuremath { \chemnum_bm:n { \mathrm { \sigma } } } } - \cs_new_nopar:Npn \chemnum_tau: { \ensuremath { \chemnum_bm:n { \mathrm { \tau } } } } - \cs_new_nopar:Npn \chemnum_upsilon: { \ensuremath { \chemnum_bm:n { \mathrm { \upsilon } } } } - \cs_new_nopar:Npn \chemnum_phi: { \ensuremath { \chemnum_bm:n { \mathrm { \varphi } } } } - \cs_new_nopar:Npn \chemnum_chi: { \ensuremath { \chemnum_bm:n { \mathrm { \chi } } } } - \cs_new_nopar:Npn \chemnum_psi: { \ensuremath { \chemnum_bm:n { \mathrm { \psi } } } } - \cs_new_nopar:Npn \chemnum_omega: { \ensuremath { \chemnum_bm:n { \mathrm { \omega } } } } - \cs_new_nopar:Npn \chemnum_Alpha: { \ensuremath { \chemnum_bm:n { \mathrm { A } } } } - \cs_new_nopar:Npn \chemnum_Beta: { \ensuremath { \chemnum_bm:n { \mathrm { B } } } } - \cs_new_nopar:Npn \chemnum_Gamma: { \ensuremath { \chemnum_bm:n { \mathrm { \Gamma } } } } - \cs_new_nopar:Npn \chemnum_Delta: { \ensuremath { \chemnum_bm:n { \mathrm { \Delta } } } } - \cs_new_nopar:Npn \chemnum_Epsilon: { \ensuremath { \chemnum_bm:n { \mathrm { E } } } } - \cs_new_nopar:Npn \chemnum_Zeta: { \ensuremath { \chemnum_bm:n { \mathrm { Z } } } } - \cs_new_nopar:Npn \chemnum_Eta: { \ensuremath { \chemnum_bm:n { \mathrm { H } } } } - \cs_new_nopar:Npn \chemnum_Theta: { \ensuremath { \chemnum_bm:n { \mathrm { \Theta } } } } - \cs_new_nopar:Npn \chemnum_Iota: { \ensuremath { \chemnum_bm:n { \mathrm { I } } } } - \cs_new_nopar:Npn \chemnum_Kappa: { \ensuremath { \chemnum_bm:n { \mathrm { K } } } } - \cs_new_nopar:Npn \chemnum_Lambda: { \ensuremath { \chemnum_bm:n { \mathrm { \Lambda } } } } - \cs_new_nopar:Npn \chemnum_Mu: { \ensuremath { \chemnum_bm:n { \mathrm { M } } } } - \cs_new_nopar:Npn \chemnum_Nu: { \ensuremath { \chemnum_bm:n { \mathrm { N } } } } - \cs_new_nopar:Npn \chemnum_Xi: { \ensuremath { \chemnum_bm:n { \mathrm { \Xi } } } } - \cs_new_nopar:Npn \chemnum_Omikron: { \ensuremath { \chemnum_bm:n { \mathrm { O } } } } - \cs_new_nopar:Npn \chemnum_Pi: { \ensuremath { \chemnum_bm:n { \mathrm { \Pi } } } } - \cs_new_nopar:Npn \chemnum_Rho: { \ensuremath { \chemnum_bm:n { \mathrm { P } } } } - \cs_new_nopar:Npn \chemnum_Sigma: { \ensuremath { \chemnum_bm:n { \mathrm { \Sigma } } } } - \cs_new_nopar:Npn \chemnum_Tau: { \ensuremath { \chemnum_bm:n { \mathrm { T } } } } - \cs_new_nopar:Npn \chemnum_Upsilon: { \ensuremath { \chemnum_bm:n { \mathrm { \Upsilon } } } } - \cs_new_nopar:Npn \chemnum_Phi: { \ensuremath { \chemnum_bm:n { \mathrm { \Phi } } } } - \cs_new_nopar:Npn \chemnum_Chi: { \ensuremath { \chemnum_bm:n { \mathrm { X } } } } - \cs_new_nopar:Npn \chemnum_Psi: { \ensuremath { \chemnum_bm:n { \mathrm { \Psi } } } } - \cs_new_nopar:Npn \chemnum_Omega: { \ensuremath { \chemnum_bm:n { \mathrm { \Omega } } } } + \cs_new_nopar:Npn \__chemnum_alpha: { \ensuremath { \__chemnum_bm:n { \mathrm { \alpha } } } } + \cs_new_nopar:Npn \__chemnum_beta: { \ensuremath { \__chemnum_bm:n { \mathrm { \beta } } } } + \cs_new_nopar:Npn \__chemnum_gamma: { \ensuremath { \__chemnum_bm:n { \mathrm { \gamma } } } } + \cs_new_nopar:Npn \__chemnum_delta: { \ensuremath { \__chemnum_bm:n { \mathrm { \delta } } } } + \cs_new_nopar:Npn \__chemnum_epsilon: { \ensuremath { \__chemnum_bm:n { \mathrm { \varepsilon } } } } + \cs_new_nopar:Npn \__chemnum_zeta: { \ensuremath { \__chemnum_bm:n { \mathrm { \zeta } } } } + \cs_new_nopar:Npn \__chemnum_eta: { \ensuremath { \__chemnum_bm:n { \mathrm { \eta } } } } + \cs_new_nopar:Npn \__chemnum_theta: { \ensuremath { \__chemnum_bm:n { \mathrm { \theta } } } } + \cs_new_nopar:Npn \__chemnum_iota: { \ensuremath { \__chemnum_bm:n { \mathrm { \iota } } } } + \cs_new_nopar:Npn \__chemnum_kappa: { \ensuremath { \__chemnum_bm:n { \mathrm { \kappa } } } } + \cs_new_nopar:Npn \__chemnum_lambda: { \ensuremath { \__chemnum_bm:n { \mathrm { \lampda } } } } + \cs_new_nopar:Npn \__chemnum_mu: { \ensuremath { \__chemnum_bm:n { \mathrm { \mu } } } } + \cs_new_nopar:Npn \__chemnum_nu: { \ensuremath { \__chemnum_bm:n { \mathrm { \nu } } } } + \cs_new_nopar:Npn \__chemnum_xi: { \ensuremath { \__chemnum_bm:n { \mathrm { \xi } } } } + \cs_new_nopar:Npn \__chemnum_omikron: { \ensuremath { \__chemnum_bm:n { \mathrm { o } } } } + \cs_new_nopar:Npn \__chemnum_pi: { \ensuremath { \__chemnum_bm:n { \mathrm { \pi } } } } + \cs_new_nopar:Npn \__chemnum_rho: { \ensuremath { \__chemnum_bm:n { \mathrm { \rho } } } } + \cs_new_nopar:Npn \__chemnum_sigma: { \ensuremath { \__chemnum_bm:n { \mathrm { \sigma } } } } + \cs_new_nopar:Npn \__chemnum_tau: { \ensuremath { \__chemnum_bm:n { \mathrm { \tau } } } } + \cs_new_nopar:Npn \__chemnum_upsilon: { \ensuremath { \__chemnum_bm:n { \mathrm { \upsilon } } } } + \cs_new_nopar:Npn \__chemnum_phi: { \ensuremath { \__chemnum_bm:n { \mathrm { \varphi } } } } + \cs_new_nopar:Npn \__chemnum_chi: { \ensuremath { \__chemnum_bm:n { \mathrm { \chi } } } } + \cs_new_nopar:Npn \__chemnum_psi: { \ensuremath { \__chemnum_bm:n { \mathrm { \psi } } } } + \cs_new_nopar:Npn \__chemnum_omega: { \ensuremath { \__chemnum_bm:n { \mathrm { \omega } } } } + \cs_new_nopar:Npn \__chemnum_Alpha: { \ensuremath { \__chemnum_bm:n { \mathrm { A } } } } + \cs_new_nopar:Npn \__chemnum_Beta: { \ensuremath { \__chemnum_bm:n { \mathrm { B } } } } + \cs_new_nopar:Npn \__chemnum_Gamma: { \ensuremath { \__chemnum_bm:n { \mathrm { \Gamma } } } } + \cs_new_nopar:Npn \__chemnum_Delta: { \ensuremath { \__chemnum_bm:n { \mathrm { \Delta } } } } + \cs_new_nopar:Npn \__chemnum_Epsilon: { \ensuremath { \__chemnum_bm:n { \mathrm { E } } } } + \cs_new_nopar:Npn \__chemnum_Zeta: { \ensuremath { \__chemnum_bm:n { \mathrm { Z } } } } + \cs_new_nopar:Npn \__chemnum_Eta: { \ensuremath { \__chemnum_bm:n { \mathrm { H } } } } + \cs_new_nopar:Npn \__chemnum_Theta: { \ensuremath { \__chemnum_bm:n { \mathrm { \Theta } } } } + \cs_new_nopar:Npn \__chemnum_Iota: { \ensuremath { \__chemnum_bm:n { \mathrm { I } } } } + \cs_new_nopar:Npn \__chemnum_Kappa: { \ensuremath { \__chemnum_bm:n { \mathrm { K } } } } + \cs_new_nopar:Npn \__chemnum_Lambda: { \ensuremath { \__chemnum_bm:n { \mathrm { \Lambda } } } } + \cs_new_nopar:Npn \__chemnum_Mu: { \ensuremath { \__chemnum_bm:n { \mathrm { M } } } } + \cs_new_nopar:Npn \__chemnum_Nu: { \ensuremath { \__chemnum_bm:n { \mathrm { N } } } } + \cs_new_nopar:Npn \__chemnum_Xi: { \ensuremath { \__chemnum_bm:n { \mathrm { \Xi } } } } + \cs_new_nopar:Npn \__chemnum_Omikron: { \ensuremath { \__chemnum_bm:n { \mathrm { O } } } } + \cs_new_nopar:Npn \__chemnum_Pi: { \ensuremath { \__chemnum_bm:n { \mathrm { \Pi } } } } + \cs_new_nopar:Npn \__chemnum_Rho: { \ensuremath { \__chemnum_bm:n { \mathrm { P } } } } + \cs_new_nopar:Npn \__chemnum_Sigma: { \ensuremath { \__chemnum_bm:n { \mathrm { \Sigma } } } } + \cs_new_nopar:Npn \__chemnum_Tau: { \ensuremath { \__chemnum_bm:n { \mathrm { T } } } } + \cs_new_nopar:Npn \__chemnum_Upsilon: { \ensuremath { \__chemnum_bm:n { \mathrm { \Upsilon } } } } + \cs_new_nopar:Npn \__chemnum_Phi: { \ensuremath { \__chemnum_bm:n { \mathrm { \Phi } } } } + \cs_new_nopar:Npn \__chemnum_Chi: { \ensuremath { \__chemnum_bm:n { \mathrm { X } } } } + \cs_new_nopar:Npn \__chemnum_Psi: { \ensuremath { \__chemnum_bm:n { \mathrm { \Psi } } } } + \cs_new_nopar:Npn \__chemnum_Omega: { \ensuremath { \__chemnum_bm:n { \mathrm { \Omega } } } } } } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % TOOLS -\int_new:N \g_chemnum_cmpd_main_int -\prop_new:N \g_chemnum_label_prop -\int_new:N \g_chemnum_cmpd_int -\tl_new:N \l_chemnum_tmpa_tl -\tl_new:N \l_chemnum_tmpb_tl -\clist_new:N \g_chemnum_cmpd_save_clist +\int_new:N \g__chemnum_cmpd_main_int +\prop_new:N \g__chemnum_label_prop +\int_new:N \g__chemnum_cmpd_int +\tl_new:N \l__chemnum_tmpa_tl +\tl_new:N \l__chemnum_tmpb_tl +\clist_new:N \g__chemnum_cmpd_save_clist %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % READ FROM PREVIOUS RUN, SAVE FOR NEXT RUN % save all labels in a clist -\cs_new:Npn \chemnum_cmpd_save:n #1 - { \clist_gput_right:Nn \g_chemnum_cmpd_save_clist { { #1 } } } +\cs_new:Npn \__chemnum_cmpd_save:n #1 + { \clist_gput_right:Nn \g__chemnum_cmpd_save_clist { { #1 } } } \msg_set:nnn { chemnum } { missing-cmpd-file } { @@ -269,18 +269,18 @@ % available at the next run \AtEndDocument { - \iow_new:N \chemnum_aux_file: - \iow_open:Nn \chemnum_aux_file: { ./ \c_job_name_tl . cmpd } - \clist_map_inline:Nn \g_chemnum_cmpd_save_clist + \iow_new:N \__chemnum_aux_file: + \iow_open:Nn \__chemnum_aux_file: { ./ \c_job_name_tl . cmpd } + \clist_map_inline:Nn \g__chemnum_cmpd_save_clist { - \iow_now:Nx \chemnum_aux_file: + \iow_now:Nx \__chemnum_aux_file: { \use:c { cs_new_nopar:cpn } { chemnum_cmpd_ #1 _ref: } { \exp_not:f { \use:c { chemnum_cmpd_ #1 : } } } } \cs_if_exist:cT { chemnum_cmpd_ #1 _min: } { - \iow_now:Nx \chemnum_aux_file: + \iow_now:Nx \__chemnum_aux_file: { \use:c { cs_new_nopar:cpn } { chemnum_cmpd_ #1 _min_ref: } { \exp_not:f { \use:c { chemnum_cmpd_ #1 _min: } } } @@ -288,24 +288,24 @@ } \cs_if_exist:cT { chemnum_cmpd_ #1 _max: } { - \iow_now:Nx \chemnum_aux_file: + \iow_now:Nx \__chemnum_aux_file: { \use:c { cs_new_nopar:cpn } { chemnum_cmpd_ #1 _max_ref: } { \exp_not:f { \use:c { chemnum_cmpd_ #1 _max: } } } } } } - \iow_close:N \chemnum_aux_file: + \iow_close:N \__chemnum_aux_file: } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % COMPOUND LABELS % STYLE OF COMPOUND LABEL -\tl_new:N \l_chemnum_style_tmp_tl -\bool_new:N \l_chemnum_cmpd_style_is_macro_bool +\tl_new:N \l__chemnum_style_tmp_tl +\bool_new:N \l__chemnum_cmpd_style_is_macro_bool % default style -\cs_new_nopar:Npn \chemnum_cmpd_style_value:n { } +\cs_new_nopar:Npn \__chemnum_cmpd_style_value:n { } % error message \msg_set:nnn { chemnum } { cmpd-style } @@ -315,45 +315,45 @@ } % set style %TODO -\cs_new_nopar:Npn \chemnum_cmpd_set_style:n #1 +\cs_new_nopar:Npn \__chemnum_cmpd_set_style:n #1 % { -% \tl_clear:N \l_chemnum_style_tmp_tl -% \tl_map_variable:nNn { #1 } \l_chemnum_style_tmp_tl +% \tl_clear:N \l__chemnum_style_tmp_tl +% \tl_map_variable:nNn { #1 } \l__chemnum_style_tmp_tl % { -% \exp_args:No \token_if_cs:NTF \l_chemnum_style_tmp_tl -% { \bool_set_true:N \l_chemnum_cmpd_style_is_macro_bool } -% { \bool_set_false:N \l_chemnum_cmpd_style_is_macro_bool } +% \exp_args:No \token_if_cs:NTF \l__chemnum_style_tmp_tl +% { \bool_set_true:N \l__chemnum_cmpd_style_is_macro_bool } +% { \bool_set_false:N \l__chemnum_cmpd_style_is_macro_bool } % } -% \bool_if:NTF \l_chemnum_cmpd_style_is_macro_bool - { \cs_set_nopar:Npn \chemnum_cmpd_style_value:n { #1 } } +% \bool_if:NTF \l__chemnum_cmpd_style_is_macro_bool + { \cs_set_nopar:Npn \__chemnum_cmpd_style_value:n { #1 } } % { \msg_error:nnx { chemnum } { cmpd-style } { #1 } } % } % use style -\bool_new:N \l_chemnum_cmpd_bold_bool -\bool_set_true:N \l_chemnum_cmpd_bold_bool +\bool_new:N \l__chemnum_cmpd_bold_bool +\bool_set_true:N \l__chemnum_cmpd_bold_bool -\cs_new_nopar:Npn \chemnum_cmpd_use_style:n #1 +\cs_new_nopar:Npn \__chemnum_cmpd_use_style:n #1 { \group_begin: - \bool_if:NT \l_chemnum_cmpd_bold_bool + \bool_if:NT \l__chemnum_cmpd_bold_bool { \bfseries } - \chemnum_cmpd_style_value:n { #1 } + \__chemnum_cmpd_style_value:n { #1 } \group_end: } %-----------------------------------------------------------------------------% % prefix, suffix, delimiters, format and separator of compound label -\tl_new:N \l_chemnum_cmpd_prefix_tl -\tl_new:N \l_chemnum_cmpd_suffix_tl +\tl_new:N \l__chemnum_cmpd_prefix_tl +\tl_new:N \l__chemnum_cmpd_suffix_tl -\tl_new:N \l_chemnum_cmpd_space_tl -\tl_set:Nn \l_chemnum_cmpd_space_tl { \penalty\@m\ } +\tl_new:N \l__chemnum_cmpd_space_tl +\tl_set:Nn \l__chemnum_cmpd_space_tl { \penalty\@m\ } -\tl_new:N \l_chemnum_cmpd_separator_tl +\tl_new:N \l__chemnum_cmpd_separator_tl -\tl_new:N \l_chemnum_cmpd_odelim_tl -\tl_new:N \l_chemnum_cmpd_cdelim_tl +\tl_new:N \l__chemnum_cmpd_odelim_tl +\tl_new:N \l__chemnum_cmpd_cdelim_tl % error message for wrong argument length of delim-keys \msg_set:nnn { chemnum } { delimiters } @@ -363,74 +363,74 @@ } % set compound delimiters -\cs_new_nopar:Npn \chemnum_cmpd_delim:n #1 +\cs_new_nopar:Npn \__chemnum_cmpd_delim:n #1 { \tl_if_blank:nTF { #1 } { - \tl_clear:N \l_chemnum_cmpd_odelim_tl - \tl_clear:N \l_chemnum_cmpd_cdelim_tl + \tl_clear:N \l__chemnum_cmpd_odelim_tl + \tl_clear:N \l__chemnum_cmpd_cdelim_tl } { \int_compare:nNnTF { \tl_length:n { #1 } } = 2 { - \tl_set:Nx \l_chemnum_cmpd_odelim_tl { \tl_head:n { #1 } } - \tl_set:Nx \l_chemnum_cmpd_cdelim_tl { \tl_tail:n { #1 } } + \tl_set:Nx \l__chemnum_cmpd_odelim_tl { \tl_head:n { #1 } } + \tl_set:Nx \l__chemnum_cmpd_cdelim_tl { \tl_tail:n { #1 } } } { \msg_error:nnx { chemnum } { delimiters } { cmpd } } } } % format of numbering -\cs_new_nopar:Npn \chemnum_cmpd_kind:nn #1#2 +\cs_new_nopar:Npn \__chemnum_cmpd_kind:nn #1#2 { \cs:w int_to_#1:n \cs_end: #2 } % default format -\tl_new:N \l_chemnum_cmpd_kind_value_tl -\tl_set:Nn \l_chemnum_cmpd_kind_value_tl { arabic } +\tl_new:N \l__chemnum_cmpd_kind_value_tl +\tl_set:Nn \l__chemnum_cmpd_kind_value_tl { arabic } % format of sub-numbering -\cs_new_nopar:Npn \chemnum_cmpd_sub_kind:nn #1#2 +\cs_new_nopar:Npn \__chemnum_cmpd_sub_kind:nn #1#2 { \cs:w int_to_ #1 :n \cs_end: #2 } -\cs_generate_variant:Nn \chemnum_cmpd_sub_kind:nn { Nc } +\cs_generate_variant:Nn \__chemnum_cmpd_sub_kind:nn { Nc } % default format -\tl_new:N \l_chemnum_cmpd_sub_kind_value_tl -\tl_set:Nn \l_chemnum_cmpd_sub_kind_value_tl { alph } +\tl_new:N \l__chemnum_cmpd_sub_kind_value_tl +\tl_set:Nn \l__chemnum_cmpd_sub_kind_value_tl { alph } %-----------------------------------------------------------------------------% % add greek letters and symbols as numbering format % define \int_to_greek function \cs_new:Npn \int_to_greek:n { } -% \bool_if:NTF \l_chemnum_textgreek_bool +% \bool_if:NTF \l__chemnum_textgreek_bool % { \cs_set:Npn \int_to_greek:n #1 { \int_to_symbols:nnn {#1} { 24 } { - { 1 } { \exp_not:o \chemnum_alpha: } - { 2 } { \exp_not:o \chemnum_beta: } - { 3 } { \exp_not:o \chemnum_gamma: } - { 4 } { \exp_not:o \chemnum_delta: } - { 5 } { \exp_not:o \chemnum_epsilon: } - { 6 } { \exp_not:o \chemnum_zeta: } - { 7 } { \exp_not:o \chemnum_eta: } - { 8 } { \exp_not:o \chemnum_theta: } - { 9 } { \exp_not:o \chemnum_iota: } - { 10 } { \exp_not:o \chemnum_kappa: } - { 11 } { \exp_not:o \chemnum_lambda: } - { 12 } { \exp_not:o \chemnum_mu: } - { 13 } { \exp_not:o \chemnum_nu: } - { 14 } { \exp_not:o \chemnum_xi: } - { 15 } { \exp_not:o \chemnum_omikron: } - { 16 } { \exp_not:o \chemnum_pi: } - { 17 } { \exp_not:o \chemnum_rho: } - { 18 } { \exp_not:o \chemnum_sigma: } - { 19 } { \exp_not:o \chemnum_tau: } - { 20 } { \exp_not:o \chemnum_upsilon: } - { 21 } { \exp_not:o \chemnum_phi: } - { 22 } { \exp_not:o \chemnum_chi: } - { 23 } { \exp_not:o \chemnum_psi: } - { 24 } { \exp_not:o \chemnum_omega: } + { 1 } { \exp_not:o \__chemnum_alpha: } + { 2 } { \exp_not:o \__chemnum_beta: } + { 3 } { \exp_not:o \__chemnum_gamma: } + { 4 } { \exp_not:o \__chemnum_delta: } + { 5 } { \exp_not:o \__chemnum_epsilon: } + { 6 } { \exp_not:o \__chemnum_zeta: } + { 7 } { \exp_not:o \__chemnum_eta: } + { 8 } { \exp_not:o \__chemnum_theta: } + { 9 } { \exp_not:o \__chemnum_iota: } + { 10 } { \exp_not:o \__chemnum_kappa: } + { 11 } { \exp_not:o \__chemnum_lambda: } + { 12 } { \exp_not:o \__chemnum_mu: } + { 13 } { \exp_not:o \__chemnum_nu: } + { 14 } { \exp_not:o \__chemnum_xi: } + { 15 } { \exp_not:o \__chemnum_omikron: } + { 16 } { \exp_not:o \__chemnum_pi: } + { 17 } { \exp_not:o \__chemnum_rho: } + { 18 } { \exp_not:o \__chemnum_sigma: } + { 19 } { \exp_not:o \__chemnum_tau: } + { 20 } { \exp_not:o \__chemnum_upsilon: } + { 21 } { \exp_not:o \__chemnum_phi: } + { 22 } { \exp_not:o \__chemnum_chi: } + { 23 } { \exp_not:o \__chemnum_psi: } + { 24 } { \exp_not:o \__chemnum_omega: } } } % } @@ -440,36 +440,36 @@ % define \int_to_Greek function \cs_new:Npn \int_to_Greek:n { } -\bool_if:NTF \l_chemnum_textgreek_bool +\bool_if:NTF \l__chemnum_textgreek_bool { \cs_set:Npn \int_to_Greek:n #1 { \int_to_symbols:nnn { #1 } { 24 } { - { 1 } { \exp_not:o \chemnum_Alpha: } - { 2 } { \exp_not:o \chemnum_Beta: } - { 3 } { \exp_not:o \chemnum_Gamma: } - { 4 } { \exp_not:o \chemnum_Delta: } - { 5 } { \exp_not:o \chemnum_Epsilon: } - { 6 } { \exp_not:o \chemnum_Zeta: } - { 7 } { \exp_not:o \chemnum_Eta: } - { 8 } { \exp_not:o \chemnum_Theta: } - { 9 } { \exp_not:o \chemnum_Iota: } - { 10 } { \exp_not:o \chemnum_Kappa: } - { 11 } { \exp_not:o \chemnum_Lambda: } - { 12 } { \exp_not:o \chemnum_Mu: } - { 13 } { \exp_not:o \chemnum_Nu: } - { 14 } { \exp_not:o \chemnum_Xi: } - { 15 } { \exp_not:o \chemnum_Omikron: } - { 16 } { \exp_not:o \chemnum_Pi: } - { 17 } { \exp_not:o \chemnum_Rho: } - { 18 } { \exp_not:o \chemnum_Sigma: } - { 19 } { \exp_not:o \chemnum_Tau: } - { 20 } { \exp_not:o \chemnum_Upsilon: } - { 21 } { \exp_not:o \chemnum_Phi: } - { 22 } { \exp_not:o \chemnum_Chi: } - { 23 } { \exp_not:o \chemnum_Psi: } - { 24 } { \exp_not:o \chemnum_Omega: } + { 1 } { \exp_not:o \__chemnum_Alpha: } + { 2 } { \exp_not:o \__chemnum_Beta: } + { 3 } { \exp_not:o \__chemnum_Gamma: } + { 4 } { \exp_not:o \__chemnum_Delta: } + { 5 } { \exp_not:o \__chemnum_Epsilon: } + { 6 } { \exp_not:o \__chemnum_Zeta: } + { 7 } { \exp_not:o \__chemnum_Eta: } + { 8 } { \exp_not:o \__chemnum_Theta: } + { 9 } { \exp_not:o \__chemnum_Iota: } + { 10 } { \exp_not:o \__chemnum_Kappa: } + { 11 } { \exp_not:o \__chemnum_Lambda: } + { 12 } { \exp_not:o \__chemnum_Mu: } + { 13 } { \exp_not:o \__chemnum_Nu: } + { 14 } { \exp_not:o \__chemnum_Xi: } + { 15 } { \exp_not:o \__chemnum_Omikron: } + { 16 } { \exp_not:o \__chemnum_Pi: } + { 17 } { \exp_not:o \__chemnum_Rho: } + { 18 } { \exp_not:o \__chemnum_Sigma: } + { 19 } { \exp_not:o \__chemnum_Tau: } + { 20 } { \exp_not:o \__chemnum_Upsilon: } + { 21 } { \exp_not:o \__chemnum_Phi: } + { 22 } { \exp_not:o \__chemnum_Chi: } + { 23 } { \exp_not:o \__chemnum_Psi: } + { 24 } { \exp_not:o \__chemnum_Omega: } } } } @@ -496,111 +496,103 @@ %-----------------------------------------------------------------------------% % lists of sublabels -\clist_new:N \l_chemnum_sublabel_clist -\tl_new:N \l_chemnum_sublabel_list_sep_tl -\tl_set:Nn \l_chemnum_sublabel_list_sep_tl { , } -\tl_new:N \l_chemnum_cmpd_sublabel_list_tl -\int_new:N \l_chemnum_sublabel_list_current_int -\int_new:N \l_chemnum_sublabel_list_length_int -\bool_new:N \l_chemnum_sublabel_list_bool - -\cs_new_nopar:Npn \chemnum_cmpd_sublabel_list:nn #1#2 +\clist_new:N \l__chemnum_sublabel_clist +\tl_new:N \l__chemnum_sublabel_list_sep_tl +\tl_set:Nn \l__chemnum_sublabel_list_sep_tl { , } +\tl_new:N \l__chemnum_cmpd_sublabel_list_tl +\int_new:N \l__chemnum_sublabel_list_current_int +\int_new:N \l__chemnum_sublabel_list_length_int +\bool_new:N \l__chemnum_sublabel_list_bool + +\cs_new_nopar:Npn \__chemnum_cmpd_sublabel_list:nn #1#2 { - \clist_clear:N \l_chemnum_sublabel_clist - \clist_set_eq:NN \l_chemnum_sublabel_clist #2 - \int_set:Nn \l_chemnum_sublabel_list_length_int - { \clist_length:N \l_chemnum_sublabel_clist } - \clist_map_variable:NNn \l_chemnum_sublabel_clist \l_chemnum_tmpb_tl + \clist_clear:N \l__chemnum_sublabel_clist + \clist_set_eq:NN \l__chemnum_sublabel_clist #2 + \int_set:Nn \l__chemnum_sublabel_list_length_int + { \clist_length:N \l__chemnum_sublabel_clist } + \clist_map_variable:NNn \l__chemnum_sublabel_clist \l__chemnum_tmpb_tl { - \int_incr:N \l_chemnum_sublabel_list_current_int - \exp_after:wN \chemnum_cmpd_sublabelsep:n \l_chemnum_tmpb_tl \q_stop - \use:c { chemnum_cmpd_#1_ \l_chemnum_cmpd_sub_one_label_tl _ref: } - \exp_args:No \tl_if_blank:nF { \l_chemnum_cmpd_sub_two_label_tl } + \int_incr:N \l__chemnum_sublabel_list_current_int + \exp_after:wN \__chemnum_cmpd_sublabelsep:n \l__chemnum_tmpb_tl \q_stop + \use:c { chemnum_cmpd_#1_ \l__chemnum_cmpd_sub_one_label_tl _ref: } + \exp_args:No \tl_if_blank:nF { \l__chemnum_cmpd_sub_two_label_tl } { - \tl_use:N \l_chemnum_sub_range_sep_tl - \use:c { chemnum_cmpd_#1_ \l_chemnum_cmpd_sub_two_label_tl _ref: } + \tl_use:N \l__chemnum_sub_range_sep_tl + \use:c { chemnum_cmpd_#1_ \l__chemnum_cmpd_sub_two_label_tl _ref: } } \int_compare:nT { - \l_chemnum_sublabel_list_current_int + \l__chemnum_sublabel_list_current_int < - \l_chemnum_sublabel_list_length_int + \l__chemnum_sublabel_list_length_int } - { \tl_use:N \l_chemnum_sublabel_list_sep_tl } + { \tl_use:N \l__chemnum_sublabel_list_sep_tl } } } %-----------------------------------------------------------------------------% % variables -\tl_new:N \l_chemnum_cmpd_name_tl - -\bool_new:N \l_chemnum_cmpd_name_bool -\bool_set_false:N \l_chemnum_cmpd_name_bool - -\bool_new:N \l_chemnum_cmpd_all_bool -\bool_set_false:N \l_chemnum_cmpd_all_bool - -\bool_new:N \l_chemnum_cmpd_range_bool -\bool_set_false:N \l_chemnum_cmpd_range_bool - -\tl_new:N \l_chemnum_cmpd_labelsep_tl -\tl_set:Nn \l_chemnum_cmpd_labelsep_tl { . } - -\tl_new:N \l_chemnum_sublist_input_separator_tl -\tl_set:Nn \l_chemnum_sublist_input_separator_tl { , } - -\tl_new:N \l_chemnum_sublist_output_separator_tl -\tl_set:Nn \l_chemnum_sublist_output_separator_tl { , } - -\tl_new:N \l_chemnum_sublabel_range_marker_tl -\tl_set:Nn \l_chemnum_sublabel_range_marker_tl { .. } - -\tl_new:N \l_chemnum_sub_range_sep_tl -\tl_set:Nn \l_chemnum_sub_range_sep_tl { -- } - -\bool_new:N \l_chemnum_sub_label_only_bool -\bool_set_false:N \l_chemnum_sub_label_only_bool +\bool_new:N \l__chemnum_cmpd_name_bool +\bool_set_false:N \l__chemnum_cmpd_name_bool +\bool_new:N \l__chemnum_cmpd_all_bool +\bool_set_false:N \l__chemnum_cmpd_all_bool +\bool_new:N \l__chemnum_cmpd_range_bool +\bool_set_false:N \l__chemnum_cmpd_range_bool +\bool_new:N \l__chemnum_sub_label_only_bool +\bool_set_false:N \l__chemnum_sub_label_only_bool + +\tl_new:N \l__chemnum_cmpd_name_tl +\tl_new:N \l__chemnum_cmpd_labelsep_tl +\tl_set:Nn \l__chemnum_cmpd_labelsep_tl { . } +\tl_new:N \l__chemnum_sublist_input_separator_tl +\tl_set:Nn \l__chemnum_sublist_input_separator_tl { , } +\tl_new:N \l__chemnum_sublist_output_separator_tl +\tl_set:Nn \l__chemnum_sublist_output_separator_tl { , } +\tl_new:N \l__chemnum_sublabel_range_marker_tl +\tl_set:Nn \l__chemnum_sublabel_range_marker_tl { .. } +\tl_new:N \l__chemnum_sub_range_sep_tl +\tl_set:Nn \l__chemnum_sub_range_sep_tl { -- } %-----------------------------------------------------------------------------% % hyperref support -\tl_new:N \l_chemnum_cmpd_hyper_name_tl +\tl_new:N \l__chemnum_cmpd_hyper_name_tl -\bool_new:N \l_chemnum_use_hyperref_bool -\bool_new:N \l_chemnum_hypertarget_bool -\bool_new:N \l_chemnum_hyperlink_bool +\bool_new:N \l__chemnum_use_hyperref_bool +\bool_new:N \l__chemnum_hypertarget_bool +\bool_new:N \l__chemnum_hyperlink_bool -\cs_new_eq:NN \chemnum_make_hyper:nn \use_ii:nn +\cs_new_eq:NN \__chemnum_make_hyper:nn \use_ii:nn % #1: main label, #2: sub labels, #3: invisible -\cs_new_nopar:Npn \chemnum_hyperref:nnn #1#2#3 +\cs_new_nopar:Npn \__chemnum_hyperref:nnn #1#2#3 { - \bool_if:nF { #3 || !\l_chemnum_use_hyperref_bool } + \bool_if:nF { #3 || !\l__chemnum_use_hyperref_bool } { - \bool_if:NT \l_chemnum_hypertarget_bool + \bool_if:NT \l__chemnum_hypertarget_bool { - \cs_set_nopar:Npn \chemnum_make_hyper:nn ##1##2 + \cs_set_nopar:Npn \__chemnum_make_hyper:nn ##1##2 { \raisebox { 3ex } [ 0pt ] { \hypertarget { ##1 } { } } ##2 } } - \bool_if:NT \l_chemnum_hyperlink_bool - { \cs_set_eq:NN \chemnum_make_hyper:nn \hyperlink } + \bool_if:NT \l__chemnum_hyperlink_bool + { \cs_set_eq:NN \__chemnum_make_hyper:nn \hyperlink } \bool_if:nT - { !\l_chemnum_hypertarget_bool && !\l_chemnum_hyperlink_bool } + { !\l__chemnum_hypertarget_bool && !\l__chemnum_hyperlink_bool } { \tl_if_blank:nTF { #2 } { % no sublabel - \tl_set:Nn \l_chemnum_cmpd_hyper_name_tl + \tl_set:Nn \l__chemnum_cmpd_hyper_name_tl { chemnum_cmpd_#1 } \cs_if_exist:cTF { chemnum_cmpd_#1_hyper: } { - \bool_set_false:N \l_chemnum_hypertarget_bool - \cs_set_eq:NN \chemnum_make_hyper:nn \hyperlink + \bool_set_false:N \l__chemnum_hypertarget_bool + \cs_set_eq:NN \__chemnum_make_hyper:nn \hyperlink } { - \bool_set_true:N \l_chemnum_hypertarget_bool - \cs_set_nopar:Npn \chemnum_make_hyper:nn ##1##2 + \bool_set_true:N \l__chemnum_hypertarget_bool + \cs_set_nopar:Npn \__chemnum_make_hyper:nn ##1##2 { \raisebox { 3ex } [ 0pt ] { \hypertarget { ##1 } { } } ##2 @@ -609,23 +601,23 @@ } } { - \chemnum_cmpd_sublist:n { #2 } - \int_compare:nT { \l_chemnum_cmpd_sublist_length_int < 2 } + \__chemnum_cmpd_sublist:n { #2 } + \int_compare:nT { \l__chemnum_cmpd_sublist_length_int < 2 } { % no sublabel list - \chemnum_cmpd_subrange_separate:n { #2 } + \__chemnum_cmpd_subrange_separate:n { #2 } \tl_if_blank:VT \l_tmpb_tl { % no sublabel range - \tl_set:Nn \l_chemnum_cmpd_hyper_name_tl + \tl_set:Nn \l__chemnum_cmpd_hyper_name_tl { chemnum_cmpd_#1_\l_tmpa_tl } \cs_if_exist:cTF { chemnum_cmpd_#1_ \l_tmpa_tl _hyper: } { - \bool_set_false:N \l_chemnum_hypertarget_bool - \cs_set_eq:NN \chemnum_make_hyper:nn \hyperlink + \bool_set_false:N \l__chemnum_hypertarget_bool + \cs_set_eq:NN \__chemnum_make_hyper:nn \hyperlink } { - \bool_set_true:N \l_chemnum_hypertarget_bool - \cs_set_nopar:Npn \chemnum_make_hyper:nn ##1##2 + \bool_set_true:N \l__chemnum_hypertarget_bool + \cs_set_nopar:Npn \__chemnum_make_hyper:nn ##1##2 { \raisebox { 3ex } [ 0pt ] { \hypertarget { ##1 } { } } ##2 @@ -643,128 +635,121 @@ %-----------------------------------------------------------------------------% % property keys for compounds \keys_define:nn { chemnum } { - cmpd-style .code:n = \chemnum_cmpd_set_style:n { #1 } , + cmpd-style .code:n = \__chemnum_cmpd_set_style:n { #1 } , cmpd-weight .choice: , cmpd-weight / bold .code:n = - \bool_set_true:N \l_chemnum_cmpd_bold_bool , + \bool_set_true:N \l__chemnum_cmpd_bold_bool , cmpd-weight / normal .code:n = - \bool_set_false:N \l_chemnum_cmpd_bold_bool , + \bool_set_false:N \l__chemnum_cmpd_bold_bool , cmpd-label .code:n = { - \bool_set_true:N \l_chemnum_cmpd_name_bool - \tl_set:Nn \l_chemnum_cmpd_name_tl { #1 } + \bool_set_true:N \l__chemnum_cmpd_name_bool + \tl_set:Nn \l__chemnum_cmpd_name_tl { #1 } } , - cmpd-prefix .tl_set:N = \l_chemnum_cmpd_prefix_tl , + cmpd-prefix .tl_set:N = \l__chemnum_cmpd_prefix_tl , cmpd-prefix .default:n = { } , - cmpd-suffix .tl_set:N = \l_chemnum_cmpd_suffix_tl , + cmpd-suffix .tl_set:N = \l__chemnum_cmpd_suffix_tl , cmpd-suffix .default:n = { } , - cmpd-space .tl_set:N = \l_chemnum_cmpd_space_tl , + cmpd-space .tl_set:N = \l__chemnum_cmpd_space_tl , cmpd-space .default:n = { \penalty\@m\ }, - cmpd-delim .code:n = \chemnum_cmpd_delim:n { #1 }, + cmpd-delim .code:n = \__chemnum_cmpd_delim:n { #1 }, cmpd-delim .default:n = { ( } { ) } , - cmpd-odelim .tl_set:N = \l_chemnum_cmpd_odelim_tl , + cmpd-odelim .tl_set:N = \l__chemnum_cmpd_odelim_tl , cmpd-odelim .default:n = { } , - cmpd-cdelim .tl_set:N = \l_chemnum_cmpd_cdelim_tl , + cmpd-cdelim .tl_set:N = \l__chemnum_cmpd_cdelim_tl , cmpd-cdelim .default:n = { } , - cmpd-all .bool_set:N = \l_chemnum_cmpd_all_bool , + cmpd-all .bool_set:N = \l__chemnum_cmpd_all_bool , cmpd-all .default:n = true , cmpd-counter .choice: , cmpd-counter .choice_code:n = - \tl_set_eq:NN \l_chemnum_cmpd_kind_value_tl \l_keys_choice_tl , + \tl_set_eq:NN \l__chemnum_cmpd_kind_value_tl \l_keys_choice_tl , cmpd-counter .generate_choices:n = { arabic , alph , Alph , greek, Greek , roman , Roman , Symbol } , cmpd-counter .default:n = arabic , hyper-use .choice: , hyper-use / true .code:n = { - \bool_set_true:N \l_chemnum_use_hyperref_bool - \bool_set_false:N \l_chemnum_hypertarget_bool - \bool_set_false:N \l_chemnum_hyperlink_bool + \bool_set_true:N \l__chemnum_use_hyperref_bool + \bool_set_false:N \l__chemnum_hypertarget_bool + \bool_set_false:N \l__chemnum_hyperlink_bool } , hyper-use / false .code:n = { - \bool_set_false:N \l_chemnum_use_hyperref_bool - \bool_set_false:N \l_chemnum_hypertarget_bool - \bool_set_false:N \l_chemnum_hyperlink_bool + \bool_set_false:N \l__chemnum_use_hyperref_bool + \bool_set_false:N \l__chemnum_hypertarget_bool + \bool_set_false:N \l__chemnum_hyperlink_bool } , hyper-use .default:n = true , hyper-target .code:n = { - \tl_set:Nn \l_chemnum_cmpd_hyper_name_tl { #1 } - \bool_set_true:N \l_chemnum_use_hyperref_bool - \bool_set_true:N \l_chemnum_hypertarget_bool - \bool_set_false:N \l_chemnum_hyperlink_bool + \tl_set:Nn \l__chemnum_cmpd_hyper_name_tl { #1 } + \bool_set_true:N \l__chemnum_use_hyperref_bool + \bool_set_true:N \l__chemnum_hypertarget_bool + \bool_set_false:N \l__chemnum_hyperlink_bool } , hyper-link .code:n = { - \tl_set:Nn \l_chemnum_cmpd_hyper_name_tl { #1 } - \bool_set_true:N \l_chemnum_use_hyperref_bool - \bool_set_false:N \l_chemnum_hypertarget_bool - \bool_set_true:N \l_chemnum_hyperlink_bool + \tl_set:Nn \l__chemnum_cmpd_hyper_name_tl { #1 } + \bool_set_true:N \l__chemnum_use_hyperref_bool + \bool_set_false:N \l__chemnum_hypertarget_bool + \bool_set_true:N \l__chemnum_hyperlink_bool } , sub-counter .choice: , sub-counter .choice_code:n = - \tl_set_eq:NN \l_chemnum_cmpd_sub_kind_value_tl \l_keys_choice_tl , + \tl_set_eq:NN \l__chemnum_cmpd_sub_kind_value_tl \l_keys_choice_tl , sub-counter .generate_choices:n = { arabic , alph , Alph , greek , Greek , roman , Roman , Symbol } , sub-counter .default:n = alph , - sub-input-sep .code:n = \chemnum_subcmpdsep:n { #1 } , + sub-input-sep .code:n = \__chemnum_subcmpdsep:n { #1 } , sub-input-sep .default:n = . , - sub-output-sep .tl_set:N = \l_chemnum_cmpd_separator_tl , + sub-output-sep .tl_set:N = \l__chemnum_cmpd_separator_tl , sub-output-sep .default:n = { } , sublist-input-sep .tl_set:N = - \l_chemnum_sublist_input_separator_tl , + \l__chemnum_sublist_input_separator_tl , sublist-input-sep .default:n = { , } , sublist-output-sep .tl_set:N = - \l_chemnum_sublist_output_separator_tl , + \l__chemnum_sublist_output_separator_tl , sublist-output-sep .default:n = { , } , - sub-only .bool_set:N = \l_chemnum_sub_label_only_bool , + sub-only .bool_set:N = \l__chemnum_sub_label_only_bool , sub-only .default:n = true , - subrange-output-sep .tl_set:N = \l_chemnum_sub_range_sep_tl , + subrange-output-sep .tl_set:N = \l__chemnum_sub_range_sep_tl , subrange-output-sep .default:n = { -- } , subrange-input-sep .code:n = - \chemnum_sublabel_range_marker:n { #1 } , + \__chemnum_sublabel_range_marker:n { #1 } , subrange-input-sep .default:n = { .. } } %-----------------------------------------------------------------------------% % list separators, delimiters, prefix and suffix -\bool_new:N \l_chemnum_no_serial_comma_bool -\bool_set_false:N \l_chemnum_no_serial_comma_bool - -\tl_new:N \l_chemnum_list_input_separator_tl -\tl_set:Nn \l_chemnum_list_input_separator_tl { , } - -\tl_new:N \l_chemnum_list_separator_tl -\tl_set:Nn \l_chemnum_list_separator_tl { , } - -\tl_new:N \l_chemunm_list_space_tl -\tl_set:Nn \l_chemnum_list_space_tl { \penalty\@m\ } - -\tl_new:N \l_chemnum_list_last_separator_lang_tl -\tl_set:Nn \l_chemnum_list_last_separator_lang_tl { and } - -\tl_new:N \l_chemnum_list_last_separator_tl -\tl_set:Nn \l_chemnum_list_last_separator_tl - { \tl_use:N \l_chemnum_list_last_separator_lang_tl } - -\tl_new:N \l_chemnum_list_prefix_tl { } -\tl_set:Nn \l_chemnum_list_prefix_tl { } - -\tl_new:N \l_chemnum_list_suffix_tl { } -\tl_set:Nn \l_chemnum_list_suffix_tl { } - -\tl_new:N \l_chemnum_list_odelim_tl { } -\tl_new:N \l_chemnum_list_cdelim_tl { } - -\cs_new_nopar:Npn \chemnum_list_delim:n #1 { +\bool_new:N \l__chemnum_no_serial_comma_bool +\bool_set_false:N \l__chemnum_no_serial_comma_bool + +\tl_new:N \l__chemnum_list_input_separator_tl +\tl_set:Nn \l__chemnum_list_input_separator_tl { , } +\tl_new:N \l__chemnum_list_separator_tl +\tl_set:Nn \l__chemnum_list_separator_tl { , } +\tl_new:N \l__chemnum_list_space_tl +\tl_set:Nn \l__chemnum_list_space_tl { \penalty\@m\ } +\tl_new:N \l__chemnum_list_last_separator_lang_tl +\tl_set:Nn \l__chemnum_list_last_separator_lang_tl { and } +\tl_new:N \l__chemnum_list_last_separator_tl +\tl_set:Nn \l__chemnum_list_last_separator_tl + { \tl_use:N \l__chemnum_list_last_separator_lang_tl } +\tl_new:N \l__chemnum_list_prefix_tl { } +\tl_set:Nn \l__chemnum_list_prefix_tl { } +\tl_new:N \l__chemnum_list_suffix_tl { } +\tl_set:Nn \l__chemnum_list_suffix_tl { } +\tl_new:N \l__chemnum_list_odelim_tl { } +\tl_new:N \l__chemnum_list_cdelim_tl { } + +\cs_new_nopar:Npn \__chemnum_list_delim:n #1 { \tl_if_blank:nTF { #1 } { - \tl_clear:N \l_chemnum_list_odelim_tl - \tl_clear:N \l_chemnum_list_cdelim_tl + \tl_clear:N \l__chemnum_list_odelim_tl + \tl_clear:N \l__chemnum_list_cdelim_tl }{ \int_compare:nNnTF { \tl_length:n { #1 } } = 2 { - \tl_set:Nx \l_chemnum_list_odelim_tl { \tl_head:n { #1 } } - \tl_set:Nx \l_chemnum_list_cdelim_tl { \tl_tail:n { #1 } } + \tl_set:Nx \l__chemnum_list_odelim_tl { \tl_head:n { #1 } } + \tl_set:Nx \l__chemnum_list_cdelim_tl { \tl_tail:n { #1 } } }{ \msg_error:nnx { chemnum } { delimiters } { list } } } } @@ -772,102 +757,102 @@ %-----------------------------------------------------------------------------% % property keys for lists \keys_define:nn { chemnum } { - list-prefix .tl_set:N = \l_chemnum_list_prefix_tl , + list-prefix .tl_set:N = \l__chemnum_list_prefix_tl , list-prefix .default:n = { } , - list-suffix .tl_set:N = \l_chemnum_list_suffix_tl , + list-suffix .tl_set:N = \l__chemnum_list_suffix_tl , list-suffix .default:n = { } , - list-delim .code:n = \chemnum_list_delim:n { #1 } , + list-delim .code:n = \__chemnum_list_delim:n { #1 } , list-delim .default:n = { ( } { ) } , - list-odelim .tl_set:N = \l_chemnum_list_odelim_tl , + list-odelim .tl_set:N = \l__chemnum_list_odelim_tl , list-odelim .default:n = { } , - list-cdelim .tl_set:N = \l_chemnum_list_cdelim_tl , + list-cdelim .tl_set:N = \l__chemnum_list_cdelim_tl , list-cdelim .default:n = { } , - list-space .tl_set:N = \l_chemnum_list_space_tl , + list-space .tl_set:N = \l__chemnum_list_space_tl , list-space .default:n = { \penalty\@m\ } , - list-input-sep .tl_set:N = \l_chemnum_list_input_separator_tl , + list-input-sep .tl_set:N = \l__chemnum_list_input_separator_tl , list-input-sep .default:n = { , } , - list-output-sep .tl_set:N = \l_chemnum_list_separator_tl , + list-output-sep .tl_set:N = \l__chemnum_list_separator_tl , list-output-sep .default:n = { , } , - list-last-sep .tl_set:N = \l_chemnum_list_last_separator_tl , - list-last-sep .default:n = \l_chemnum_list_last_separator_lang_tl , + list-last-sep .tl_set:N = \l__chemnum_list_last_separator_tl , + list-last-sep .default:n = \l__chemnum_list_last_separator_lang_tl , list-serial-comma .choice: , list-serial-comma / true .code:n = - \bool_set_false:N \l_chemnum_no_serial_comma_bool , + \bool_set_false:N \l__chemnum_no_serial_comma_bool , list-serial-comma / false .code:n = - \bool_set_true:N \l_chemnum_no_serial_comma_bool , + \bool_set_true:N \l__chemnum_no_serial_comma_bool , list-serial-comma .default:n = true , list-lang .choice: , list-lang / US .code:n = { - \bool_set_false:N \l_chemnum_no_serial_comma_bool - \tl_set:Nn \l_chemnum_list_last_separator_lang_tl { and } + \bool_set_false:N \l__chemnum_no_serial_comma_bool + \tl_set:Nn \l__chemnum_list_last_separator_lang_tl { and } } , list-lang / GB .code:n = { - \bool_set_true:N \l_chemnum_no_serial_comma_bool - \tl_set:Nn \l_chemnum_list_last_separator_lang_tl { and } + \bool_set_true:N \l__chemnum_no_serial_comma_bool + \tl_set:Nn \l__chemnum_list_last_separator_lang_tl { and } } , list-lang / DE .code:n = { - \bool_set_true:N \l_chemnum_no_serial_comma_bool - \tl_set:Nn \l_chemnum_list_last_separator_lang_tl { und } + \bool_set_true:N \l__chemnum_no_serial_comma_bool + \tl_set:Nn \l__chemnum_list_last_separator_lang_tl { und } } , list-lang / FR .code:n = { - \bool_set_true:N \l_chemnum_no_serial_comma_bool - \tl_set:Nn \l_chemnum_list_last_separator_lang_tl { et } + \bool_set_true:N \l__chemnum_no_serial_comma_bool + \tl_set:Nn \l__chemnum_list_last_separator_lang_tl { et } } , list-lang / IT .code:n = { - \bool_set_true:N \l_chemnum_no_serial_comma_bool - \tl_set:Nn \l_chemnum_list_last_separator_lang_tl { e } + \bool_set_true:N \l__chemnum_no_serial_comma_bool + \tl_set:Nn \l__chemnum_list_last_separator_lang_tl { e } } , list-lang / ES .code:n = { - \bool_set_true:N \l_chemnum_no_serial_comma_bool - \tl_set:Nn \l_chemnum_list_last_separator_lang_tl { y } + \bool_set_true:N \l__chemnum_no_serial_comma_bool + \tl_set:Nn \l__chemnum_list_last_separator_lang_tl { y } } , list-lang .default:n = US } %-----------------------------------------------------------------------------% % label and sublabel declaration -\cs_new:Npn \chemnum_cmpd_declare:n #1 +\cs_new:Npn \__chemnum_cmpd_declare:n #1 { \cs_if_exist:cF { chemnum_cmpd_#1: } { - \int_gincr:N \g_chemnum_cmpd_main_int - \prop_gput:Nnx \g_chemnum_label_prop + \int_gincr:N \g__chemnum_cmpd_main_int + \prop_gput:Nnx \g__chemnum_label_prop { #1 } - { \int_use:N \g_chemnum_cmpd_main_int } - \chemnum_cmpd_save:n { #1 } - \bool_if:NF \l_chemnum_cmpd_name_bool - { \int_gincr:N \g_chemnum_cmpd_int } + { \int_use:N \g__chemnum_cmpd_main_int } + \__chemnum_cmpd_save:n { #1 } + \bool_if:NF \l__chemnum_cmpd_name_bool + { \int_gincr:N \g__chemnum_cmpd_int } \cs_new_nopar:cpx { chemnum_cmpd_#1: } { - \bool_if:NTF \l_chemnum_cmpd_name_bool - { \l_chemnum_cmpd_name_tl } + \bool_if:NTF \l__chemnum_cmpd_name_bool + { \l__chemnum_cmpd_name_tl } { - \chemnum_cmpd_kind:nn - \l_chemnum_cmpd_kind_value_tl - \g_chemnum_cmpd_int + \__chemnum_cmpd_kind:nn + \l__chemnum_cmpd_kind_value_tl + \g__chemnum_cmpd_int } } } } -\cs_new:Npn \chemnum_cmpd_sub_declare:nn #1#2 +\cs_new:Npn \__chemnum_cmpd_sub_declare:nn #1#2 { \cs_if_exist:cF { chemnum_cmpd_#1_#2: } { - \chemnum_cmpd_save:n { #1 _ #2 } + \__chemnum_cmpd_save:n { #1 _ #2 } \cs_new_nopar:cpx { chemnum_cmpd_#1_#2: } { } \int_gincr:c { g_chemnum_cmpd_#1_int } % why is the next line working when \cs_gset_nopar:cpx doesn't? % (in case ":" is part of #1) \exp_after:wN \cs_gset_nopar:Npx \cs:w chemnum_cmpd_#1_#2: \cs_end: { - \chemnum_cmpd_sub_kind:Nc - \l_chemnum_cmpd_sub_kind_value_tl + \__chemnum_cmpd_sub_kind:Nc + \l__chemnum_cmpd_sub_kind_value_tl { g_chemnum_cmpd_#1_int } } \int_compare:nT { \int_use:c { g_chemnum_cmpd_#1_int } = 1 } @@ -877,47 +862,47 @@ \cs_gset_eq:cc { chemnum_cmpd_#1_max: } { chemnum_cmpd_#1_#2: } } } -\cs_generate_variant:Nn \chemnum_cmpd_sub_declare:nn { no } +\cs_generate_variant:Nn \__chemnum_cmpd_sub_declare:nn { no } -\cs_new_nopar:Npn \chemnum_cmpd_sub_initiate:nn #1#2 +\cs_new_nopar:Npn \__chemnum_cmpd_sub_initiate:nn #1#2 { \cs_if_exist:cF { chemnum_cmpd_ #1 _ #2 _init: } { - \bool_if:NTF \l_chemnum_cmpd_init_strict_bool + \bool_if:NTF \l__chemnum_cmpd_init_strict_bool { \msg_error:nnx { chemnum } { cmpd-init-sub } - { #1 \l_chemnum_cmpd_labelsep_tl #2 } + { #1 \l__chemnum_cmpd_labelsep_tl #2 } } { \msg_warning:nnx { chemnum } { cmpd-init-sub } - { #1 \l_chemnum_cmpd_labelsep_tl #2 } + { #1 \l__chemnum_cmpd_labelsep_tl #2 } } } } %-----------------------------------------------------------------------------% % label and sublabel initiation -\cs_new:Npn \chemnum_cmpd_initiate:nn #1#2 +\cs_new:Npn \__chemnum_cmpd_initiate:nn #1#2 { \cs_if_exist:cTF { chemnum_cmpd_#1_init: } { - \bool_if:NT \l_chemnum_cmpd_sub_init_bool + \bool_if:NT \l__chemnum_cmpd_sub_init_bool { \tl_if_blank:nF { #2 } { - \chemnum_cmpd_sublist:n { #2 } - \exp_args:No \tl_map_inline:nn { \l_chemnum_cmpd_sublist_tl } + \__chemnum_cmpd_sublist:n { #2 } + \exp_args:No \tl_map_inline:nn { \l__chemnum_cmpd_sublist_tl } { - \chemnum_cmpd_subrange_separate:n { ##1 } - \chemnum_cmpd_sub_initiate:nn { #1 } { \l_tmpa_tl } + \__chemnum_cmpd_subrange_separate:n { ##1 } + \__chemnum_cmpd_sub_initiate:nn { #1 } { \l_tmpa_tl } \tl_if_blank:VF \l_tmpb_tl - { \chemnum_cmpd_sub_initiate:nn { #1 } { \l_tmpb_tl } } + { \__chemnum_cmpd_sub_initiate:nn { #1 } { \l_tmpb_tl } } } } } } { - \bool_if:NTF \l_chemnum_cmpd_init_strict_bool + \bool_if:NTF \l__chemnum_cmpd_init_strict_bool { \msg_error:nnx { chemnum } { cmpd-init } { #1 } } { \msg_warning:nnx { chemnum } { cmpd-init } { #1 } } } @@ -940,79 +925,78 @@ %-----------------------------------------------------------------------------% % variables -\tl_new:N \l_chemnum_cmpd_main_label_tl -\tl_new:N \l_chemnum_cmpd_sub_label_tl - -\tl_new:N \l_chemnum_labelsep_tmp_tl +\tl_new:N \l__chemnum_cmpd_main_label_tl +\tl_new:N \l__chemnum_cmpd_sub_label_tl +\tl_new:N \l__chemnum_labelsep_tmp_tl % set sublabel-separator -\cs_new_nopar:Npn \chemnum_subcmpdsep:n #1 { +\cs_new_nopar:Npn \__chemnum_subcmpdsep:n #1 { \tl_if_blank:nTF { #1 } { \msg_error:nn { chemnum } { sub-label-separator } } - { \tl_set:Nn \l_chemnum_cmpd_labelsep_tl { #1 } } + { \tl_set:Nn \l__chemnum_cmpd_labelsep_tl { #1 } } } -\cs_new_nopar:Npn \chemnum_sublabel_range_marker:n #1 { +\cs_new_nopar:Npn \__chemnum_sublabel_range_marker:n #1 { \tl_if_blank:nTF { #1 } { \msg_error:nn { chemnum } { sub-label-range_sep } } - { \tl_set:Nn \l_chemnum_sublabel_range_marker_tl { #1 } } + { \tl_set:Nn \l__chemnum_sublabel_range_marker_tl { #1 } } } % actual separating -\cs_new_nopar:Npn \chemnum_cmpd_labelsep:n #1 \q_stop { - \tl_clear:N \l_chemnum_labelsep_tmp_tl - \exp_args:Noo \tl_if_in:nnTF { #1 } { \l_chemnum_cmpd_labelsep_tl } +\cs_new_nopar:Npn \__chemnum_cmpd_labelsep:n #1 \q_stop { + \tl_clear:N \l__chemnum_labelsep_tmp_tl + \exp_args:Noo \tl_if_in:nnTF { #1 } { \l__chemnum_cmpd_labelsep_tl } { - \tl_set:Nn \l_chemnum_labelsep_tmp_tl { #1 } - \exp_args:NNo \tl_replace_once:Nnn \l_chemnum_labelsep_tmp_tl - { \l_chemnum_cmpd_labelsep_tl } + \tl_set:Nn \l__chemnum_labelsep_tmp_tl { #1 } + \exp_args:NNo \tl_replace_once:Nnn \l__chemnum_labelsep_tmp_tl + { \l__chemnum_cmpd_labelsep_tl } { \q_nil } - \exp_after:wN \chemnum_cmpd_labelsep_aux_ii:n - \l_chemnum_labelsep_tmp_tl \q_stop + \exp_after:wN \__chemnum_cmpd_labelsep_aux_ii:n + \l__chemnum_labelsep_tmp_tl \q_stop } - { \chemnum_cmpd_labelsep_aux_i:n { #1 } } + { \__chemnum_cmpd_labelsep_aux_i:n { #1 } } } -\cs_new_nopar:Npn \chemnum_cmpd_labelsep_aux_i:n #1 +\cs_new_nopar:Npn \__chemnum_cmpd_labelsep_aux_i:n #1 { - \tl_set:Nn \l_chemnum_cmpd_main_label_tl { #1 } - \tl_clear:N \l_chemnum_cmpd_sub_label_tl + \tl_set:Nn \l__chemnum_cmpd_main_label_tl { #1 } + \tl_clear:N \l__chemnum_cmpd_sub_label_tl } -\cs_new_nopar:Npn \chemnum_cmpd_labelsep_aux_ii:n #1 \q_nil #2 \q_stop +\cs_new_nopar:Npn \__chemnum_cmpd_labelsep_aux_ii:n #1 \q_nil #2 \q_stop { - \tl_set:Nn \l_chemnum_cmpd_main_label_tl { #1 } - \tl_set:Nn \l_chemnum_cmpd_sub_label_tl { #2 } + \tl_set:Nn \l__chemnum_cmpd_main_label_tl { #1 } + \tl_set:Nn \l__chemnum_cmpd_sub_label_tl { #2 } } % sublabel separating to display a list and/or range -\tl_new:N \l_chemnum_cmpd_sublist_tl -\int_new:N \l_chemnum_cmpd_sublist_length_int +\tl_new:N \l__chemnum_cmpd_sublist_tl +\int_new:N \l__chemnum_cmpd_sublist_length_int -\NewDocumentCommand \chemnum_cmpd_sublist:n - { > { \exp_args:No \SplitList { \l_chemnum_sublist_input_separator_tl } } m } +\NewDocumentCommand \__chemnum_cmpd_sublist:n + { > { \exp_args:No \SplitList { \l__chemnum_sublist_input_separator_tl } } m } { - \tl_set:Nn \l_chemnum_cmpd_sublist_tl { #1 } - \int_zero:N \l_chemnum_cmpd_sublist_length_int - \exp_args:No \tl_map_inline:nn { \l_chemnum_cmpd_sublist_tl } - { \int_incr:N \l_chemnum_cmpd_sublist_length_int } + \tl_set:Nn \l__chemnum_cmpd_sublist_tl { #1 } + \int_zero:N \l__chemnum_cmpd_sublist_length_int + \exp_args:No \tl_map_inline:nn { \l__chemnum_cmpd_sublist_tl } + { \int_incr:N \l__chemnum_cmpd_sublist_length_int } } -\cs_new_nopar:Npn \chemnum_cmpd_subrange_separate:n #1 +\cs_new_nopar:Npn \__chemnum_cmpd_subrange_separate:n #1 { \tl_clear:N \l_tmpa_tl \tl_clear:N \l_tmpb_tl - \tl_if_in:noTF { #1 } { \l_chemnum_sublabel_range_marker_tl } + \tl_if_in:noTF { #1 } { \l__chemnum_sublabel_range_marker_tl } { \tl_set:Nn \l_tmpa_tl { #1 } \exp_args:NNo \tl_replace_once:Nnn \l_tmpa_tl - { \l_chemnum_sublabel_range_marker_tl } { \q_nil } - \exp_after:wN \chemnum_cmpd_subrange_separate_aux:n \l_tmpa_tl \q_stop + { \l__chemnum_sublabel_range_marker_tl } { \q_nil } + \exp_after:wN \__chemnum_cmpd_subrange_separate_aux:n \l_tmpa_tl \q_stop } { \tl_set:Nn \l_tmpa_tl { #1 } } } -\cs_new_nopar:Npn \chemnum_cmpd_subrange_separate_aux:n +\cs_new_nopar:Npn \__chemnum_cmpd_subrange_separate_aux:n #1 \q_nil #2 \q_stop { \tl_set:Nn \l_tmpa_tl { #1 } @@ -1021,20 +1005,20 @@ %-----------------------------------------------------------------------------% % print compound label -\cs_new_nopar:Npn \chemnum_cmpd_print:n #1 +\cs_new_nopar:Npn \__chemnum_cmpd_print:n #1 { - \tl_if_blank:VF \l_chemnum_cmpd_prefix_tl + \tl_if_blank:VF \l__chemnum_cmpd_prefix_tl { - \tl_use:N \l_chemnum_cmpd_prefix_tl - \tl_use:N \l_chemnum_cmpd_space_tl + \tl_use:N \l__chemnum_cmpd_prefix_tl + \tl_use:N \l__chemnum_cmpd_space_tl } - \tl_use:N \l_chemnum_cmpd_odelim_tl - \chemnum_cmpd_use_style:n { #1 } - \tl_use:N \l_chemnum_cmpd_cdelim_tl - \tl_if_blank:VF \l_chemnum_cmpd_suffix_tl + \tl_use:N \l__chemnum_cmpd_odelim_tl + \__chemnum_cmpd_use_style:n { #1 } + \tl_use:N \l__chemnum_cmpd_cdelim_tl + \tl_if_blank:VF \l__chemnum_cmpd_suffix_tl { - \tl_use:N \l_chemnum_cmpd_space_tl - \tl_use:N \l_chemnum_cmpd_suffix_tl + \tl_use:N \l__chemnum_cmpd_space_tl + \tl_use:N \l__chemnum_cmpd_suffix_tl } } @@ -1042,26 +1026,26 @@ % main internal compound label command % #1:
#2: #3: #4: % #2 may be a list of sublabels -\cs_new_nopar:Npn \chemnum_cmpd_aux_i:nnnn #1#2#3#4 +\cs_new_nopar:Npn \__chemnum_cmpd_aux_i:nnnn #1#2#3#4 { - \bool_if:NT \l_chemnum_cmpd_initiated_bool - { \chemnum_cmpd_initiate:nn { #1 } { #2 } } - \bool_if:NF \l_chemnum_cmpd_ref_bool - { \chemnum_cmpd_declare:n { #1 } } - \chemnum_hyperref:nnn { #1 } { #2 } { #3 } + \bool_if:NT \l__chemnum_cmpd_initiated_bool + { \__chemnum_cmpd_initiate:nn { #1 } { #2 } } + \bool_if:NF \l__chemnum_cmpd_ref_bool + { \__chemnum_cmpd_declare:n { #1 } } + \__chemnum_hyperref:nnn { #1 } { #2 } { #3 } \tl_if_blank:nF { #2 } { \cs_if_exist:cF { g_chemnum_cmpd_#1_int } { \int_new:c { g_chemnum_cmpd_#1_int } } - \chemnum_cmpd_sublist:n { #2 } - \bool_if:NF \l_chemnum_cmpd_ref_bool + \__chemnum_cmpd_sublist:n { #2 } + \bool_if:NF \l__chemnum_cmpd_ref_bool { - \exp_args:No \tl_map_inline:nn { \l_chemnum_cmpd_sublist_tl } + \exp_args:No \tl_map_inline:nn { \l__chemnum_cmpd_sublist_tl } { - \chemnum_cmpd_subrange_separate:n { ##1 } - \chemnum_cmpd_sub_declare:no { #1 } { \l_tmpa_tl } + \__chemnum_cmpd_subrange_separate:n { ##1 } + \__chemnum_cmpd_sub_declare:no { #1 } { \l_tmpa_tl } \tl_if_blank:VF \l_tmpb_tl - { \chemnum_cmpd_sub_declare:no { #1 } { \l_tmpb_tl } } + { \__chemnum_cmpd_sub_declare:no { #1 } { \l_tmpb_tl } } } } } @@ -1070,60 +1054,60 @@ { \bool_if:NT #4 { - \tl_clear:N \l_chemnum_cmpd_odelim_tl - \tl_clear:N \l_chemnum_cmpd_cdelim_tl + \tl_clear:N \l__chemnum_cmpd_odelim_tl + \tl_clear:N \l__chemnum_cmpd_cdelim_tl } - \chemnum_make_hyper:nn { \l_chemnum_cmpd_hyper_name_tl } + \__chemnum_make_hyper:nn { \l__chemnum_cmpd_hyper_name_tl } { - \chemnum_cmpd_print:n + \__chemnum_cmpd_print:n { - \bool_if:NF \l_chemnum_sub_label_only_bool + \bool_if:NF \l__chemnum_sub_label_only_bool { - \bool_if:NTF \l_chemnum_cmpd_ref_bool + \bool_if:NTF \l__chemnum_cmpd_ref_bool { \use:c { chemnum_cmpd_ #1 _ref: } } { \use:c { chemnum_cmpd_ #1 : } } } - \bool_if:NTF \l_chemnum_cmpd_all_bool + \bool_if:NTF \l__chemnum_cmpd_all_bool { - \tl_use:N \l_chemnum_cmpd_separator_tl + \tl_use:N \l__chemnum_cmpd_separator_tl \use:c { chemnum_cmpd_ #1 _min_ref: } \cs_if_eq:ccF { chemnum_cmpd_ #1 _min_ref: } { chemnum_cmpd_ #1 _max_ref: } { - \tl_use:N \l_chemnum_sub_range_sep_tl + \tl_use:N \l__chemnum_sub_range_sep_tl \use:c { chemnum_cmpd_ #1 _max_ref: } } } { - \bool_if:NTF \l_chemnum_sublabel_list_bool + \bool_if:NTF \l__chemnum_sublabel_list_bool { - \chemnum_cmpd_sublabel_list:nn { #1 } - { \l_chemnum_cmpd_sublabel_list_tl } + \__chemnum_cmpd_sublabel_list:nn { #1 } + { \l__chemnum_cmpd_sublabel_list_tl } } { \tl_if_blank:nF { #2 } { - \tl_use:N \l_chemnum_cmpd_separator_tl + \tl_use:N \l__chemnum_cmpd_separator_tl \int_zero:N \l_tmpa_int \exp_args:No \tl_map_inline:nn - { \l_chemnum_cmpd_sublist_tl } + { \l__chemnum_cmpd_sublist_tl } { \int_incr:N \l_tmpa_int - \chemnum_cmpd_subrange_separate:n { ##1 } - \bool_if:NTF \l_chemnum_cmpd_ref_bool + \__chemnum_cmpd_subrange_separate:n { ##1 } + \bool_if:NTF \l__chemnum_cmpd_ref_bool { \use:c { chemnum_cmpd_ #1 _ \l_tmpa_tl _ref: } } { \use:c { chemnum_cmpd_ #1 _ \l_tmpa_tl : } } \tl_if_blank:VF \l_tmpb_tl { - \tl_use:N \l_chemnum_sub_range_sep_tl - \bool_if:NTF \l_chemnum_cmpd_ref_bool + \tl_use:N \l__chemnum_sub_range_sep_tl + \bool_if:NTF \l__chemnum_cmpd_ref_bool { \use:c { chemnum_cmpd_ #1 _ \l_tmpb_tl _ref: } } { \use:c { chemnum_cmpd_ #1 _ \l_tmpb_tl : } } } \int_compare:nF - { \l_tmpa_int = \l_chemnum_cmpd_sublist_length_int } - { \l_chemnum_sublist_output_separator_tl } + { \l_tmpa_int = \l__chemnum_cmpd_sublist_length_int } + { \l__chemnum_sublist_output_separator_tl } } } } @@ -1132,37 +1116,37 @@ } } -\cs_generate_variant:Nn \chemnum_cmpd_aux_i:nnnn { oonn } +\cs_generate_variant:Nn \__chemnum_cmpd_aux_i:nnnn { oonn } %-----------------------------------------------------------------------------% % create compound label % #1: label name #2: star (invisible) #3: minus (no delimiters) -\cs_new_nopar:Npn \chemnum_cmpd:nnn #1#2#3 { +\cs_new_nopar:Npn \__chemnum_cmpd:nnn #1#2#3 { \group_begin: - \tl_clear:N \l_chemnum_cmpd_main_label_tl - \tl_clear:N \l_chemnum_cmpd_sub_label_tl - \chemnum_cmpd_labelsep:n #1 \q_stop - \tl_remove_all:Nn \l_chemnum_cmpd_sub_label_tl { ~ } - \chemnum_cmpd_aux_i:oonn - { \l_chemnum_cmpd_main_label_tl } - { \l_chemnum_cmpd_sub_label_tl } + \tl_clear:N \l__chemnum_cmpd_main_label_tl + \tl_clear:N \l__chemnum_cmpd_sub_label_tl + \__chemnum_cmpd_labelsep:n #1 \q_stop + \tl_remove_all:Nn \l__chemnum_cmpd_sub_label_tl { ~ } + \__chemnum_cmpd_aux_i:oonn + { \l__chemnum_cmpd_main_label_tl } + { \l__chemnum_cmpd_sub_label_tl } { #2 } { #3 } \group_end: } -\cs_generate_variant:Nn \chemnum_cmpd:nnn { onn } +\cs_generate_variant:Nn \__chemnum_cmpd:nnn { onn } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % DOCUMENT COMMANDS % variables: -\int_new:N \l_chemnum_list_items_int -\int_new:N \l_chemnum_list_separate_int +\int_new:N \l__chemnum_list_items_int +\int_new:N \l__chemnum_list_separate_int -\tl_new:N \l_chemnum_list_last_sep_empty_tl -\tl_set:Nn \l_chemnum_list_last_sep_empty_tl { empty } +\tl_new:N \l__chemnum_list_last_sep_empty_tl +\tl_set:Nn \l__chemnum_list_last_sep_empty_tl { empty } -\bool_new:N \l_chemnum_cmpd_ref_bool +\bool_new:N \l__chemnum_cmpd_ref_bool \msg_set:nnnn { chemnum } { fatal-combination } { @@ -1179,52 +1163,55 @@ % MAIN COMMAND % \cmpd*+-[]{<(possibly comma separated list of) compound % label(s)>} -\NewDocumentCommand \chemnum_input_separator:n - { > { \exp_args:No \SplitList { \l_chemnum_list_input_separator_tl } } m } +\NewDocumentCommand \__chemnum_input_separator:n + { > { \exp_args:No \SplitList { \l__chemnum_list_input_separator_tl } } m } { \tl_set:Nn \l_tmpa_tl { #1 } } -\NewDocumentCommand \cmpd_main_command:w { s t+ t- o m } +\NewDocumentCommand \cmpd { s t+ t- o m } + { \cmpd_main:nnnnn { #1 } { #2 } { #3 } { #4 } { #5 } } + +\cs_new:Npn \cmpd_main:nnnnn #1#2#3#4#5 { \IfBooleanT #2 { - \bool_set_true:N \l_chemnum_cmpd_ref_bool + \bool_set_true:N \l__chemnum_cmpd_ref_bool \IfBooleanT #1 { \msg_error:nnx { chemnum } { fatal-combination } { plus } } } - \tl_clear:N \l_chemnum_tmpa_tl + \tl_clear:N \l__chemnum_tmpa_tl \group_begin: - \int_zero:N \l_chemnum_list_items_int - \int_zero:N \l_chemnum_list_separate_int + \int_zero:N \l__chemnum_list_items_int + \int_zero:N \l__chemnum_list_separate_int \IfNoValueF { #4 } { \keys_set:nn { chemnum } { #4 } } - \chemnum_input_separator:n { #5 } - \tl_map_variable:NNn \l_tmpa_tl \l_chemnum_tmpa_tl + \__chemnum_input_separator:n { #5 } + \tl_map_variable:NNn \l_tmpa_tl \l__chemnum_tmpa_tl { - \tl_if_blank:VF \l_chemnum_tmpa_tl - { \int_incr:N \l_chemnum_list_items_int } + \tl_if_blank:VF \l__chemnum_tmpa_tl + { \int_incr:N \l__chemnum_list_items_int } } - \tl_map_variable:NNn \l_tmpa_tl \l_chemnum_tmpa_tl + \tl_map_variable:NNn \l_tmpa_tl \l__chemnum_tmpa_tl { - \tl_remove_all:Nn \l_chemnum_tmpa_tl { ~ } - \tl_if_blank:VF \l_chemnum_tmpa_tl + \tl_remove_all:Nn \l__chemnum_tmpa_tl { ~ } + \tl_if_blank:VF \l__chemnum_tmpa_tl { - \int_incr:N \l_chemnum_list_separate_int + \int_incr:N \l__chemnum_list_separate_int \IfBooleanF #1 { - \if_int_compare:w \l_chemnum_list_separate_int = 1 - \if_int_compare:w \l_chemnum_list_items_int = 1 + \if_int_compare:w \l__chemnum_list_separate_int = 1 + \if_int_compare:w \l__chemnum_list_items_int = 1 \else: - \tl_use:N \l_chemnum_list_prefix_tl - \tl_if_blank:VF { \l_chemnum_list_prefix_tl } - { \l_chemnum_list_space_tl } - \tl_use:N \l_chemnum_list_odelim_tl + \tl_use:N \l__chemnum_list_prefix_tl + \tl_if_blank:VF { \l__chemnum_list_prefix_tl } + { \l__chemnum_list_space_tl } + \tl_use:N \l__chemnum_list_odelim_tl \fi: \fi: } \IfBooleanTF #1 { - \chemnum_cmpd:onn - { \l_chemnum_tmpa_tl } + \__chemnum_cmpd:onn + { \l__chemnum_tmpa_tl } { \BooleanTrue } { \BooleanFalse } \IfBooleanT #3 @@ -1236,89 +1223,87 @@ { \IfBooleanTF #3 { - \chemnum_cmpd:onn - { \l_chemnum_tmpa_tl } + \__chemnum_cmpd:onn + { \l__chemnum_tmpa_tl } { \BooleanFalse } { \BooleanTrue } } { - \chemnum_cmpd:onn - { \l_chemnum_tmpa_tl } + \__chemnum_cmpd:onn + { \l__chemnum_tmpa_tl } { \BooleanFalse } { \BooleanFalse } } \int_compare:nTF - { \l_chemnum_list_separate_int = \l_chemnum_list_items_int } + { \l__chemnum_list_separate_int = \l__chemnum_list_items_int } { - \int_compare:nNnF { \l_chemnum_list_items_int } = { 1 } + \int_compare:nNnF { \l__chemnum_list_items_int } = { 1 } { - \tl_use:N \l_chemnum_list_cdelim_tl + \tl_use:N \l__chemnum_list_cdelim_tl \tl_if_blank:VF - { \l_chemnum_list_suffix_tl } - { \l_chemnum_list_space_tl } - \tl_use:N \l_chemnum_list_suffix_tl + { \l__chemnum_list_suffix_tl } + { \l__chemnum_list_space_tl } + \tl_use:N \l__chemnum_list_suffix_tl } } { \int_compare:nTF { - \l_chemnum_list_separate_int + \l__chemnum_list_separate_int = - \int_eval:n { \l_chemnum_list_items_int - 1 } + \int_eval:n { \l__chemnum_list_items_int - 1 } } { \tl_if_eq:NNTF - \l_chemnum_list_last_separator_tl - \l_chemnum_list_last_sep_empty_tl + \l__chemnum_list_last_separator_tl + \l__chemnum_list_last_sep_empty_tl { - \tl_use:N \l_chemnum_list_separator_tl - \l_chemnum_list_space_tl + \tl_use:N \l__chemnum_list_separator_tl + \l__chemnum_list_space_tl } { \int_compare:nNnF - { \l_chemnum_list_separate_int } = { 1 } + { \l__chemnum_list_separate_int } = { 1 } { - \bool_if:NF \l_chemnum_no_serial_comma_bool - { \l_chemnum_list_separator_tl } + \bool_if:NF \l__chemnum_no_serial_comma_bool + { \l__chemnum_list_separator_tl } } - \tl_if_blank:VF \l_chemnum_list_last_separator_tl - { \l_chemnum_list_space_tl } - \tl_use:N \l_chemnum_list_last_separator_tl - \l_chemnum_list_space_tl + \tl_if_blank:VF \l__chemnum_list_last_separator_tl + { \l__chemnum_list_space_tl } + \tl_use:N \l__chemnum_list_last_separator_tl + \l__chemnum_list_space_tl } } { - \tl_use:N \l_chemnum_list_separator_tl - \l_chemnum_list_space_tl + \tl_use:N \l__chemnum_list_separator_tl + \l__chemnum_list_space_tl } } } } } \group_end: - \bool_set_false:N \l_chemnum_cmpd_ref_bool + \bool_set_false:N \l__chemnum_cmpd_ref_bool } -\cs_set_eq:NN \cmpd \cmpd_main_command:w - %-----------------------------------------------------------------------------% % INITIALISING LABELS -\bool_new:N \l_chemnum_cmpd_initiated_bool -\bool_new:N \l_chemnum_cmpd_init_strict_bool -\bool_new:N \l_chemnum_cmpd_sub_init_bool -\bool_new:N \l_chemnum_cmpd_init_declare_bool +\bool_new:N \l__chemnum_cmpd_initiated_bool +\bool_new:N \l__chemnum_cmpd_init_strict_bool +\bool_new:N \l__chemnum_cmpd_sub_init_bool +\bool_new:N \l__chemnum_cmpd_init_declare_bool -\tl_new:N \l_chemnum_cmpd_init_separator_tl -\tl_set:Nn \l_chemnum_cmpd_init_separator_tl { , } +\tl_new:N \l__chemnum_cmpd_init_separator_tl +\tl_set:Nn \l__chemnum_cmpd_init_separator_tl { , } % property keys for \cmpdinit command % strict=true will produce an error instead of a warning \keys_define:nn { chemnum } { - init-strict .bool_set:N = \l_chemnum_cmpd_init_strict_bool , + init-strict .bool_set:N = \l__chemnum_cmpd_init_strict_bool , init-strict .default:n = true , - init-sub .bool_set:N = \l_chemnum_cmpd_sub_init_bool , + init-sub .bool_set:N = \l__chemnum_cmpd_sub_init_bool , init-sub .default:n = true , - init-input-sep .tl_set:N = \l_chemnum_cmpd_init_separator_tl , + init-input-sep .tl_set:N = \l__chemnum_cmpd_init_separator_tl , init-input-sep .default:n = { , } } @@ -1336,32 +1321,32 @@ } % initialize (and maybe declare) labels -\cs_new_nopar:Npn \chemnum_cmpd_init:n #1 +\cs_new_nopar:Npn \__chemnum_cmpd_init:n #1 { - \tl_clear:N \l_chemnum_tmpa_tl - \tl_set:Nn \l_chemnum_tmpa_tl { #1 } - \tl_remove_all:Nn \l_chemnum_tmpa_tl { ~ } - \tl_clear:N \l_chemnum_cmpd_main_label_tl - \tl_clear:N \l_chemnum_cmpd_sub_label_tl - \exp_after:wN \chemnum_cmpd_labelsep:n \l_chemnum_tmpa_tl \q_stop - \cs_if_exist:cF { chemnum_cmpd_ \l_chemnum_cmpd_main_label_tl _init: } + \tl_clear:N \l__chemnum_tmpa_tl + \tl_set:Nn \l__chemnum_tmpa_tl { #1 } + \tl_remove_all:Nn \l__chemnum_tmpa_tl { ~ } + \tl_clear:N \l__chemnum_cmpd_main_label_tl + \tl_clear:N \l__chemnum_cmpd_sub_label_tl + \exp_after:wN \__chemnum_cmpd_labelsep:n \l__chemnum_tmpa_tl \q_stop + \cs_if_exist:cF { chemnum_cmpd_ \l__chemnum_cmpd_main_label_tl _init: } { \cs_new_nopar:cpn - { chemnum_cmpd_ \l_chemnum_cmpd_main_label_tl _init: } + { chemnum_cmpd_ \l__chemnum_cmpd_main_label_tl _init: } { } } - \bool_if:NT \l_chemnum_cmpd_sub_init_bool + \bool_if:NT \l__chemnum_cmpd_sub_init_bool { - \tl_if_blank:VF \l_chemnum_cmpd_sub_label_tl + \tl_if_blank:VF \l__chemnum_cmpd_sub_label_tl { - \exp_args:No \chemnum_cmpd_sublist:n - { \l_chemnum_cmpd_sub_label_tl } - \exp_args:No \tl_map_inline:nn { \l_chemnum_cmpd_sublist_tl } + \exp_args:No \__chemnum_cmpd_sublist:n + { \l__chemnum_cmpd_sub_label_tl } + \exp_args:No \tl_map_inline:nn { \l__chemnum_cmpd_sublist_tl } { \cs_if_exist:cF { chemnum_cmpd_ - \l_chemnum_cmpd_main_label_tl + \l__chemnum_cmpd_main_label_tl _ ##1 _init: @@ -1370,7 +1355,7 @@ \cs_new_nopar:cpn { chemnum_cmpd_ - \l_chemnum_cmpd_main_label_tl + \l__chemnum_cmpd_main_label_tl _ ##1 _init: @@ -1380,10 +1365,10 @@ } } } - \bool_if:NT \l_chemnum_cmpd_init_declare_bool + \bool_if:NT \l__chemnum_cmpd_init_declare_bool { - \chemnum_cmpd:onn - { \l_chemnum_tmpa_tl } + \__chemnum_cmpd:onn + { \l__chemnum_tmpa_tl } { \BooleanTrue } { \BooleanFalse } } @@ -1392,13 +1377,13 @@ % \cmpdinit*[strict=]{} \NewDocumentCommand \cmpdinit { s o m } { - \bool_set_true:N \l_chemnum_cmpd_initiated_bool + \bool_set_true:N \l__chemnum_cmpd_initiated_bool \IfBooleanTF #1 - { \bool_set_false:N \l_chemnum_cmpd_init_declare_bool } - { \bool_set_true:N \l_chemnum_cmpd_init_declare_bool } + { \bool_set_false:N \l__chemnum_cmpd_init_declare_bool } + { \bool_set_true:N \l__chemnum_cmpd_init_declare_bool } \IfNoValueF { #2 } { \keys_set:nn { chemnum } { #2 } } - \chemnum_input_separator:n { #3 } - \tl_map_function:NN \l_tmpa_tl \chemnum_cmpd_init:n + \__chemnum_input_separator:n { #3 } + \tl_map_function:NN \l_tmpa_tl \__chemnum_cmpd_init:n } %-----------------------------------------------------------------------------% @@ -1407,8 +1392,8 @@ \NewDocumentCommand \cmpdreset { o } { \IfNoValueTF { #1 } - { \int_zero:N \g_chemnum_cmpd_int } - { \int_set:Nn \g_chemnum_cmpd_int { #1 - 1 } } + { \int_zero:N \g__chemnum_cmpd_int } + { \int_set:Nn \g__chemnum_cmpd_int { #1 - 1 } } } %-----------------------------------------------------------------------------% @@ -1421,113 +1406,122 @@ % REPLACE TAG IN EPS PICTURE WITH LABEL % works similar to \schemeref command of the chemscheme package % \cmpdref-[][]{