diff options
author | Karl Berry <karl@freefriends.org> | 2015-04-05 21:40:32 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2015-04-05 21:40:32 +0000 |
commit | 8e6cd0d2a4540b6b5deaa37f69edcc10feffa75e (patch) | |
tree | e05599af36cfa5a8e8218e5c22cd6d92d0e7d769 /Master/texmf-dist/tex/latex/chemformula | |
parent | b5c336cc046422ec6b8b75be0f12ba52b4137344 (diff) |
chemformula (5apr15)
git-svn-id: svn://tug.org/texlive/trunk@36722 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/chemformula')
-rw-r--r-- | Master/texmf-dist/tex/latex/chemformula/chemformula.sty | 493 |
1 files changed, 253 insertions, 240 deletions
diff --git a/Master/texmf-dist/tex/latex/chemformula/chemformula.sty b/Master/texmf-dist/tex/latex/chemformula/chemformula.sty index 692f90e5963..e80de909eb9 100644 --- a/Master/texmf-dist/tex/latex/chemformula/chemformula.sty +++ b/Master/texmf-dist/tex/latex/chemformula/chemformula.sty @@ -28,8 +28,8 @@ % -------------------------------------------------------------------------- \RequirePackage{ expl3 , xparse , l3keys2e , tikz , amsmath , xfrac , nicefrac , scrlfile } \usetikzlibrary{arrows.meta} -\def\chemformula@version{4.10} -\def\chemformula@date{2015/03/16} +\def\chemformula@version{4.10a} +\def\chemformula@date{2015/04/03} \ProvidesExplPackage {chemformula} @@ -64,32 +64,32 @@ } \msg_new:nnnn { chemformula } { new-arrow } - { The~arrow~type~ \tl_to_str:n { #1 } \c_space_tl is~already~defined. } + { The~arrow~type~ \tl_to_str:n {#1} \c_space_tl is~already~defined. } { - You've~tried~to~define~the~arrow~type~\tl_to_str:n { #1 } \c_space_tl with + You've~tried~to~define~the~arrow~type~\tl_to_str:n {#1} \c_space_tl with ~\token_to_str:N \NewChemArrow \c_space_tl but~it~already~exists. ~Choose~another~name. } \msg_new:nnnn { chemformula } { renew-arrow } - { The~arrow~type~ \tl_to_str:n { #1 } \c_space_tl is~not~defined. } + { The~arrow~type~ \tl_to_str:n {#1} \c_space_tl is~not~defined. } { - You've~tried~to~renew~the~arrow~type~\tl_to_str:n { #1 } ~but~it~doesn't~ + You've~tried~to~renew~the~arrow~type~\tl_to_str:n {#1} ~but~it~doesn't~ exist. } \msg_new:nnnn { chemformula } { new-bond } - { The~bond~type~ \tl_to_str:n { #1 } \c_space_tl is~already~defined. } + { The~bond~type~ \tl_to_str:n {#1} \c_space_tl is~already~defined. } { - You've~tried~to~define~the~bond~type~\tl_to_str:n { #1 } \c_space_tl with + You've~tried~to~define~the~bond~type~\tl_to_str:n {#1} \c_space_tl with ~\token_to_str:N \NewChemBond \c_space_tl but~it~already~exists. ~Choose~another~name. } \msg_new:nnnn { chemformula } { renew-bond } - { The~bond~type~ \tl_to_str:n { #1 } \c_space_tl is~not~defined. } + { The~bond~type~ \tl_to_str:n {#1} \c_space_tl is~not~defined. } { - You've~tried~to~renew~the~bond~type~\tl_to_str:n { #1 } ~but~it~doesn't~ + You've~tried~to~renew~the~bond~type~\tl_to_str:n {#1} ~but~it~doesn't~ exist. } @@ -122,13 +122,13 @@ \cs_new_protected:Npn #1 { \msg_warning:nnnn { chemformula } { command-deprecated } - { #1 } { #2 } + {#1} {#2} #3 } } \NewDocumentCommand \DeprecatedFormulaCommand { mmm } - { \chemformula_define_deprecated:NNn #1 #2 { #3 } } + { \chemformula_define_deprecated:NNn #1 #2 {#3} } % -------------------------------------------------------------------------- % variants of kernel functions: @@ -377,7 +377,7 @@ % -------------------------------------------------------------------------- % general and helper functions: \cs_new:Npn \chemformula_tikz:nn #1#2 - { \tikz [ #1 ] { #2 } } + { \tikz [ #1 ] {#2} } \cs_generate_variant:Nn \chemformula_tikz:nn { xn,nf } \cs_new:Npn \chemformula_draw:nn #1#2 @@ -385,11 +385,11 @@ \cs_generate_variant:Nn \chemformula_draw:nn { xn,nx,xx,xf,Vn } \cs_new:Npn \chemformula_node:nn #1#2 - { \node [ #1 ] { #2 } ; } + { \node [ #1 ] {#2} ; } \cs_generate_variant:Nn \chemformula_node:nn { x } \cs_new:Npn \chemformula_node:nnn #1#2#3 - { \node [ #1 ] ( #2 ) { #3 } ; } + { \node [ #1 ] ( #2 ) {#3} ; } \cs_generate_variant:Nn \chemformula_node:nnn { nx } \cs_new:Npn \chemformula_allow_break: @@ -419,7 +419,7 @@ \cs_new_protected:Npn \chemformula_dim_to_width:Nn #1#2 { - \hbox_set:Nn \l__chemformula_tmpa_box { #2 } + \hbox_set:Nn \l__chemformula_tmpa_box {#2} \dim_set:Nn #1 { \box_wd:N \l__chemformula_tmpa_box } \box_clear:N \l__chemformula_tmpa_box } @@ -869,7 +869,7 @@ \box_clear:N \l__chemformula_arrow_arg_i_box \box_clear:N \l__chemformula_arrow_arg_ii_box % then get the arrow type - \tl_set:Nn \l__chemformula_arrow_type_tl { #1 } + \tl_set:Nn \l__chemformula_arrow_type_tl {#1} } % this will be \arrow inside \ch @@ -877,8 +877,8 @@ { \group_begin: \chemformula_tikzexternaldisable: - \__chemformula_arrows_get:n { #1 } - \chemformula_arrow_labels:nn { #2 } { #3 } + \__chemformula_arrows_get:n {#1} + \chemformula_arrow_labels:nn {#2} {#3} \group_end: } @@ -888,7 +888,7 @@ \chemformula_nobreak: % prepare arrow code for drawing: \tl_set_rescan:Nnn \l__chemformula_tmpc_tl - { \char_set_catcode_letter:N \_ } { #1 } + { \char_set_catcode_letter:N \_ } {#1} % determine length of the arrow \__chemformula_determine_arrow_length:NN \l__chemformula_arrow_arg_i_box @@ -935,33 +935,33 @@ % #1: symbol, #2: code \NewDocumentCommand \NewChemArrow { mm } { - \prop_if_in:NnTF \l__chemformula_arrows_code_prop { #1 } - { \msg_error:nnn { chemformula } { new-arrow } { #1 } } + \prop_if_in:NnTF \l__chemformula_arrows_code_prop {#1} + { \msg_error:nnn { chemformula } { new-arrow } {#1} } { % store type in the sequence and code in the property list - \seq_put_right:Nn \l__chemformula_arrows_type_seq { #1 } - \prop_put:Nnn \l__chemformula_arrows_code_prop { #1 } { #2 } + \seq_put_right:Nn \l__chemformula_arrows_type_seq {#1} + \prop_put:Nnn \l__chemformula_arrows_code_prop {#1} {#2} } } \NewDocumentCommand \DeclareChemArrow { mm } { - \prop_if_in:NnF \l__chemformula_arrows_code_prop { #1 } - { \seq_put_right:Nn \l__chemformula_arrows_type_seq { #1 } } + \prop_if_in:NnF \l__chemformula_arrows_code_prop {#1} + { \seq_put_right:Nn \l__chemformula_arrows_type_seq {#1} } % store type in the sequence and code in the property list - \prop_put:Nnn \l__chemformula_arrows_code_prop { #1 } { #2 } + \prop_put:Nnn \l__chemformula_arrows_code_prop {#1} {#2} } \NewDocumentCommand \RenewChemArrow { mm } { - \prop_if_in:NnTF \l__chemformula_arrows_code_prop { #1 } - { \prop_put:Nnn \l__chemformula_arrows_code_prop { #1 } { #2 } } - { \msg_error:nnn { chemformula } { renew-arrow } { #1 } } + \prop_if_in:NnTF \l__chemformula_arrows_code_prop {#1} + { \prop_put:Nnn \l__chemformula_arrows_code_prop {#1} {#2} } + { \msg_error:nnn { chemformula } { renew-arrow } {#1} } } \NewDocumentCommand \ShowChemArrow { m } { - \prop_get:NnN \l__chemformula_arrows_code_prop { #1 } \l__chemformula_tmpa_tl + \prop_get:NnN \l__chemformula_arrows_code_prop {#1} \l__chemformula_tmpa_tl \tl_to_str:N \l__chemformula_tmpa_tl } @@ -1073,7 +1073,7 @@ \cs_new_protected:Npn \__chemformula_ch_main:n #1 { \group_begin: - \seq_set_split:Nnn \l__chemformula_input_seq { ~ } { #1 } + \seq_set_split:Nnn \l__chemformula_input_seq { ~ } {#1} \cs_set_eq:NN \xspace \scan_stop: % the next two aren't necessary any more but shouldn't do harm, too: \cs_set_nopar:Npn \[ { [ } @@ -1112,9 +1112,9 @@ { \group_align_safe_begin: \chemformula_leave_vmode: - \tl_if_blank:nTF { #1 } + \tl_if_blank:nTF {#1} { \tl_gclear:N \g__chemformula_options_tl } - { \tl_gset:Nn \g__chemformula_options_tl { #1 } } + { \tl_gset:Nn \g__chemformula_options_tl {#1} } \__chemformula_ch_newline:w #2 \\ \q_no_value \q_stop \group_align_safe_end: \tl_use:N \g__chemformula_output_tl @@ -1127,7 +1127,7 @@ \cs_new_protected:Npn \__chemformula_ch_newline:w #1 \\ #2 \q_stop { \__chemformula_ch_align:w #1 & \q_no_value \q_stop - \quark_if_no_value:nF { #2 } + \quark_if_no_value:nF {#2} { \tl_gput_right:Nn \g__chemformula_output_tl { \\ } % look for optional argument: @@ -1148,7 +1148,7 @@ \cs_new_protected:Npn \__chemformula_ch_align:w #1 & #2 \q_stop { \__chemformula_ch_label:w #1 \label \q_no_value \q_stop - \quark_if_no_value:nF { #2 } + \quark_if_no_value:nF {#2} { \tl_gput_right:Nn \g__chemformula_output_tl { & } \__chemformula_ch_align:w #2 \q_stop @@ -1159,7 +1159,7 @@ \cs_new_protected:Npn \__chemformula_ch_label:w #1 \label #2 \q_stop { \__chemformula_ch_tag:w #1 \tag{} \q_no_value \q_stop - \quark_if_no_value:nF { #2 } + \quark_if_no_value:nF {#2} { \tl_gput_right:Nn \g__chemformula_output_tl { \label } \peek_meaning:NTF [ % ] @@ -1187,9 +1187,9 @@ \cs_new_protected:Npn \__chemformula_ch_tag:w #1 \tag#2 #3 \q_stop { \__chemformula_ch_intertext:w #1 \intertext{} \q_no_value \q_stop - \quark_if_no_value:nF { #3 } + \quark_if_no_value:nF {#3} { - \tl_gput_right:Nn \g__chemformula_output_tl { \protect\tag { #2 } } + \tl_gput_right:Nn \g__chemformula_output_tl { \protect\tag {#2} } \__chemformula_ch_tag:w #3 \q_stop } } @@ -1198,10 +1198,10 @@ \cs_new_protected:Npn \__chemformula_ch_intertext:w #1 \intertext#2 #3 \q_stop { \tl_gput_right:Nn \g__chemformula_output_tl - { \__chemformula_ch_main:n { #1 } } - \quark_if_no_value:nF { #3 } + { \__chemformula_ch_main:n {#1} } + \quark_if_no_value:nF {#3} { - \tl_gput_right:Nn \g__chemformula_output_tl { \intertext { #2 } } + \tl_gput_right:Nn \g__chemformula_output_tl { \intertext {#2} } \__chemformula_ch_intertext:w #3 \q_stop } } @@ -1209,16 +1209,16 @@ % -------------------------------------------------------------------------- % user commands: \NewDocumentCommand \ch { O{}m } - { \chemformula_ch:nn { #1 } { #2 } } + { \chemformula_ch:nn {#1} {#2} } \cs_new_protected:Npn \chemformula_chcpd:nn #1#2 { \group_begin: - \keys_set:nn { chemmacros / chemformula } { #1 } + \keys_set:nn { chemmacros / chemformula } {#1} \__chemformula_save_catcodes: \__chemformula_sanitize:Nn \l__chemformula_chemformula_tmpa_tl - { #2 } + {#2} \chemformula_input_cmpd:VN \l__chemformula_chemformula_tmpa_tl \l__chemformula_compound_tl @@ -1228,7 +1228,7 @@ } \NewDocumentCommand \chcpd { O{}m } - { \chemformula_chcpd:nn { #1 } { #2 } } + { \chemformula_chcpd:nn {#1} {#2} } % -------------------------------------------------------------------------- % arrow generation & detection @@ -1241,11 +1241,11 @@ \char_set_catcode_other:N \- \char_set_catcode_other:N \= } - { #2 } + {#2} \seq_map_inline:Nn \l__chemformula_arrows_type_seq { \tl_replace_all:Nnn \l__chemformula_tmpa_tl - { ##1 } { \charrow { ##1 } } + {##1} { \charrow {##1} } } \tl_set_eq:NN #1 \l__chemformula_tmpa_tl } @@ -1256,8 +1256,8 @@ \bool_set_false:N \l__chemformula_is_arrow_bool \prop_map_inline:Nn \l__chemformula_arrows_code_prop { - \__chemformula_sanitize:Nn \l__chemformula_tmpa_tl { ##1 } - \tl_if_in:nVT { #1 } \l__chemformula_tmpa_tl + \__chemformula_sanitize:Nn \l__chemformula_tmpa_tl {##1} + \tl_if_in:nVT {#1} \l__chemformula_tmpa_tl { \bool_set_true:N \l__chemformula_is_arrow_bool } } } @@ -1268,7 +1268,7 @@ { \peek_meaning:NTF ( { \chname } { ! } } \NewDocumentCommand \chname { R(){}R(){} } - { \chemformula_chwritebelow:nn { #1 } { #2 } } + { \chemformula_chwritebelow:nn {#1} {#2} } \cs_new:Npn \chemformula_chwritebelow:nn #1#2 { @@ -1290,7 +1290,7 @@ \cs_new_protected:Npn \__chemformula_generate_name:Nn #1#2 { - \__chemformula_sanitize:Nn \l__chemformula_tmpa_tl { #2 } + \__chemformula_sanitize:Nn \l__chemformula_tmpa_tl {#2} \tl_if_in:VnT \l__chemformula_tmpa_tl { ! } { \tl_replace_all:Nnn \l__chemformula_tmpa_tl @@ -1304,7 +1304,7 @@ \cs_new_protected:Npn \__chemformula_detect_name:n #1 { \bool_set_false:N \l__chemformula_is_name_bool - \tl_set:Nn \l__chemformula_tmpa_tl { #1 } + \tl_set:Nn \l__chemformula_tmpa_tl {#1} \tl_if_in:VnT \l__chemformula_tmpa_tl { ! } { \bool_set_true:N \l__chemformula_is_name_bool } } @@ -1450,25 +1450,25 @@ { \chemformula_skip_nobreak:N \l__chemformula_bond_space_dim \group_begin: - \chemformula_tikzexternaldisable: - \chemformula_tikz:nn - { - inner~sep = 0pt , - outer~sep = 0pt , - text~height = 1em , - baseline = (chemformula-bond-ground.base) - } - { - \draw node[draw=none,minimum~height=1em,minimum~width=0] - (chemformula-bond-ground) at (0pt,0pt) {}; - \draw (chemformula-bond-ground) ++ (0pt,-.1716em) - coordinate (chemformula-bond-start) ; - \draw (chemformula-bond-start) ++(\l__chemformula_bond_dim ,0pt) - coordinate (chemformula-bond-end) ; - \tl_if_blank:nTF { #1 } - { \__chemformula_bond_draw:n { single } } - { \__chemformula_bond_draw:n { #1 } } - } + \chemformula_tikzexternaldisable: + \chemformula_tikz:nn + { + inner~sep = 0pt , + outer~sep = 0pt , + text~height = 1em , + baseline = (chemformula-bond-ground.base) + } + { + \draw node[ draw=none, minimum~height=1em, minimum~width=0 ] + (chemformula-bond-ground) at (0pt,0pt) {}; + \draw (chemformula-bond-ground) ++ (0pt,-.1716em) + coordinate (chemformula-bond-start) ; + \draw (chemformula-bond-start) ++(\l__chemformula_bond_dim ,0pt) + coordinate (chemformula-bond-end) ; + \tl_if_blank:nTF {#1} + { \__chemformula_bond_draw:n { single } } + { \__chemformula_bond_draw:n {#1} } + } \group_end: \chemformula_skip_nobreak_penalty:Nn \l__chemformula_bond_space_dim @@ -1477,69 +1477,84 @@ \cs_new_protected:Npn \__chemformula_bond_draw:n #1 { - \__chemformula_reset:Nn \l__chemformula_tmpa_tl { #1 } - % \tl_set_rescan:Nnn \l__chemformula_tmpa_tl {} { #1 } + \__chemformula_reset:Nn \l__chemformula_tmpa_tl {#1} \prop_get:NV \l__chemformula_bonds_prop \l__chemformula_tmpa_tl } -\NewDocumentCommand \NewChemBond { mm } +\cs_new_protected:Npn \chemformula_declare_bond:nn #1#2 { \cs_if_exist:cTF { chemformula_bond_type_#1: } - { \msg_error:nnn { chemformula } { new-bond } { #1 } } - { - \cs_new:cpn { chemformula_bond_type_#1: } {} - \prop_put:Nnn \l__chemformula_bonds_prop { #1 } { #2 } - } + { \cs_set:cpn { chemformula_bond_type_#1: } {} } + { \cs_new:cpn { chemformula_bond_type_#1: } {} } + \prop_put:Nnn \l__chemformula_bonds_prop {#1} {#2} } -\NewDocumentCommand \DeclareChemBond { mm } +\cs_new_protected:Npn \chemformula_new_bond:nn #1#2 { - \cs_if_exist:cF { chemformula_bond_type_#1: } - { \cs_new:cpn { chemformula_bond_type_#1: } {} } - \prop_put:Nnn \l__chemformula_bonds_prop { #1 } { #2 } + \cs_if_exist:cTF { chemformula_bond_type_#1: } + { \msg_error:nnn {chemformula} {new-bond} {#1} } + { \chemformula_declare_bond:nn {#1} {#2} } } -\NewDocumentCommand \NewChemBondAlias { mm } +\cs_new_protected:Npn \chemformula_renew_bond:nn #1#2 + { + \cs_if_exist:cTF { chemformula_bond_type_#1: } + { \chemformula_declare_bond:nn {#1} {#2} } + { \msg_error:nnn {chemformula} {renew-bond} {#1} } + } + +\cs_new_protected:Npn \chemformula_new_bond_alias:nn #1#2 { \cs_if_exist:cTF { chemformula_bond_type_#2: } { \cs_if_exist:cTF { chemformula_bond_type_#1: } - { \msg_error:nnn { chemformula } { new-bond } { #1 } } + { \msg_error:nnn {chemformula} {new-bond} {#1} } { \cs_new:cpn { chemformula_bond_type_#1: } {} } - \prop_get:NnN \l__chemformula_bonds_prop { #2 } \l__chemformula_tmpa_tl - \prop_put:Nno \l__chemformula_bonds_prop { #1 } { \l__chemformula_tmpa_tl } + \prop_get:NnN \l__chemformula_bonds_prop {#2} \l__chemformula_tmpa_tl + \prop_put:Nno \l__chemformula_bonds_prop {#1} { \l__chemformula_tmpa_tl } } - { \msg_error:nnnn { chemformula } { bond-alias } { #1 } { #2 } } + { \msg_error:nnnn {chemformula} {bond-alias} {#1} {#2} } } -\NewDocumentCommand \DeclareChemBondAlias { mm } +\cs_new_protected:Npn \chemformula_declare_bond_alias:nn #1#2 { \cs_if_exist:cTF { chemformula_bond_type_#2: } { \cs_if_exist:cF { chemformula_bond_type_#1: } { \cs_new:cpn { chemformula_bond_type_#1: } {} } - \prop_get:NnN \l__chemformula_bonds_prop { #2 } \l__chemformula_tmpa_tl - \prop_put:Nno \l__chemformula_bonds_prop { #1 } { \l__chemformula_tmpa_tl } + \prop_get:NnN \l__chemformula_bonds_prop {#2} \l__chemformula_tmpa_tl + \prop_put:Nno \l__chemformula_bonds_prop {#1} { \l__chemformula_tmpa_tl } } - { \msg_error:nnnn { chemformula } { bond-alias } { #1 } { #2 } } + { \msg_error:nnnn {chemformula} {bond-alias} {#1} {#2} } } -\NewDocumentCommand \RenewChemBond { mm } +\cs_new_protected:Npn \chemformula_show_bond:n #1 { - \cs_if_exist:cTF { chemformula_bond_type_#1: } - { \prop_put:Nnn \l__chemformula_bonds_prop { #1 } { #2 } } - { \msg_error:nnn { chemformula } { renew-bond } { #1 } } + \prop_get:NnN \l__chemformula_bonds_prop {#1} \l__chemformula_tmpa_tl + \tl_to_str:N \l__chemformula_tmpa_tl } +\NewDocumentCommand \NewChemBond { mm } + { \chemformula_new_bond:nn {#1} {#2} } + +\NewDocumentCommand \DeclareChemBond { mm } + { \chemformula_declare_bond:nn {#1} {#2} } + +\NewDocumentCommand \RenewChemBond { mm } + { \chemformula_renew_bond:nn {#1} {#2} } + +\NewDocumentCommand \NewChemBondAlias { mm } + { \chemformula_new_bond_alias:nn {#1} {#2} } + +\NewDocumentCommand \DeclareChemBondAlias { mm } + { \chemformula_declare_bond_alias:nn {#1} {#2} } + \NewDocumentCommand \ShowChemBond { m } - { - \prop_get:NnN \l__chemformula_bonds_prop { #1 } \l__chemformula_tmpa_tl - \tl_to_str:N \l__chemformula_tmpa_tl - } + { \chemformula_show_bond:n {#1} } \NewDocumentCommand \bond { m } - { \chemformula_bond:n { #1 } } + { \chemformula_bond:n {#1} } % now let's declare some default bonds: \NewChemBond{single} @@ -1574,7 +1589,6 @@ } \NewChemBondAlias{deloc}{semidouble} -% \DeclareChemBondAlias{deloc2}{semidouble} \NewChemBond{triple} { @@ -1615,16 +1629,16 @@ \cs_new:Npn \__chemformula_number_style:n #1 { \bool_if:NTF \l__chemformula_number_style_math_bool - { \ensuremath { #1 } } - { \ensuremath { \text { #1 } } } + { \ensuremath {#1} } + { \ensuremath { \text {#1} } } } \cs_generate_variant:Nn \__chemformula_number_style:n { V } \cs_new_protected:Npn \chemformula_charge_style:n #1 { \bool_if:NTF \l__chemformula_charge_style_math_bool - { \ensuremath { #1 } } - { \ensuremath { \text { #1 } } } + { \ensuremath {#1} } + { \ensuremath { \text {#1} } } } \cs_generate_variant:Nn \chemformula_charge_style:n { V } @@ -1633,16 +1647,16 @@ \cs_new_protected:Npn \chemformula_subscript:n #1 { \chemformula_nobreak: - \tl_if_eq:nnTF { #1 }{ \chemformula_superscript:n } + \tl_if_eq:nnTF {#1}{ \chemformula_superscript:n } { \__chemformula_subscript:n } { - \tl_if_eq:nnTF { #1 }{ \chemformula_subscript:n } + \tl_if_eq:nnTF {#1}{ \chemformula_subscript:n } { \__chemformula_subscript:n } { - \tl_set:Nn \l__chemformula_tmpc_tl { #1 } - \tl_if_in:nnT { #1 } { \chemformula_subscript:n } + \tl_set:Nn \l__chemformula_tmpc_tl {#1} + \tl_if_in:nnT {#1} { \chemformula_subscript:n } { \tl_remove_all:Nn \l__chemformula_tmpc_tl { \chemformula_subscript:n } } - \tl_if_in:nnT { #1 } { \chemformula_superscript:n } + \tl_if_in:nnT {#1} { \chemformula_superscript:n } { \tl_remove_all:Nn \l__chemformula_tmpc_tl { \chemformula_superscript:n } } \__chemformula_subscript:V \l__chemformula_tmpc_tl } @@ -1652,7 +1666,7 @@ % handle subscripts \cs_new_protected:Npn \__chemformula_subscript:n #1 { - \tl_put_right:Nn \l__chemformula_subscript_tl { #1 } + \tl_put_right:Nn \l__chemformula_subscript_tl {#1} \__chemformula_clean_subscript: % if a subscript follows just store and do nothing else \peek_meaning:NF \chemformula_subscript:n @@ -1706,9 +1720,9 @@ \c_math_toggle_token \scriptstyle \prop_get:NoNTF \l__chemformula_numbers_prop - { #1 } \l__chemformula_tmpa_tl + {#1} \l__chemformula_tmpa_tl { \__chemformula_number_style:V \l__chemformula_tmpa_tl } - { \__chemformula_number_style:n { #1 } } + { \__chemformula_number_style:n {#1} } \c_math_toggle_token } \group_end: @@ -1718,7 +1732,7 @@ \cs_new_protected:Npn \__chemformula_measure_subscript:n #1 { \hbox_set:Nn \l__chemformula_tmpa_box - { \__chemformula_subscript_write:n { #1 } } + { \__chemformula_subscript_write:n {#1} } \dim_set:Nn \l__chemformula_subscript_dim { -\box_wd:N \l__chemformula_tmpa_box } \box_clear:N \l__chemformula_tmpa_box @@ -1730,16 +1744,16 @@ \cs_new_protected:Npn \chemformula_superscript:n #1 { \chemformula_nobreak: - \tl_if_eq:nnTF { #1 } { \chemformula_superscript:n } + \tl_if_eq:nnTF {#1} { \chemformula_superscript:n } { \__chemformula_superscript:n } { - \tl_if_eq:nnTF { #1 } { \chemformula_subscript:n } + \tl_if_eq:nnTF {#1} { \chemformula_subscript:n } { \__chemformula_superscript:n } { - \tl_set:Nn \l__chemformula_tmpc_tl { #1 } - \tl_if_in:nnT { #1 } { \chemformula_subscript:n } + \tl_set:Nn \l__chemformula_tmpc_tl {#1} + \tl_if_in:nnT {#1} { \chemformula_subscript:n } { \tl_remove_all:Nn \l__chemformula_tmpc_tl { \chemformula_subscript:n } } - \tl_if_in:nnT { #1 } { \chemformula_superscript:n } + \tl_if_in:nnT {#1} { \chemformula_superscript:n } { \tl_remove_all:Nn \l__chemformula_tmpc_tl { \chemformula_superscript:n } } \__chemformula_superscript:V \l__chemformula_tmpc_tl } @@ -1749,7 +1763,7 @@ % handle superscripts \cs_new_protected:Npn \__chemformula_superscript:n #1 { - \tl_put_right:Nn \l__chemformula_superscript_tl { #1 } + \tl_put_right:Nn \l__chemformula_superscript_tl {#1} \__chemformula_clean_superscript: \peek_meaning:NF \chemformula_superscript:n { @@ -1829,15 +1843,15 @@ \bool_if:NTF \l__chemformula_kroegervink_bool { \prop_get:NoNTF \l__chemformula_kroegervink_prop - { #1 } \l__chemformula_tmpa_tl + {#1} \l__chemformula_tmpa_tl { \tl_use:N \l__chemformula_tmpa_tl } - { \chemformula_charge_style:n { #1 } } + { \chemformula_charge_style:n {#1} } } { \prop_get:NoNTF \l__chemformula_charge_prop - { #1 } \l__chemformula_tmpa_tl + {#1} \l__chemformula_tmpa_tl { \tl_use:N \l__chemformula_tmpa_tl } - { \chemformula_charge_style:n { #1 } } + { \chemformula_charge_style:n {#1} } } \c_math_toggle_token } @@ -1848,7 +1862,7 @@ \cs_new_protected:Npn \__chemformula_measure_superscript:n #1 { \hbox_set:Nn \l__chemformula_tmpa_box - { \__chemformula_superscript_write:n { #1 } } + { \__chemformula_superscript_write:n {#1} } \dim_set:Nn \l__chemformula_superscript_dim { -\box_wd:N \l__chemformula_tmpa_box } \box_clear:N \l__chemformula_tmpa_box @@ -1957,18 +1971,18 @@ \cs_new_protected:Npn \chemformula_input:n #1 { \__chemformula_save_catcodes: - \__chemformula_sanitize:Nn \l__chemformula_chemformula_tmpa_tl { #1 } + \__chemformula_sanitize:Nn \l__chemformula_chemformula_tmpa_tl {#1} \chemformula_input_escape_text:V \l__chemformula_chemformula_tmpa_tl - \chemformula_input_escape_math:n { #1 } - \chemformula_input_stoich:n { #1 } + \chemformula_input_escape_math:n {#1} + \chemformula_input_stoich:n {#1} \__chemformula_clean_chemmacros:V \l__chemformula_chemformula_tmpa_tl \chemformula_input_cmpd:VN \l__chemformula_chemformula_tmpa_tl \l__chemformula_input_tl - \chemformula_input_arrow:n { #1 } - \chemformula_input_name:n { #1 } - \chemformula_input_plus:n { #1 } - \chemformula_input_up:n { #1 } - \chemformula_input_down:n { #1 } + \chemformula_input_arrow:n {#1} + \chemformula_input_name:n {#1} + \chemformula_input_plus:n {#1} + \chemformula_input_up:n {#1} + \chemformula_input_down:n {#1} } % -------------------------------------------------------------------------- @@ -1979,7 +1993,7 @@ \char_set_catcode_other:N \@ \tl_set_rescan:Nnn \l__chemformula_tmpa_tl { \char_set_catcode_letter:N \@ } - { #1 } + {#1} \tl_if_in:VnTF \l__chemformula_tmpa_tl { @ } { \bool_set_true:N \l__chemformula_options_bool @@ -2000,26 +2014,24 @@ { \bool_set_true:N \l__chemformula_stoich_bool % the factor consists only of a parenthesis or a decimal marcer: - % \bool_set_true:N \l__chemformula_no_stoich_bool - % \tl_map_inline:nn { #1 } - % { - % \prop_if_in:NnF \l__chemformula_no_stoich_prop { ##1 } - % { \bool_set_false:N \l__chemformula_no_stoich_bool } - % } - % \bool_if:NF \l__chemformula_no_stoich_bool - % { - \tl_map_inline:nn { #1 } - { - \prop_get:NnNTF \l__chemformula_stoich_prop { ##1 } \l__chemformula_tmpa_tl + \bool_set_true:N \l__chemformula_no_stoich_bool + \tl_map_inline:nn {#1} + { + \prop_if_in:NnF \l__chemformula_no_stoich_prop {##1} + { \bool_set_false:N \l__chemformula_no_stoich_bool } + } + \bool_if:NF \l__chemformula_no_stoich_bool + { + \tl_map_inline:nn {#1} { - % \bool_if:NT \l__chemformula_stoich_bool - % { - \tl_put_right:NV \l__chemformula_stoich_tl \l__chemformula_tmpa_tl - % } - } - { \bool_set_false:N \l__chemformula_stoich_bool } + \prop_get:NnNTF \l__chemformula_stoich_prop {##1} \l__chemformula_tmpa_tl + { + \bool_if:NT \l__chemformula_stoich_bool + { \tl_put_right:NV \l__chemformula_stoich_tl \l__chemformula_tmpa_tl } + } + { \bool_set_false:N \l__chemformula_stoich_bool } + } } - % } \bool_if:NTF \l__chemformula_stoich_bool { \tl_if_blank:VF \l__chemformula_stoich_tl @@ -2035,25 +2047,25 @@ { \tl_clear:N \l__chemformula_stoich_tl } } -\cs_new:Npn \chemformula_bm:n #1 { #1 } +\cs_new:Npn \chemformula_bm:n #1 {#1} \cs_new:Npn \__chemformula_print_stoich:n #1 - { \chemformula_parse_stoich:n { #1 } } + { \chemformula_parse_stoich:n {#1} } \cs_generate_variant:Nn \__chemformula_print_stoich:n { V } \cs_new_protected:Npn \chemformula_parse_stoich:n #1 { \__chemformula_parse_stoich:w #1 \q_nil } \NewDocumentCommand \chstoich { m } - { \chemformula_parse_stoich:n { #1 } } + { \chemformula_parse_stoich:n {#1} } \cs_new:Npn \__chemformula_parse_stoich:w \q_mark #1 \q_nil { \__chemformula_bool_set_if_first_last:Nnnn - \l__chemformula_stoich_is_iupac_bool { #1 } { ( } { ) } + \l__chemformula_stoich_is_iupac_bool {#1} { ( } { ) } \bool_if:NTF \l__chemformula_stoich_is_iupac_bool - { \__chemformula_parse_stoich_iupac:n { #1 } } - { \__chemformula_parse_stoich_regular:n { #1 } } + { \__chemformula_parse_stoich_iupac:n {#1} } + { \__chemformula_parse_stoich_regular:n {#1} } } \DeclareInstance { xfrac } { chemformula-text-frac } { text } @@ -2065,25 +2077,25 @@ \cs_new:Npn \__chemformula_parse_stoich_regular:n #1 { - \tl_if_in:nnTF { #1 } { / } - { \__chemformula_parse_stoich_frac:n { #1 } } - { \__chemformula_parse_stoich_decimal:n { #1 } } + \tl_if_in:nnTF {#1} { / } + { \__chemformula_parse_stoich_frac:n {#1} } + { \__chemformula_parse_stoich_decimal:n {#1} } } \cs_new_protected:Npn \__chemformula_parse_stoich_decimal:n #1 { % get head: - \tl_set:Nx \l__chemformula_tmpa_tl { \tl_head:n { #1 } } + \tl_set:Nx \l__chemformula_tmpa_tl { \tl_head:n {#1} } \tl_set:Nn \l__chemformula_tmpb_tl { \chemformula_decimal: } % check if stoich starts with decimal-marker and add leading 0 if so: \tl_if_eq:NNTF \l__chemformula_tmpa_tl \l__chemformula_tmpb_tl { \tl_put_right:Nn \l__chemformula_input_tl { 0#1 } } - { \tl_put_right:Nn \l__chemformula_input_tl { #1 } } + { \tl_put_right:Nn \l__chemformula_input_tl {#1} } } \cs_new:Npn \__chemformula_parse_stoich_frac:n #1 { - \tl_if_in:nnTF { #1 } { _ } + \tl_if_in:nnTF {#1} { _ } { \__chemformula_parse_stoich_misc_frac:w #1 \q_nil } { \__chemformula_parse_stoich_frac:w #1 \q_nil } } @@ -2091,26 +2103,26 @@ \cs_new_protected:Npn \__chemformula_parse_stoich_frac:w #1/#2 \q_nil { \tl_put_right:Nn \l__chemformula_input_tl - { \__chemformula_frac:nn { #1 } { #2 } } + { \__chemformula_frac:nn {#1} {#2} } } \cs_new_protected:Npn \__chemformula_parse_stoich_misc_frac:w #1_#2/#3 \q_nil { \tl_put_right:Nn \l__chemformula_input_tl - { \__chemformula_misc_frac:nnn { #1 } { #2 } { #3 } } + { \__chemformula_misc_frac:nnn {#1} {#2} {#3} } } \cs_new_protected:Npn \__chemformula_parse_stoich_iupac:n #1 { \bool_if:NTF \l__chemformula_stoich_parse_iupac_bool { \__chemformula_parse_stoich_iupac:w #1 \q_nil } - { \tl_put_right:Nn \l__chemformula_input_tl { #1 } } + { \tl_put_right:Nn \l__chemformula_input_tl {#1} } } \cs_new:Npn \__chemformula_parse_stoich_iupac:w (#1) \q_nil { \tl_put_right:Nn \l__chemformula_input_tl { ( } - \__chemformula_parse_stoich_regular:n { #1 } + \__chemformula_parse_stoich_regular:n {#1} \tl_put_right:Nn \l__chemformula_input_tl { ) } } @@ -2125,7 +2137,7 @@ \bool_if:NT \l__chemformula_mathfrac_bool { \c_math_toggle_token - \chemformula_math_frac:nn { \text { #1 } } { \text { #2 } } + \chemformula_math_frac:nn { \text {#1} } { \text {#2} } \c_math_toggle_token } } @@ -2140,7 +2152,7 @@ { #1 \c_math_toggle_token - \chemformula_math_frac:nn { \text { #2 } } { \text { #3 } } + \chemformula_math_frac:nn { \text {#2} } { \text {#3} } \c_math_toggle_token } } @@ -2151,17 +2163,17 @@ { \tl_if_blank:VTF \l__chemformula_stoich_tl { - \tl_if_eq:nnT { #1 } { + } + \tl_if_eq:nnT {#1} { + } { \bool_set_true:N \l__chemformula_is_plus_bool } - \tl_if_eq:nnT { #1 } { - } + \tl_if_eq:nnT {#1} { - } { \bool_set_true:N \l__chemformula_is_plus_bool } - \tl_if_eq:nnT { #1 } { v } + \tl_if_eq:nnT {#1} { v } { \bool_set_true:N \l__chemformula_is_down_bool } - \tl_if_eq:nnT { #1 } { ^ } + \tl_if_eq:nnT {#1} { ^ } { \bool_set_true:N \l__chemformula_is_up_bool } - \__chemformula_detect_arrows:n { #1 } - \__chemformula_detect_name:n { #1 } - \chemformula_input_options:n { #1 } + \__chemformula_detect_arrows:n {#1} + \__chemformula_detect_name:n {#1} + \chemformula_input_options:n {#1} \bool_if:NT \l__chemformula_is_option_bool { \tl_put_right:Nn #2 @@ -2184,7 +2196,7 @@ !\l__chemformula_first_last_math_bool } { - \__chemformula_handle_sub_and_superscripts:nN { #1 } #2 + \__chemformula_handle_sub_and_superscripts:nN {#1} #2 \bool_if:NT \l__chemformula_options_bool { \tl_put_right:Nn #2 @@ -2221,19 +2233,19 @@ \tl_use:N \l__chemformula_format_tl \exp_args:No \tl_if_eq:nnTF { \f@series } { bx } { \cs_set_eq:NN \chemformula_bm:n \bm } - { \cs_set:Nn \chemformula_bm:n { ##1 } } + { \cs_set:Nn \chemformula_bm:n {##1} } } \cs_new:Npn \chemformula_font: {} \cs_new:Npn \__chemformula_fontspec:n #1 { - \tl_if_in:nnTF { #1 } { [ } + \tl_if_in:nnTF {#1} { [ } { \__chemformula_fontspec_aux:w #1 \q_stop } { \__chemformula_fontspec_aux:w [] #1 \q_stop } } \cs_new:Npn \__chemformula_fontspec_aux:w [#1]#2 \q_stop - { \newfontfamily \chemformula_font: [ #1 ] { #2 } } + { \newfontfamily \chemformula_font: [ #1 ] {#2} } \cs_new_protected:Npn \__chemformula_save_catcodes: { @@ -2277,7 +2289,7 @@ % ensure " is other: \char_set_catcode_other:N \" } - { #2 } + {#2} } \cs_generate_variant:Nn \__chemformula_sanitize:Nn { NV } @@ -2293,12 +2305,12 @@ } \cs_new_protected:Npn \__chemformula_reset:Nn #1#2 - { \tl_set_rescan:Nnn #1 { \__chemformula_restore: } { #2 } } + { \tl_set_rescan:Nnn #1 { \__chemformula_restore: } {#2} } \cs_generate_variant:Nn \__chemformula_reset:Nn { NV } \cs_new_protected:Npn \__chemformula_handle_sub_and_superscripts:nN #1#2 { - \__chemformula_sanitize:Nn \l__chemformula_tmpa_tl { #1 } + \__chemformula_sanitize:Nn \l__chemformula_tmpa_tl {#1} % let's see if the compound starts with a sub- or superscript: \tl_if_in:xnT { \tl_head:V \l__chemformula_tmpa_tl } { ^ } { @@ -2333,28 +2345,28 @@ \int_compare:nTF { \l__chemformula_count_tokens_int = \tl_count:N \l__chemformula_tmpa_tl } { - \tl_if_eq:nnTF { ##1 } { + } + \tl_if_eq:nnTF {##1} { + } { \tl_put_right:Nn #2 { \chemformula_superscript:n { \chemformula_plus: } } } { - \tl_if_eq:nnTF { ##1 } { - } + \tl_if_eq:nnTF {##1} { - } { \tl_put_right:Nn #2 { \chemformula_superscript:n { \chemformula_minus: } } } { - \prop_get:NnNTF \l__chemformula_cmpd_prop { ##1 } \l__chemformula_tmpb_tl + \prop_get:NnNTF \l__chemformula_cmpd_prop {##1} \l__chemformula_tmpb_tl { \tl_put_right:NV #2 \l__chemformula_tmpb_tl } - { \tl_put_right:Nn #2 { ##1 } } + { \tl_put_right:Nn #2 {##1} } } } } { - \prop_get:NnNTF \l__chemformula_cmpd_prop { ##1 } \l__chemformula_tmpb_tl + \prop_get:NnNTF \l__chemformula_cmpd_prop {##1} \l__chemformula_tmpb_tl { \tl_put_right:NV #2 \l__chemformula_tmpb_tl } - { \tl_put_right:Nn #2 { ##1 } } + { \tl_put_right:Nn #2 {##1} } } } \bool_if:NT \l__chemformula_kroegervink_bool @@ -2370,7 +2382,7 @@ \cs_new_protected:Npn \__chemformula_clean_chemmacros:n #1 { \cs_set:Nn \chemmacros_text:n - { \mode_if_math:TF { \text { ##1 } } { ##1 } } + { \mode_if_math:TF { \text {##1} } {##1} } \cs_set:Npn \chemmacros_xspace: {} } \cs_generate_variant:Nn \__chemformula_clean_chemmacros:n { V } @@ -2379,7 +2391,7 @@ % input "and" sign \cs_new_protected:Npn \chemformula_input_plus:n #1 { - \tl_if_eq:nnT { #1 } { + } + \tl_if_eq:nnT {#1} { + } { \tl_put_right:Nn \l__chemformula_input_tl { @@ -2390,7 +2402,7 @@ { \l__chemformula_plus_penalty_tl } } } - \tl_if_eq:nnT { #1 } { - } + \tl_if_eq:nnT {#1} { - } { \tl_put_right:Nn \l__chemformula_input_tl { @@ -2411,7 +2423,7 @@ \group_begin: % ensure ^ has catcode 7 % (else chemmacros wouldn't work with e.g. `breqn') - \__chemformula_sanitize:Nn \g__chemformula_input_up_tl { #1 } + \__chemformula_sanitize:Nn \g__chemformula_input_up_tl {#1} \char_set_catcode_math_superscript:N \^ \__chemformula_input_up:V \g__chemformula_input_up_tl } @@ -2419,7 +2431,7 @@ \cs_new_protected:Npn \__chemformula_input_up:n #1 { \tl_gclear:N \g__chemformula_input_up_tl - \tl_if_eq:nnT { #1 } { ^ } + \tl_if_eq:nnT {#1} { ^ } { \tl_gset:Nn \g__chemformula_input_up_tl { \c_math_toggle_token \uparrow \c_math_toggle_token } @@ -2434,7 +2446,7 @@ % input precipitate \cs_new_protected:Npn \chemformula_input_down:n #1 { - \tl_if_eq:nnT { #1 } { v } + \tl_if_eq:nnT {#1} { v } { \tl_put_right:Nn \l__chemformula_input_tl { \c_math_toggle_token \downarrow \c_math_toggle_token } @@ -2453,7 +2465,7 @@ !\l__chemformula_first_last_math_bool } { - \__chemformula_generate_arrows:Nn \l__chemformula_arrow_tmp_tl { #1 } + \__chemformula_generate_arrows:Nn \l__chemformula_arrow_tmp_tl {#1} \tl_put_right:NV \l__chemformula_input_tl \l__chemformula_arrow_tmp_tl } \bool_set_false:N \l__chemformula_is_arrow_bool @@ -2471,7 +2483,7 @@ !\l__chemformula_first_last_math_bool } { - \__chemformula_generate_name:Nn \l__chemformula_name_tmp_tl { #1 } + \__chemformula_generate_name:Nn \l__chemformula_name_tmp_tl {#1} \tl_put_right:NV \l__chemformula_input_tl \l__chemformula_name_tmp_tl } \bool_set_false:N \l__chemformula_is_name_bool @@ -2484,18 +2496,18 @@ { \int_zero:N \l__chemformula_tmpa_int \int_zero:N \l__chemformula_tmpb_int - \int_set:Nn \l__chemformula_tmpa_int { \tl_count:n { #2 } } - \tl_map_inline:nn { #2 } + \int_set:Nn \l__chemformula_tmpa_int { \tl_count:n {#2} } + \tl_map_inline:nn {#2} { \int_incr:N \l__chemformula_tmpb_int \int_compare:nT { \l__chemformula_tmpb_int = 1 } { - \tl_if_eq:nnT { ##1 } { #3 } + \tl_if_eq:nnT {##1} {#3} { \bool_set_true:N #1 } } \int_compare:nT { \l__chemformula_tmpb_int = \l__chemformula_tmpa_int } { - \tl_if_eq:nnF { ##1 } { #4 } + \tl_if_eq:nnF {##1} {#4} { \bool_set_false:N #1 } } } @@ -2503,7 +2515,7 @@ \cs_new_protected:Npn \chemformula_input_escape_text:n #1 { - \__chemformula_first_last_text:n { #1 } + \__chemformula_first_last_text:n {#1} \bool_if:NT \l__chemformula_first_last_double_bool { \bool_set_true:N \l__chemformula_first_last_text_bool @@ -2525,7 +2537,7 @@ \char_set_catcode_other:N \: } - { #1 } + {#1} \tl_replace_all:Nnn \l__chemformula_tmpa_tl { \_ } { chemformulaplaceholder } \tl_replace_all:Nnn \l__chemformula_tmpa_tl @@ -2538,10 +2550,10 @@ } \cs_new:Npn \__chemformula_read_escape_double:w "#1" \q_nil - { \__chemformula_read_escape_text:n { #1 } } + { \__chemformula_read_escape_text:n {#1} } \cs_new:Npn \__chemformula_read_escape_single:w '#1' \q_nil - { \__chemformula_read_escape_text:n { #1 } } + { \__chemformula_read_escape_text:n {#1} } \cs_new_protected:Npn \__chemformula_first_last_text:n #1 { @@ -2550,13 +2562,13 @@ \bool_set_false:N \l__chemformula_first_last_text_bool \__chemformula_bool_set_if_first_last:Nnnn \l__chemformula_first_last_double_bool - { #1 } + {#1} { " } { " } \bool_if:NF \l__chemformula_first_last_double_bool { \__chemformula_bool_set_if_first_last:Nnnn \l__chemformula_first_last_single_bool - { #1 } + {#1} { ' } { ' } } } @@ -2565,7 +2577,7 @@ % input escaped math \cs_new_protected:Npn \chemformula_input_escape_math:n #1 { - \__chemformula_first_last_math:n { #1 } + \__chemformula_first_last_math:n {#1} \bool_if:NT \l__chemformula_first_last_dollar_bool { \bool_set_true:N \l__chemformula_first_last_math_bool @@ -2599,10 +2611,10 @@ } \cs_new:Npn \__chemformula_read_escape_dollar:w $#1$ \q_nil - { \__chemformula_read_escape_math:n { #1 } } + { \__chemformula_read_escape_math:n {#1} } \cs_new:Npn \__chemformula_read_escape_mathbraces:w \(#1\) \q_nil - { \__chemformula_read_escape_math:n { #1 } } + { \__chemformula_read_escape_math:n {#1} } \cs_new_protected:Npn \__chemformula_first_last_math:n #1 { @@ -2611,13 +2623,13 @@ \bool_set_false:N \l__chemformula_first_last_mathbraces_bool \__chemformula_bool_set_if_first_last:Nnnn \l__chemformula_first_last_dollar_bool - { #1 } + {#1} { $ } { $ } \bool_if:NF \l__chemformula_first_last_dollar_bool { \__chemformula_bool_set_if_first_last:Nnnn \l__chemformula_first_last_mathbraces_bool - { #1 } + {#1} { \( } { \) } } } @@ -2641,11 +2653,11 @@ { \bool_set_true:N \l__chemformula_formal_chem_bool } , circletype .default:n = chem , charge-hshift .code:n = - \tl_if_eq:nnTF { #1 } { full } + \tl_if_eq:nnTF {#1} { full } { \bool_set_true:N \l__chemformula_charge_full_shift_bool } { \bool_set_false:N \l__chemformula_charge_full_shift_bool - \dim_set:Nn \l__chemformula_charge_shift_dim { #1 } + \dim_set:Nn \l__chemformula_charge_shift_dim {#1} } , charge-hshift .default:n = .25em , charge-vshift .tl_set:N = @@ -2694,11 +2706,11 @@ name-format .tl_set:N = \l__chemformula_name_format_tl , name-width .code:n = { - \tl_if_eq:nnTF { #1 } { auto } + \tl_if_eq:nnTF {#1} { auto } { \bool_set_false:N \l__chemformula_name_width_bool } { \bool_set_true:N \l__chemformula_name_width_bool - \dim_set:Nn \l__chemformula_name_dim { #1 } + \dim_set:Nn \l__chemformula_name_dim {#1} } } , bond-length .dim_set:N = \l__chemformula_bond_dim , @@ -2710,25 +2722,25 @@ \bool_set_true:N \l__chemformula_fss_bool \bool_set_false:N \l__chemformula_fontspec_bool \bool_set_true:N \l__chemformula_fss_family_bool - \tl_set:Nn \l__chemformula_font_family_tl { #1 } , + \tl_set:Nn \l__chemformula_font_family_tl {#1} , font-series .code:n = \bool_set_true:N \l__chemformula_fss_bool \bool_set_false:N \l__chemformula_fontspec_bool \bool_set_true:N \l__chemformula_fss_series_bool - \tl_set:Nn \l__chemformula_font_series_tl { #1 } , + \tl_set:Nn \l__chemformula_font_series_tl {#1} , font-shape .code:n = \bool_set_true:N \l__chemformula_fss_bool \bool_set_false:N \l__chemformula_fontspec_bool \bool_set_true:N \l__chemformula_fss_shape_bool - \tl_set:Nn \l__chemformula_font_shape_tl { #1 } , + \tl_set:Nn \l__chemformula_font_shape_tl {#1} , font-spec .code:n = \bool_set_false:N \l__chemformula_fss_bool \bool_set_true:N \l__chemformula_fontspec_bool - \__chemformula_fontspec:n { #1 } , + \__chemformula_fontspec:n {#1} , format .code:n = \bool_set_false:N \l__chemformula_fss_bool \bool_set_false:N \l__chemformula_fontspec_bool - \tl_set:Nn \l__chemformula_format_tl { #1 } + \tl_set:Nn \l__chemformula_format_tl {#1} } % -------------------------------------------------------------------------- @@ -2749,20 +2761,20 @@ \cs_new_protected:Npn \chemformula_lewis:nnn #1#2#3 { \group_begin: - \keys_set:nn { chemmacros / chemformula } { #1 } + \keys_set:nn { chemmacros / chemformula } {#1} \int_gincr:N \g__chemformula_lewis_int - \chemformula_get_lewis_sequence:n { #2 } + \chemformula_get_lewis_sequence:n {#2} \chemformula_tikz:nn { baseline } { \chemformula_node:nxn { anchor=base , inner~sep=0pt } { chlewis-\int_use:N \g__chemformula_lewis_int } { \bool_if:NTF \l_chemformula_inside_ch_bool - { #3 } - { \chemformula_chcpd:nn {} { #3 } } + {#3} + { \chemformula_chcpd:nn {} {#3} } } \seq_map_inline:Nn \l__chemformula_tmpa_seq - { \chemformula_lewis_get_angle_and_spec:n { ##1 } } + { \chemformula_lewis_get_angle_and_spec:n {##1} } } \group_end: } @@ -2786,23 +2798,23 @@ \cs_new_protected:Npn \__chemformula_lewis_get_angle_and_spec:w #1 \scan_stop: #2 \scan_stop: #3 \q_stop { - \tl_if_blank:nF { #1 } + \tl_if_blank:nF {#1} { - \tl_set:Nn \l__chemformula_elspec_angle_tl { #1 } - \tl_if_blank:nTF { #2 } + \tl_set:Nn \l__chemformula_elspec_angle_tl {#1} + \tl_if_blank:nTF {#2} { \tl_set_eq:NN \l__chemformula_elspec_type_tl \l__chemformula_elspec_default_type_tl } - { \tl_set:Nn \l__chemformula_elspec_type_tl { #2 } } + { \tl_set:Nn \l__chemformula_elspec_type_tl {#2} } \__chemformula_lewis_set_elspec_type:V \l__chemformula_elspec_type_tl } } \cs_new_protected:Npn \__chemformula_lewis_set_elspec_type:n #1 { - \prop_get:NnNT \l__chemformula_lewis_elspec_types_prop { #1 } + \prop_get:NnNT \l__chemformula_lewis_elspec_types_prop {#1} \l__chemformula_tmpa_tl { \tl_use:N \l__chemformula_tmpa_tl } } @@ -2966,12 +2978,12 @@ } \NewDocumentCommand\chlewis{O{}mm} - { \chemformula_lewis:nnn { #1 } { #2 } { #3 } } + { \chemformula_lewis:nnn {#1} {#2} {#3} } % -------------------------------------------------------------------------- \NewDocumentCommand \setchemformula { m } - { \keys_set:nn { chemmacros / chemformula } { #1 } } + { \keys_set:nn { chemmacros / chemformula } {#1} } \setchemformula{ bond-style = {} , @@ -2984,11 +2996,11 @@ { \pdfstringdefDisableCommands { - \cs_set:Npn \chcpd #1 { #1 } - \cs_set:Npn \charrow #1 { #1 } + \cs_set:Npn \chcpd #1 {#1} + \cs_set:Npn \charrow #1 {#1} \cs_set:Npn \chname (#1)(#2) { #2~(#1) } - \cs_set:Npn \ch #1 { #1 } - \cs_set:Npn \chlewis #1#2 { #2 } + \cs_set:Npn \ch #1 {#1} + \cs_set:Npn \chlewis #1#2 {#2} } } @@ -3153,6 +3165,7 @@ VERSION HISTORY \RenewChemCompoundProperty, \DeclareChemCompoundProperty, \RemoveChemCompoundProperty +2015/04/03 - version 4.10a - bug fix in \chemformula_input_stoich:n % -------------------------------------------------------------------------- % TODO |