diff options
Diffstat (limited to 'macros/latex/contrib/chemmacros/chemmacros.module.redox.code.tex')
-rw-r--r-- | macros/latex/contrib/chemmacros/chemmacros.module.redox.code.tex | 45 |
1 files changed, 20 insertions, 25 deletions
diff --git a/macros/latex/contrib/chemmacros/chemmacros.module.redox.code.tex b/macros/latex/contrib/chemmacros/chemmacros.module.redox.code.tex index cbc0b2e242..2c0421b470 100644 --- a/macros/latex/contrib/chemmacros/chemmacros.module.redox.code.tex +++ b/macros/latex/contrib/chemmacros/chemmacros.module.redox.code.tex @@ -25,7 +25,7 @@ % % The Current Maintainer of this work is Clemens Niederberger. % -------------------------------------------------------------------------- -\ChemModule{redox}{2015/09/30 oxidation numbers, redox reactions} +\ChemModule{redox}{2020/02/02 oxidation numbers, redox reactions} \chemmacros_load_modules:n {tikz,xfrac} @@ -85,18 +85,14 @@ \ChemCompatibilityTo{5.4} \cs_new_protected:Npn \__chemmacros_ox_sign:n #1 { - \bool_if:nT - { - \fp_compare_p:n { #1 > 0 } && - \l__chemmacros_ox_explicit_sign_bool - } + \bool_lazy_and:nnT + { \fp_compare_p:n { #1 > 0 } } + { \l__chemmacros_ox_explicit_sign_bool } { \c_math_toggle_token + \c_math_toggle_token } - \bool_if:nT - { - \fp_compare_p:n { #1 = 0 } && - \l__chemmacros_ox_explicit_sign_bool - } - { \c_math_toggle_token \pm \c_math_toggle_token } + \bool_lazy_and:nnT + { \fp_compare_p:n { #1 = 0 } } + { \l__chemmacros_ox_explicit_sign_bool } + { \c_math_toggle_token \pm \c_math_toggle_token } \fp_compare:nT { #1 < 0 } { \c_math_toggle_token - \c_math_toggle_token } } @@ -104,19 +100,17 @@ \ChemCompatibilityFrom{5.4} \cs_new_protected:Npn \__chemmacros_ox_sign:n #1 { - \bool_if:nT + \bool_lazy_and:nnT + { \fp_compare_p:n { #1 > 0 } } + { \l__chemmacros_ox_explicit_sign_bool } + { \c_math_toggle_token + \c_math_toggle_token } + \bool_lazy_all:nT { - \fp_compare_p:n { #1 > 0 } && - \l__chemmacros_ox_explicit_sign_bool + { \fp_compare_p:n { #1 = 0 } } + { \l__chemmacros_ox_explicit_sign_bool } + { \l__chemmacros_ox_explicit_zero_sign_bool } } - { \c_math_toggle_token + \c_math_toggle_token } - \bool_if:nT - { - \fp_compare_p:n { #1 = 0 } && - \l__chemmacros_ox_explicit_sign_bool && - \l__chemmacros_ox_explicit_zero_sign_bool - } - { \c_math_toggle_token \pm \c_math_toggle_token } + { \c_math_toggle_token \pm \c_math_toggle_token } \fp_compare:nT { #1 < 0 } { \c_math_toggle_token - \c_math_toggle_token } } @@ -334,7 +328,7 @@ % TODO: add option to make `#2' be parsed as chem formula \cs_new_protected:Npn \chemmacros_redox_partner:nn #1#2 { - \chemmacros_tex_if:nnTF {measuring@} {} + \legacy_if:nTF {measuring@} { \group_begin: \tikz[baseline=(#1.base)] { \node [inner~sep=0pt] (#1) {#2} ; } @@ -437,4 +431,5 @@ % -------------------------------------------------------------------------- \file_input_stop: 2015/09/30 - new option `explicit-zero-sign' - +2020/02/02 - lazy boolean evaluation + - prefer \legacy_if:nTF over \chemmacros_if_tex:nnTF |