diff options
author | Karl Berry <karl@freefriends.org> | 2021-08-17 20:49:32 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-08-17 20:49:32 +0000 |
commit | f1eec09cda1fe0f51c7dd3c722cbc8621e6d1295 (patch) | |
tree | daa55c91db57cf444983230f0e509a1274e0095c | |
parent | a72444daf54a90226829464d6e5fe9ec42d1a3c9 (diff) |
siunitx (17aug21)
git-svn-id: svn://tug.org/texlive/trunk@60258 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md | 21 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/siunitx/siunitx-code.pdf | bin | 1499904 -> 1510786 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/siunitx/siunitx-print.pdf | bin | 484555 -> 0 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/siunitx/siunitx-unit.pdf | bin | 627332 -> 0 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/siunitx/siunitx.pdf | bin | 636250 -> 636202 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx | 184 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/siunitx/siunitx-print.dtx | 6 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/siunitx/siunitx-table.dtx | 67 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/siunitx/siunitx-unit.dtx | 11 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/siunitx/siunitx.dtx | 2 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/siunitx/siunitx.tex | 4 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/siunitx/siunitx.sty | 212 |
12 files changed, 429 insertions, 78 deletions
diff --git a/Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md b/Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md index 87f73526de6..d02f9594168 100644 --- a/Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md +++ b/Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md @@ -7,6 +7,24 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to ## [Unreleased] +## [v3.0.25] + +### Changed +- Default to sanserif units if `\familydefault` is `\sfdefault` + (issue [#516](https://github.com/josephwright/siunitx/issues/516)) + +### Fixed +- Rounding to an uncertainty of the same magnitude as the + value (issue + [#524](https://github.com/josephwright/siunitx/issues/524)) +- Extend `propogate-math-font` to cover `\mathbf` and `\mathit` + (issue [#525](https://github.com/josephwright/siunitx/issues/525)) +- Position of non-aligned non-numeric material in table cells when + centering decimal marker (issue + [#526](https://github.com/josephwright/siunitx/issues/526)) +- Treatment of multiple tokens for `input-ignore` (issue + [#531](https://github.com/josephwright/siunitx/issues/531)) + ## [v3.0.24] ### Fixed @@ -1521,7 +1539,8 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to ### Added - First public testing release (as `si`) -[Unreleased]: https://github.com/josephwright/siunitx/compare/v3.0.24...HEAD +[Unreleased]: https://github.com/josephwright/siunitx/compare/v3.0.25...HEAD +[v3.0.25]: https://github.com/josephwright/siunitx/compare/v3.0.24...v3.0.25 [v3.0.24]: https://github.com/josephwright/siunitx/compare/v3.0.23...v3.0.24 [v3.0.23]: https://github.com/josephwright/siunitx/compare/v3.0.22...v3.0.23 [v3.0.22]: https://github.com/josephwright/siunitx/compare/v3.0.21...v3.0.22 diff --git a/Master/texmf-dist/doc/latex/siunitx/siunitx-code.pdf b/Master/texmf-dist/doc/latex/siunitx/siunitx-code.pdf Binary files differindex c0a7e9b1fee..6e575cff026 100644 --- a/Master/texmf-dist/doc/latex/siunitx/siunitx-code.pdf +++ b/Master/texmf-dist/doc/latex/siunitx/siunitx-code.pdf diff --git a/Master/texmf-dist/doc/latex/siunitx/siunitx-print.pdf b/Master/texmf-dist/doc/latex/siunitx/siunitx-print.pdf Binary files differdeleted file mode 100644 index e1a77edadf3..00000000000 --- a/Master/texmf-dist/doc/latex/siunitx/siunitx-print.pdf +++ /dev/null diff --git a/Master/texmf-dist/doc/latex/siunitx/siunitx-unit.pdf b/Master/texmf-dist/doc/latex/siunitx/siunitx-unit.pdf Binary files differdeleted file mode 100644 index 0050caf4e50..00000000000 --- a/Master/texmf-dist/doc/latex/siunitx/siunitx-unit.pdf +++ /dev/null diff --git a/Master/texmf-dist/doc/latex/siunitx/siunitx.pdf b/Master/texmf-dist/doc/latex/siunitx/siunitx.pdf Binary files differindex 67b9a4fbee1..5d7777db9cb 100644 --- a/Master/texmf-dist/doc/latex/siunitx/siunitx.pdf +++ b/Master/texmf-dist/doc/latex/siunitx/siunitx.pdf diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx index 38db10d71b7..924aaa3b0fe 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx @@ -807,6 +807,11 @@ { \group_begin: \tl_clear:N \l_@@_parsed_tl + \tl_map_inline:Nn \l_@@_input_ignore_tl + { + \token_if_macro:NT ##1 + { \cs_set_eq:NN ##1 \scan_stop: } + } \protected@edef \l_@@_arg_tl { \bool_if:NTF \l_@@_expression_bool @@ -815,9 +820,8 @@ } \tl_set_eq:NN \l_@@_input_tl \l_@@_arg_tl \siunitx_number_normalize_symbols:N \l_@@_arg_tl - \protected@edef \l_@@_input_ignore_tl { \l_@@_input_ignore_tl } - \tl_if_empty:NF \l_@@_input_ignore_tl - { \tl_remove_all:NV \l_@@_arg_tl \l_@@_input_ignore_tl } + \tl_map_inline:Nn \l_@@_input_ignore_tl + { \tl_remove_all:Nn \l_@@_arg_tl {##1} } \tl_if_empty:NF \l_@@_arg_tl { \@@_parse_comparator: } \@@_parse_check: @@ -2201,6 +2205,9 @@ % \begin{macro}[EXP]{\@@_round_auxvi:nN} % \begin{macro}[EXP]{\@@_round_auxvii:nnN, \@@_round_auxviii:nnN} % \begin{macro}[EXP]{\@@_round_final_integer:nnw, \@@_round_final_decimal:nnw} +% \begin{macro}[EXP]{\@@_round_final_signicant:n} +% \begin{macro}[EXP]{\@@_round_final_signicant:N} +% \begin{macro}[EXP]{\@@_round_final_signicant:w} % \begin{macro}[EXP]{\@@_round_final_output:nn, \@@_round_final_output:ff} % \begin{macro}[EXP]{\@@_round_final:nn, \@@_round_final:fn} % \begin{macro}[EXP]{\@@_round_final_shift:nn, \@@_round_final_shift:ff} @@ -2259,7 +2266,10 @@ % one of which deals with the integer. In the latter, we should never hit % the end before we've dropped all the digits: the fixed-zero is a % fall-back in case something weird happens. For the integer case, we need -% to collect up zeros to pad the length back out correctly later. +% to collect up zeros to pad the length back out correctly later. We also +% have to cover the case where we round to exactly place above the length +% of the integer: that may product a value of $1\dots$: we tidy up the +% case where it comes out as $0$ later. % \begin{macrocode} \cs_new:Npn \@@_round_auxiii:nnnN #1#2#3#4 { @@ -2278,13 +2288,20 @@ \cs_new:Npn \@@_round_auxiv:nnnN #1#2#3#4 { \quark_if_recursion_tail_stop_do:Nn #4 - { { 0 } { } } + { + \int_compare:nNnTF {#1} = 0 + { + \@@_round_auxvi:nnN {#3} {#2} + 0 \q_recursion_tail \q_recursion_stop + } + { { 0 } { } } + } \int_compare:nNnTF {#1} > 0 { \exp_args:Nf \@@_round_auxiv:nnnN { \int_eval:n { #1 - 1 } } { #2 0 } { #4#3 } } - { \@@_round_auxvi:nnnN {#3} {#2} #4 } + { \@@_round_auxvi:nnN {#3} {#2} #4 } } % \end{macrocode} % The lead off to rounding proper needs to deal with the half-even rule: @@ -2312,7 +2329,7 @@ { \@@_round_auxvii:nnN } {#2} { } #3 } -\cs_new:Npn \@@_round_auxvi:nnnN #1#2#3 +\cs_new:Npn \@@_round_auxvi:nnN #1#2#3 { \quark_if_recursion_tail_stop_do:Nn #3 { { 0 } { } } @@ -2409,9 +2426,27 @@ #1#2#3 \q_recursion_tail \q_recursion_stop { \@@_round_final_output:ff - { \tl_reverse:n {#3} #2 } + { \exp_args:Ne \@@_round_final_significant:n { \tl_reverse:n {#3} #2 } } {#1} } +\cs_new:Npn \@@_round_final_significant:n #1 + { + \@@_round_final_significant:N #1 + \q_recursion_tail \q_recursion_stop + } +\cs_new:Npn \@@_round_final_significant:N #1 + { + \quark_if_recursion_tail_stop_do:Nn #1 { 0 } + \int_compare:nNnTF {#1} = 0 + { \@@_round_final_significant:N } + { + #1 + \@@_round_final_significant:w + } + } +\cs_new:Npn \@@_round_final_significant:w + #1 \q_recursion_tail \q_recursion_stop + {#1} \cs_new:Npn \@@_round_final_output:nn #1#2 { {#1} {#2} } \cs_generate_variant:Nn \@@_round_final_output:nn { ff } \cs_new:Npn \@@_round_final:nn #1#2 @@ -2442,7 +2477,6 @@ \int_compare:nNnTF { \tl_count:n {#1} } = 4 { \@@_round_engineering:NNNNn #1 {#2} - { } \@@_round_final_shift:Nw 3 } { {#1} {#2} } @@ -2467,11 +2501,13 @@ { \@@_exponent_shift:nnf { 1 } {#1} { \@@_round_truncate_direct:n {#2} } - { } \@@_round_final_shift:Nw 1 } -\cs_new:Npn \@@_round_final_shift:Nw #1#2 \@@_round_places_end:nn #3#4 - { \@@_exponent_finalise:n { #3#4 + #1 } } +\cs_new:Npn \@@_round_final_shift:Nw #1#2 \@@_round_places_end:nnn #3#4#5 + { + \exp_not:n { {#3} } + \@@_exponent_finalise:n { #4#5 + #1 } + } % \end{macrocode} % When we have rounded up to the next power of ten, we need to go back and % remove one more digit. That only happens when rounding to a number of @@ -2509,6 +2545,9 @@ % \end{macro} % \end{macro} % \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} % % \begin{macro}[EXP]{\@@_round_if_half_p:n} % \begin{macro}[EXP]{\@@_round_if_half:N} @@ -2622,7 +2661,7 @@ % \end{macro} % % \begin{macro}[EXP]{\@@_round_places:nnnnnnn} -% \begin{macro}[EXP]{\@@_round_places_end:nn} +% \begin{macro}[EXP]{\@@_round_places_end:nnn} % \begin{macro}[EXP]{\@@_round_places_decimal:nn, \@@_round_places_integer:nn} % \begin{macro}[EXP]{\@@_round_places_finalise:n} % \begin{macro}[EXP]{\@@_round_places_finalise:nnnnnnn} @@ -2644,12 +2683,12 @@ { \@@_round_places_decimal:nn } { \@@_round_places_integer:nn } {#3} {#4} - \@@_round_places_end:nn {#6} {#7} + \@@_round_places_end:nnn { } {#6} {#7} } } { \exp_not:n { {#1} {#2} {#3} {#4} {#5} {#6} {#7} } } } -\cs_new:Npn \@@_round_places_end:nn #1#2 { { } \exp_not:n { {#1} {#2} } } +\cs_new:Npn \@@_round_places_end:nnn #1#2#3 { \exp_not:n { {#1} {#2} {#3} } } \cs_new:Npn \@@_round_places_decimal:nn #1#2 { \int_compare:nNnTF @@ -2724,9 +2763,26 @@ % \end{macro} % % \begin{macro}[EXP]{\@@_round_uncertainty:nnnnnnn} +% \begin{macro}[EXP]{\@@_round_uncertainty_end:nn} % \begin{macro}[EXP]{\@@_round_uncertainty:nnn} % \begin{macro}[EXP]{\@@_round_uncertainty:nnnnn, \@@_round_uncertainty_aux:nnnnn} % \begin{macro}[EXP]{\@@_round_uncertainty_aux:nnnnnn} +% \begin{macro}[EXP]{\@@_round_uncertainty_shift:nn} +% \begin{macro}[EXP]{\@@_round_uncertainty_shift:nnnw} +% \begin{macro}[EXP]{\@@_round_uncertainty_shift:nnnn} +% \begin{macro}[EXP] +% { +% \@@_round_uncertainty_engineering:nnn , +% \@@_round_uncertainty_fixed:nnn , +% \@@_round_uncertainty_input:nnn , +% \@@_round_uncertainty_scientific:nnn +% } +% \begin{macro}[EXP] +% { +% \@@_round_uncertainty_engineering_2:n , +% \@@_round_uncertainty_engineering_3:n , +% \@@_round_uncertainty_engineering_4:n +% } % Rounding to an uncertainty can only happen where the result will have some % uncertainty left: otherwise we simply drop the uncertainty entirely. Only % |S|-type uncertainties can be used for rounding. @@ -2736,18 +2792,20 @@ \bool_lazy_or:nnTF { \tl_if_blank_p:n {#5} } { ! \int_compare_p:nNn \l_@@_round_precision_int > 0 } - { \exp_not:n { {#1} #2 {#3} {#4} { } #6 {#7} } } + { \exp_not:n { {#1} {#2} {#3} {#4} { } {#6} {#7} } } { \str_if_eq:eeTF { \tl_head:n {#5} } { S } { \exp_not:n { {#1} {#2} } \exp_args:Nnno \@@_round_uncertainty:nnn {#3} {#4} { \use_ii:nn #5 } - \exp_not:n { {#6} {#7} } + \@@_round_uncertainty_end:nn {#6} {#7} } { \exp_not:n { {#1} {#2} {#3} {#4} {#5} {#6} {#7} } } } } +\cs_new:Npn \@@_round_uncertainty_end:nn #1#2 + { \exp_not:n { {#1} {#2} } } % \end{macrocode} % Round the uncertainty first: this is needed to get the number of places % correct (for the case where the uncertainty rounds up to |1...|). Once that @@ -2796,13 +2854,97 @@ { { S } { #4 #1 } } } { - \@@_round:fnn - { \int_eval:n { #2 + 1 } } - {#5} {#6} - { { S } { #3 \@@_round_truncate_direct:n {#4} #1 } } + \exp_args:Ne \@@_round_uncertainty_shift:nn + { + \@@_round:fnn + { \int_eval:n { #2 + 1 } } + {#5} {#6} + } + { { S } { #3 #1 } } } } % \end{macrocode} +% We now have to clear up the exponent, plus deal with the case where +% rounding has resulted in the entire value being uncertain (|1(1)| with +% some exponent). The latter shows up if the uncertainty is too long or if +% we match a specific pattern. +% \begin{macrocode} +\cs_new:Npn \@@_round_uncertainty_shift:nn #1#2 + { \@@_round_uncertainty_shift:nnnw #1 {#2} } +\cs_new:Npn \@@_round_uncertainty_shift:nnnw + #1#2#3 #4 \@@_round_uncertainty_end:nn #5#6 + { + #4 + \bool_lazy_and:nnTF + { + \int_compare_p:nNn + { \tl_count:o { \use_ii:nn #3 } } = \l_@@_round_precision_int + } + { + ! \str_if_eq_p:nn { {#1} {#2} {#3} } { { 10 } { } { { S } { 1 } } } + } + { + \use:c + { @@_round_ \l_@@_exponent_mode_tl :nn } + {#1} {#2} + \@@_round_places_end:nnn {#3} {#5} {#6} + } + { + \use:c + { @@_round_uncertainty_ \l_@@_exponent_mode_tl :nnn } + {#1} {#5} {#6} + } + } +% \end{macrocode} +% With the data available, adjust the output such that the uncertainty +% is of the right length. +% \begin{macrocode} +\cs_new:Npn \@@_round_uncertainty_engineering:nnn #1#2#3 + { + \use:c + { + @@_round_uncertainty_ + \l_@@_exponent_mode_tl _ + \tl_count:n {#1} + :n + } + {#2#3} + } +\cs_new:cpn { @@_round_uncertainty_engineering_2:n } #1 + { + { 10 } { } { { S } { 10 } } + \@@_exponent_finalise:n {#1} + } +\cs_new:cpn { @@_round_uncertainty_engineering_3:n } #1 + { + { 100 } { } { { S } { 100 } } + \@@_exponent_finalise:n {#1} + } +\cs_new:cpn { @@_round_uncertainty_engineering_4:n } #1 + { + { 1 } { } { { S } { 1 } } + \@@_exponent_finalise:n { #1 + 3 } + } +\cs_new:Npn \@@_round_uncertainty_fixed:nnn #1#2#3 + { + {#1} { } + { { S } { 1 \prg_replicate:nn { \tl_count:n {#1} - 1 } { 0 } } } + {#2} {#3} + } +\cs_new_eq:NN \@@_round_uncertainty_input:nnn + \@@_round_uncertainty_fixed:nnn +\cs_new:Npn \@@_round_uncertainty_scientific:nnn #1#2#3 + { + { 1 } { } { { S } { 1 } } + \@@_exponent_finalise:n { #2#3 + \tl_count:n {#1} - 1 } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} % \end{macro} % \end{macro} % \end{macro} diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-print.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-print.dtx index 25acdd306b5..a38edf5c55d 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx-print.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx-print.dtx @@ -627,7 +627,11 @@ \cs_new_protected:Npn \@@_math_auxiv:n #1 { \bool_if:NTF \l_@@_math_font_bool - { \@@_math_aux:N \mathsf \mathtt \q_recursion_tail \q_recursion_stop } + { + \@@_math_aux:N + \mathbf \mathit \mathsf \mathtt + \q_recursion_tail \q_recursion_stop + } { \@@_math_auxv:n } {#1} } diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-table.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-table.dtx index 64ef013e176..75a5a7f0115 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx-table.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx-table.dtx @@ -736,7 +736,8 @@ % When centering on the decimal marker, the easiest approach is to simply % re-box the two parts. That is needed whether or not we are parsing numbers, % so is best as a short auxiliary. Notice that we need to allow for the width -% of the decimal marker itself. +% of the decimal marker itself. When not aligning non-numerical material, we +% put the extra space into the boxes around the number. % \begin{macrocode} \cs_new_protected:Npn \@@_center_marker: { @@ -750,26 +751,53 @@ - \box_wd:N \l_@@_tmp_box } { - \hbox_set_to_wd:Nnn \l_@@_decimal_box + \bool_if:NTF \l_@@_align_after_bool { - \box_wd:N \l_@@_integer_box - + \box_wd:N \l_@@_tmp_box - } - { - \hbox_unpack:N \l_@@_decimal_box - \@@_fil: - } + \@@_center_marker_aux:Nnnn \l_@@_decimal_box + { + \box_wd:N \l_@@_integer_box + + \box_wd:N \l_@@_tmp_box + } + } + { + \@@_center_marker_aux:Nnnn \l_@@_after_box + { + \box_wd:N \l_@@_after_box + + \box_wd:N \l_@@_integer_box + - \box_wd:N \l_@@_decimal_box + + \box_wd:N \l_@@_tmp_box + } + } + { } { \@@_fil: } } { - \hbox_set_to_wd:Nnn \l_@@_integer_box + \bool_if:NTF \l_@@_align_before_bool { - \box_wd:N \l_@@_decimal_box - - \box_wd:N \l_@@_tmp_box + \@@_center_marker_aux:Nnnn \l_@@_integer_box + { + \box_wd:N \l_@@_decimal_box + - \box_wd:N \l_@@_tmp_box + } } { - \@@_fil: - \hbox_unpack:N \l_@@_integer_box + \@@_center_marker_aux:Nnnn \l_@@_before_box + { + \box_wd:N \l_@@_before_box + + \box_wd:N \l_@@_decimal_box + - \box_wd:N \l_@@_integer_box + - \box_wd:N \l_@@_tmp_box + } } + { \@@_fil: } { } + } + } +\cs_new_protected:Npn \@@_center_marker_aux:Nnnn #1#2#3#4 + { + \hbox_set_to_wd:Nnn #1 {#2} + { + #3 + \hbox_unpack:N #1 + #4 } } % \end{macrocode} @@ -967,10 +995,17 @@ \c_math_toggle_token \l_siunitx_number_output_decimal_tl } +% \end{macrocode} +% We set the two alignment booleans here so that a single auxiliary can +% cover this case as well as the one for centering the marker when also +% parsing. +% \begin{macrocode} \cs_new_protected:Npn \@@_direct_marker_end: { \c_math_toggle_token \hbox_set_end: + \bool_set_true:N \l_@@_align_before_bool + \bool_set_true:N \l_@@_align_after_bool \@@_center_marker: \use:c { @@_align_ \l_@@_align_text_tl :n } { @@ -1159,7 +1194,6 @@ \@@_fil: } } - \box_use_drop:N \l_@@_before_box \siunitx_number_parse:nN {#2} \l_@@_tmp_tl \siunitx_number_process:NN \l_@@_tmp_tl \l_@@_tmp_tl \tl_set:Nx \l_@@_tmp_tl @@ -1167,7 +1201,6 @@ \@@_color_check:N \l_@@_tmp_tl \exp_after:wN \@@_print_marker:w \l_@@_tmp_tl \q_stop - \box_use_drop:N \l_@@_after_box } \cs_new_protected:Npn \@@_print_marker:w #1 \q_nil #2 \q_nil #3 \q_nil #4 \q_stop @@ -1182,8 +1215,10 @@ \@@_center_marker: \use:c { @@_align_ \l_@@_align_text_tl :n } { + \box_use_drop:N \l_@@_before_box \box_use_drop:N \l_@@_integer_box \box_use_drop:N \l_@@_decimal_box + \box_use_drop:N \l_@@_after_box } } \cs_new:Npn \@@_print_marker_aux:w diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-unit.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-unit.dtx index be3e6eaf613..2c76156563a 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx-unit.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx-unit.dtx @@ -2826,6 +2826,17 @@ } % \end{macrocode} % +% Cover the case where the default font is sanserif. +% \begin{macrocode} +\AtBeginDocument + { + \str_if_eq:eeTF + { \exp_not:o { \familydefault } } + { \exp_not:n { \sfdefault } } + { \keys_set:nn { siunitx } { unit-font-command = \mathsf } } + } +% \end{macrocode} +% % \begin{macrocode} %</package> % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx.dtx index 275f824a356..d0d855e92ac 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} {2021-08-04} {3.0.24} +\ProvidesExplPackage {siunitx} {2021-08-16} {3.0.25} {A comprehensive (SI) units package} % \end{macrocode} % diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx.tex b/Master/texmf-dist/source/latex/siunitx/siunitx.tex index 136283140d6..b83b72463d3 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx.tex +++ b/Master/texmf-dist/source/latex/siunitx/siunitx.tex @@ -3280,7 +3280,7 @@ which will then allow for the parenthesis. If a sign is applied to the number, it may not be necessary to add a \enquote{digit} for the leading bracket. If parsing is also required, this approach cannot be employed. Instead, the parsing needs to be adjusted such that |(| and |)| are not treated as part of -the number, and \opt{table-align-text-pre} is set to |false| such that these +the number, and \opt{table-align-text-before} is set to |false| such that these will be placed next to the numerical part. These methods are illustrated in Table~\ref{tab:regression}. @@ -3299,7 +3299,7 @@ Table~\ref{tab:regression}. input-close-uncertainty = , minimum-decimal-digits = 3, % ( table-format = +1.3), - table-align-text-pre = false + table-align-text-before = false ] @{} } diff --git a/Master/texmf-dist/tex/latex/siunitx/siunitx.sty b/Master/texmf-dist/tex/latex/siunitx/siunitx.sty index 3bef92d6566..3978b3fe629 100644 --- a/Master/texmf-dist/tex/latex/siunitx/siunitx.sty +++ b/Master/texmf-dist/tex/latex/siunitx/siunitx.sty @@ -42,7 +42,7 @@ }% \endinput }% -\ProvidesExplPackage {siunitx} {2021-08-04} {3.0.24} +\ProvidesExplPackage {siunitx} {2021-08-16} {3.0.25} {A comprehensive (SI) units package} \msg_new:nnnn { siunitx } { incompatible-package } { Package~'#1'~incompatible. } @@ -1586,6 +1586,11 @@ { \group_begin: \tl_clear:N \l__siunitx_number_parsed_tl + \tl_map_inline:Nn \l__siunitx_number_input_ignore_tl + { + \token_if_macro:NT ##1 + { \cs_set_eq:NN ##1 \scan_stop: } + } \protected@edef \l__siunitx_number_arg_tl { \bool_if:NTF \l__siunitx_number_expression_bool @@ -1594,9 +1599,8 @@ } \tl_set_eq:NN \l__siunitx_number_input_tl \l__siunitx_number_arg_tl \siunitx_number_normalize_symbols:N \l__siunitx_number_arg_tl - \protected@edef \l__siunitx_number_input_ignore_tl { \l__siunitx_number_input_ignore_tl } - \tl_if_empty:NF \l__siunitx_number_input_ignore_tl - { \tl_remove_all:NV \l__siunitx_number_arg_tl \l__siunitx_number_input_ignore_tl } + \tl_map_inline:Nn \l__siunitx_number_input_ignore_tl + { \tl_remove_all:Nn \l__siunitx_number_arg_tl {##1} } \tl_if_empty:NF \l__siunitx_number_arg_tl { \__siunitx_number_parse_comparator: } \__siunitx_number_parse_check: @@ -2545,13 +2549,20 @@ \cs_new:Npn \__siunitx_number_round_auxiv:nnnN #1#2#3#4 { \quark_if_recursion_tail_stop_do:Nn #4 - { { 0 } { } } + { + \int_compare:nNnTF {#1} = 0 + { + \__siunitx_number_round_auxvi:nnN {#3} {#2} + 0 \q_recursion_tail \q_recursion_stop + } + { { 0 } { } } + } \int_compare:nNnTF {#1} > 0 { \exp_args:Nf \__siunitx_number_round_auxiv:nnnN { \int_eval:n { #1 - 1 } } { #2 0 } { #4#3 } } - { \__siunitx_number_round_auxvi:nnnN {#3} {#2} #4 } + { \__siunitx_number_round_auxvi:nnN {#3} {#2} #4 } } \cs_new:Npn \__siunitx_number_round_auxv:nnN #1#2#3 { @@ -2574,7 +2585,7 @@ { \__siunitx_number_round_auxvii:nnN } {#2} { } #3 } -\cs_new:Npn \__siunitx_number_round_auxvi:nnnN #1#2#3 +\cs_new:Npn \__siunitx_number_round_auxvi:nnN #1#2#3 { \quark_if_recursion_tail_stop_do:Nn #3 { { 0 } { } } @@ -2660,9 +2671,27 @@ #1#2#3 \q_recursion_tail \q_recursion_stop { \__siunitx_number_round_final_output:ff - { \tl_reverse:n {#3} #2 } + { \exp_args:Ne \__siunitx_number_round_final_significant:n { \tl_reverse:n {#3} #2 } } {#1} } +\cs_new:Npn \__siunitx_number_round_final_significant:n #1 + { + \__siunitx_number_round_final_significant:N #1 + \q_recursion_tail \q_recursion_stop + } +\cs_new:Npn \__siunitx_number_round_final_significant:N #1 + { + \quark_if_recursion_tail_stop_do:Nn #1 { 0 } + \int_compare:nNnTF {#1} = 0 + { \__siunitx_number_round_final_significant:N } + { + #1 + \__siunitx_number_round_final_significant:w + } + } +\cs_new:Npn \__siunitx_number_round_final_significant:w + #1 \q_recursion_tail \q_recursion_stop + {#1} \cs_new:Npn \__siunitx_number_round_final_output:nn #1#2 { {#1} {#2} } \cs_generate_variant:Nn \__siunitx_number_round_final_output:nn { ff } \cs_new:Npn \__siunitx_number_round_final:nn #1#2 @@ -2684,7 +2713,6 @@ \int_compare:nNnTF { \tl_count:n {#1} } = 4 { \__siunitx_number_round_engineering:NNNNn #1 {#2} - { } \__siunitx_number_round_final_shift:Nw 3 } { {#1} {#2} } @@ -2709,11 +2737,13 @@ { \__siunitx_number_exponent_shift:nnf { 1 } {#1} { \__siunitx_number_round_truncate_direct:n {#2} } - { } \__siunitx_number_round_final_shift:Nw 1 } -\cs_new:Npn \__siunitx_number_round_final_shift:Nw #1#2 \__siunitx_number_round_places_end:nn #3#4 - { \__siunitx_number_exponent_finalise:n { #3#4 + #1 } } +\cs_new:Npn \__siunitx_number_round_final_shift:Nw #1#2 \__siunitx_number_round_places_end:nnn #3#4#5 + { + \exp_not:n { {#3} } + \__siunitx_number_exponent_finalise:n { #4#5 + #1 } + } \cs_new:Npn \__siunitx_number_round_truncate:n #1 { \str_if_eq:VnTF \l__siunitx_number_round_mode_tl { figures } @@ -2819,12 +2849,12 @@ { \__siunitx_number_round_places_decimal:nn } { \__siunitx_number_round_places_integer:nn } {#3} {#4} - \__siunitx_number_round_places_end:nn {#6} {#7} + \__siunitx_number_round_places_end:nnn { } {#6} {#7} } } { \exp_not:n { {#1} {#2} {#3} {#4} {#5} {#6} {#7} } } } -\cs_new:Npn \__siunitx_number_round_places_end:nn #1#2 { { } \exp_not:n { {#1} {#2} } } +\cs_new:Npn \__siunitx_number_round_places_end:nnn #1#2#3 { \exp_not:n { {#1} {#2} {#3} } } \cs_new:Npn \__siunitx_number_round_places_decimal:nn #1#2 { \int_compare:nNnTF @@ -2890,18 +2920,20 @@ \bool_lazy_or:nnTF { \tl_if_blank_p:n {#5} } { ! \int_compare_p:nNn \l__siunitx_number_round_precision_int > 0 } - { \exp_not:n { {#1} #2 {#3} {#4} { } #6 {#7} } } + { \exp_not:n { {#1} {#2} {#3} {#4} { } {#6} {#7} } } { \str_if_eq:eeTF { \tl_head:n {#5} } { S } { \exp_not:n { {#1} {#2} } \exp_args:Nnno \__siunitx_number_round_uncertainty:nnn {#3} {#4} { \use_ii:nn #5 } - \exp_not:n { {#6} {#7} } + \__siunitx_number_round_uncertainty_end:nn {#6} {#7} } { \exp_not:n { {#1} {#2} {#3} {#4} {#5} {#6} {#7} } } } } +\cs_new:Npn \__siunitx_number_round_uncertainty_end:nn #1#2 + { \exp_not:n { {#1} {#2} } } \cs_new:Npn \__siunitx_number_round_uncertainty:nnn #1#2#3 { \exp_last_unbraced:Nf \__siunitx_number_round_uncertainty:nnnnn @@ -2941,11 +2973,79 @@ { { S } { #4 #1 } } } { - \__siunitx_number_round:fnn - { \int_eval:n { #2 + 1 } } - {#5} {#6} - { { S } { #3 \__siunitx_number_round_truncate_direct:n {#4} #1 } } + \exp_args:Ne \__siunitx_number_round_uncertainty_shift:nn + { + \__siunitx_number_round:fnn + { \int_eval:n { #2 + 1 } } + {#5} {#6} + } + { { S } { #3 #1 } } + } + } +\cs_new:Npn \__siunitx_number_round_uncertainty_shift:nn #1#2 + { \__siunitx_number_round_uncertainty_shift:nnnw #1 {#2} } +\cs_new:Npn \__siunitx_number_round_uncertainty_shift:nnnw + #1#2#3 #4 \__siunitx_number_round_uncertainty_end:nn #5#6 + { + #4 + \bool_lazy_and:nnTF + { + \int_compare_p:nNn + { \tl_count:o { \use_ii:nn #3 } } = \l__siunitx_number_round_precision_int + } + { + ! \str_if_eq_p:nn { {#1} {#2} {#3} } { { 10 } { } { { S } { 1 } } } + } + { + \use:c + { __siunitx_number_round_ \l__siunitx_number_exponent_mode_tl :nn } + {#1} {#2} + \__siunitx_number_round_places_end:nnn {#3} {#5} {#6} + } + { + \use:c + { __siunitx_number_round_uncertainty_ \l__siunitx_number_exponent_mode_tl :nnn } + {#1} {#5} {#6} + } + } +\cs_new:Npn \__siunitx_number_round_uncertainty_engineering:nnn #1#2#3 + { + \use:c + { + __siunitx_number_round_uncertainty_ + \l__siunitx_number_exponent_mode_tl _ + \tl_count:n {#1} + :n } + {#2#3} + } +\cs_new:cpn { __siunitx_number_round_uncertainty_engineering_2:n } #1 + { + { 10 } { } { { S } { 10 } } + \__siunitx_number_exponent_finalise:n {#1} + } +\cs_new:cpn { __siunitx_number_round_uncertainty_engineering_3:n } #1 + { + { 100 } { } { { S } { 100 } } + \__siunitx_number_exponent_finalise:n {#1} + } +\cs_new:cpn { __siunitx_number_round_uncertainty_engineering_4:n } #1 + { + { 1 } { } { { S } { 1 } } + \__siunitx_number_exponent_finalise:n { #1 + 3 } + } +\cs_new:Npn \__siunitx_number_round_uncertainty_fixed:nnn #1#2#3 + { + {#1} { } + { { S } { 1 \prg_replicate:nn { \tl_count:n {#1} - 1 } { 0 } } } + {#2} {#3} + } +\cs_new_eq:NN \__siunitx_number_round_uncertainty_input:nnn + \__siunitx_number_round_uncertainty_fixed:nnn +\cs_new:Npn \__siunitx_number_round_uncertainty_scientific:nnn #1#2#3 + { + { 1 } { } { { S } { 1 } } + \__siunitx_number_exponent_finalise:n { #2#3 + \tl_count:n {#1} - 1 } } \cs_new_protected:Npn \__siunitx_number_zero_decimal:NN #1#2 { @@ -3662,7 +3762,11 @@ \cs_new_protected:Npn \__siunitx_print_math_auxiv:n #1 { \bool_if:NTF \l__siunitx_print_math_font_bool - { \__siunitx_print_math_aux:N \mathsf \mathtt \q_recursion_tail \q_recursion_stop } + { + \__siunitx_print_math_aux:N + \mathbf \mathit \mathsf \mathtt + \q_recursion_tail \q_recursion_stop + } { \__siunitx_print_math_auxv:n } {#1} } @@ -4215,26 +4319,53 @@ - \box_wd:N \l__siunitx_table_tmp_box } { - \hbox_set_to_wd:Nnn \l__siunitx_table_decimal_box + \bool_if:NTF \l__siunitx_table_align_after_bool { - \box_wd:N \l__siunitx_table_integer_box - + \box_wd:N \l__siunitx_table_tmp_box - } - { - \hbox_unpack:N \l__siunitx_table_decimal_box - \__siunitx_table_fil: - } + \__siunitx_table_center_marker_aux:Nnnn \l__siunitx_table_decimal_box + { + \box_wd:N \l__siunitx_table_integer_box + + \box_wd:N \l__siunitx_table_tmp_box + } + } + { + \__siunitx_table_center_marker_aux:Nnnn \l__siunitx_table_after_box + { + \box_wd:N \l__siunitx_table_after_box + + \box_wd:N \l__siunitx_table_integer_box + - \box_wd:N \l__siunitx_table_decimal_box + + \box_wd:N \l__siunitx_table_tmp_box + } + } + { } { \__siunitx_table_fil: } } { - \hbox_set_to_wd:Nnn \l__siunitx_table_integer_box + \bool_if:NTF \l__siunitx_table_align_before_bool { - \box_wd:N \l__siunitx_table_decimal_box - - \box_wd:N \l__siunitx_table_tmp_box + \__siunitx_table_center_marker_aux:Nnnn \l__siunitx_table_integer_box + { + \box_wd:N \l__siunitx_table_decimal_box + - \box_wd:N \l__siunitx_table_tmp_box + } } { - \__siunitx_table_fil: - \hbox_unpack:N \l__siunitx_table_integer_box + \__siunitx_table_center_marker_aux:Nnnn \l__siunitx_table_before_box + { + \box_wd:N \l__siunitx_table_before_box + + \box_wd:N \l__siunitx_table_decimal_box + - \box_wd:N \l__siunitx_table_integer_box + - \box_wd:N \l__siunitx_table_tmp_box + } } + { \__siunitx_table_fil: } { } + } + } +\cs_new_protected:Npn \__siunitx_table_center_marker_aux:Nnnn #1#2#3#4 + { + \hbox_set_to_wd:Nnn #1 {#2} + { + #3 + \hbox_unpack:N #1 + #4 } } \keys_define:nn { siunitx } @@ -4368,6 +4499,8 @@ { \c_math_toggle_token \hbox_set_end: + \bool_set_true:N \l__siunitx_table_align_before_bool + \bool_set_true:N \l__siunitx_table_align_after_bool \__siunitx_table_center_marker: \use:c { __siunitx_table_align_ \l__siunitx_table_align_text_tl :n } { @@ -4471,7 +4604,6 @@ \__siunitx_table_fil: } } - \box_use_drop:N \l__siunitx_table_before_box \siunitx_number_parse:nN {#2} \l__siunitx_table_tmp_tl \siunitx_number_process:NN \l__siunitx_table_tmp_tl \l__siunitx_table_tmp_tl \tl_set:Nx \l__siunitx_table_tmp_tl @@ -4479,7 +4611,6 @@ \__siunitx_table_color_check:N \l__siunitx_table_tmp_tl \exp_after:wN \__siunitx_table_print_marker:w \l__siunitx_table_tmp_tl \q_stop - \box_use_drop:N \l__siunitx_table_after_box } \cs_new_protected:Npn \__siunitx_table_print_marker:w #1 \q_nil #2 \q_nil #3 \q_nil #4 \q_stop @@ -4494,8 +4625,10 @@ \__siunitx_table_center_marker: \use:c { __siunitx_table_align_ \l__siunitx_table_align_text_tl :n } { + \box_use_drop:N \l__siunitx_table_before_box \box_use_drop:N \l__siunitx_table_integer_box \box_use_drop:N \l__siunitx_table_decimal_box + \box_use_drop:N \l__siunitx_table_after_box } } \cs_new:Npn \__siunitx_table_print_marker_aux:w @@ -5911,6 +6044,13 @@ sticky-per = false , unit-font-command = \mathrm } +\AtBeginDocument + { + \str_if_eq:eeTF + { \exp_not:o { \familydefault } } + { \exp_not:n { \sfdefault } } + { \keys_set:nn { siunitx } { unit-font-command = \mathsf } } + } \tl_new:N \l__siunitx_quantity_tmp_fp \tl_new:N \l__siunitx_quantity_tmp_tl \tl_new:N \l__siunitx_quantity_bracket_close_tl |