diff options
author | Karl Berry <karl@freefriends.org> | 2023-03-05 20:49:14 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-03-05 20:49:14 +0000 |
commit | dd10324ada1ff7ff64bf2ca7405408536c9d2484 (patch) | |
tree | 112816f52d5b265d2a56537d2234963c2f623ec5 | |
parent | b24dd6990f2db63d1fa0e4f0ba4ab31201de1d7c (diff) |
siunitx (5mar23)
git-svn-id: svn://tug.org/texlive/trunk@66365 c570f23f-e606-0410-a88d-b1316a301751
21 files changed, 281 insertions, 214 deletions
diff --git a/Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md b/Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md index fe99aadd7a4..3fef1b87f73 100644 --- a/Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md +++ b/Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md @@ -7,6 +7,16 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to ## [Unreleased] +## [v3.2.2] - 2023-03-04 + +### Fixed +- Value of uncertainty around decimal marker when rounding + to `10` (see issues + [\#644](https://github.com/josephwright/siunitx/issues/644) + and [\#646](https://github.com/josephwright/siunitx/issues/646)) +- Exponent format output when rounding to an uncertainty (see issue + [\#645](https://github.com/josephwright/siunitx/issues/645)) + ## [v3.2.1] - 2023-02-21 ### Fixed @@ -1866,7 +1876,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.2.1...HEAD +[Unreleased]: https://github.com/josephwright/siunitx/compare/v3.2.2...HEAD +[v3.2.2]: https://github.com/josephwright/siunitx/compare/v3.2.1...v3.2.2 [v3.2.1]: https://github.com/josephwright/siunitx/compare/v3.2.0...v3.2.1 [v3.2.0]: https://github.com/josephwright/siunitx/compare/v3.1.11...v3.2.0 [v3.1.11]: https://github.com/josephwright/siunitx/compare/v3.1.10...v3.1.11 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 7f915ef16fd..b6daad35bc5 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.pdf b/Master/texmf-dist/doc/latex/siunitx/siunitx.pdf Binary files differindex ee58cd5ff26..aba22033ac1 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-abbreviation.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-abbreviation.dtx index 11ebc290cb9..152f56608a9 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx-abbreviation.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx-abbreviation.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% File: siunitx-abbreviation.dtx Copyright (C) 2018,2019,2021,2022 Joseph Wright +% File: siunitx-abbreviation.dtx Copyright (C) 2018,2019,2021-2023 Joseph Wright % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -26,6 +26,8 @@ % %<*driver> \documentclass{l3doc} +% Additional commands needed in this source +\ProvideDocumentCommand\email{m}{\href{mailto:#1}{\nolinkurl{#1}}} % The next line is needed so that \GetFileInfo will be able to pick up % version data \usepackage{siunitx} @@ -47,8 +49,7 @@ % Joseph Wright^^A % \thanks{^^A % E-mail: -% \href{mailto:joseph.wright@morningstar2.co.uk} -% {joseph.wright@morningstar2.co.uk}^^A +% \email{joseph.wright@morningstar2.co.uk}^^A % }^^A % } % diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-angle.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-angle.dtx index ac1c19638ca..866fae193fe 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx-angle.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx-angle.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% File: siunitx-angle.dtx Copyright (C) 2016-2019,2021,2022 Joseph Wright +% File: siunitx-angle.dtx Copyright (C) 2016-2019,2021-2023 Joseph Wright % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -26,6 +26,8 @@ % %<*driver> \documentclass{l3doc} +% Additional commands needed in this source +\ProvideDocumentCommand\email{m}{\href{mailto:#1}{\nolinkurl{#1}}} \ProvideDocumentCommand\foreign{m}{\textit{#1}} % The next line is needed so that \GetFileInfo will be able to pick up % version data @@ -48,8 +50,7 @@ % Joseph Wright^^A % \thanks{^^A % E-mail: -% \href{mailto:joseph.wright@morningstar2.co.uk} -% {joseph.wright@morningstar2.co.uk}^^A +% \email{joseph.wright@morningstar2.co.uk}^^A % }^^A % } % diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-binary.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-binary.dtx index f3e3afff3e5..bcb643808e4 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx-binary.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx-binary.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% File: siunitx-binary.dtx Copyright (C) 2021 Joseph Wright +% File: siunitx-binary.dtx Copyright (C) 2021,2023 Joseph Wright % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -26,6 +26,8 @@ % %<*driver> \documentclass{l3doc} +% Additional commands needed in this source +\ProvideDocumentCommand\email{m}{\href{mailto:#1}{\nolinkurl{#1}}} % The next line is needed so that \GetFileInfo will be able to pick up % version data \usepackage{siunitx} @@ -47,8 +49,7 @@ % Joseph Wright^^A % \thanks{^^A % E-mail: -% \href{mailto:joseph.wright@morningstar2.co.uk} -% {joseph.wright@morningstar2.co.uk}^^A +% \email{joseph.wright@morningstar2.co.uk}^^A % }^^A % } % diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-code.tex b/Master/texmf-dist/source/latex/siunitx/siunitx-code.tex index a4c39783107..a0a4319e236 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx-code.tex +++ b/Master/texmf-dist/source/latex/siunitx/siunitx-code.tex @@ -1,6 +1,6 @@ \iffalse meta-comment -File: siunitx-code.tex Copyright (C) 2016-2022 Joseph Wright +File: siunitx-code.tex Copyright (C) 2016-2023 Joseph Wright It may be distributed and/or modified under the conditions of the LaTeX Project Public License (LPPL), either version 1.3c of this @@ -47,6 +47,7 @@ for those people who are interested. } \makeatother \ExplSyntaxOff +\NewDocumentCommand\email{m}{\href{mailto:#1}{\nolinkurl{#1}}} \NewDocumentCommand\foreign{m}{\textit{#1}} % Standard settings @@ -67,8 +68,7 @@ for those people who are interested. Joseph Wright% \thanks{% E-mail: - \href{mailto:joseph.wright@morningstar2.co.uk} - {joseph.wright@morningstar2.co.uk}% + \email{joseph.wright@morningstar2.co.uk}% }% } diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-command.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-command.dtx index 354ab3734c2..a862676ade2 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx-command.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx-command.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% File: siunitx-command.dtx Copyright (C) 2019,2021 Joseph Wright +% File: siunitx-command.dtx Copyright (C) 2019,2021,2023 Joseph Wright % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -26,6 +26,8 @@ % %<*driver> \documentclass{l3doc} +% Additional commands needed in this source +\ProvideDocumentCommand\email{m}{\href{mailto:#1}{\nolinkurl{#1}}} \ProvideDocumentCommand\foreign{m}{\textit{#1}} % The next line is needed so that \GetFileInfo will be able to pick up % version data @@ -48,8 +50,7 @@ % Joseph Wright^^A % \thanks{^^A % E-mail: -% \href{mailto:joseph.wright@morningstar2.co.uk} -% {joseph.wright@morningstar2.co.uk}^^A +% \email{joseph.wright@morningstar2.co.uk}^^A % }^^A % } % diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-complex.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-complex.dtx index 8303c9f3027..fe235989503 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx-complex.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx-complex.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% File: siunitx-complex.dtx Copyright (C) 2021,2022 Joseph Wright +% File: siunitx-complex.dtx Copyright (C) 2021-2023 Joseph Wright % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -26,6 +26,8 @@ % %<*driver> \documentclass{l3doc} +% Additional commands needed in this source +\ProvideDocumentCommand\email{m}{\href{mailto:#1}{\nolinkurl{#1}}} \ProvideDocumentCommand\foreign{m}{\textit{#1}} % The next line is needed so that \GetFileInfo will be able to pick up % version data @@ -48,8 +50,7 @@ % Joseph Wright^^A % \thanks{^^A % E-mail: -% \href{mailto:joseph.wright@morningstar2.co.uk} -% {joseph.wright@morningstar2.co.uk}^^A +% \email{joseph.wright@morningstar2.co.uk}^^A % }^^A % } % diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-compound.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-compound.dtx index a11121a4ac9..c4d22488450 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx-compound.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx-compound.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% File: siunitx-compound.dtx Copyright (C) 2018-2021 Joseph Wright +% File: siunitx-compound.dtx Copyright (C) 2018-2021,2023 Joseph Wright % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -26,6 +26,8 @@ % %<*driver> \documentclass{l3doc} +% Additional commands needed in this source +\ProvideDocumentCommand\email{m}{\href{mailto:#1}{\nolinkurl{#1}}} \ProvideDocumentCommand\foreign{m}{\textit{#1}} % The next line is needed so that \GetFileInfo will be able to pick up % version data @@ -48,8 +50,7 @@ % Joseph Wright^^A % \thanks{^^A % E-mail: -% \href{mailto:joseph.wright@morningstar2.co.uk} -% {joseph.wright@morningstar2.co.uk}^^A +% \email{joseph.wright@morningstar2.co.uk}^^A % }^^A % } % diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-emulation.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-emulation.dtx index 65db65b6645..9cb54d21c20 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx-emulation.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx-emulation.dtx @@ -26,6 +26,8 @@ % %<*driver> \documentclass{l3doc} +% Additional commands needed in this source +\ProvideDocumentCommand\email{m}{\href{mailto:#1}{\nolinkurl{#1}}} % The next line is needed so that \GetFileInfo will be able to pick up % version data \usepackage{siunitx} @@ -47,8 +49,7 @@ % Joseph Wright^^A % \thanks{^^A % E-mail: -% \href{mailto:joseph.wright@morningstar2.co.uk} -% {joseph.wright@morningstar2.co.uk}^^A +% \email{joseph.wright@morningstar2.co.uk}^^A % }^^A % } % diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-locale.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-locale.dtx index cbf3ec14a0d..6a0aa3ffea6 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx-locale.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx-locale.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% File: siunitx-locale.dtx Copyright (C) 2020-2022 Joseph Wright +% File: siunitx-locale.dtx Copyright (C) 2020-2023 Joseph Wright % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -26,6 +26,8 @@ % %<*driver> \documentclass{l3doc} +% Additional commands needed in this source +\ProvideDocumentCommand\email{m}{\href{mailto:#1}{\nolinkurl{#1}}} % The next line is needed so that \GetFileInfo will be able to pick up % version data \usepackage{siunitx} @@ -47,8 +49,7 @@ % Joseph Wright^^A % \thanks{^^A % E-mail: -% \href{mailto:joseph.wright@morningstar2.co.uk} -% {joseph.wright@morningstar2.co.uk}^^A +% \email{joseph.wright@morningstar2.co.uk}^^A % }^^A % } % diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx index f4d44ea5cc4..8df5670c25f 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx @@ -26,6 +26,8 @@ % %<*driver> \documentclass{l3doc} +% Additional commands needed in this source +\ProvideDocumentCommand\email{m}{\href{mailto:#1}{\nolinkurl{#1}}} \ProvideDocumentCommand\foreign{m}{\textit{#1}} % The next line is needed so that \GetFileInfo will be able to pick up % version data @@ -48,8 +50,7 @@ % Joseph Wright^^A % \thanks{^^A % E-mail: -% \href{mailto:joseph.wright@morningstar2.co.uk} -% {joseph.wright@morningstar2.co.uk}^^A +% \email{joseph.wright@morningstar2.co.uk}^^A % }^^A % } % @@ -3160,18 +3161,20 @@ % \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:nnnn} % \begin{macro}[EXP]{\@@_round_uncertainty:nnnnnn} % \begin{macro}[EXP] % { -% \@@_round_uncertainty_simple:nnnnnn , -% \@@_round_uncertainty_shift:nnnnnn +% \@@_round_uncertainty_auxi:nnnnn , +% \@@_round_uncertainty_auxii:nnnnn % } -% \begin{macro}[EXP]{\@@_round_uncertainty_shift:nn} -% \begin{macro}[EXP]{\@@_round_uncertainty_shift:nnnw} -% \begin{macro}[EXP]{\@@_round_uncertainty_shift_aux:nnnnn} +% \begin{macro}[EXP]{\@@_round_uncertainty_auxiii:nnnnnnn} +% \begin{macro}[EXP]{\@@_round_uncertainty_zeros:nnnn} +% \begin{macro}[EXP]{\@@_round_uncertainty_auxiv:nnnnnnN} +% \begin{macro}[EXP]{\@@_round_uncertainty_auxv:nnnN} +% \begin{macro}[EXP]{\@@_round_uncertainty_auxvi:nn} +% \begin{macro}[EXP]{\@@_round_uncertainty_auxvii:nnNnnn} % \begin{macro}[EXP] % { % \@@_round_uncertainty_engineering:nnn , @@ -3202,13 +3205,11 @@ \exp_not:n { {#1} {#2} } \exp_args:Nnno \@@_round_uncertainty:nnn {#3} {#4} { \use_ii:nn #5 } - \@@_round_uncertainty_end:nn {#6} {#7} + {#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. Once that is done, it's just a question of working out the digits @@ -3233,123 +3234,142 @@ } } % \end{macrocode} -% Here, we need to work out how many digits to zero-fill the uncertainty, for -% the case where it crosses into the integer part. This depends on whether -% the uncertainty rounded up, which also links to additional treatment. We -% therefore split paths here. +% The number of digits to remove from the main part and the detail of +% zero filling depends on whether we rounded up the uncertainty. So there +% is a split here. % \begin{macrocode} \cs_new:Npn \@@_round_uncertainty:nnnnnn #1#2#3#4#5#6 { \tl_if_blank:nTF {#1} - { - \exp_args:Nf \@@_round_uncertainty_simple:nnnnn - { - \prg_replicate:nn - { - \int_max:nn - { - \tl_if_blank:nTF {#4} - { #5 } - { ( \tl_count:n {#6} - \tl_count:n {#4} ) - \tl_count:n {#2} } - } - { 0 } - } - { 0 } - } - {#3} {#4} {#2} {#5} - } - { \@@_round_uncertainty_shift:nnnnn {#3} {#4} {#1} {#2} {#5} } - + { \@@_round_uncertainty_auxi:nnnnn } + { \@@_round_uncertainty_auxii:nnnnn } + {#2} {#3} {#4} {#5} {#6} } % \end{macrocode} -% The simple case: round and pad out the uncertainty as required. +% The simple case: just round to the same number of digits and do zero +% filling. % \begin{macrocode} -\cs_new:Npn \@@_round_uncertainty_simple:nnnnn #1#2#3#4#5 +\cs_new:Npn \@@_round_uncertainty_auxi:nnnnn #1#2#3#4#5 { - \@@_round:nnn - {#5} - {#2} {#3} - { { S } { #4 #1 } } + \exp_args:Nf \@@_round_uncertainty_auxiv:nnnnnnN + { \@@_round_uncertainty_zeros:nnnn {#1} {#3} {#4} {#5} } + {#4} + {#2} {#3} {#1} { } + \@@_round_uncertainty_auxvi:nn } % \end{macrocode} +% When the uncertainty rounds up, zero filling is dependent on whether we +% cross the boundary for the integer part. % \begin{macrocode} -\cs_new:Npn \@@_round_uncertainty_shift:nnnnn #1#2#3#4#5 +\cs_new:Npn \@@_round_uncertainty_auxii:nnnnn #1#2#3#4#5 { - \exp_args:Ne \@@_round_uncertainty_shift:nn - { \@@_round:fnn { \int_eval:n { #5 + 1 } } {#1} {#2} } - {#5} + \exp_args:Nff \@@_round_uncertainty_auxiii:nnnnnnn + { \tl_count:n {#5} } + { \tl_count:n {#3} } + {#1} {#2} {#3} {#4} {#5} } -% \end{macrocode} -% If the padding length is the same as the number of integer digits, then -% we have a pathological case and need to filter out. They show up as they -% have the either the precision greater than the length of the integer -% part, or have a value of exactly $10$ when the exponent mode is -% scientific. The latter test has to deal with an exponent threshold too: -% there we are looking for cases where the threshold will have forced -% scientific presentation. -% \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 +\cs_new:Npn \@@_round_uncertainty_auxiii:nnnnnnn #1#2#3#4#5#6#7 { - #4 - \bool_lazy_and:nnTF - { \int_compare_p:nNn {#3} > { \tl_count:n {#1} } } + \int_compare:nNnTF {#1} < { #2 + 1 } { - ! \bool_lazy_and_p:nn + \bool_lazy_and:nnTF + { \int_compare_p:nNn \l_@@_round_precision_int = 2 } + { \int_compare_p:nNn {#1} = {#2} } { - \bool_lazy_or_p:nn - { \str_if_eq_p:Vn \l_@@_exponent_mode_tl { scientific } } - { - \bool_lazy_and_p:nn - { \str_if_eq_p:Vn \l_@@_exponent_mode_tl { threshold } } - { - ! \bool_lazy_or_p:nn - { - \int_compare_p:nNn {#5#6} > - \l_@@_lower_threshold_int - } - { - \int_compare_p:nNn {#5#6} < - \l_@@_upper_threshold_int - } - } - } + \exp_args:Nnf \@@_round_uncertainty_auxiv:nnnnnnN + { 0 } } - { \str_if_eq_p:nn { #1.#2 } { 10. } } + { + \exp_args:Nnf \@@_round_uncertainty_auxiv:nnnnnnN + { } + } + { \int_eval:n { #6 + 1 } } + {#4} {#5} { 1 } { } + \@@_round_uncertainty_auxvii:nnNnnn } { - \exp_args:Nf \@@_round_uncertainty_shift_aux:nnnnn + \exp_args:Nff \@@_round_uncertainty_auxiv:nnnnnnN + { \@@_round_uncertainty_zeros:nnnn {#3} {#5} {#6} {#7} } + { \int_eval:n { #6 + 1 } } + {#4} {#5} { 1 } {#3} + \@@_round_uncertainty_auxvii:nnNnnn + } + } +\cs_new:Npn \@@_round_uncertainty_zeros:nnnn #1#2#3#4 + { + \prg_replicate:nn + { + \int_max:nn { - \prg_replicate:nn + \tl_if_blank:nTF {#2} + { #3 } { - \tl_if_blank:nTF {#2} - { \int_min:nn {#3} { \tl_count:n {#1} - 1 } } - { 0 } + ( \tl_count:n {#4} - \tl_count:n {#2} ) + - \tl_count:n {#1} } - { 0 } } - {#1} {#2} + { 0 } } + { 0 } + } +% \end{macrocode} +% Back together for the business end. If there has been a shift, we may need +% to tidy up. +% \begin{macrocode} +\cs_new:Npn \@@_round_uncertainty_auxiv:nnnnnnN #1#2#3#4#5#6#7 + { + \use:e { - \use:c - { @@_round_uncertainty_ \l_@@_exponent_mode_tl :nnn } - {#1} + \exp_not:N \@@_round_uncertainty_auxv:nnnN + \@@_round:nnn {#2} {#3} {#4} } - {#5} {#6} + {#3} #7 + \@@_round_end:nnn { { S } { #5#6 #1 } } } -\cs_new:Npn \@@_round_uncertainty_shift_aux:nnnnn #1#2#3#4#5 +\cs_new:Npn \@@_round_uncertainty_auxv:nnnN #1#2#3#4 { - \use:c - { @@_round_ \l_@@_exponent_mode_tl :nn } - {#2} {#3} - \@@_round_end:nnn { { S } { 1 #1 } } {#4} {#5} + \int_compare:nNnT { \tl_count:n {#1} } > { \tl_count:n {#3} } + { #4 } + {#1} {#2} } +\cs_new:Npn \@@_round_uncertainty_auxvi:nn #1#2 + { \use:c { @@_round_ \l_@@_exponent_mode_tl :nn } {#1} {#2} } % \end{macrocode} -% With the data available, adjust the output such that the uncertainty -% is of the right length. +% If there was a rounding up in the uncertainty, there is a bit more to do. % \begin{macrocode} +\cs_new:Npn \@@_round_uncertainty_auxvii:nnNnnn #1#2#3#4#5#6 + { + \bool_lazy_any:nTF + { + { \str_if_eq_p:Vn \l_@@_exponent_mode_tl { engineering } } + { \str_if_eq_p:Vn \l_@@_exponent_mode_tl { scientific } } + { + \bool_lazy_and_p:nn + { \str_if_eq_p:Vn \l_@@_exponent_mode_tl { threshold } } + { + ! \bool_lazy_or_p:nn + { + \int_compare_p:nNn {#5#6} > + \l_@@_lower_threshold_int + } + { + \int_compare_p:nNn {#5#6} < + \l_@@_upper_threshold_int + } + } + } + } + { + \use:c + { @@_round_uncertainty_ \l_@@_exponent_mode_tl :nnn } + {#1} + } + { + \@@_round_uncertainty_auxvi:nn {#1} {#2} + \@@_round_end:nnn {#4} + } + {#5} {#6} + } \cs_new:Npn \@@_round_uncertainty_engineering:nnn #1#2#3 { \use:c @@ -3413,6 +3433,8 @@ % \end{macro} % \end{macro} % \end{macro} +% \end{macro} +% \end{macro} % % \begin{macro}{\@@_zero_decimal:NN} % \begin{macro}[EXP]{\@@_zero_decimal:nnnnnnn} diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-print.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-print.dtx index d02eefdf518..236cbbab80e 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx-print.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx-print.dtx @@ -26,6 +26,8 @@ % %<*driver> \documentclass{l3doc} +% Additional commands needed in this source +\ProvideDocumentCommand\email{m}{\href{mailto:#1}{\nolinkurl{#1}}} \ProvideDocumentCommand\foreign{m}{\textit{#1}} % The next line is needed so that \GetFileInfo will be able to pick up % version data @@ -48,8 +50,7 @@ % Joseph Wright^^A % \thanks{^^A % E-mail: -% \href{mailto:joseph.wright@morningstar2.co.uk} -% {joseph.wright@morningstar2.co.uk}^^A +% \email{joseph.wright@morningstar2.co.uk}^^A % }^^A % } % diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-quantity.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-quantity.dtx index b7e6352bdd3..e16f6ffa8b4 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx-quantity.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx-quantity.dtx @@ -26,6 +26,8 @@ % %<*driver> \documentclass{l3doc} +% Additional commands needed in this source +\ProvideDocumentCommand\email{m}{\href{mailto:#1}{\nolinkurl{#1}}} \ProvideDocumentCommand\foreign{m}{\textit{#1}} % The next line is needed so that \GetFileInfo will be able to pick up % version data @@ -48,8 +50,7 @@ % Joseph Wright^^A % \thanks{^^A % E-mail: -% \href{mailto:joseph.wright@morningstar2.co.uk} -% {joseph.wright@morningstar2.co.uk}^^A +% \email{joseph.wright@morningstar2.co.uk}^^A % }^^A % } % diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-symbol.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-symbol.dtx index 6d55931ce7d..2a359b5fe0f 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx-symbol.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx-symbol.dtx @@ -26,6 +26,8 @@ % %<*driver> \documentclass{l3doc} +% Additional commands needed in this source +\ProvideDocumentCommand\email{m}{\href{mailto:#1}{\nolinkurl{#1}}} % The next line is needed so that \GetFileInfo will be able to pick up % version data \usepackage{siunitx} @@ -47,8 +49,7 @@ % Joseph Wright^^A % \thanks{^^A % E-mail: -% \href{mailto:joseph.wright@morningstar2.co.uk} -% {joseph.wright@morningstar2.co.uk}^^A +% \email{joseph.wright@morningstar2.co.uk}^^A % }^^A % } % diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-table.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-table.dtx index 10b9b9a7cd1..4b7cd9ea9f9 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx-table.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx-table.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% File: siunitx-table.dtx Copyright (C) 2016-2019,2021,2022 Joseph Wright +% File: siunitx-table.dtx Copyright (C) 2016-2019,2021-2023 Joseph Wright % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -26,6 +26,8 @@ % %<*driver> \documentclass{l3doc} +% Additional commands needed in this source +\ProvideDocumentCommand\email{m}{\href{mailto:#1}{\nolinkurl{#1}}} \ProvideDocumentCommand\foreign{m}{\textit{#1}} % The next line is needed so that \GetFileInfo will be able to pick up % version data @@ -48,8 +50,7 @@ % Joseph Wright^^A % \thanks{^^A % E-mail: -% \href{mailto:joseph.wright@morningstar2.co.uk} -% {joseph.wright@morningstar2.co.uk}^^A +% \email{joseph.wright@morningstar2.co.uk}^^A % }^^A % } % diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-unit.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-unit.dtx index 3b2defb6ea9..eccc0349bb1 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx-unit.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx-unit.dtx @@ -26,6 +26,7 @@ % %<*driver> \documentclass{l3doc} +% Additional commands needed in this source \ExplSyntaxOn \makeatletter \NewDocumentCommand \acro { m } @@ -40,6 +41,7 @@ } \makeatother \ExplSyntaxOff +\ProvideDocumentCommand\email{m}{\href{mailto:#1}{\nolinkurl{#1}}} \ProvideDocumentCommand\foreign{m}{\textit{#1}} % The next line is needed so that \GetFileInfo will be able to pick up % version data @@ -62,8 +64,7 @@ % Joseph Wright^^A % \thanks{^^A % E-mail: -% \href{mailto:joseph.wright@morningstar2.co.uk} -% {joseph.wright@morningstar2.co.uk}^^A +% \email{joseph.wright@morningstar2.co.uk}^^A % }^^A % } % diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx.dtx index 1d1d08e4574..047da57d554 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx.dtx @@ -26,6 +26,8 @@ % %<*driver> \documentclass{l3doc} +% Additional commands needed in this source +\ProvideDocumentCommand\email{m}{\href{mailto:#1}{\nolinkurl{#1}}} % The next line is needed so that \GetFileInfo will be able to pick up % version data \usepackage{siunitx} @@ -47,8 +49,7 @@ % Joseph Wright^^A % \thanks{^^A % E-mail: -% \href{mailto:joseph.wright@morningstar2.co.uk} -% {joseph.wright@morningstar2.co.uk}^^A +% \email{joseph.wright@morningstar2.co.uk}^^A % }^^A % } % @@ -121,7 +122,7 @@ % % Identify the package and give the over all version information. % \begin{macrocode} -\ProvidesExplPackage {siunitx} {2023-02-21} {3.2.1} +\ProvidesExplPackage {siunitx} {2023-03-04} {3.2.2} {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 63e7f86861f..ad9b137015a 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx.tex +++ b/Master/texmf-dist/source/latex/siunitx/siunitx.tex @@ -200,8 +200,7 @@ for those people who are interested. Joseph Wright% \thanks{% E-mail: - \href{mailto:joseph.wright@morningstar2.co.uk} - {joseph.wright@morningstar2.co.uk}% + \email{joseph.wright@morningstar2.co.uk}% }% } diff --git a/Master/texmf-dist/tex/latex/siunitx/siunitx.sty b/Master/texmf-dist/tex/latex/siunitx/siunitx.sty index b2a4080f7f1..7d01bed00e5 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} {2023-02-21} {3.2.1} +\ProvidesExplPackage {siunitx} {2023-03-04} {3.2.2} {A comprehensive (SI) units package} \msg_new:nnnn { siunitx } { incompatible-package } { Package~'#1'~incompatible. } @@ -3351,13 +3351,11 @@ \exp_not:n { {#1} {#2} } \exp_args:Nnno \__siunitx_number_round_uncertainty:nnn {#3} {#4} { \use_ii:nn #5 } - \__siunitx_number_round_uncertainty_end:nn {#6} {#7} + {#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_args:Nf \__siunitx_number_round_uncertainty:nnnn @@ -3379,96 +3377,119 @@ \cs_new:Npn \__siunitx_number_round_uncertainty:nnnnnn #1#2#3#4#5#6 { \tl_if_blank:nTF {#1} - { - \exp_args:Nf \__siunitx_number_round_uncertainty_simple:nnnnn - { - \prg_replicate:nn - { - \int_max:nn - { - \tl_if_blank:nTF {#4} - { #5 } - { ( \tl_count:n {#6} - \tl_count:n {#4} ) - \tl_count:n {#2} } - } - { 0 } - } - { 0 } - } - {#3} {#4} {#2} {#5} - } - { \__siunitx_number_round_uncertainty_shift:nnnnn {#3} {#4} {#1} {#2} {#5} } - + { \__siunitx_number_round_uncertainty_auxi:nnnnn } + { \__siunitx_number_round_uncertainty_auxii:nnnnn } + {#2} {#3} {#4} {#5} {#6} } -\cs_new:Npn \__siunitx_number_round_uncertainty_simple:nnnnn #1#2#3#4#5 +\cs_new:Npn \__siunitx_number_round_uncertainty_auxi:nnnnn #1#2#3#4#5 { - \__siunitx_number_round:nnn - {#5} - {#2} {#3} - { { S } { #4 #1 } } + \exp_args:Nf \__siunitx_number_round_uncertainty_auxiv:nnnnnnN + { \__siunitx_number_round_uncertainty_zeros:nnnn {#1} {#3} {#4} {#5} } + {#4} + {#2} {#3} {#1} { } + \__siunitx_number_round_uncertainty_auxvi:nn } -\cs_new:Npn \__siunitx_number_round_uncertainty_shift:nnnnn #1#2#3#4#5 +\cs_new:Npn \__siunitx_number_round_uncertainty_auxii:nnnnn #1#2#3#4#5 { - \exp_args:Ne \__siunitx_number_round_uncertainty_shift:nn - { \__siunitx_number_round:fnn { \int_eval:n { #5 + 1 } } {#1} {#2} } - {#5} + \exp_args:Nff \__siunitx_number_round_uncertainty_auxiii:nnnnnnn + { \tl_count:n {#5} } + { \tl_count:n {#3} } + {#1} {#2} {#3} {#4} {#5} } -\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 +\cs_new:Npn \__siunitx_number_round_uncertainty_auxiii:nnnnnnn #1#2#3#4#5#6#7 { - #4 - \bool_lazy_and:nnTF - { \int_compare_p:nNn {#3} > { \tl_count:n {#1} } } + \int_compare:nNnTF {#1} < { #2 + 1 } { - ! \bool_lazy_and_p:nn + \bool_lazy_and:nnTF + { \int_compare_p:nNn \l__siunitx_number_round_precision_int = 2 } + { \int_compare_p:nNn {#1} = {#2} } { - \bool_lazy_or_p:nn - { \str_if_eq_p:Vn \l__siunitx_number_exponent_mode_tl { scientific } } - { - \bool_lazy_and_p:nn - { \str_if_eq_p:Vn \l__siunitx_number_exponent_mode_tl { threshold } } - { - ! \bool_lazy_or_p:nn - { - \int_compare_p:nNn {#5#6} > - \l__siunitx_number_lower_threshold_int - } - { - \int_compare_p:nNn {#5#6} < - \l__siunitx_number_upper_threshold_int - } - } - } + \exp_args:Nnf \__siunitx_number_round_uncertainty_auxiv:nnnnnnN + { 0 } + } + { + \exp_args:Nnf \__siunitx_number_round_uncertainty_auxiv:nnnnnnN + { } } - { \str_if_eq_p:nn { #1.#2 } { 10. } } + { \int_eval:n { #6 + 1 } } + {#4} {#5} { 1 } { } + \__siunitx_number_round_uncertainty_auxvii:nnNnnn } { - \exp_args:Nf \__siunitx_number_round_uncertainty_shift_aux:nnnnn + \exp_args:Nff \__siunitx_number_round_uncertainty_auxiv:nnnnnnN + { \__siunitx_number_round_uncertainty_zeros:nnnn {#3} {#5} {#6} {#7} } + { \int_eval:n { #6 + 1 } } + {#4} {#5} { 1 } {#3} + \__siunitx_number_round_uncertainty_auxvii:nnNnnn + } + } +\cs_new:Npn \__siunitx_number_round_uncertainty_zeros:nnnn #1#2#3#4 + { + \prg_replicate:nn + { + \int_max:nn { - \prg_replicate:nn + \tl_if_blank:nTF {#2} + { #3 } { - \tl_if_blank:nTF {#2} - { \int_min:nn {#3} { \tl_count:n {#1} - 1 } } - { 0 } + ( \tl_count:n {#4} - \tl_count:n {#2} ) + - \tl_count:n {#1} } - { 0 } } - {#1} {#2} + { 0 } } + { 0 } + } +\cs_new:Npn \__siunitx_number_round_uncertainty_auxiv:nnnnnnN #1#2#3#4#5#6#7 + { + \use:e { - \use:c - { __siunitx_number_round_uncertainty_ \l__siunitx_number_exponent_mode_tl :nnn } - {#1} + \exp_not:N \__siunitx_number_round_uncertainty_auxv:nnnN + \__siunitx_number_round:nnn {#2} {#3} {#4} } - {#5} {#6} + {#3} #7 + \__siunitx_number_round_end:nnn { { S } { #5#6 #1 } } } -\cs_new:Npn \__siunitx_number_round_uncertainty_shift_aux:nnnnn #1#2#3#4#5 +\cs_new:Npn \__siunitx_number_round_uncertainty_auxv:nnnN #1#2#3#4 { - \use:c - { __siunitx_number_round_ \l__siunitx_number_exponent_mode_tl :nn } - {#2} {#3} - \__siunitx_number_round_end:nnn { { S } { 1 #1 } } {#4} {#5} + \int_compare:nNnT { \tl_count:n {#1} } > { \tl_count:n {#3} } + { #4 } + {#1} {#2} + } +\cs_new:Npn \__siunitx_number_round_uncertainty_auxvi:nn #1#2 + { \use:c { __siunitx_number_round_ \l__siunitx_number_exponent_mode_tl :nn } {#1} {#2} } +\cs_new:Npn \__siunitx_number_round_uncertainty_auxvii:nnNnnn #1#2#3#4#5#6 + { + \bool_lazy_any:nTF + { + { \str_if_eq_p:Vn \l__siunitx_number_exponent_mode_tl { engineering } } + { \str_if_eq_p:Vn \l__siunitx_number_exponent_mode_tl { scientific } } + { + \bool_lazy_and_p:nn + { \str_if_eq_p:Vn \l__siunitx_number_exponent_mode_tl { threshold } } + { + ! \bool_lazy_or_p:nn + { + \int_compare_p:nNn {#5#6} > + \l__siunitx_number_lower_threshold_int + } + { + \int_compare_p:nNn {#5#6} < + \l__siunitx_number_upper_threshold_int + } + } + } + } + { + \use:c + { __siunitx_number_round_uncertainty_ \l__siunitx_number_exponent_mode_tl :nnn } + {#1} + } + { + \__siunitx_number_round_uncertainty_auxvi:nn {#1} {#2} + \__siunitx_number_round_end:nnn {#4} + } + {#5} {#6} } \cs_new:Npn \__siunitx_number_round_uncertainty_engineering:nnn #1#2#3 { |