From c8e3dae3f1927ad24133fbf27333831fdc3db48f Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 6 Jan 2022 21:08:20 +0000 Subject: siunitx (6jan22) git-svn-id: svn://tug.org/texlive/trunk@61515 c570f23f-e606-0410-a88d-b1316a301751 --- .../source/latex/siunitx/siunitx-complex.dtx | 30 +++----- .../source/latex/siunitx/siunitx-number.dtx | 80 +++++++++++++--------- Master/texmf-dist/source/latex/siunitx/siunitx.dtx | 2 +- 3 files changed, 57 insertions(+), 55 deletions(-) (limited to 'Master/texmf-dist/source/latex/siunitx') diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-complex.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-complex.dtx index 247d9acc0dc..8aa6e8ebc14 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx-complex.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx-complex.dtx @@ -603,7 +603,6 @@ % \begin{macro}{\@@_format_sign:nnnnnnn} % \begin{macro}{\@@_extract_exponent:nw} % \begin{macro}{\@@_extract_exponent_aux:w} -% \begin{macro}{\@@_format_unary:nnnnnnn} % \begin{macro}[EXP]{\@@_format_bracket:n} % We start here checking that there is something to do. % \begin{macrocode} @@ -643,7 +642,6 @@ \tl_if_empty:NF \l_@@_real_tl { \exp_after:wN \@@_drop_exponent:nnnnnnn \l_@@_real_tl } \exp_after:wN \@@_format_sign:nnnnnnn \l_@@_img_tl - \exp_after:wN \@@_format_unary:nnnnnnn \l_@@_img_tl \tl_set:Nx \l_@@_tmp_tl { \siunitx_number_output:NN \l_@@_img_tl \q_nil } \exp_after:wN \@@_extract_exponent:w \l_@@_tmp_tl \q_stop @@ -708,13 +706,20 @@ } % \end{macrocode} % Pull out the formatted exponent: we also need the sign. +% An imaginary part that is exactly $1$ is omitted, with only the complex +% root printed. That means checking and removing a lone $1$ here. % \begin{macrocode} \cs_new_protected:Npn \@@_extract_exponent:w #1 \q_nil #2 \q_nil #3 \q_nil #4 \q_nil #5 \q_nil #6 \q_nil #7 \q_nil #8 \q_nil #9 \q_stop { \tl_set:Nn \l_@@_sign_tl {#1#2} - \@@_extract_exponent_aux:nw {#3#4#5#6#7#8} #9 \q_stop + \bool_lazy_and:nnTF + { \str_if_eq_p:nn {#3} { 1 } } + { \tl_if_blank_p:n {#5} } + { \@@_extract_exponent_aux:nw {#6#7#8} } + { \@@_extract_exponent_aux:nw {#3#4#5#6#7#8} } + #9 \q_stop } \cs_new:Npn \@@_extract_exponent_aux:nw #1#2 \q_nil #3 \q_nil #4 \q_stop @@ -722,25 +727,6 @@ \tl_set:Nn \l_@@_tmp_tl {#1#2} \tl_set:Nn \l_@@_exp_tl {#3#4} } -% \end{macrocode} -% An imaginary part that is exactly $1$ is omitted, with only the complex -% root printed. That means checking and removing a lone $1$ here. -% \begin{macrocode} -\cs_new_protected:Npn \@@_format_unary:nnnnnnn #1#2#3#4#5#6#7 - { - \tl_set:Nx \l_@@_img_tl - { - \exp_not:n { {#1} {#2} } - \tl_if_blank:nTF {#4} - { - \str_if_eq:nnTF {#3} { 1 } - { { } { } } - { \exp_not:n { {#3} {#4} } } - } - { \exp_not:n { {#3} {#4} } } - \exp_not:n { {#5} {#6} {#7} } - } - } \cs_new_protected:Npn \@@_format_bracket:n #1 { \exp_not:V \l_@@_bracket_open_tl diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx index bb3abd6b7a3..6b457a2ff89 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx @@ -1196,8 +1196,8 @@ % Valid cases here are % \begin{itemize} % \item Entirely blank if the original input was for example |+e10|: -% simply clean up if in the integer part of issue an error if in -% a second part (complex number, \foreign{etc.}). +% simply clean up if in the integer part or issue an error if in +% a second part (uncertainty). % \item An integer part digit: pass through to the main collection % routine. % \item A decimal marker: store an empty integer part and move to @@ -1210,7 +1210,7 @@ \quark_if_recursion_tail_stop_do:Nn #3 { \bool_if:NTF #2 - { \tl_put_right:Nn #1 { { 1 } { } { } } } + { \tl_put_right:Nn #1 { { } { } { } } } { \@@_parse_loop_break:wN \q_recursion_stop } } \tl_if_in:NnTF \l_@@_input_digit_tl {#3} @@ -3198,9 +3198,9 @@ % } % \begin{macro}[rEXP] % { -% \@@_output_exponent:nnnn , -% \@@_output_exponent_auxi:nnnn , -% \@@_output_exponent_auxii:nnnn +% \@@_output_exponent:nnnnn , +% \@@_output_exponent_auxi:nnnnn , +% \@@_output_exponent_auxii:nnnnn % } % \begin{macro}[rEXP]{\@@_output_exponent_auxiii:nn} % \begin{macro}[rEXP]{\@@_output_end:} @@ -3236,7 +3236,7 @@ \@@_output_integer:nnn {#3} {#4} {#7} \@@_output_decimal:nn {#4} {#8} \@@_output_uncertainty:nnn {#5} {#4} {#8} - \@@_output_exponent:nnnn {#6} {#7} { #3 . #4 } {#8} + \@@_output_exponent:nnnnn {#6} {#7} {#3} {#4} {#8} \@@_output_end: } % \end{macrocode} @@ -3259,12 +3259,12 @@ } \@@_output_bracket:w } -\cs_new:Npn \@@_output_bracket:w #1 \@@_output_exponent:nnnn +\cs_new:Npn \@@_output_bracket:w #1 \@@_output_exponent:nnnnn { \exp_not:V \l_@@_bracket_open_tl #1 \exp_not:V \l_@@_bracket_close_tl - \@@_output_exponent:nnnn + \@@_output_exponent:nnnnn } % \end{macrocode} % As color for negative values applies to the \emph{whole} output, we have @@ -3340,17 +3340,26 @@ % \begin{macrocode} \cs_new:Npn \@@_output_integer:nnn #1#2#3 { - \bool_lazy_any:nT + \tl_if_blank:nTF {#1} { - { \l_@@_unity_mantissa_bool } - { ! \str_if_eq_p:nn { #1 . #2 } { 1. } } - { - \bool_lazy_and_p:nn - { \str_if_eq_p:nn {#3} { 0 } } - { ! \l_@@_zero_exponent_bool } - } + \bool_lazy_and:nnT + { \str_if_eq_p:nn {#3} { 0 } } + { ! \l_@@_zero_exponent_bool } + { \@@_output_digits:nn { integer } { 1 } } + } + { + \bool_lazy_any:nT + { + { \l_@@_unity_mantissa_bool } + { ! \str_if_eq_p:nn { #1 . #2 } { 1. } } + { + \bool_lazy_and_p:nn + { \str_if_eq_p:nn {#3} { 0 } } + { ! \l_@@_zero_exponent_bool } + } + } + { \@@_output_digits:nn { integer } {#1} } } - { \@@_output_digits:nn { integer } {#1} } } \cs_new:Npn \@@_output_decimal:nn #1#2 { @@ -3553,40 +3562,47 @@ % For signs, the auxiliary from the main sign routine can be used, but not % the main function: negative exponents don't have special handling. % \begin{macrocode} -\cs_new:Npn \@@_output_exponent:nnnn #1#2#3#4 +\cs_new:Npn \@@_output_exponent:nnnnn #1#2#3#4#5 { - \exp_not:n {#4} + \exp_not:n {#5} \bool_lazy_or:nnTF { \l_@@_zero_exponent_bool } { ! \str_if_eq_p:nn {#2} { 0 } } { \tl_if_empty:NTF \l_@@_output_exp_marker_tl - { \@@_output_exponent_auxi:nnnn } - { \@@_output_exponent_auxii:nnnn } - {#1} {#2} {#3} {#4} + { \@@_output_exponent_auxi:nnnnn } + { \@@_output_exponent_auxii:nnnnn } + {#1} {#2} {#3} {#4} {#5} } - { \exp_not:n {#4} } + { \exp_not:n {#5} } } -\cs_new:Npn \@@_output_exponent_auxi:nnnn #1#2#3#4 +\cs_new:Npn \@@_output_exponent_auxi:nnnnn #1#2#3#4#5 { - \bool_lazy_or:nnTF - { \l_@@_unity_mantissa_bool } - { ! \str_if_eq_p:nn {#3} { 1. } } + \bool_lazy_or:nnT + { + \bool_lazy_and_p:nn + { \l_@@_unity_mantissa_bool } + { \str_if_eq_p:nn { #3 . #4 } { 1. } } + } + { + ! \bool_lazy_or_p:nn + { \str_if_eq_p:nn { #3 . #4 } { 1. } } + { \tl_if_blank_p:n {#3} } + } { \bool_if:NTF \l_@@_tight_bool { \exp_not:N \mathord } { \use:n } { \exp_not:V \l_@@_exponent_product_tl } - \exp_not:n {#4} } - { \exp_not:n {#4} } + \exp_not:n {#5} \exp_not:V \l_@@_exponent_base_tl ^ { \@@_output_exponent_auxiii:nn {#1} {#2} } } -\cs_new:Npn \@@_output_exponent_auxii:nnnn #1#2#3#4 +\cs_new:Npn \@@_output_exponent_auxii:nnnnn #1#2#3#4#5 { - \exp_not:n {#4} + \exp_not:n {#5} \exp_not:V \l_@@_output_exp_marker_tl \@@_output_exponent_auxiii:nn {#1} {#2} } diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx.dtx index 228b98047cd..7ef3f726df4 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx.dtx @@ -121,7 +121,7 @@ % % Identify the package and give the over all version information. % \begin{macrocode} -\ProvidesExplPackage {siunitx} {2022-01-04} {3.0.38} +\ProvidesExplPackage {siunitx} {2022-01-05} {3.0.39} {A comprehensive (SI) units package} % \end{macrocode} % -- cgit v1.2.3