diff options
author | Karl Berry <karl@freefriends.org> | 2021-05-22 20:16:01 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-05-22 20:16:01 +0000 |
commit | 0b7bb0e5c26e2e478a73d0308ec2b5411a2b1ad2 (patch) | |
tree | a727e90ee46fec3c7db290263e683094db9034f8 | |
parent | e96c767f8326af5def39f4902980cb0e887a5e0a (diff) |
siunitx (22may21)
git-svn-id: svn://tug.org/texlive/trunk@59308 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md | 12 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/siunitx/siunitx-code.pdf | bin | 1441368 -> 1441845 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/siunitx/siunitx.pdf | bin | 605429 -> 605308 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx | 35 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/siunitx/siunitx-table.dtx | 14 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/siunitx/siunitx.dtx | 2 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/siunitx/siunitx.tex | 15 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/siunitx/siunitx.sty | 29 |
8 files changed, 60 insertions, 47 deletions
diff --git a/Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md b/Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md index 3215c8926b3..093b87bada3 100644 --- a/Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md +++ b/Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md @@ -7,6 +7,15 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to ## [Unreleased] +## [v3.0.4] + +### Changed +- Standardise and document the position of `\color` in negative values + within the code-level API + +### Fixed +- Alignment of integers in tables when `parse-numbers = tables` (issue #442) + ## [v3.0.3] ### Changed @@ -1280,7 +1289,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.3...HEAD +[Unreleased]: https://github.com/josephwright/siunitx/compare/v3.0.4...HEAD +[v3.0.4]: https://github.com/josephwright/siunitx/compare/v3.0.3...v3.0.4 [v3.0.3]: https://github.com/josephwright/siunitx/compare/v3.0.2...v3.0.3 [v3.0.2]: https://github.com/josephwright/siunitx/compare/v3.0.1...v3.0.2 [v3.0.1]: https://github.com/josephwright/siunitx/compare/v3.0.0...v3.0.1 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 16510233a49..718aeef446a 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 2c3c742c949..3a8e7d02774 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 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 } @@ -3094,13 +3106,6 @@ { \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: { \exp_not:V \l_@@_bracket_open_tl 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} diff --git a/Master/texmf-dist/tex/latex/siunitx/siunitx.sty b/Master/texmf-dist/tex/latex/siunitx/siunitx.sty index 0503d1dc192..6bcb2422b9a 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-05-20} {3.0.3} +\ProvidesExplPackage {siunitx} {2021-05-21} {3.0.4} {A comprehensive (SI) units package} \msg_new:nnnn { siunitx } { incompatible-package } { Package~'#1'~incompatible. } @@ -2985,6 +2985,7 @@ } \cs_new:Npn \__siunitx_number_output:nnnnnnn #1#2#3#4#5#6#7#8 { + \__siunitx_number_output_color:n {#2} \__siunitx_number_output_comparator:nn {#1} {#8} \__siunitx_number_output_bracket:nn {#5} {#7} \__siunitx_number_output_sign:nnn {#1} {#2} {#8} @@ -3016,6 +3017,13 @@ \exp_not:V \l__siunitx_number_bracket_close_tl \__siunitx_number_output_exponent:nnnn } +\cs_new:Npn \__siunitx_number_output_color:n #1 + { + \bool_lazy_and:nnT + { \str_if_eq_p:nn {#1} { - } } + { ! \tl_if_empty_p:N \l__siunitx_number_negative_color_tl } + { \exp_not:N \color { \exp_not:V \l__siunitx_number_negative_color_tl } } + } \cs_new:Npn \__siunitx_number_output_comparator:nn #1#2 { \tl_if_blank:nF {#1} @@ -3032,8 +3040,6 @@ { \str_if_eq:nnTF {#2} { - } { - \tl_if_empty:NF \l__siunitx_number_negative_color_tl - { \__siunitx_number_output_sign_color:w } \bool_if:NTF \l__siunitx_number_bracket_negative_bool { \__siunitx_number_output_sign_brackets:w } { \__siunitx_number_output_sign:nN {#1} #2 } @@ -3055,13 +3061,6 @@ { \exp_not:n {#1} } } \cs_new:Npn - \__siunitx_number_output_sign_color:w #1 \__siunitx_number_output_end: - { - \exp_not:N \color { \exp_not:V \l__siunitx_number_negative_color_tl } - #1 - \__siunitx_number_output_end: - } -\cs_new:Npn \__siunitx_number_output_sign_brackets:w #1 \__siunitx_number_output_end: { \exp_not:V \l__siunitx_number_bracket_open_tl @@ -4060,15 +4059,16 @@ \box_new:N \l__siunitx_table_integer_box \box_new:N \l__siunitx_table_decimal_box \cs_new_eq:NN \__siunitx_table_fil: \tex_hfil:D +\cs_new_eq:NN \__siunitx_table_fill: \tex_hfill:D \cs_new:Npn \__siunitx_table_cleanup_decimal:w #1 \q_nil #2 \q_nil #3 \q_nil #4 \q_nil #5 \q_nil #6 \q_nil #7 \q_nil { #1#2#3#4#5#6#7 } \cs_new_protected:Npn \__siunitx_table_color_check:N #1 { \exp_after:wN \__siunitx_table_color_check:w #1 \q_stop } -\cs_new_protected:Npn \__siunitx_table_color_check:w #1 \q_nil #2 \q_nil #3 \q_stop +\cs_new_protected:Npn \__siunitx_table_color_check:w #1 \q_nil #2 \q_stop { - \tl_if_head_eq_meaning:nNT {#2} \color - { \__siunitx_table_color_check:Nnw #2 \q_stop } + \tl_if_head_eq_meaning:nNT {#1} \color + { \__siunitx_table_color_check:Nnw #1 \q_stop } } \cs_new_protected:Npn \__siunitx_table_color_check:Nnw #1#2#3 \q_stop { \keys_set:nn { siunitx } { number-color = #2 } } @@ -4245,7 +4245,6 @@ { \tl_set:Nx \l__siunitx_table_tmp_tl { \siunitx_number_output:NN \l__siunitx_table_model_tl \q_nil } - \__siunitx_table_color_check:N \l__siunitx_table_tmp_tl \exp_after:wN \__siunitx_table_direct_format_aux:w \l__siunitx_table_tmp_tl \q_stop } @@ -4266,7 +4265,7 @@ \char_set_active_eq:NN ##1 \__siunitx_table_direct_format_switch: \char_set_mathcode:nn { `##1 } { "8000 } } - \__siunitx_table_fil: + \__siunitx_table_fill: } \cs_new_protected:Npn \__siunitx_table_direct_format_switch: { |