From 5d4d6e312887e7c62c64d35f26f62f135998afa9 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 20 May 2021 20:17:51 +0000 Subject: siunitx (20may21) git-svn-id: svn://tug.org/texlive/trunk@59279 c570f23f-e606-0410-a88d-b1316a301751 --- .../source/latex/siunitx/siunitx-emulation.dtx | 19 ++++++ .../source/latex/siunitx/siunitx-number.dtx | 19 ++++-- .../source/latex/siunitx/siunitx-symbol.dtx | 32 ++++++++++- .../source/latex/siunitx/siunitx-table.dtx | 67 +++++++++++++++------- Master/texmf-dist/source/latex/siunitx/siunitx.dtx | 2 +- Master/texmf-dist/source/latex/siunitx/siunitx.tex | 4 +- 6 files changed, 112 insertions(+), 31 deletions(-) (limited to 'Master/texmf-dist/source') diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-emulation.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-emulation.dtx index 40f145a6c68..5287f2c8cf8 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx-emulation.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx-emulation.dtx @@ -346,6 +346,18 @@ % \begin{macrocode} \keys_define:nn { siunitx } { + group-digits / false .code:n = + { + \@@_option_deprecated:nn + { group-digits ~ = ~ false } + { group-digits ~ = ~ none } + } , + group-digits / true .code:n = + { + \@@_option_deprecated:nn + { group-digits ~ = ~ true } + { group-digits ~ = ~ all } + } , separate-uncertainty .choice: , separate-uncertainty / false .code:n = { @@ -965,6 +977,13 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\celsius} +% Deprecated but should work. +% \begin{macrocode} +\siunitx_declare_unit:Nn \celsius { \degreeCelsius } +% \end{macrocode} +% \end{macro} +% % \begin{macrocode} % % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx index adc798fb2ca..45f8ad25627 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx @@ -59,6 +59,17 @@ % % \begin{documentation} % +% This submodule is dedicated to parsing and formatting numbers. A small number +% of \LaTeXe{} math mode commands are assumed to be available as part of the +% formatted output. The sign commands \cs{mp}, \cs{pm}, \cs{ll}, \cs{le}, +% \cs{gg} and \cs{ge} are used to replace two-character input; \cs{pm} +% is also required for the output of uncertainties. The standard settings +% require \cs{times}. For the display of colored negative numbers, the command +% \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}). +% % \section{Formatting numbers} % % \begin{function}{\siunitx_number_parse:nN, \siunitx_number_parse:VN} @@ -3085,11 +3096,9 @@ \cs_new:Npn \@@_output_sign_color:w #1 \@@_output_end: { - \exp_not:N \textcolor { \exp_not:V \l_@@_negative_color_tl } - { - #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-symbol.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-symbol.dtx index 6d67c5a29d1..1307e2ee0bf 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx-symbol.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx-symbol.dtx @@ -259,6 +259,8 @@ % same as |\textmu| support. It's hard to check for the product symbol, so % we just go with it an hope for the best! % \begin{macrocode} +\keys_set:nn { siunitx } + { product-symbol = \ifmmode \times \else \texttimes \fi } \AtBeginDocument { \group_begin: @@ -273,12 +275,36 @@ \keys_set:nn { siunitx } { exponent-product = - \ifmmode \times \else \texttimes \fi , - product-symbol = \ifmmode \times \else \texttimes \fi } } - { \group_end: } + { + \tl_set:Nn \l_@@_tmpb_tl { 2 \cdot 10 ^ { 1 } } + \tl_if_eq:NNTF \l_@@_tmpa_tl \l_@@_tmpb_tl + { + \group_end: + \keys_set:nn { siunitx } + { + exponent-product = + \ifmmode \cdot \else \textperiodcentered \fi + } + } + { \group_end: } + } + \group_begin: + \tl_set:Nn \l_@@_tmpa_tl { \mathrm { m } \cdot \mathrm { s } } + \tl_set:Nn \l_siunitx_unit_font_tl { \mathrm } + \siunitx_unit_format:nN { m . s } \l_@@_tmpb_tl + \tl_if_eq:NNTF \l_@@_tmpa_tl \l_@@_tmpb_tl + { + \group_end: + \keys_set:nn { siunitx } + { + inter-unit-product = + \ifmmode \cdot \else \textperiodcentered \fi + } + } + { \group_end: } } % \end{macrocode} % diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-table.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-table.dtx index d16d2d7780f..430a7157104 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx-table.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx-table.dtx @@ -315,7 +315,8 @@ % % \begin{macro}{\@@_collect_loop:} % \begin{macro}{\@@_collect_group:n} -% \begin{macro}{\@@_collect_token:N} +% \begin{macro}{\@@_collect_token:N, \@@_collect_token_aux:N} +% \begin{macro}{\@@_collect_relax:N} % \begin{macro}{\@@_collect_search:NnF} % \begin{macro}{\@@_collect_search_aux:NNn} % Collecting up the cell content needs a loop: this is done using @@ -325,7 +326,8 @@ % (\foreign{cf.}~the approach in \pkg{collcell}): the special cases are % pulled out for manual handling. The flexible lookup approach is more-or-less % the same idea as in the kernel |case| functions. The |\relax| special case -% covers the case where |\\| has been expanded in an empty cell. +% covers the case where |\\| has been expanded in an empty cell. This has to +% be an explicit token as we can get the same meaning from |\protect|. % \begin{macrocode} \cs_new_protected:Npn \@@_collect_loop: { @@ -344,14 +346,22 @@ { \unskip { \@@_collect_loop: } \end { \tabularnewline \end } - \relax { \relax } + \relax { \@@_collect_relax:N #1 } \tabularnewline { \tabularnewline } \siunitx_cell_end: { \siunitx_cell_end: } } - { - \tl_put_right:Nn \l_@@_collect_tl {#1} - \@@_collect_loop: - } + { \@@_collect_token_aux:N #1 } + } +\cs_new_protected:Npn \@@_collect_token_aux:N #1 + { + \tl_put_right:Nn \l_@@_collect_tl {#1} + \@@_collect_loop: + } +\cs_new_protected:Npn \@@_collect_relax:N #1 + { + \str_if_eq:nnTF {#1} { \relax } + { \relax } + { \@@_collect_token_aux:N #1 } } \AtBeginDocument { @@ -365,14 +375,11 @@ \tab@setcr { \@@_collect_loop: } \unskip { \@@_collect_loop: } \end { \tabularnewline \end } - \relax { \relax } + \relax { \@@_collect_relax:N #1 } \tabularnewline { \tabularnewline } \siunitx_cell_end: { \siunitx_cell_end: } } - { - \tl_put_right:Nn \l_@@_collect_tl {#1} - \@@_collect_loop: - } + { \@@_collect_token_aux:N #1 } } } { } @@ -396,6 +403,7 @@ % \end{macro} % \end{macro} % \end{macro} +% \end{macro} % % \subsection{Separating collected material} % @@ -682,16 +690,26 @@ % \begin{macro}{\@@_center_marker:} % 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. +% so is best as a short auxiliary. Notice that we need to allow for the width +% of the decimal marker itself. % \begin{macrocode} \cs_new_protected:Npn \@@_center_marker: { + \hbox_set:Nn \l_@@_tmp_box + { \ensuremath { \mathord { \l_siunitx_number_output_decimal_tl } } } \dim_compare:nNnTF { \box_wd:N \l_@@_integer_box } - > { \box_wd:N \l_@@_decimal_box } + > + { + \box_wd:N \l_@@_decimal_box + - \box_wd:N \l_@@_tmp_box + } { \hbox_set_to_wd:Nnn \l_@@_decimal_box - { \box_wd:N \l_@@_integer_box } + { + \box_wd:N \l_@@_integer_box + + \box_wd:N \l_@@_tmp_box + } { \hbox_unpack:N \l_@@_decimal_box \@@_fil: @@ -699,7 +717,10 @@ } { \hbox_set_to_wd:Nnn \l_@@_integer_box - { \box_wd:N \l_@@_decimal_box } + { + \box_wd:N \l_@@_decimal_box + - \box_wd:N \l_@@_tmp_box + } { \@@_fil: \hbox_unpack:N \l_@@_integer_box @@ -903,8 +924,11 @@ \c_math_toggle_token \hbox_set_end: \@@_center_marker: - \box_use_drop:N \l_@@_integer_box - \box_use_drop:N \l_@@_decimal_box + \use:c { @@_align_ \l_@@_align_text_tl :n } + { + \box_use_drop:N \l_@@_integer_box + \box_use_drop:N \l_@@_decimal_box + } } % \end{macrocode} % For the version where there is space reserved, first format and decompose @@ -1093,8 +1117,11 @@ { \@@_print_marker_aux:w #4 } } \@@_center_marker: - \box_use_drop:N \l_@@_integer_box - \box_use_drop:N \l_@@_decimal_box + \use:c { @@_align_ \l_@@_align_text_tl :n } + { + \box_use_drop:N \l_@@_integer_box + \box_use_drop:N \l_@@_decimal_box + } } \cs_new:Npn \@@_print_marker_aux:w #1 \q_nil #2 \q_nil #3 \q_nil #4 \q_nil #5 \q_nil #6 \q_nil #7 \q_nil diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx.dtx index 99932bd943f..9e4705dd4d8 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-18} {3.0.1} +\ProvidesExplPackage {siunitx} {2021-05-19} {3.0.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 2fc9e465d0b..e7035ee5c8c 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx.tex +++ b/Master/texmf-dist/source/latex/siunitx/siunitx.tex @@ -481,7 +481,7 @@ Runs of products of of numbers with units can be handled using the \begin{function}{\qtyrange} \begin{syntax} - \cs{qtyrange}\oarg{options}\marg{number1}\meta{number2}\marg{unit} + \cs{qtyrange}\oarg{options}\marg{number1}\marg{number2}\marg{unit} \end{syntax} \end{function} Products of numbers with units can be handled using the \cs{qtyrange} @@ -3567,7 +3567,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 form from \acro{CTAN}. +MiK\TeX{}, or are again available in ready-to-install from \acro{CTAN}. \section{Thanks} -- cgit v1.2.3