From ce7d64db1fb70a31bc172c3c6f2c3f62cac9f785 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 4 Aug 2021 21:15:29 +0000 Subject: siunitx (4aug21) git-svn-id: svn://tug.org/texlive/trunk@60164 c570f23f-e606-0410-a88d-b1316a301751 --- .../source/latex/siunitx/siunitx-number.dtx | 33 +++++++++++++--------- Master/texmf-dist/source/latex/siunitx/siunitx.dtx | 4 +-- Master/texmf-dist/source/latex/siunitx/siunitx.tex | 7 +++-- 3 files changed, 27 insertions(+), 17 deletions(-) (limited to 'Master/texmf-dist/source/latex/siunitx') diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx index 61ca7af1032..38db10d71b7 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx @@ -1449,12 +1449,9 @@ % \begin{macro}{\@@_parse_uncert:NN} % \begin{macro}{\@@_parse_uncert:NNNN} % \begin{macro}{\@@_parse_uncert_auxi:NN, \@@_parse_uncert_auxii:NN} -% \begin{macro} -% { -% \@@_parse_uncert_auxii:N , -% \@@_parse_uncert_marker:N , -% \@@_parse_uncert_after:N -% } +% \begin{macro} {\@@_parse_uncert_auxii:N, \@@_parse_uncert_marker:N} +% \begin{macro}{\@@_parse_uncert_extend:nnnN} +% \begin{macro}{\@@_parse_uncert_after:N} % Parsing a combined uncertainty has a very restricted range of allowed % tokens. A closing uncertainty token in the first place is an error, % so we filter that out explicitly. After that, we check for digits, @@ -1544,7 +1541,8 @@ % Handling a decimal marker in the uncertainty is a bit tricky: we need to make % sure it's valid. First, we need to be sure that the integer part of the captured % uncertainty is not too long. Then we need to check that the decimal part is -% not too long. Both of these require data from the collected partial number, +% not too long, and extend the decimal if it is. +% Both of these require data from the collected partial number, % so we extract that first. Checking the decimal part needs the length of the % not-yet-collected uncertainty. Handily, we know that it should be a set of % digits then a closing marker. So we can use that as a length: if it's @@ -1578,9 +1576,15 @@ } \@@_parse_uncert_auxii:NN } - { \@@_parse_loop_break:wN } + { \exp_after:wN \@@_parse_uncert_extend:nnnN #2 #2 } #3 \q_recursion_tail \q_recursion_stop } +\cs_new_protected:Npn \@@_parse_uncert_extend:nnnN #1#2#3#4 + { + \tl_set:Nn #4 { {#1} {#2} { #3 0 } } + \@@_parse_uncert:NNNN #4 \c_true_bool + \@@_parse_uncert_auxii:NN + } % \end{macrocode} % No further tokens are allowed after an uncertainty in parenthesis. % \begin{macrocode} @@ -1594,6 +1598,8 @@ % \end{macro} % \end{macro} % \end{macro} +% \end{macro} +% \end{macro} % % \subsection{Processing numbers} % @@ -2298,7 +2304,7 @@ \bool_lazy_all_p:n { { \l_@@_round_half_even_bool } - { \int_if_odd_p:n {#3} } + { ! \int_if_odd_p:n {#3} } { \@@_round_if_half_p:n {#1} } } } @@ -2316,7 +2322,7 @@ \bool_lazy_all_p:n { { \l_@@_round_half_even_bool } - { \int_if_odd_p:n {#3} } + { ! \int_if_odd_p:n {#3} } { \@@_round_if_half_p:n {#1} } } } @@ -2762,7 +2768,7 @@ } \cs_new:Npn \@@_round_uncertainty:nnnnn #1#2#3#4#5 { - \exp_args:Nf \@@_round_uncertainty_aux:nnnnn + \exp_args:Nff \@@_round_uncertainty_aux:nnnnn { \int_eval:n { \tl_count:n {#5} - \tl_count:n {#2} } } {#1} {#2} {#3} {#4} } @@ -2774,8 +2780,9 @@ { \exp_args:Nf \@@_round_uncertainty_aux:nnnnnn { - \tl_if_blank:nT {#5} - { \prg_replicate:nn {#1} { 0 } } + \prg_replicate:nn + { \int_max:nn { #1 - \tl_count:n {#5} } { 0 } } + { 0 } } {#1} {#2} {#3} {#4} {#5} } diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx.dtx index 9a53dd6c880..275f824a356 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx.dtx @@ -106,7 +106,7 @@ % We use \cs{ExplFileDate} as \cs{@ifpackagelater} doesn't work for pre-loaded % \pkg{expl3} in the absence of the package. % \begin{macrocode} -\@ifl@t@r\ExplFileDate{2018-06-01} +\@ifl@t@r\ExplFileDate{2020-01-09} {} {% \PackageError{siunitx}{Support package expl3 too old} @@ -121,7 +121,7 @@ % % Identify the package and give the over all version information. % \begin{macrocode} -\ProvidesExplPackage {siunitx} {2021-07-26} {3.0.23} +\ProvidesExplPackage {siunitx} {2021-08-04} {3.0.24} {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 735ab2d0d8c..136283140d6 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx.tex +++ b/Master/texmf-dist/source/latex/siunitx/siunitx.tex @@ -314,8 +314,8 @@ optional argument, \meta{options}, and one mandatory one, \meta{number}. The contents of \meta{number} are automatically formatted. The formatter removes both \enquote{soft} (\verb*| |) and \enquote{hard} spaces (|\,| and |~|), automatically identifies exponents (as standard marked using |e|, |E|, |d| or -|D|) and adds the appropriate spacing of large numbers. With the standard -settings a leading zero is added before a decimal marker, if needed: both |.| +|D|) and adds the appropriate spacing of large numbers.If required, +a leading zero is added before a decimal marker: both |.| and "," are recognised as decimal markers. \begin{LaTeXdemo} \num{123} \\ @@ -2158,6 +2158,7 @@ the output directly (Table~\ref{tab:opt:units:out}). \midrule bracket-unit-denominator & Switch & true \\ forbid-literal-units & Switch & false \\ + fraction-command & Literal & \cs{frac} \\ inter-unit-product & Literal & \cs{,} \\ parse-units & Switch & true \\ per-mode & Choice & power \\ @@ -2183,11 +2184,13 @@ centred dot. To get the correct spacing it is necessary to use \DescribeOption{per-mode} \DescribeOption{per-symbol} +\DescribeOption{fraction-command} \DescribeOption{bracket-unit-denominator} The handling of \cs{per} is altered using the \opt{per-mode} choice option. The standard setting is \opt{power}, meaning that \cs{per} generates reciprocal powers for units. Setting the option to \opt{fraction} uses the |\frac| function to typeset the positive and negative powers of a unit separately. +The exact function can be adjusted using the \opt{fraction-command} option. \begin{LaTeXdemo} \unit{\joule\per\mole\per\kelvin} \\ \unit{\metre\per\second\squared} \\ -- cgit v1.2.3