From 0b7bb0e5c26e2e478a73d0308ec2b5411a2b1ad2 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 22 May 2021 20:16:01 +0000 Subject: siunitx (22may21) git-svn-id: svn://tug.org/texlive/trunk@59308 c570f23f-e606-0410-a88d-b1316a301751 --- .../source/latex/siunitx/siunitx-number.dtx | 35 ++++++++++++---------- .../source/latex/siunitx/siunitx-table.dtx | 14 ++++----- Master/texmf-dist/source/latex/siunitx/siunitx.dtx | 2 +- Master/texmf-dist/source/latex/siunitx/siunitx.tex | 15 +++++----- 4 files changed, 35 insertions(+), 31 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 3bedf3794ce..dec433df026 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx @@ -68,7 +68,9 @@ % \cs{color} is assumed to be available. Where the latter may apply, numbers % should be printed inside a group: note that \TeX{} grouping is not added % \emph{within} formatted numbers as they may need to be decomposed into parts -% (see \cs{siunitx_number_output:NN}). +% (see \cs{siunitx_number_output:NN}). Such a color will be the \emph{first} +% part of the result, meaning that a test for an initial |\color| and following +% brace group may be used to detect/remove/adjust this part. % % \section{Formatting numbers} % @@ -3008,6 +3010,7 @@ } \cs_new:Npn \@@_output:nnnnnnn #1#2#3#4#5#6#7#8 { + \@@_output_color:n {#2} \@@_output_comparator:nn {#1} {#8} \@@_output_bracket:nn {#5} {#7} \@@_output_sign:nnn {#1} {#2} {#8} @@ -3045,6 +3048,17 @@ \@@_output_exponent:nnnn } % \end{macrocode} +% As color for negative values applies to the \emph{whole} output, we have +% to deal with it before anything else. +% \begin{macrocode} +\cs_new:Npn \@@_output_color:n #1 + { + \bool_lazy_and:nnT + { \str_if_eq_p:nn {#1} { - } } + { ! \tl_if_empty_p:N \l_@@_negative_color_tl } + { \exp_not:N \color { \exp_not:V \l_@@_negative_color_tl } } + } +% \end{macrocode} % To get the spacing correct this needs to be an ordinary math character. % \begin{macrocode} \cs_new:Npn \@@_output_comparator:nn #1#2 @@ -3055,11 +3069,11 @@ } % \end{macrocode} % Formatting signs has to deal with some additional formatting requirements -% for negative numbers. Both making such numbers a fixed color and bracketing -% them needs some rearrangement of the order of tokens, which is set up in -% the main formatting macro by the dedicated do-nothing end function. We -% also have the comparator passed here: if it is present, we need to deal -% with tighter spacing. +% for negative numbers. Making such numbers by bracketing them needs some +% rearrangement of the order of tokens, which is set up in the main +% formatting macro by the dedicated do-nothing end function. We also have +% the comparator passed here: if it is present, we need to deal with +% tighter spacing. % \begin{macrocode} \cs_new:Npn \@@_output_sign:nnn #1#2#3 { @@ -3071,8 +3085,6 @@ { \str_if_eq:nnTF {#2} { - } { - \tl_if_empty:NF \l_@@_negative_color_tl - { \@@_output_sign_color:w } \bool_if:NTF \l_@@_bracket_negative_bool { \@@_output_sign_brackets:w } { \@@_output_sign:nN {#1} #2 } @@ -3093,13 +3105,6 @@ { \exp_not:n { \mathord {#1} } } { \exp_not:n {#1} } } -\cs_new:Npn - \@@_output_sign_color:w #1 \@@_output_end: - { - \exp_not:N \color { \exp_not:V \l_@@_negative_color_tl } - #1 - \@@_output_end: - } \cs_new:Npn \@@_output_sign_brackets:w #1 \@@_output_end: { diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-table.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-table.dtx index f4ca1ec5296..3f8673c2fcd 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx-table.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx-table.dtx @@ -671,10 +671,11 @@ % \end{macrocode} % \end{variable} % -% \begin{macro}{\@@_fil:} -% A primitive renamed. +% \begin{macro}{\@@_fil:, \@@_fill:} +% Primitives renamed. % \begin{macrocode} \cs_new_eq:NN \@@_fil: \tex_hfil:D +\cs_new_eq:NN \@@_fill: \tex_hfill:D % \end{macrocode} % \end{macro} % @@ -695,10 +696,10 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_color_check:N #1 { \exp_after:wN \@@_color_check:w #1 \q_stop } -\cs_new_protected:Npn \@@_color_check:w #1 \q_nil #2 \q_nil #3 \q_stop +\cs_new_protected:Npn \@@_color_check:w #1 \q_nil #2 \q_stop { - \tl_if_head_eq_meaning:nNT {#2} \color - { \@@_color_check:Nnw #2 \q_stop } + \tl_if_head_eq_meaning:nNT {#1} \color + { \@@_color_check:Nnw #1 \q_stop } } \cs_new_protected:Npn \@@_color_check:Nnw #1#2#3 \q_stop { \keys_set:nn { siunitx } { number-color = #2 } } @@ -958,7 +959,6 @@ { \tl_set:Nx \l_@@_tmp_tl { \siunitx_number_output:NN \l_@@_model_tl \q_nil } - \@@_color_check:N \l_@@_tmp_tl \exp_after:wN \@@_direct_format_aux:w \l_@@_tmp_tl \q_stop } @@ -979,7 +979,7 @@ \char_set_active_eq:NN ##1 \@@_direct_format_switch: \char_set_mathcode:nn { `##1 } { "8000 } } - \@@_fil: + \@@_fill: } \cs_new_protected:Npn \@@_direct_format_switch: { diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx.dtx index b8b6b79b026..40ba293d81a 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-05-20} {3.0.3} +\ProvidesExplPackage {siunitx} {2021-05-21} {3.0.4} {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 191e6194909..857a1569a6c 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx.tex +++ b/Master/texmf-dist/source/latex/siunitx/siunitx.tex @@ -1693,7 +1693,7 @@ There are certain combinations of numerical input which can be ambiguous. This can be corrected by adding brackets in the appropriate place, and is controlled by the \opt{bracket-ambiguous-numbers} switch. This option only applies to pure numbers: when formatting quantities, the need for brackets also depends on the -placement of units, so is controlled by \opt{seperate-uncertainty-units}. +placement of units, so is controlled by \opt{separate-uncertainty-units}. \begin{LaTeXdemo} \sisetup{separate-uncertainty} \num{1.2(3)e4} \\ @@ -3147,7 +3147,6 @@ also be done using \pkg{siunitx} (Table~\ref{tbl:xmpl:unrel}). S[ table-format = 5.0, parse-numbers = false, - input-digits = .0123456789, input-decimal-markers = x ] @{} @@ -3393,9 +3392,9 @@ these units, needing no others and with no redundancy. All other units within the \acro{SI} system are regarded as \enquote{derived} from the seven base units. At the most basic, all other \acro{SI} units can be expressed as combinations of the base units. However, many units (listed in -Tables~\ref{tab:unit:derived} and~\ref{tab:unit:accepted}) have a special name -and symbol. Most of these units are simple combinations of one or more base -units (raised to powers as appropriate). +Table~\ref{tab:unit:derived}) have a special name and symbol. Most of these +units are simple combinations of one or more base units (raised to powers as +appropriate). A series of \acro{SI} prefixes for decimal multiples and sub-multiples are provided, and can be used as modifiers for any \acro{SI} unit (either base or @@ -3525,7 +3524,7 @@ but mathematically poor.\footnote{For example, for an acceleration \(a\), the expression $[a]$ is the dimensions of $a$, \foreign{i.e.}~length per time squared in this case.} Much better is to show division of all quantities by the unit, which leaves the entries as unitless ratios. This is illustrated in -Tables~\ref{tab:xmpl:unitless} and~\ref{fig:xmpl:unitless}. +Table~\ref{tab:xmpl:unitless} and Figure~\ref{fig:xmpl:unitless}. \begin{LaTeXdemo}[code and float] \begin{table} \caption{An example of table labelling.% @@ -3580,7 +3579,7 @@ Tables~\ref{tab:xmpl:unitless} and~\ref{fig:xmpl:unitless}. the titles are followed by \enquote{\unit{\kilo\gram}}! \begin{LaTeXdemo}[code and float] \begin{table} - \caption{Good and bad columns.% + \caption{Bad and good columns.% \label{tab:good}} \sisetup{table-number-alignment = center} \begin{tabular}{ @@ -3618,7 +3617,7 @@ unzip this in your local \path{texmf} directory. The package requires \LaTeX3 support as provided in the \pkg{l3kernel} and \pkg{l3packages} bundles. Both of these are included in \TeX{} Live and -MiK\TeX{}, or are again available in ready-to-install from \acro{CTAN}. +MiK\TeX{}, or are again available in ready-to-install form from \acro{CTAN}. \section{Thanks} -- cgit v1.2.3