From 2e7a25deb44a2a967e5776a19053c291aa6e3527 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 18 Apr 2013 23:07:46 +0000 Subject: chemnum (18apr13) git-svn-id: svn://tug.org/texlive/trunk@30024 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/chemnum/chemnum.sty | 211 ++++++++++++------------ 1 file changed, 106 insertions(+), 105 deletions(-) (limited to 'Master/texmf-dist/tex/latex') diff --git a/Master/texmf-dist/tex/latex/chemnum/chemnum.sty b/Master/texmf-dist/tex/latex/chemnum/chemnum.sty index 83885ea3f14..28e40a1dc3e 100644 --- a/Master/texmf-dist/tex/latex/chemnum/chemnum.sty +++ b/Master/texmf-dist/tex/latex/chemnum/chemnum.sty @@ -32,8 +32,8 @@ \ProvidesExplPackage {chemnum} - {2013/01/20} - {0.6} + {2013/04/17} + {0.6a} {a comprehensive approach for the numbering of chemical compounds} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -96,7 +96,7 @@ \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_protected:Npn \__chemnum_load_textgreek:n #1 { \AtEndPreamble { @@ -183,60 +183,60 @@ } { \RequirePackage { bm }% abhängig machen von textoption bold - \cs_new_nopar:Npn \__chemnum_bm:n #1 + \cs_new:Npn \__chemnum_bm:n #1 { \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:Npn \__chemnum_alpha: { \ensuremath { \__chemnum_bm:n { \mathrm { \alpha } } } } + \cs_new:Npn \__chemnum_beta: { \ensuremath { \__chemnum_bm:n { \mathrm { \beta } } } } + \cs_new:Npn \__chemnum_gamma: { \ensuremath { \__chemnum_bm:n { \mathrm { \gamma } } } } + \cs_new:Npn \__chemnum_delta: { \ensuremath { \__chemnum_bm:n { \mathrm { \delta } } } } + \cs_new:Npn \__chemnum_epsilon: { \ensuremath { \__chemnum_bm:n { \mathrm { \varepsilon } } } } + \cs_new:Npn \__chemnum_zeta: { \ensuremath { \__chemnum_bm:n { \mathrm { \zeta } } } } + \cs_new:Npn \__chemnum_eta: { \ensuremath { \__chemnum_bm:n { \mathrm { \eta } } } } + \cs_new:Npn \__chemnum_theta: { \ensuremath { \__chemnum_bm:n { \mathrm { \theta } } } } + \cs_new:Npn \__chemnum_iota: { \ensuremath { \__chemnum_bm:n { \mathrm { \iota } } } } + \cs_new:Npn \__chemnum_kappa: { \ensuremath { \__chemnum_bm:n { \mathrm { \kappa } } } } + \cs_new:Npn \__chemnum_lambda: { \ensuremath { \__chemnum_bm:n { \mathrm { \lampda } } } } + \cs_new:Npn \__chemnum_mu: { \ensuremath { \__chemnum_bm:n { \mathrm { \mu } } } } + \cs_new:Npn \__chemnum_nu: { \ensuremath { \__chemnum_bm:n { \mathrm { \nu } } } } + \cs_new:Npn \__chemnum_xi: { \ensuremath { \__chemnum_bm:n { \mathrm { \xi } } } } + \cs_new:Npn \__chemnum_omikron: { \ensuremath { \__chemnum_bm:n { \mathrm { o } } } } + \cs_new:Npn \__chemnum_pi: { \ensuremath { \__chemnum_bm:n { \mathrm { \pi } } } } + \cs_new:Npn \__chemnum_rho: { \ensuremath { \__chemnum_bm:n { \mathrm { \rho } } } } + \cs_new:Npn \__chemnum_sigma: { \ensuremath { \__chemnum_bm:n { \mathrm { \sigma } } } } + \cs_new:Npn \__chemnum_tau: { \ensuremath { \__chemnum_bm:n { \mathrm { \tau } } } } + \cs_new:Npn \__chemnum_upsilon: { \ensuremath { \__chemnum_bm:n { \mathrm { \upsilon } } } } + \cs_new:Npn \__chemnum_phi: { \ensuremath { \__chemnum_bm:n { \mathrm { \varphi } } } } + \cs_new:Npn \__chemnum_chi: { \ensuremath { \__chemnum_bm:n { \mathrm { \chi } } } } + \cs_new:Npn \__chemnum_psi: { \ensuremath { \__chemnum_bm:n { \mathrm { \psi } } } } + \cs_new:Npn \__chemnum_omega: { \ensuremath { \__chemnum_bm:n { \mathrm { \omega } } } } + \cs_new:Npn \__chemnum_Alpha: { \ensuremath { \__chemnum_bm:n { \mathrm { A } } } } + \cs_new:Npn \__chemnum_Beta: { \ensuremath { \__chemnum_bm:n { \mathrm { B } } } } + \cs_new:Npn \__chemnum_Gamma: { \ensuremath { \__chemnum_bm:n { \mathrm { \Gamma } } } } + \cs_new:Npn \__chemnum_Delta: { \ensuremath { \__chemnum_bm:n { \mathrm { \Delta } } } } + \cs_new:Npn \__chemnum_Epsilon: { \ensuremath { \__chemnum_bm:n { \mathrm { E } } } } + \cs_new:Npn \__chemnum_Zeta: { \ensuremath { \__chemnum_bm:n { \mathrm { Z } } } } + \cs_new:Npn \__chemnum_Eta: { \ensuremath { \__chemnum_bm:n { \mathrm { H } } } } + \cs_new:Npn \__chemnum_Theta: { \ensuremath { \__chemnum_bm:n { \mathrm { \Theta } } } } + \cs_new:Npn \__chemnum_Iota: { \ensuremath { \__chemnum_bm:n { \mathrm { I } } } } + \cs_new:Npn \__chemnum_Kappa: { \ensuremath { \__chemnum_bm:n { \mathrm { K } } } } + \cs_new:Npn \__chemnum_Lambda: { \ensuremath { \__chemnum_bm:n { \mathrm { \Lambda } } } } + \cs_new:Npn \__chemnum_Mu: { \ensuremath { \__chemnum_bm:n { \mathrm { M } } } } + \cs_new:Npn \__chemnum_Nu: { \ensuremath { \__chemnum_bm:n { \mathrm { N } } } } + \cs_new:Npn \__chemnum_Xi: { \ensuremath { \__chemnum_bm:n { \mathrm { \Xi } } } } + \cs_new:Npn \__chemnum_Omikron: { \ensuremath { \__chemnum_bm:n { \mathrm { O } } } } + \cs_new:Npn \__chemnum_Pi: { \ensuremath { \__chemnum_bm:n { \mathrm { \Pi } } } } + \cs_new:Npn \__chemnum_Rho: { \ensuremath { \__chemnum_bm:n { \mathrm { P } } } } + \cs_new:Npn \__chemnum_Sigma: { \ensuremath { \__chemnum_bm:n { \mathrm { \Sigma } } } } + \cs_new:Npn \__chemnum_Tau: { \ensuremath { \__chemnum_bm:n { \mathrm { T } } } } + \cs_new:Npn \__chemnum_Upsilon: { \ensuremath { \__chemnum_bm:n { \mathrm { \Upsilon } } } } + \cs_new:Npn \__chemnum_Phi: { \ensuremath { \__chemnum_bm:n { \mathrm { \Phi } } } } + \cs_new:Npn \__chemnum_Chi: { \ensuremath { \__chemnum_bm:n { \mathrm { X } } } } + \cs_new:Npn \__chemnum_Psi: { \ensuremath { \__chemnum_bm:n { \mathrm { \Psi } } } } + \cs_new:Npn \__chemnum_Omega: { \ensuremath { \__chemnum_bm:n { \mathrm { \Omega } } } } } } @@ -252,7 +252,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % READ FROM PREVIOUS RUN, SAVE FOR NEXT RUN % save all labels in a clist -\cs_new:Npn \__chemnum_cmpd_save:n #1 +\cs_new_protected:Npn \__chemnum_cmpd_save:n #1 { \clist_gput_right:Nn \g__chemnum_cmpd_save_clist { { #1 } } } \msg_set:nnn { chemnum } { missing-cmpd-file } @@ -275,14 +275,14 @@ { \iow_now:Nx \__chemnum_aux_file: { - \use:c { cs_new_nopar:cpn } { chemnum_cmpd_ #1 _ref: } + \use:c { cs_new: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: { - \use:c { cs_new_nopar:cpn } { chemnum_cmpd_ #1 _min_ref: } + \use:c { cs_new:cpn } { chemnum_cmpd_ #1 _min_ref: } { \exp_not:f { \use:c { chemnum_cmpd_ #1 _min: } } } } } @@ -290,7 +290,7 @@ { \iow_now:Nx \__chemnum_aux_file: { - \use:c { cs_new_nopar:cpn } { chemnum_cmpd_ #1 _max_ref: } + \use:c { cs_new:cpn } { chemnum_cmpd_ #1 _max_ref: } { \exp_not:f { \use:c { chemnum_cmpd_ #1 _max: } } } } } @@ -305,7 +305,7 @@ \bool_new:N \l__chemnum_cmpd_style_is_macro_bool % default style -\cs_new_nopar:Npn \__chemnum_cmpd_style_value:n { } +\cs_new:Npn \__chemnum_cmpd_style_value:n { } % error message \msg_set:nnn { chemnum } { cmpd-style } @@ -315,7 +315,7 @@ } % set style %TODO -\cs_new_nopar:Npn \__chemnum_cmpd_set_style:n #1 +\cs_new_protected: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 @@ -325,7 +325,7 @@ % { \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 } } + { \cs_set:Npn \__chemnum_cmpd_style_value:n { #1 } } % { \msg_error:nnx { chemnum } { cmpd-style } { #1 } } % } @@ -333,7 +333,7 @@ \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_protected:Npn \__chemnum_cmpd_use_style:n #1 { \group_begin: \bool_if:NT \l__chemnum_cmpd_bold_bool @@ -363,7 +363,7 @@ } % set compound delimiters -\cs_new_nopar:Npn \__chemnum_cmpd_delim:n #1 +\cs_new_protected:Npn \__chemnum_cmpd_delim:n #1 { \tl_if_blank:nTF { #1 } { @@ -371,7 +371,7 @@ \tl_clear:N \l__chemnum_cmpd_cdelim_tl } { - \int_compare:nNnTF { \tl_length:n { #1 } } = 2 + \int_compare:nNnTF { \tl_count: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 } } @@ -381,7 +381,7 @@ } % format of numbering -\cs_new_nopar:Npn \__chemnum_cmpd_kind:nn #1#2 +\cs_new:Npn \__chemnum_cmpd_kind:nn #1#2 { \cs:w int_to_#1:n \cs_end: #2 } % default format @@ -389,7 +389,7 @@ \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: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 } @@ -442,7 +442,7 @@ \cs_new:Npn \int_to_Greek:n { } \bool_if:NTF \l__chemnum_textgreek_bool { - \cs_set:Npn \int_to_Greek:n #1 + \cs_set_protected:Npn \int_to_Greek:n #1 { \int_to_symbols:nnn { #1 } { 24 } { @@ -478,7 +478,7 @@ } % define \int_to_Symbol function -\cs_new:Npn \int_to_Symbol:n #1 +\cs_new_protected:Npn \int_to_Symbol:n #1 { \int_to_symbols:nnn { #1 } { 9 } { @@ -504,12 +504,12 @@ \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 +\cs_new_protected: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_count: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 @@ -564,13 +564,13 @@ \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_protected:Npn \__chemnum_hyperref:nnn #1#2#3 { \bool_if:nF { #3 || !\l__chemnum_use_hyperref_bool } { \bool_if:NT \l__chemnum_hypertarget_bool { - \cs_set_nopar:Npn \__chemnum_make_hyper:nn ##1##2 + \cs_set:Npn \__chemnum_make_hyper:nn ##1##2 { \raisebox { 3ex } [ 0pt ] { \hypertarget { ##1 } { } } ##2 @@ -592,12 +592,12 @@ } { \bool_set_true:N \l__chemnum_hypertarget_bool - \cs_set_nopar:Npn \__chemnum_make_hyper:nn ##1##2 + \cs_set:Npn \__chemnum_make_hyper:nn ##1##2 { \raisebox { 3ex } [ 0pt ] { \hypertarget { ##1 } { } } ##2 } - \cs_new_nopar:cpn { chemnum_cmpd_#1_hyper: } { } + \cs_new:cpn { chemnum_cmpd_#1_hyper: } { } } } { @@ -617,12 +617,12 @@ } { \bool_set_true:N \l__chemnum_hypertarget_bool - \cs_set_nopar:Npn \__chemnum_make_hyper:nn ##1##2 + \cs_set:Npn \__chemnum_make_hyper:nn ##1##2 { \raisebox { 3ex } [ 0pt ] { \hypertarget { ##1 } { } } ##2 } - \cs_new_nopar:cpn + \cs_new:cpn { chemnum_cmpd_#1_ \l_tmpa_tl _hyper: } { } } } @@ -742,12 +742,12 @@ \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 { +\cs_new_protected: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 }{ - \int_compare:nNnTF { \tl_length:n { #1 } } = 2 { + \int_compare:nNnTF { \tl_count: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 } } }{ \msg_error:nnx { chemnum } { delimiters } { list } } @@ -817,7 +817,7 @@ %-----------------------------------------------------------------------------% % label and sublabel declaration -\cs_new:Npn \__chemnum_cmpd_declare:n #1 +\cs_new_protected:Npn \__chemnum_cmpd_declare:n #1 { \cs_if_exist:cF { chemnum_cmpd_#1: } { @@ -828,7 +828,7 @@ \__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: } { + \cs_new:cpx { chemnum_cmpd_#1: } { \bool_if:NTF \l__chemnum_cmpd_name_bool { \l__chemnum_cmpd_name_tl } { @@ -840,16 +840,16 @@ } } -\cs_new:Npn \__chemnum_cmpd_sub_declare:nn #1#2 +\cs_new_protected:Npn \__chemnum_cmpd_sub_declare:nn #1#2 { \cs_if_exist:cF { chemnum_cmpd_#1_#2: } { \__chemnum_cmpd_save:n { #1 _ #2 } - \cs_new_nopar:cpx { chemnum_cmpd_#1_#2: } { } + \cs_new: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? + % why is the next line working when \cs_gset:cpx doesn't? % (in case ":" is part of #1) - \exp_after:wN \cs_gset_nopar:Npx \cs:w chemnum_cmpd_#1_#2: \cs_end: + \exp_after:wN \cs_gset:Npx \cs:w chemnum_cmpd_#1_#2: \cs_end: { \__chemnum_cmpd_sub_kind:Nc \l__chemnum_cmpd_sub_kind_value_tl @@ -864,7 +864,7 @@ } \cs_generate_variant:Nn \__chemnum_cmpd_sub_declare:nn { no } -\cs_new_nopar:Npn \__chemnum_cmpd_sub_initiate:nn #1#2 +\cs_new_protected:Npn \__chemnum_cmpd_sub_initiate:nn #1#2 { \cs_if_exist:cF { chemnum_cmpd_ #1 _ #2 _init: } { @@ -882,7 +882,7 @@ %-----------------------------------------------------------------------------% % label and sublabel initiation -\cs_new:Npn \__chemnum_cmpd_initiate:nn #1#2 +\cs_new_protected:Npn \__chemnum_cmpd_initiate:nn #1#2 { \cs_if_exist:cTF { chemnum_cmpd_#1_init: } { @@ -930,20 +930,20 @@ \tl_new:N \l__chemnum_labelsep_tmp_tl % set sublabel-separator -\cs_new_nopar:Npn \__chemnum_subcmpdsep:n #1 { +\cs_new_protected: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 } } } -\cs_new_nopar:Npn \__chemnum_sublabel_range_marker:n #1 { +\cs_new_protected: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 } } } % actual separating -\cs_new_nopar:Npn \__chemnum_cmpd_labelsep:n #1 \q_stop { +\cs_new_protected: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 } { @@ -957,13 +957,13 @@ { \__chemnum_cmpd_labelsep_aux_i:n { #1 } } } -\cs_new_nopar:Npn \__chemnum_cmpd_labelsep_aux_i:n #1 +\cs_new_protected: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 } -\cs_new_nopar:Npn \__chemnum_cmpd_labelsep_aux_ii:n #1 \q_nil #2 \q_stop +\cs_new_protected: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 } @@ -982,7 +982,7 @@ { \int_incr:N \l__chemnum_cmpd_sublist_length_int } } -\cs_new_nopar:Npn \__chemnum_cmpd_subrange_separate:n #1 +\cs_new_protected:Npn \__chemnum_cmpd_subrange_separate:n #1 { \tl_clear:N \l_tmpa_tl \tl_clear:N \l_tmpb_tl @@ -991,13 +991,12 @@ \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 + \exp_after:wN \__chemnum_cmpd_subrange_separate_aux:w \l_tmpa_tl \q_stop } { \tl_set:Nn \l_tmpa_tl { #1 } } } -\cs_new_nopar:Npn \__chemnum_cmpd_subrange_separate_aux:n - #1 \q_nil #2 \q_stop +\cs_new_protected:Npn \__chemnum_cmpd_subrange_separate_aux:w #1 \q_nil #2 \q_stop { \tl_set:Nn \l_tmpa_tl { #1 } \tl_set:Nn \l_tmpb_tl { #2 } @@ -1005,7 +1004,7 @@ %-----------------------------------------------------------------------------% % print compound label -\cs_new_nopar:Npn \__chemnum_cmpd_print:n #1 +\cs_new_protected:Npn \__chemnum_cmpd_print:n #1 { \tl_if_blank:VF \l__chemnum_cmpd_prefix_tl { @@ -1026,7 +1025,7 @@ % 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_protected:Npn \__chemnum_cmpd_aux_i:nnnn #1#2#3#4 { \bool_if:NT \l__chemnum_cmpd_initiated_bool { \__chemnum_cmpd_initiate:nn { #1 } { #2 } } @@ -1121,7 +1120,7 @@ %-----------------------------------------------------------------------------% % 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_protected: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 @@ -1170,7 +1169,7 @@ \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 +\cs_new_protected:Npn \cmpd_main:nnnnn #1#2#3#4#5 { \IfBooleanT #2 { @@ -1321,7 +1320,7 @@ } % initialize (and maybe declare) labels -\cs_new_nopar:Npn \__chemnum_cmpd_init:n #1 +\cs_new_protected:Npn \__chemnum_cmpd_init:n #1 { \tl_clear:N \l__chemnum_tmpa_tl \tl_set:Nn \l__chemnum_tmpa_tl { #1 } @@ -1331,7 +1330,7 @@ \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 + \cs_new_protected:cpn { chemnum_cmpd_ \l__chemnum_cmpd_main_label_tl _init: } { } } @@ -1352,7 +1351,7 @@ _init: } { - \cs_new_nopar:cpn + \cs_new_protected:cpn { chemnum_cmpd_ \l__chemnum_cmpd_main_label_tl @@ -1420,17 +1419,17 @@ \int_new:N \l__chemnum_cmpdref_int -\cs_new_nopar:Npn \__chemnum_set_psfrag_pos:nn #1#2 +\cs_new_protected:Npn \__chemnum_set_psfrag_pos:nn #1#2 { \tl_set:Nn \l__chemnum_psfrag_texpos_tl { #1 } \tl_set:Nn \l__chemnum_psfrag_pspos_tl { #2 } } -\cs_new_nopar:Npn \__chemnum_psfrag:nnnn #1#2#3#4 +\cs_new_protected:Npn \__chemnum_psfrag:nnnn #1#2#3#4 { \psfrag { #1 } [ #2 ] [ #3 ] { #4 } } \cs_generate_variant:Nn \__chemnum_psfrag:nnnn { VVVn } -\cs_new:Npn \__chemnum_set_psfrag_pos_local:w #1 ref-pos #2 = #3#4 , #5 \q_stop +\cs_new_protected:Npn \__chemnum_set_psfrag_pos_local:w #1 ref-pos #2 = #3#4 , #5 \q_stop { \tl_set_eq:NN \l__chemnum_psfrag_texpos_current_tl \l__chemnum_psfrag_texpos_tl \tl_set_eq:NN \l__chemnum_psfrag_pspos_current_tl \l__chemnum_psfrag_pspos_tl @@ -1451,7 +1450,7 @@ \NewDocumentCommand \cmpdref { t- t+ o o m } { \cmpd_ref:nnnnn { #1 } { #2 } { #3 } { #4 } { #5 } } -\cs_new:Npn \cmpd_ref:nnnnn #1#2#3#4#5 +\cs_new_protected:Npn \cmpd_ref:nnnnn #1#2#3#4#5 { \IfBooleanT { #1 } { \keys_set:nn { chemnum } { cmpd-delim = } } @@ -1556,7 +1555,7 @@ { \bool_set_false:N \l__chemnum_no_serial_comma_bool } { \bool_set_true:N \l__chemnum_no_serial_comma_bool } \cs_new_eq:NN \__chemnum_selectlanguage:n \selectlanguage - \cs_set_nopar:Npn \selectlanguage #1 + \cs_set:Npn \selectlanguage #1 { \__chemnum_selectlanguage:n { #1 } \iflanguage { american } @@ -1653,6 +1652,8 @@ HISTORY: 2012/12/29 version 0.5f - added Italian documentation, minor adjustment of `ref-pos' 2013/01/20 version 0.6 - added + argument to \cmpdref - changed internal syntax + 2013/04/17 version 0.6a - adapted to deprecated l3 functions + - protected functions that needed to be %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % TODO: -- cgit v1.2.3