summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-06-02 20:59:05 +0000
committerKarl Berry <karl@freefriends.org>2021-06-02 20:59:05 +0000
commitd33b92d9d4a7e58fe1a2b2a7795a1ac51b25f0b3 (patch)
tree98f483a0f383e0cbcd33b6f450836843d0732c58
parent3b90242ab28c1c59546d3cf26e0663803f397407 (diff)
siunitx (2jun21)
git-svn-id: svn://tug.org/texlive/trunk@59437 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md40
-rw-r--r--Master/texmf-dist/doc/latex/siunitx/siunitx-code.pdfbin1447215 -> 1447170 bytes
-rw-r--r--Master/texmf-dist/doc/latex/siunitx/siunitx-table.pdfbin0 -> 475888 bytes
-rw-r--r--Master/texmf-dist/doc/latex/siunitx/siunitx.pdfbin603229 -> 607150 bytes
-rw-r--r--Master/texmf-dist/source/latex/siunitx/siunitx-compound.dtx7
-rw-r--r--Master/texmf-dist/source/latex/siunitx/siunitx-emulation.dtx1
-rw-r--r--Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx139
-rw-r--r--Master/texmf-dist/source/latex/siunitx/siunitx-table.dtx58
-rw-r--r--Master/texmf-dist/source/latex/siunitx/siunitx-unit.dtx20
-rw-r--r--Master/texmf-dist/source/latex/siunitx/siunitx.dtx2
-rw-r--r--Master/texmf-dist/source/latex/siunitx/siunitx.tex59
-rw-r--r--Master/texmf-dist/tex/latex/siunitx/siunitx.sty152
12 files changed, 279 insertions, 199 deletions
diff --git a/Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md b/Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md
index 2e71ec3ecad..6cde2cdc729 100644
--- a/Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md
+++ b/Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md
@@ -7,12 +7,25 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to
## [Unreleased]
+## [v3.0.9]
+
+### Changed
+- Documentation improvements
+- Add a hint for formatting regression tables
+
+### Fixed
+- Suppress some spurious overfull box warnings
+- Issue an error with `output-product`
+- Rounding of uncertainties falling in the integer part (issue #454)
+- Printing in text mode for compound quantities (issue #463)
+- Correctly handle `\protect` in literal units (issue #464)
+- Interpretation of uncertainties in integers (issue #465)
+
## [v3.0.8]
### Changed
- Documentation improvements
-- Add `\barn`, `\knot`, `\mmHg`, `\nauticalmile` to list of
- deprecated units
+- Add `\barn`, `\knot`, `\mmHg`, `\nauticalmile` to list of deprecated units
- Provide a fallback route for deprecated units
### Fixed
@@ -23,10 +36,9 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to
### Fixed
- Formatting of some literal units (issue #449)
-- Issue a warning for removed option `load-configurations`
- (issue #455)
-- Printing of `\times` and `\cdot` in text mode when using a
- locale (issue #457)
+- Issue a warning for removed option `load-configurations` (issue #455)
+- Printing of `\times` and `\cdot` in text mode when using a locale
+ (issue #457)
- Implement missing `output-exponent-marker` (issue #458)
## [v3.0.6]
@@ -35,10 +47,9 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to
- Documentation improvements
### Fixed
-- Avoid error if `forbid-literal-units` is set in the preamble
- (issue #452)
-- Format separate uncertainty correctly where it falls purely
- in the integer part (issue #454)
+- Avoid error if `forbid-literal-units` is set in the preamble (issue #452)
+- Format separate uncertainty correctly where it falls purely in the integer
+ part (issue #454)
## [v3.0.5]
@@ -46,8 +57,7 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to
- Documentation improvements
### Fixed
-- Bracket separate uncertainties in compound quantities
- (issue #441)
+- Bracket separate uncertainties in compound quantities (issue #441)
- Color negative values in table cells correctly (issue #444)
- Avoid consumption of any math alphabets (issue #445)
- Mark `\bar` as removed (issue #448)
@@ -98,8 +108,7 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to
### Fixed
- Printing of fractional units in text mode (issue #418)
-- Include `siunitx-abbreviations.cfg` in fallback v2 files
- (issue #419)
+- Include `siunitx-abbreviations.cfg` in fallback v2 files (issue #419)
- French translation of 'to' for ranges (issue #421)
## [v3.0.0]
@@ -1334,7 +1343,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.8...HEAD
+[Unreleased]: https://github.com/josephwright/siunitx/compare/v3.0.9...HEAD
+[v3.0.9]: https://github.com/josephwright/siunitx/compare/v3.0.8...v3.0.9
[v3.0.8]: https://github.com/josephwright/siunitx/compare/v3.0.7...v3.0.8
[v3.0.7]: https://github.com/josephwright/siunitx/compare/v3.0.6...v3.0.7
[v3.0.6]: https://github.com/josephwright/siunitx/compare/v3.0.5...v3.0.6
diff --git a/Master/texmf-dist/doc/latex/siunitx/siunitx-code.pdf b/Master/texmf-dist/doc/latex/siunitx/siunitx-code.pdf
index 6ba4bd131f0..3c20dfb0f6f 100644
--- a/Master/texmf-dist/doc/latex/siunitx/siunitx-code.pdf
+++ b/Master/texmf-dist/doc/latex/siunitx/siunitx-code.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/siunitx/siunitx-table.pdf b/Master/texmf-dist/doc/latex/siunitx/siunitx-table.pdf
new file mode 100644
index 00000000000..6c241941b53
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/siunitx/siunitx-table.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/siunitx/siunitx.pdf b/Master/texmf-dist/doc/latex/siunitx/siunitx.pdf
index 4388753d2f6..356fee236bd 100644
--- a/Master/texmf-dist/doc/latex/siunitx/siunitx.pdf
+++ b/Master/texmf-dist/doc/latex/siunitx/siunitx.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-compound.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-compound.dtx
index a164d883b70..f377585b782 100644
--- a/Master/texmf-dist/source/latex/siunitx/siunitx-compound.dtx
+++ b/Master/texmf-dist/source/latex/siunitx/siunitx-compound.dtx
@@ -669,7 +669,7 @@
\str_if_eq:VnT \l_siunitx_quantity_prefix_mode_tl { combine-exponent }
{ \tl_clear:N \l_@@_exp_tl }
\bool_if:NTF \l_@@_unit_repeat_bool
- { \@@_print:N \@@_print_quantity:n }
+ { \@@_print:N \@@_print_quantity:x }
{
\bool_lazy_and:nnTF
{ \l_@@_unit_bracket_bool }
@@ -692,6 +692,8 @@
% \begin{macro}{\@@_print:nnnN}
% \begin{macro}{\@@_print_aux:n}
% \begin{macro}{\@@_print_aux:nn}
+% \begin{macro}{\@@_print_quantity:n, \@@_print_quantity:x}
+% \begin{macro}{\@@_print_separator:n, \@@_print_separator:V}
% We now need to know how many entries there are: the reason we don't use
% \cs{seq_use:Nnnn} is that we want to be able to insert
% \cs{siunitx_print_\dots:n} in a controlled way.
@@ -794,6 +796,7 @@
}
\cs_new_protected:Npn \@@_print_quantity:n #1
{ \siunitx_quantity_print:nV {#1} \l_@@_unit_tl }
+\cs_generate_variant:Nn \@@_print_quantity:n { x }
\cs_new_protected:Npn \@@_print_separator:n #1
{
\bool_if:NTF \l_@@_separator_text_bool
@@ -807,6 +810,8 @@
% \end{macro}
% \end{macro}
% \end{macro}
+% \end{macro}
+% \end{macro}
%
% \begin{macro}[EXP]{\@@_uncert_bracket:N}
% \begin{macro}[EXP]{\@@_uncert_bracket:w}
diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-emulation.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-emulation.dtx
index 0878c37d74e..3d2e0370f15 100644
--- a/Master/texmf-dist/source/latex/siunitx/siunitx-emulation.dtx
+++ b/Master/texmf-dist/source/latex/siunitx/siunitx-emulation.dtx
@@ -393,6 +393,7 @@
{
input-protect-tokens ,
input-quotient ,
+ output-product ,
quotient-mode
}
{
diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx
index 070b9c5e9d5..b304a573c9d 100644
--- a/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx
+++ b/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx
@@ -2708,7 +2708,8 @@
%
% \begin{macro}[EXP]{\@@_round_uncertainty:nnnnnnn}
% \begin{macro}[EXP]{\@@_round_uncertainty:nnn}
-% \begin{macro}[EXP]{\@@_round_uncertainty:nnnnn}
+% \begin{macro}[EXP]{\@@_round_uncertainty:nnnnn, \@@_round_uncertainty_aux:nnnnn}
+% \begin{macro}[EXP]{\@@_round_uncertainty_aux:nnnnnn}
% Rounding to an uncertainty can only happen where the result will have some
% uncertainty left: otherwise we simply drop the uncertainty entirely. Only
% |S|-type uncertainties can be used for rounding.
@@ -2740,28 +2741,54 @@
\exp_last_unbraced:Nf \@@_round_uncertainty:nnnnn
{
\@@_round:fnn
- { \tl_count:n {#3} - \l_@@_round_precision_int } { } {#3}
+ {
+ \int_eval:n
+ { \tl_count:n {#3} - \l_@@_round_precision_int }
+ }
+ { } {#3}
}
{#1} {#2} {#3}
}
\cs_new:Npn \@@_round_uncertainty:nnnnn #1#2#3#4#5
{
- \tl_if_blank:nTF {#1}
+ \exp_args:Nf \@@_round_uncertainty_aux:nnnnn
+ { \int_eval:n { \tl_count:n {#5} - \tl_count:n {#2} } }
+ {#1} {#2} {#3} {#4}
+ }
+% \end{macrocode}
+% The first argument here deals with the case where we've lost digits
+% in the uncertainty and it's purely located in the integer part.
+% \begin{macrocode}
+\cs_new:Npn \@@_round_uncertainty_aux:nnnnn #1#2#3#4#5
+ {
+ \exp_args:Nf \@@_round_uncertainty_aux:nnnnnn
{
- \@@_round:fnn
- { \tl_count:n {#5} - \tl_count:n {#2} } {#3} {#4}
- { { S } {#2} }
+ \tl_if_blank:nT {#5}
+ { \prg_replicate:nn {#1} { 0 } }
+ }
+ {#1} {#2} {#3} {#4} {#5}
+ }
+\cs_new:Npn \@@_round_uncertainty_aux:nnnnnn #1#2#3#4#5#6
+ {
+ \tl_if_blank:nTF {#3}
+ {
+ \@@_round:nnn
+ {#2}
+ {#5} {#6}
+ { { S } { #4 #1 } }
}
{
\@@_round:fnn
- { \tl_count:n {#5} - \tl_count:n {#2} + 1 } {#3} {#4}
- { { S } { #1 \@@_round_truncate_direct:n {#2} } }
+ { \int_eval:n { #2 + 1 } }
+ {#5} {#6}
+ { { S } { #3 \@@_round_truncate_direct:n {#4} #1 } }
}
}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
+% \end{macro}
%
% \begin{macro}{\@@_zero_decimal:NN}
% \begin{macro}[EXP]{\@@_zero_decimal:nnnnnnn}
@@ -2966,17 +2993,14 @@
% \begin{macro}[rEXP]{\@@_output_decimal_loop:NNNN}
% \begin{macro}[rEXP]{\@@_output_integer_first:nnNN}
% \begin{macro}[rEXP]{\@@_output_integer_loop:NNNN}
-% \begin{macro}[rEXP]{\@@_output_uncertainty:nnnn}
+% \begin{macro}[rEXP]{\@@_output_uncertainty:nnn}
% \begin{macro}[rEXP]{\@@_output_uncertainty_unaligned:n}
-% \begin{macro}[rEXP]{\@@_output_uncert_S:nnnnw}
-% \begin{macro}[rEXP]{\@@_output_uncert_S_auxi:nn}
-% \begin{macro}[rEXP]{\@@_output_uncert_S_auxii:nnN}
-% \begin{macro}[rEXP]{\@@_output_uncert_S_auxiii:nnn}
+% \begin{macro}[rEXP]{\@@_output_uncert_S:nnnw}
% \begin{macro}[rEXP]
-% {\@@_output_uncert_S_auxiv:nnn, \@@_output_uncert_S_auxiv:fnn}
+% {\@@_output_uncert_S_aux:nnn, \@@_output_uncert_S_aux:fnn}
% \begin{macro}[rEXP]
-% {\@@_output_uncert_S_auxv:nnnw, \@@_output_uncert_S_auxv:fnnw}
-% \begin{macro}[rEXP]{\@@_output_uncert_S_auxvi:nnw}
+% {\@@_output_uncert_S:nnnw, \@@_output_uncert_S:fnw}
+% \begin{macro}[rEXP]{\@@_output_uncert_S:nnw}
% \begin{macro}[rEXP]
% {
% \@@_output_uncert_S_compact:nn ,
@@ -3022,7 +3046,7 @@
\@@_output_sign:nnn {#1} {#2} {#8}
\@@_output_integer:nnn {#3} {#4} {#7}
\@@_output_decimal:nn {#4} {#8}
- \@@_output_uncertainty:nnnn {#5} {#3} {#4} {#8}
+ \@@_output_uncertainty:nnn {#5} {#4} {#8}
\@@_output_exponent:nnnn {#6} {#7} { #3 . #4 } {#8}
\@@_output_end:
}
@@ -3232,77 +3256,41 @@
% digit tokens need to be removed from the start of the uncertainty and
% the split result sent to the appropriate auxiliaries.
% \begin{macrocode}
-\cs_new:Npn \@@_output_uncertainty:nnnn #1#2#3#4
+\cs_new:Npn \@@_output_uncertainty:nnn #1#2#3
{
\tl_if_blank:nTF {#1}
- { \@@_output_uncertainty_unaligned:n {#4} }
+ { \@@_output_uncertainty_unaligned:n {#3} }
{
- \use:c { @@_output_uncert_ \tl_head:n {#1} :nnnnw }
- {#2} {#3} {#4} #1
+ \use:c { @@_output_uncert_ \tl_head:n {#1} :nnnw }
+ {#2} {#3} #1
}
}
\cs_new:Npn \@@_output_uncertainty_unaligned:n #1
{ \exp_not:n { #1 #1 #1 #1 } }
-% \end{macrocode}
-% There is a bit more to do here if the uncertainty is purely in the integer
-% part and printed separately. We need to pad it by the number of
-% non-significant figures, then pass on to allow digit separation.
-% \begin{macrocode}
-\cs_new:Npn \@@_output_uncert_S:nnnnw #1#2#3#4#5
+\cs_new:Npn \@@_output_uncert_S:nnnw #1#2#3#4
{
\str_if_eq:VnTF \l_@@_uncert_mode_tl { separate }
{
- \exp_not:n {#3}
+ \exp_not:n {#2}
\@@_output_sign:N \pm
- \exp_not:n {#3}
- \tl_if_blank:nTF {#2}
- { \@@_output_uncert_S_auxi:nnn {#1} {#5} {#3} }
- {
- \@@_output_uncert_S_auxiv:fnn
- { \int_eval:n { \tl_count:n {#5} - \tl_count:n {#2} } }
- {#5} {#3}
- }
+ \exp_not:n {#2}
+ \@@_output_uncert_S_aux:nnn
+ { \int_eval:n { \tl_count:n {#4} - \tl_count:n {#1} } }
+ {#4} {#2}
}
{
\exp_not:V \l_@@_uncert_separator_tl
\exp_not:V \l_@@_output_uncert_open_tl
- \use:c { @@_output_uncert_S_ \l_@@_uncert_mode_tl :nn } {#2} {#5}
+ \use:c { @@_output_uncert_S_ \l_@@_uncert_mode_tl :nn } {#1} {#4}
\exp_not:V \l_@@_output_uncert_close_tl
- \@@_output_uncertainty_unaligned:n {#3}
- }
- }
-\cs_new:Npn \@@_output_uncert_S_auxi:nnn #1#2#3
- {
- \@@_output_uncert_S_auxii:nnN { 0 } {#2} #1
- \q_recursion_tail \q_recursion_stop {#3}
- }
-\cs_new:Npn \@@_output_uncert_S_auxii:nnN #1#2#3
- {
- \quark_if_recursion_tail_stop_do:Nn #3
- {
- \exp_args:Nf \@@_output_uncert_S_auxiii:nnn
- { \prg_replicate:nn {#1} { 0 } } {#2}
- }
- \str_if_eq:nnTF {#3} { 0 }
- {
- \exp_args:Nf \@@_output_uncert_S_auxii:nnN
- { \int_eval:n { #1 + 1 } } {#2}
+ \@@_output_uncertainty_unaligned:n {#2}
}
- { \@@_output_uncert_S_auxii:nnN { 0 } {#2} }
}
-\cs_new:Npn \@@_output_uncert_S_auxiii:nnn #1#2#3
- {
- \@@_output_uncert_S_auxiv:fnn
- { \int_eval:n { \tl_count:n {#2#1} } } {#2#1} {#3}
- }
-% \end{macrocode}
-% All separated uncertainties bring us to here.
-% \begin{macrocode}
-\cs_new:Npn \@@_output_uncert_S_auxiv:nnn #1#2#3
+\cs_new:Npn \@@_output_uncert_S_aux:nnn #1#2#3
{
\int_compare:nNnTF {#1} > 0
{
- \@@_output_uncert_S_auxv:fnnw
+ \@@_output_uncert_S_aux:fnnw
{ \int_eval:n { #1 - 1 } }
{#3}
{ }
@@ -3318,23 +3306,23 @@
{#3}
}
}
-\cs_generate_variant:Nn \@@_output_uncert_S_auxiv:nnn { f }
-\cs_new:Npn \@@_output_uncert_S_auxv:nnnw #1#2#3#4
+\cs_generate_variant:Nn \@@_output_uncert_S_aux:nnn { f }
+\cs_new:Npn \@@_output_uncert_S_aux:nnnw #1#2#3#4
{
\quark_if_nil:NF #4
{
\int_compare:nNnTF {#1} = 0
- { \@@_output_uncert_S_auxvi:nnw {#3#4} {#2} }
+ { \@@_output_uncert_S_aux:nnw {#3#4} {#2} }
{
- \@@_output_uncert_S_auxv:fnnw
+ \@@_output_uncert_S_aux:fnnw
{ \int_eval:n { #1 - 1 } }
{#2}
{#3#4}
}
}
}
-\cs_generate_variant:Nn \@@_output_uncert_S_auxv:nnnw { f }
-\cs_new:Npn \@@_output_uncert_S_auxvi:nnw #1#2#3 \q_nil
+\cs_generate_variant:Nn \@@_output_uncert_S_aux:nnnw { f }
+\cs_new:Npn \@@_output_uncert_S_aux:nnw #1#2#3 \q_nil
{
\@@_output_digits:nn { integer } {#1}
\@@_output_decimal:nn {#3} {#2}
@@ -3356,7 +3344,7 @@
}
\cs_new:Npn \@@_output_uncert_S_full:nn #1#2
{
- \@@_output_uncert_S_auxiv:fnn
+ \@@_output_uncert_S_aux:fnn
{ \int_eval:n { \tl_count:n {#2} - \tl_count:n {#1} } }
{#2} { }
}
@@ -3455,9 +3443,6 @@
% \end{macro}
% \end{macro}
% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
%
% \subsection{Miscellaneous tools}
%
diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-table.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-table.dtx
index c0330900228..269015d857f 100644
--- a/Master/texmf-dist/source/latex/siunitx/siunitx-table.dtx
+++ b/Master/texmf-dist/source/latex/siunitx/siunitx-table.dtx
@@ -1027,6 +1027,15 @@
% \end{macrocode}
% \end{variable}
%
+% \begin{variable}{\l_@@_before_dim}
+% Space reserved for any non-numerical text before the number: as we need
+% to allow for this to be available after setting the integer part, we need
+% to carry it along for a bit.
+% \begin{macrocode}
+\dim_new:N \l_@@_before_dim
+% \end{macrocode}
+% \end{variable}
+%
% \begin{variable}{\l_@@_carry_dim}
% Used to \enquote{carry forward} the amount of white space which needs to
% be inserted after the decimal marker.
@@ -1067,14 +1076,19 @@
% \begin{macro}{\@@_print_marker:w}
% \begin{macro}[EXP]{\@@_print_marker_aux:w}
% \begin{macro}{\@@_print_format:nnn}
+% \begin{macro}[EXP]{\@@_print_format:nnnnnn}
% \begin{macro}
% {
-% \@@_print_marker_auxi:w,
-% \@@_print_marker_auxii:w,
-% \@@_print_marker_auxiii:w
+% \@@_print_format_auxi:w ,
+% \@@_print_format_auxii:w ,
+% \@@_print_format_auxiii:w ,
+% \@@_print_format_auxiv:w ,
+% \@@_print_format_auxv:w ,
+% \@@_print_format_auxvi:w ,
+% \@@_print_format_auxvii:w
% }
-% \begin{macro}{\@@_print_format_after:N}
% \begin{macro}{\@@_print_format_box:Nn}
+% \begin{macro}{\@@_print_format_after:N}
% \begin{macro}{\@@_print_none:nnn}
% \begin{macrocode}
\cs_new_protected:Npn \@@_print:nnn #1#2#3
@@ -1157,7 +1171,9 @@
% are a number of alignment points to get right. As for the |marker| approach,
% first we check if the material before the numerical content is of zero
% width. Next we need to format the model and content numbers, before
-% starting an auxiliary chain to pick out the various parts in order.
+% starting an auxiliary chain to pick out the various parts in order. We have
+% to carry the amount of space for the non-numerical material before the cell
+% forward: this may end up being enlarged by unused parts of the integer.
% \begin{macrocode}
\cs_new_protected:Npn \@@_print_format:nnn #1#2#3
{
@@ -1168,12 +1184,7 @@
\box_clear:N \l_@@_before_box
#1
}
- \hbox_set_to_wd:Nnn \l_@@_before_box
- { \box_wd:N \l_@@_tmp_box }
- {
- \@@_fil:
- \hbox_unpack:N \l_@@_before_box
- }
+ \dim_set:Nn \l_@@_before_dim { \box_wd:N \l_@@_tmp_box }
\siunitx_number_parse:nN {#2} \l_@@_tmp_tl
\group_begin:
\bool_if:NT \l_@@_auto_round_bool
@@ -1239,16 +1250,11 @@
}
{
\@@_print_format_box:Nn \l_@@_integer_box {#3}
- \hbox_set_to_wd:Nnn \l_@@_before_box
+ \dim_add:Nn \l_@@_before_dim
{
- \box_wd:N \l_@@_before_box
- + \box_wd:N \l_@@_tmp_box
+ \box_wd:N \l_@@_tmp_box
- \box_wd:N \l_@@_integer_box
}
- {
- \@@_fil:
- \hbox_unpack:N \l_@@_before_box
- }
}
\@@_print_format_auxii:w #2 \q_mark #4 \q_stop
}
@@ -1259,6 +1265,9 @@
% much \emph{extra} material has been added. To avoid using more boxes
% or re-setting, we do that by recording sizes before and after the change.
% (In effect, \cs{l_@@_tmp_dim} is here \enquote{l_@@_comparator_dim}.)
+% As the integer part is completed here, we are able to finalise the width
+% of the pre-numeral part, reboxing it to have the correct width and possibly
+% to force a single overfull warning if appropriate.
% \begin{macrocode}
\cs_new_protected:Npn \@@_print_format_auxii:w
#1 \q_nil #2 \q_nil #3 \q_mark #4 \q_nil #5 \q_nil #6 \q_stop
@@ -1301,19 +1310,19 @@
\hbox_unpack:N \l_@@_integer_box
\siunitx_print_number:n {#4#5}
}
- \hbox_set_to_wd:Nnn \l_@@_before_box
+ \dim_add:Nn \l_@@_before_dim
{
- \box_wd:N \l_@@_before_box
+ \box_wd:N \l_@@_tmp_box
+ \l_@@_tmp_dim
- \box_wd:N \l_@@_integer_box
}
- {
- \@@_fil:
- \hbox_unpack:N \l_@@_before_box
- }
}
}
+ \hbox_set_to_wd:Nnn \l_@@_before_box \l_@@_before_dim
+ {
+ \@@_fil:
+ \hbox_unpack:N \l_@@_before_box
+ }
\@@_print_format_auxiii:w #3 \q_mark #6 \q_stop
}
% \end{macrocode}
@@ -1458,6 +1467,7 @@
% \end{macro}
% \end{macro}
% \end{macro}
+% \end{macro}
%
% \subsection{Standard settings for module options}
%
diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-unit.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-unit.dtx
index 604883dfa6e..782ac23dcf2 100644
--- a/Master/texmf-dist/source/latex/siunitx/siunitx-unit.dtx
+++ b/Master/texmf-dist/source/latex/siunitx/siunitx-unit.dtx
@@ -1181,7 +1181,12 @@
% \begin{macro}{\@@_format_literal_auxiii:w}
% \begin{macro}{\@@_format_literal_auxiv:n}
% \begin{macro}{\@@_format_literal_auxv:nw}
-% \begin{macro}{\@@_format_literal_auxvi:nN}
+% \begin{macro}
+% {
+% \@@_format_literal_auxvi:nN ,
+% \@@_format_literal_auxvii:nN ,
+% \@@_format_literal_auxviii:nN
+% }
% \begin{macro}{\@@_format_literal_super:nn, \@@_format_literal_sub:nn}
% \begin{macro}{\@@_format_literal_add:n}
% \begin{macro}{\@@_format_literal_auxvii:nn}
@@ -1293,9 +1298,20 @@
\exp_not:N \token_if_eq_meaning:NNTF
#2 \c_@@_math_subscript_tl
{ \exp_not:N \@@_format_literal_sub:nn {#1} }
- { \exp_not:N \@@_format_literal_auxvi:nN {#1#2} }
+ { \exp_not:N \@@_format_literal_auxvii:nN {#1} #2 }
}
}
+% \end{macrocode}
+% We need to make sure |\protect| sticks with the next token.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_format_literal_auxvii:nN #1#2
+ {
+ \str_if_eq:nnTF {#2} { \protect }
+ { \@@_format_literal_auxviii:nN {#1} }
+ { \@@_format_literal_auxvi:nN {#1#2} }
+ }
+\cs_new_protected:Npn \@@_format_literal_auxviii:nN #1#2
+ { \@@_format_literal_auxv:nw { #1 \protect #2 } }
\cs_new_protected:Npn \@@_format_literal_super:nn #1#2
{
\quark_if_recursion_tail_stop:n {#2}
diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx.dtx
index 33b6776591d..cd0c5ca2c9d 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-31} {3.0.8}
+\ProvidesExplPackage {siunitx} {2021-06-01} {3.0.9}
{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 76afc348615..86db9afa6c9 100644
--- a/Master/texmf-dist/source/latex/siunitx/siunitx.tex
+++ b/Master/texmf-dist/source/latex/siunitx/siunitx.tex
@@ -3219,6 +3219,54 @@ also be done using \pkg{siunitx} (Table~\ref{tbl:xmpl:unrel}).
\end{table}
\end{LaTeXdemo}
+\subsection{Regression tables%
+ \label{sec:hint:regression}}
+
+In some subject areas, it is common to present regression values or similar,
+which feature an uncertainty value in parenthesis on the line below the main
+value. As these are separate cells, they cannot be entered using \pkg{siunitx}
+in one value. There are a couple of ways of formatting them using the package,
+depending on whether the values also need to be parsed.
+
+Where parsing is not required, the most straight-forward method is available:
+provide a model format allowing space for an extra \enquote{digit} at each end,
+which will then allow for the parenthesis. If a sign is applied to the number,
+it may not be necessary to add a \enquote{digit} for the leading bracket. If
+parsing is also required, this approach cannot be employed. Instead, the
+parsing needs to be adjusted such that |(| and |)| are not treated as part of
+the number, and \opt{table-align-text-pre} is set to |false| such that these
+will be placed next to the numerical part. These methods are illustrated in
+Table~\ref{tab:regression}.
+
+\begin{LaTeXdemo}[code and float]
+ \begin{table}
+ \caption{Regression tables%
+ \label{tab:regression}
+ }
+ \begin{tabular}
+ {
+ @{}
+ S[table-format = 2.4, parse-numbers = false]
+ S[table-format = +1.4, parse-numbers = false]
+ S[
+ input-open-uncertainty = ,
+ input-close-uncertainty = ,
+ minimum-decimal-digits = 3, % (
+ table-format = +1.3),
+ table-align-text-pre = false
+ ]
+ @{}
+ }
+ \toprule
+ {Header} &{Header} & {Header} \\
+ \midrule
+ 1.234 & -1.234 & -1.23 \\
+ (0.053) & (0.053) & (0.053) \\
+ \bottomrule
+ \end{tabular}
+ \end{table}
+\end{LaTeXdemo}
+
\subsection{Maximising performance%
\label{sec:hint:performance}}
@@ -3235,6 +3283,17 @@ systems:
]{7.3}{\Hz}
\end{LaTeXdemo}
+For tables, any settings that can be given before the table are only parsed once,
+whereas given in the optional argument to |S| they are read in ever cell. As such,
+you should favour
+\begin{LaTeXdemo}[code only]
+ \begin{table}
+ \sisetup{...}
+ \begin{tabular}{S}
+ ...
+\end{LaTeXdemo}
+for common settings.
+
\subsection{Special considerations for the \cs{kWh} unit%
\label{sec:hint:kWh}}
diff --git a/Master/texmf-dist/tex/latex/siunitx/siunitx.sty b/Master/texmf-dist/tex/latex/siunitx/siunitx.sty
index 1e3411436d2..2140838f83a 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-31} {3.0.8}
+\ProvidesExplPackage {siunitx} {2021-06-01} {3.0.9}
{A comprehensive (SI) units package}
\msg_new:nnnn { siunitx } { incompatible-package }
{ Package~'#1'~incompatible. }
@@ -1077,7 +1077,7 @@
\str_if_eq:VnT \l_siunitx_quantity_prefix_mode_tl { combine-exponent }
{ \tl_clear:N \l__siunitx_compound_exp_tl }
\bool_if:NTF \l__siunitx_compound_unit_repeat_bool
- { \__siunitx_compound_print:N \__siunitx_compound_print_quantity:n }
+ { \__siunitx_compound_print:N \__siunitx_compound_print_quantity:x }
{
\bool_lazy_and:nnTF
{ \l__siunitx_compound_unit_bracket_bool }
@@ -1184,6 +1184,7 @@
}
\cs_new_protected:Npn \__siunitx_compound_print_quantity:n #1
{ \siunitx_quantity_print:nV {#1} \l__siunitx_compound_unit_tl }
+\cs_generate_variant:Nn \__siunitx_compound_print_quantity:n { x }
\cs_new_protected:Npn \__siunitx_compound_print_separator:n #1
{
\bool_if:NTF \l__siunitx_compound_separator_text_bool
@@ -2882,22 +2883,43 @@
\exp_last_unbraced:Nf \__siunitx_number_round_uncertainty:nnnnn
{
\__siunitx_number_round:fnn
- { \tl_count:n {#3} - \l__siunitx_number_round_precision_int } { } {#3}
+ {
+ \int_eval:n
+ { \tl_count:n {#3} - \l__siunitx_number_round_precision_int }
+ }
+ { } {#3}
}
{#1} {#2} {#3}
}
\cs_new:Npn \__siunitx_number_round_uncertainty:nnnnn #1#2#3#4#5
{
- \tl_if_blank:nTF {#1}
+ \exp_args:Nf \__siunitx_number_round_uncertainty_aux:nnnnn
+ { \int_eval:n { \tl_count:n {#5} - \tl_count:n {#2} } }
+ {#1} {#2} {#3} {#4}
+ }
+\cs_new:Npn \__siunitx_number_round_uncertainty_aux:nnnnn #1#2#3#4#5
+ {
+ \exp_args:Nf \__siunitx_number_round_uncertainty_aux:nnnnnn
{
- \__siunitx_number_round:fnn
- { \tl_count:n {#5} - \tl_count:n {#2} } {#3} {#4}
- { { S } {#2} }
+ \tl_if_blank:nT {#5}
+ { \prg_replicate:nn {#1} { 0 } }
+ }
+ {#1} {#2} {#3} {#4} {#5}
+ }
+\cs_new:Npn \__siunitx_number_round_uncertainty_aux:nnnnnn #1#2#3#4#5#6
+ {
+ \tl_if_blank:nTF {#3}
+ {
+ \__siunitx_number_round:nnn
+ {#2}
+ {#5} {#6}
+ { { S } { #4 #1 } }
}
{
\__siunitx_number_round:fnn
- { \tl_count:n {#5} - \tl_count:n {#2} + 1 } {#3} {#4}
- { { S } { #1 \__siunitx_number_round_truncate_direct:n {#2} } }
+ { \int_eval:n { #2 + 1 } }
+ {#5} {#6}
+ { { S } { #3 \__siunitx_number_round_truncate_direct:n {#4} #1 } }
}
}
\cs_new_protected:Npn \__siunitx_number_zero_decimal:NN #1#2
@@ -3033,7 +3055,7 @@
\__siunitx_number_output_sign:nnn {#1} {#2} {#8}
\__siunitx_number_output_integer:nnn {#3} {#4} {#7}
\__siunitx_number_output_decimal:nn {#4} {#8}
- \__siunitx_number_output_uncertainty:nnnn {#5} {#3} {#4} {#8}
+ \__siunitx_number_output_uncertainty:nnn {#5} {#4} {#8}
\__siunitx_number_output_exponent:nnnn {#6} {#7} { #3 . #4 } {#8}
\__siunitx_number_output_end:
}
@@ -3198,69 +3220,41 @@
}
}
}
-\cs_new:Npn \__siunitx_number_output_uncertainty:nnnn #1#2#3#4
+\cs_new:Npn \__siunitx_number_output_uncertainty:nnn #1#2#3
{
\tl_if_blank:nTF {#1}
- { \__siunitx_number_output_uncertainty_unaligned:n {#4} }
+ { \__siunitx_number_output_uncertainty_unaligned:n {#3} }
{
- \use:c { __siunitx_number_output_uncert_ \tl_head:n {#1} :nnnnw }
- {#2} {#3} {#4} #1
+ \use:c { __siunitx_number_output_uncert_ \tl_head:n {#1} :nnnw }
+ {#2} {#3} #1
}
}
\cs_new:Npn \__siunitx_number_output_uncertainty_unaligned:n #1
{ \exp_not:n { #1 #1 #1 #1 } }
-\cs_new:Npn \__siunitx_number_output_uncert_S:nnnnw #1#2#3#4#5
+\cs_new:Npn \__siunitx_number_output_uncert_S:nnnw #1#2#3#4
{
\str_if_eq:VnTF \l__siunitx_number_uncert_mode_tl { separate }
{
- \exp_not:n {#3}
+ \exp_not:n {#2}
\__siunitx_number_output_sign:N \pm
- \exp_not:n {#3}
- \tl_if_blank:nTF {#2}
- { \__siunitx_number_output_uncert_S_auxi:nnn {#1} {#5} {#3} }
- {
- \__siunitx_number_output_uncert_S_auxiv:fnn
- { \int_eval:n { \tl_count:n {#5} - \tl_count:n {#2} } }
- {#5} {#3}
- }
+ \exp_not:n {#2}
+ \__siunitx_number_output_uncert_S_aux:nnn
+ { \int_eval:n { \tl_count:n {#4} - \tl_count:n {#1} } }
+ {#4} {#2}
}
{
\exp_not:V \l__siunitx_number_uncert_separator_tl
\exp_not:V \l__siunitx_number_output_uncert_open_tl
- \use:c { __siunitx_number_output_uncert_S_ \l__siunitx_number_uncert_mode_tl :nn } {#2} {#5}
+ \use:c { __siunitx_number_output_uncert_S_ \l__siunitx_number_uncert_mode_tl :nn } {#1} {#4}
\exp_not:V \l__siunitx_number_output_uncert_close_tl
- \__siunitx_number_output_uncertainty_unaligned:n {#3}
+ \__siunitx_number_output_uncertainty_unaligned:n {#2}
}
}
-\cs_new:Npn \__siunitx_number_output_uncert_S_auxi:nnn #1#2#3
- {
- \__siunitx_number_output_uncert_S_auxii:nnN { 0 } {#2} #1
- \q_recursion_tail \q_recursion_stop {#3}
- }
-\cs_new:Npn \__siunitx_number_output_uncert_S_auxii:nnN #1#2#3
- {
- \quark_if_recursion_tail_stop_do:Nn #3
- {
- \exp_args:Nf \__siunitx_number_output_uncert_S_auxiii:nnn
- { \prg_replicate:nn {#1} { 0 } } {#2}
- }
- \str_if_eq:nnTF {#3} { 0 }
- {
- \exp_args:Nf \__siunitx_number_output_uncert_S_auxii:nnN
- { \int_eval:n { #1 + 1 } } {#2}
- }
- { \__siunitx_number_output_uncert_S_auxii:nnN { 0 } {#2} }
- }
-\cs_new:Npn \__siunitx_number_output_uncert_S_auxiii:nnn #1#2#3
- {
- \__siunitx_number_output_uncert_S_auxiv:fnn
- { \int_eval:n { \tl_count:n {#2#1} } } {#2#1} {#3}
- }
-\cs_new:Npn \__siunitx_number_output_uncert_S_auxiv:nnn #1#2#3
+\cs_new:Npn \__siunitx_number_output_uncert_S_aux:nnn #1#2#3
{
\int_compare:nNnTF {#1} > 0
{
- \__siunitx_number_output_uncert_S_auxv:fnnw
+ \__siunitx_number_output_uncert_S_aux:fnnw
{ \int_eval:n { #1 - 1 } }
{#3}
{ }
@@ -3276,23 +3270,23 @@
{#3}
}
}
-\cs_generate_variant:Nn \__siunitx_number_output_uncert_S_auxiv:nnn { f }
-\cs_new:Npn \__siunitx_number_output_uncert_S_auxv:nnnw #1#2#3#4
+\cs_generate_variant:Nn \__siunitx_number_output_uncert_S_aux:nnn { f }
+\cs_new:Npn \__siunitx_number_output_uncert_S_aux:nnnw #1#2#3#4
{
\quark_if_nil:NF #4
{
\int_compare:nNnTF {#1} = 0
- { \__siunitx_number_output_uncert_S_auxvi:nnw {#3#4} {#2} }
+ { \__siunitx_number_output_uncert_S_aux:nnw {#3#4} {#2} }
{
- \__siunitx_number_output_uncert_S_auxv:fnnw
+ \__siunitx_number_output_uncert_S_aux:fnnw
{ \int_eval:n { #1 - 1 } }
{#2}
{#3#4}
}
}
}
-\cs_generate_variant:Nn \__siunitx_number_output_uncert_S_auxv:nnnw { f }
-\cs_new:Npn \__siunitx_number_output_uncert_S_auxvi:nnw #1#2#3 \q_nil
+\cs_generate_variant:Nn \__siunitx_number_output_uncert_S_aux:nnnw { f }
+\cs_new:Npn \__siunitx_number_output_uncert_S_aux:nnw #1#2#3 \q_nil
{
\__siunitx_number_output_digits:nn { integer } {#1}
\__siunitx_number_output_decimal:nn {#3} {#2}
@@ -3310,7 +3304,7 @@
}
\cs_new:Npn \__siunitx_number_output_uncert_S_full:nn #1#2
{
- \__siunitx_number_output_uncert_S_auxiv:fnn
+ \__siunitx_number_output_uncert_S_aux:fnn
{ \int_eval:n { \tl_count:n {#2} - \tl_count:n {#1} } }
{#2} { }
}
@@ -4357,6 +4351,7 @@
\cs_new_protected:Npn \__siunitx_table_direct_none_end: { \c_math_toggle_token }
\box_new:N \l__siunitx_table_before_box
\box_new:N \l__siunitx_table_after_box
+\dim_new:N \l__siunitx_table_before_dim
\dim_new:N \l__siunitx_table_carry_dim
\keys_define:nn { siunitx }
{
@@ -4445,12 +4440,7 @@
\box_clear:N \l__siunitx_table_before_box
#1
}
- \hbox_set_to_wd:Nnn \l__siunitx_table_before_box
- { \box_wd:N \l__siunitx_table_tmp_box }
- {
- \__siunitx_table_fil:
- \hbox_unpack:N \l__siunitx_table_before_box
- }
+ \dim_set:Nn \l__siunitx_table_before_dim { \box_wd:N \l__siunitx_table_tmp_box }
\siunitx_number_parse:nN {#2} \l__siunitx_table_tmp_tl
\group_begin:
\bool_if:NT \l__siunitx_table_auto_round_bool
@@ -4511,16 +4501,11 @@
}
{
\__siunitx_table_print_format_box:Nn \l__siunitx_table_integer_box {#3}
- \hbox_set_to_wd:Nnn \l__siunitx_table_before_box
+ \dim_add:Nn \l__siunitx_table_before_dim
{
- \box_wd:N \l__siunitx_table_before_box
- + \box_wd:N \l__siunitx_table_tmp_box
+ \box_wd:N \l__siunitx_table_tmp_box
- \box_wd:N \l__siunitx_table_integer_box
}
- {
- \__siunitx_table_fil:
- \hbox_unpack:N \l__siunitx_table_before_box
- }
}
\__siunitx_table_print_format_auxii:w #2 \q_mark #4 \q_stop
}
@@ -4565,19 +4550,19 @@
\hbox_unpack:N \l__siunitx_table_integer_box
\siunitx_print_number:n {#4#5}
}
- \hbox_set_to_wd:Nnn \l__siunitx_table_before_box
+ \dim_add:Nn \l__siunitx_table_before_dim
{
- \box_wd:N \l__siunitx_table_before_box
+ \box_wd:N \l__siunitx_table_tmp_box
+ \l__siunitx_table_tmp_dim
- \box_wd:N \l__siunitx_table_integer_box
}
- {
- \__siunitx_table_fil:
- \hbox_unpack:N \l__siunitx_table_before_box
- }
}
}
+ \hbox_set_to_wd:Nnn \l__siunitx_table_before_box \l__siunitx_table_before_dim
+ {
+ \__siunitx_table_fil:
+ \hbox_unpack:N \l__siunitx_table_before_box
+ }
\__siunitx_table_print_format_auxiii:w #3 \q_mark #6 \q_stop
}
\cs_new_protected:Npn \__siunitx_table_print_format_auxiii:w
@@ -4980,9 +4965,17 @@
\exp_not:N \token_if_eq_meaning:NNTF
#2 \c__siunitx_unit_math_subscript_tl
{ \exp_not:N \__siunitx_unit_format_literal_sub:nn {#1} }
- { \exp_not:N \__siunitx_unit_format_literal_auxvi:nN {#1#2} }
+ { \exp_not:N \__siunitx_unit_format_literal_auxvii:nN {#1} #2 }
}
}
+\cs_new_protected:Npn \__siunitx_unit_format_literal_auxvii:nN #1#2
+ {
+ \str_if_eq:nnTF {#2} { \protect }
+ { \__siunitx_unit_format_literal_auxviii:nN {#1} }
+ { \__siunitx_unit_format_literal_auxvi:nN {#1#2} }
+ }
+\cs_new_protected:Npn \__siunitx_unit_format_literal_auxviii:nN #1#2
+ { \__siunitx_unit_format_literal_auxv:nw { #1 \protect #2 } }
\cs_new_protected:Npn \__siunitx_unit_format_literal_super:nn #1#2
{
\quark_if_recursion_tail_stop:n {#2}
@@ -6610,6 +6603,7 @@
{
input-protect-tokens ,
input-quotient ,
+ output-product ,
quotient-mode
}
{