summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-02-16 22:44:12 +0000
committerKarl Berry <karl@freefriends.org>2022-02-16 22:44:12 +0000
commit6d61a2cc468f99649f3e0617eef1f36e6d115e57 (patch)
treecaab7a3d5e59bfcd683cec1d47493c78ca4f6d36
parentcba8ece37bbd9d57322f76f4b6d1584464dfb7b1 (diff)
siunitx (15feb22)
git-svn-id: svn://tug.org/texlive/trunk@62048 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md14
-rw-r--r--Master/texmf-dist/doc/latex/siunitx/siunitx-code.pdfbin607830 -> 608847 bytes
-rw-r--r--Master/texmf-dist/doc/latex/siunitx/siunitx.pdfbin639784 -> 640391 bytes
-rw-r--r--Master/texmf-dist/source/latex/siunitx/siunitx-emulation.dtx6
-rw-r--r--Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx182
-rw-r--r--Master/texmf-dist/source/latex/siunitx/siunitx.dtx2
-rw-r--r--Master/texmf-dist/source/latex/siunitx/siunitx.tex63
-rw-r--r--Master/texmf-dist/tex/latex/siunitx/siunitx.sty163
8 files changed, 267 insertions, 163 deletions
diff --git a/Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md b/Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md
index 836e95a0af5..63b5abae999 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.49] - 2022-02-15
+
+### Added
+- Option `retain-explicit-decimal-marker` to allow printing of
+ significant decimal markers (see issue
+ [\#590](https://github.com/josephwright/siunitx/issues/590))
+- Option `print-zero-integer` to replace older `add-integer-zero` option
+ (see issue [\#587](https://github.com/josephwright/siunitx/issues/587))
+
## [v3.0.48] - 2022-02-07
### Added
@@ -14,7 +23,7 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to
### Fixed
- Printing blank entries in text mode (see issue
- [\#5853](https://github.com/josephwright/siunitx/issues/585))
+ [\#585](https://github.com/josephwright/siunitx/issues/585))
## [v3.0.47] - 2022-02-03
@@ -1712,7 +1721,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.48...HEAD
+[Unreleased]: https://github.com/josephwright/siunitx/compare/v3.0.49...HEAD
+[v3.0.49]: https://github.com/josephwright/siunitx/compare/v3.0.48...v3.0.49
[v3.0.48]: https://github.com/josephwright/siunitx/compare/v3.0.47...v3.0.48
[v3.0.47]: https://github.com/josephwright/siunitx/compare/v3.0.46...v3.0.47
[v3.0.46]: https://github.com/josephwright/siunitx/compare/v3.0.45...v3.0.46
diff --git a/Master/texmf-dist/doc/latex/siunitx/siunitx-code.pdf b/Master/texmf-dist/doc/latex/siunitx/siunitx-code.pdf
index f427b017c8d..6537e876940 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.pdf b/Master/texmf-dist/doc/latex/siunitx/siunitx.pdf
index 70e9f7d7ac0..d737b16cf82 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-emulation.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-emulation.dtx
index 87d213a3b98..aab7d478f25 100644
--- a/Master/texmf-dist/source/latex/siunitx/siunitx-emulation.dtx
+++ b/Master/texmf-dist/source/latex/siunitx/siunitx-emulation.dtx
@@ -421,7 +421,11 @@
} ,
add-decimal-zero .default:n = true ,
add-integer-zero .code:n =
- { \@@_option_removed:V \l_keys_key_tl } ,
+ {
+ \@@_option_deprecated:nn
+ { add-integer-zero }
+ { print-zero-integer }
+ } ,
close-bracket .code:n =
{ \@@_option_removed:V \l_keys_key_tl } ,
bracket-numbers .choice: ,
diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx
index 98f52307c24..19b505bc333 100644
--- a/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx
+++ b/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx
@@ -97,11 +97,14 @@
% \meta{integer} and \meta{exponent} parts: these are required. The
% \meta{uncertainty} part should either be blank or contain an
% \meta{identifier} (as a brace group), followed by one or more data entries.
-% Valid \meta{identifiers} currently are
+% Valid uncertainty \meta{identifiers} currently are
% \begin{itemize}
% \item[\texttt{S}] A single symmetrical uncertainty (\foreign{e.g.}~a
% statistical standard uncertainty)
% \end{itemize}
+% If a decimal marker should be explicitly recorded as present for a value
+% with no decimal digits, the \meta{decimal} part should contain
+% \cs{empty}.
% \end{function}
%
% \begin{function}{\siunitx_number_process:NN}
@@ -430,12 +433,24 @@
% \end{syntax}
% \end{function}
%
+% \begin{function}{print-zero-integer}
+% \begin{syntax}
+% |print-zero-integer| = |true|\verb"|"|false|
+% \end{syntax}
+% \end{function}
+%
% \begin{function}{retain-explicit-plus}
% \begin{syntax}
% |retain-explicit-plus| = |true|\verb"|"|false|
% \end{syntax}
% \end{function}
%
+% \begin{function}{retain-explicit-decimal-marker}
+% \begin{syntax}
+% |retain-explicit-decimal-marker| = |true|\verb"|"|false|
+% \end{syntax}
+% \end{function}
+%
% \begin{function}{retain-zero-uncertainty}
% \begin{syntax}
% |retain-zero-uncertainty| = |true|\verb"|"|false|
@@ -629,6 +644,7 @@
% \l_@@_input_uncert_open_tl ,
% \l_siunitx_number_input_sign_tl ,
% \l_@@_input_uncert_sign_tl ,
+% \l_@@_explicit_decimal_bool ,
% \l_@@_explicit_plus_bool ,
% \l_@@_zero_uncert_bool
% }
@@ -668,6 +684,8 @@
} ,
parse-numbers .bool_set:N =
\l_siunitx_number_parse_bool ,
+ retain-explicit-decimal-marker .bool_set:N =
+ \l_@@_explicit_decimal_bool ,
retain-explicit-plus .bool_set:N =
\l_@@_explicit_plus_bool ,
retain-zero-uncertainty .bool_set:N =
@@ -1287,13 +1305,21 @@
% depending on the setting for the indicator switch. For the integer
% part, if no number has been collected then one or more non-significant
% zeros have been dropped. Exactly one zero is therefore needed to make
-% sure the parsed result is correct.
+% sure the parsed result is correct. On the other hand, if the decimal
+% is empty \emph{and} we are asked to track the presence of a marker,
+% we store the indicator value \cs{empty}.
% \begin{macrocode}
\cs_new_protected:Npn \@@_parse_loop_main_end:NN #1#2
{
- \bool_lazy_and:nnT
- {#2} { \tl_if_empty_p:N \l_@@_partial_tl }
- { \tl_set:Nn \l_@@_partial_tl { 0 } }
+ \tl_if_empty:NT \l_@@_partial_tl
+ {
+ \bool_if:NTF #2
+ { \tl_set:Nn \l_@@_partial_tl { 0 } }
+ {
+ \bool_if:NT \l_@@_explicit_decimal_bool
+ { \tl_set:Nn \l_@@_partial_tl { \empty } }
+ }
+ }
\tl_put_right:Nx #1
{
{ \exp_not:V \l_@@_partial_tl }
@@ -2176,7 +2202,7 @@
% \end{macro}
%
% \begin{macro}{\@@_round:NN}
-% \begin{macro}[EXP]{\@@_round_none:nnnnnnn}
+% \begin{macro}[EXP]{\@@_round:nnnnnnn}
% Rounding is at the top level simple enough: fire off the expandable
% set up which does the work.
% \begin{macrocode}
@@ -2184,14 +2210,18 @@
{
\tl_set:Nx #2
{
- \cs:w
- @@_round_ \l_@@_round_mode_tl :nnnnnnn
- \exp_after:wN
- \cs_end: #1
- }
+ \str_if_eq:VnTF \l_@@_round_mode_tl { none }
+ { \exp_not:V #1 }
+ { \exp_after:wN \@@_round:nnnnnnn #1 }
+ }
+ }
+\cs_new:Npn \@@_round:nnnnnnn #1#2#3#4#5#6#7
+ {
+ \str_if_eq:nnTF {#4} { \empty }
+ { \use:c { @@_round_ \l_@@_round_mode_tl :nnnnnnn } {#1} {#2} {#3} { } }
+ { \use:c { @@_round_ \l_@@_round_mode_tl :nnnnnnn } {#1} {#2} {#3} {#4} }
+ {#5} {#6} {#7}
}
-\cs_new:Npn \@@_round_none:nnnnnnn #1#2#3#4#5#6#7
- { \exp_not:n { {#1} {#2} {#3} {#4} {#5} {#6} {#7} } }
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -3087,7 +3117,8 @@
% \l_@@_uncert_separator_tl ,
% \l_@@_tight_bool ,
% \l_@@_unity_mantissa_bool ,
-% \l_@@_zero_exponent_bool
+% \l_@@_zero_exponent_bool ,
+% \l_@@_zero_integer_bool
% }
% Keys producing tokens in the output.
% \begin{macrocode}
@@ -3143,6 +3174,8 @@
\l_@@_unity_mantissa_bool ,
print-zero-exponent .bool_set:N =
\l_@@_zero_exponent_bool ,
+ print-zero-integer .bool_set:N =
+ \l_@@_zero_integer_bool ,
tight-spacing .bool_set:N =
\l_@@_tight_bool ,
uncertainty-mode .choices:nn =
@@ -3346,17 +3379,27 @@
{ \@@_output_digits:nn { integer } { 1 } }
}
{
- \bool_lazy_any:nT
- {
- { \l_@@_unity_mantissa_bool }
- { ! \str_if_eq_p:nn { #1 . #2 } { 1. } }
- {
- \bool_lazy_and_p:nn
- { \str_if_eq_p:nn {#3} { 0 } }
- { ! \l_@@_zero_exponent_bool }
- }
+ \bool_lazy_or:nnT
+ { \l_@@_zero_integer_bool }
+ { ! \str_if_eq_p:nn {#1} { 0 } }
+ {
+ \bool_lazy_any:nT
+ {
+ { \l_@@_unity_mantissa_bool }
+ { ! \str_if_eq_p:nn { #1 . #2 } { 1. } }
+ {
+ \bool_lazy_and_p:nn
+ { \str_if_eq_p:nn {#3} { 0 } }
+ { ! \l_@@_zero_exponent_bool }
+ }
+ {
+ \bool_lazy_and_p:nn
+ { \str_if_eq_p:nn {#1} { 0 } }
+ { \l_@@_zero_integer_bool }
+ }
+ }
+ { \@@_output_digits:nn { integer } {#1} }
}
- { \@@_output_digits:nn { integer } {#1} }
}
}
\cs_new:Npn \@@_output_decimal:nn #1#2
@@ -3370,7 +3413,8 @@
{ \exp_not:V \l_siunitx_number_output_decimal_tl }
}
\exp_not:n {#2}
- \@@_output_digits:nn { decimal } {#1}
+ \str_if_eq:nnF {#1} { \empty }
+ { \@@_output_digits:nn { decimal } {#1} }
}
\cs_generate_variant:Nn \@@_output_decimal:nn { f }
\cs_new:Npn \@@_output_digits:nn #1#2
@@ -3770,49 +3814,51 @@
% \begin{macrocode}
\keys_set:nn { siunitx }
{
- bracket-ambiguous-numbers = true ,
- bracket-negative-numbers = false ,
- drop-exponent = false ,
- drop-uncertainty = false ,
- drop-zero-decimal = false ,
- evaluate-expression = false ,
- exponent-base = 10 ,
- exponent-mode = input ,
- exponent-product = \times ,
- expression = #1 ,
- fixed-exponent = 0 ,
- group-digits = all ,
- group-minimum-digits = 5 ,
- group-separator = \, , % (
- input-close-uncertainty = ) ,
- input-comparators = { <=>\approx\ge\geq\gg\le\leq\ll\sim } ,
- input-decimal-markers = { ., } ,
- input-digits = 0123456789 ,
- input-exponent-markers = dDeE ,
- input-ignore = \, ,
- input-open-uncertainty = ( , % )
- input-signs = +-\mp\pm ,
- input-uncertainty-signs = \pm ,
- minimum-decimal-digits = 0 ,
- minimum-integer-digits = 0 ,
- negative-color = , % (
- output-close-uncertainty = ) ,
- output-decimal-marker = . ,
- output-open-uncertainty = ( , % )
- parse-numbers = true ,
- print-implicit-plus = false ,
- print-unity-mantissa = true ,
- print-zero-exponent = false ,
- retain-explicit-plus = false ,
- retain-zero-uncertainty = false ,
- round-half = up ,
- round-minimum = 0 ,
- round-mode = none ,
- round-pad = true ,
- round-precision = 2 ,
- tight-spacing = false ,
- uncertainty-mode = compact ,
- uncertainty-separator =
+ bracket-ambiguous-numbers = true ,
+ bracket-negative-numbers = false ,
+ drop-exponent = false ,
+ drop-uncertainty = false ,
+ drop-zero-decimal = false ,
+ evaluate-expression = false ,
+ exponent-base = 10 ,
+ exponent-mode = input ,
+ exponent-product = \times ,
+ expression = #1 ,
+ fixed-exponent = 0 ,
+ group-digits = all ,
+ group-minimum-digits = 5 ,
+ group-separator = \, , % (
+ input-close-uncertainty = ) ,
+ input-comparators = { <=>\approx\ge\geq\gg\le\leq\ll\sim } ,
+ input-decimal-markers = { ., } ,
+ input-digits = 0123456789 ,
+ input-exponent-markers = dDeE ,
+ input-ignore = \, ,
+ input-open-uncertainty = ( , % )
+ input-signs = +-\mp\pm ,
+ input-uncertainty-signs = \pm ,
+ minimum-decimal-digits = 0 ,
+ minimum-integer-digits = 0 ,
+ negative-color = , % (
+ output-close-uncertainty = ) ,
+ output-decimal-marker = . ,
+ output-open-uncertainty = ( , % )
+ parse-numbers = true ,
+ print-implicit-plus = false ,
+ print-unity-mantissa = true ,
+ print-zero-exponent = false ,
+ print-zero-integer = true ,
+ retain-explicit-decimal-marker = false ,
+ retain-explicit-plus = false ,
+ retain-zero-uncertainty = false ,
+ round-half = up ,
+ round-minimum = 0 ,
+ round-mode = none ,
+ round-pad = true ,
+ round-precision = 2 ,
+ tight-spacing = false ,
+ uncertainty-mode = compact ,
+ uncertainty-separator =
}
% \end{macrocode}
%
diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx.dtx
index 61d45f9621c..0bd7fa2a8a9 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} {2022-02-07} {3.0.48}
+\ProvidesExplPackage {siunitx} {2022-02-15} {3.0.49}
{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 62fa382f866..8854ff3f75b 100644
--- a/Master/texmf-dist/source/latex/siunitx/siunitx.tex
+++ b/Master/texmf-dist/source/latex/siunitx/siunitx.tex
@@ -1256,22 +1256,23 @@ Table~\ref{tab:opt:num:in}.
Type &
\multicolumn{1}{l@{}}{Default} \\
\midrule
- evaluate-expression & Switch & false \\
- expression & Literal & |#1| \\^^A (
- input-close-uncertainty & Literal & ) \\
- input-comparators & Literal &
+ evaluate-expression & Switch & false \\
+ expression & Literal & |#1| \\^^A (
+ input-close-uncertainty & Literal & ) \\
+ input-comparators & Literal &
<=>\cs{approx}\cs{ge}\cs{geq} \\
& & \cs{gg}\cs{le}\cs{leq}\cs{ll} \cs{sim} \\
- input-decimal-markers & Literal & ., \\
- input-digits & Literal & 0123456789 \\
- input-exponent-markers & Literal & dDeE \\
- input-ignore & Literal & \meta{none} \\
- input-open-uncertainty & Literal & ( \\ ^^A )
- input-signs & Literal & +-\cs{pm}\cs{mp} \\
- input-uncertainty-signs & Literal & \cs{pm} \\
- parse-numbers & Switch & true \\
- retain-explicit-plus & Switch & false \\
- retain-zero-uncertainty & Switch & false \\
+ input-decimal-markers & Literal & ., \\
+ input-digits & Literal & 0123456789 \\
+ input-exponent-markers & Literal & dDeE \\
+ input-ignore & Literal & \meta{none} \\
+ input-open-uncertainty & Literal & ( \\ ^^A )
+ input-signs & Literal & +-\cs{pm}\cs{mp} \\
+ input-uncertainty-signs & Literal & \cs{pm} \\
+ parse-numbers & Switch & true \\
+ retain-explicit-decimal-marker & Switch & false \\
+ retain-explicit-plus & Switch & false \\
+ retain-zero-uncertainty & Switch & false \\
\bottomrule
\end{tabular}
\end{table}
@@ -1361,15 +1362,21 @@ most notably in that a decimal marker must be |.|.
\qty[expression = 10 * (#1)]{2 + 4 * 3}{\joule}
\end{LaTeXdemo}
+\DescribeOption{retain-explicit-decimal-marker}
\DescribeOption{retain-explicit-plus}
\DescribeOption{retain-zero-uncertainty}
-The inclusion of a leading plus sign is usually unnecessary for positive
-numbers, and so they are not retained as-standard when parsing. The
-\opt{retain-explicit-plus} option is available to control this behaviour.
-Similarly, an uncertainty of zero is normally not meaningful, and so is
-ignored by the parser. This can be controlled using the
+In some areas, a trailing decimal marker with no decimal part present is used
+to show that zeros in the integer part are significant. This can be enabled
+using the \opt{retain-explicit-decimal-marker} option. The inclusion of a
+leading plus sign is usually unnecessary for positive numbers, and so they are
+not retained as-standard when parsing. The \opt{retain-explicit-plus} option is
+available to control this behaviour. Similarly, an uncertainty of zero is
+normally not meaningful, and so is ignored by the parser. This can be
+controlled using the
\opt{retain-zero-uncertainty} option.
\begin{LaTeXdemo}
+ \num{10.} \\
+ \num[retain-explicit-decimal-marker]{10.} \\
\num{+345} \\
\num[retain-explicit-plus]{+345} \\
\num{12.3(0)} \\
@@ -1589,6 +1596,7 @@ conveys. The options are summarised in Table~\ref{tab:opt:num:out}.
print-implicit-plus & Switch & false \\
print-unity-mantissa & Switch & true \\
print-zero-exponent & Switch & false \\
+ print-zero-integer & Switch & false \\
tight-spacing & Switch & false \\
uncertainty-mode & Choice & compact \\
uncertainty-separator & Literal & \meta{none} \\
@@ -1750,16 +1758,21 @@ if no sign was present in the input.
\DescribeOption{print-unity-mantissa}
\DescribeOption{print-zero-exponent}
-Printing of a mantissa of $1$ and an exponent of $0$ is controllable by the
-options \opt{print-unity-mantissa} and \opt{print-zero-exponent}. The standard
-settings print a mantissa of $1$ but omit an exponent of $0$. Notice that where
-both are set to \opt{false}, the value $1$ will still be printed
-(\foreign{i.e.}~\opt{print-zero-exponent} has a higher priority).
+\DescribeOption{print-zero-integer}
+Printing of a mantissa of $1$, an exponent of $0$ and an integer component of
+$0$ is controllable by the options \opt{print-unity-mantissa},
+\opt{print-zero-exponent} and \opt{print-zero-integer}. The standard settings
+print a mantissa of $1$ and an integer part of $0$, but omit an exponent of
+$0$. Notice that where both \opt{print-unity-mantissa} and
+\opt{print-zero-exponent} are set to \opt{false}, the value $1$ will still be
+printed (\foreign{i.e.}~\opt{print-zero-exponent} has a higher priority).
\begin{LaTeXdemo}
\num{1e4} \\
\num[print-unity-mantissa = false]{1e4} \\
\num{444e0} \\
- \num[print-zero-exponent = true]{444e0}
+ \num[print-zero-exponent = true]{444e0} \\
+ \num{0.123} \\
+ \num[print-zero-integer = false]{0.123}
\end{LaTeXdemo}
\subsection{Lists, products and ranges}
diff --git a/Master/texmf-dist/tex/latex/siunitx/siunitx.sty b/Master/texmf-dist/tex/latex/siunitx/siunitx.sty
index c67097bd938..bf0cc10e738 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} {2022-02-07} {3.0.48}
+\ProvidesExplPackage {siunitx} {2022-02-15} {3.0.49}
{A comprehensive (SI) units package}
\msg_new:nnnn { siunitx } { incompatible-package }
{ Package~'#1'~incompatible. }
@@ -1558,6 +1558,8 @@
} ,
parse-numbers .bool_set:N =
\l_siunitx_number_parse_bool ,
+ retain-explicit-decimal-marker .bool_set:N =
+ \l__siunitx_number_explicit_decimal_bool ,
retain-explicit-plus .bool_set:N =
\l__siunitx_number_explicit_plus_bool ,
retain-zero-uncertainty .bool_set:N =
@@ -1927,9 +1929,15 @@
}
\cs_new_protected:Npn \__siunitx_number_parse_loop_main_end:NN #1#2
{
- \bool_lazy_and:nnT
- {#2} { \tl_if_empty_p:N \l__siunitx_number_partial_tl }
- { \tl_set:Nn \l__siunitx_number_partial_tl { 0 } }
+ \tl_if_empty:NT \l__siunitx_number_partial_tl
+ {
+ \bool_if:NTF #2
+ { \tl_set:Nn \l__siunitx_number_partial_tl { 0 } }
+ {
+ \bool_if:NT \l__siunitx_number_explicit_decimal_bool
+ { \tl_set:Nn \l__siunitx_number_partial_tl { \empty } }
+ }
+ }
\tl_put_right:Nx #1
{
{ \exp_not:V \l__siunitx_number_partial_tl }
@@ -2524,14 +2532,18 @@
{
\tl_set:Nx #2
{
- \cs:w
- __siunitx_number_round_ \l__siunitx_number_round_mode_tl :nnnnnnn
- \exp_after:wN
- \cs_end: #1
- }
+ \str_if_eq:VnTF \l__siunitx_number_round_mode_tl { none }
+ { \exp_not:V #1 }
+ { \exp_after:wN \__siunitx_number_round:nnnnnnn #1 }
+ }
+ }
+\cs_new:Npn \__siunitx_number_round:nnnnnnn #1#2#3#4#5#6#7
+ {
+ \str_if_eq:nnTF {#4} { \empty }
+ { \use:c { __siunitx_number_round_ \l__siunitx_number_round_mode_tl :nnnnnnn } {#1} {#2} {#3} { } }
+ { \use:c { __siunitx_number_round_ \l__siunitx_number_round_mode_tl :nnnnnnn } {#1} {#2} {#3} {#4} }
+ {#5} {#6} {#7}
}
-\cs_new:Npn \__siunitx_number_round_none:nnnnnnn #1#2#3#4#5#6#7
- { \exp_not:n { {#1} {#2} {#3} {#4} {#5} {#6} {#7} } }
\cs_new:Npn \__siunitx_number_round:nnn #1#2#3
{
\__siunitx_number_round_auxi:nnnN {#1} {#2} { }
@@ -3191,6 +3203,8 @@
\l__siunitx_number_unity_mantissa_bool ,
print-zero-exponent .bool_set:N =
\l__siunitx_number_zero_exponent_bool ,
+ print-zero-integer .bool_set:N =
+ \l__siunitx_number_zero_integer_bool ,
tight-spacing .bool_set:N =
\l__siunitx_number_tight_bool ,
uncertainty-mode .choices:nn =
@@ -3310,17 +3324,27 @@
{ \__siunitx_number_output_digits:nn { integer } { 1 } }
}
{
- \bool_lazy_any:nT
- {
- { \l__siunitx_number_unity_mantissa_bool }
- { ! \str_if_eq_p:nn { #1 . #2 } { 1. } }
- {
- \bool_lazy_and_p:nn
- { \str_if_eq_p:nn {#3} { 0 } }
- { ! \l__siunitx_number_zero_exponent_bool }
- }
+ \bool_lazy_or:nnT
+ { \l__siunitx_number_zero_integer_bool }
+ { ! \str_if_eq_p:nn {#1} { 0 } }
+ {
+ \bool_lazy_any:nT
+ {
+ { \l__siunitx_number_unity_mantissa_bool }
+ { ! \str_if_eq_p:nn { #1 . #2 } { 1. } }
+ {
+ \bool_lazy_and_p:nn
+ { \str_if_eq_p:nn {#3} { 0 } }
+ { ! \l__siunitx_number_zero_exponent_bool }
+ }
+ {
+ \bool_lazy_and_p:nn
+ { \str_if_eq_p:nn {#1} { 0 } }
+ { \l__siunitx_number_zero_integer_bool }
+ }
+ }
+ { \__siunitx_number_output_digits:nn { integer } {#1} }
}
- { \__siunitx_number_output_digits:nn { integer } {#1} }
}
}
\cs_new:Npn \__siunitx_number_output_decimal:nn #1#2
@@ -3334,7 +3358,8 @@
{ \exp_not:V \l_siunitx_number_output_decimal_tl }
}
\exp_not:n {#2}
- \__siunitx_number_output_digits:nn { decimal } {#1}
+ \str_if_eq:nnF {#1} { \empty }
+ { \__siunitx_number_output_digits:nn { decimal } {#1} }
}
\cs_generate_variant:Nn \__siunitx_number_output_decimal:nn { f }
\cs_new:Npn \__siunitx_number_output_digits:nn #1#2
@@ -3624,49 +3649,51 @@
}
\keys_set:nn { siunitx }
{
- bracket-ambiguous-numbers = true ,
- bracket-negative-numbers = false ,
- drop-exponent = false ,
- drop-uncertainty = false ,
- drop-zero-decimal = false ,
- evaluate-expression = false ,
- exponent-base = 10 ,
- exponent-mode = input ,
- exponent-product = \times ,
- expression = #1 ,
- fixed-exponent = 0 ,
- group-digits = all ,
- group-minimum-digits = 5 ,
- group-separator = \, , % (
- input-close-uncertainty = ) ,
- input-comparators = { <=>\approx\ge\geq\gg\le\leq\ll\sim } ,
- input-decimal-markers = { ., } ,
- input-digits = 0123456789 ,
- input-exponent-markers = dDeE ,
- input-ignore = \, ,
- input-open-uncertainty = ( , % )
- input-signs = +-\mp\pm ,
- input-uncertainty-signs = \pm ,
- minimum-decimal-digits = 0 ,
- minimum-integer-digits = 0 ,
- negative-color = , % (
- output-close-uncertainty = ) ,
- output-decimal-marker = . ,
- output-open-uncertainty = ( , % )
- parse-numbers = true ,
- print-implicit-plus = false ,
- print-unity-mantissa = true ,
- print-zero-exponent = false ,
- retain-explicit-plus = false ,
- retain-zero-uncertainty = false ,
- round-half = up ,
- round-minimum = 0 ,
- round-mode = none ,
- round-pad = true ,
- round-precision = 2 ,
- tight-spacing = false ,
- uncertainty-mode = compact ,
- uncertainty-separator =
+ bracket-ambiguous-numbers = true ,
+ bracket-negative-numbers = false ,
+ drop-exponent = false ,
+ drop-uncertainty = false ,
+ drop-zero-decimal = false ,
+ evaluate-expression = false ,
+ exponent-base = 10 ,
+ exponent-mode = input ,
+ exponent-product = \times ,
+ expression = #1 ,
+ fixed-exponent = 0 ,
+ group-digits = all ,
+ group-minimum-digits = 5 ,
+ group-separator = \, , % (
+ input-close-uncertainty = ) ,
+ input-comparators = { <=>\approx\ge\geq\gg\le\leq\ll\sim } ,
+ input-decimal-markers = { ., } ,
+ input-digits = 0123456789 ,
+ input-exponent-markers = dDeE ,
+ input-ignore = \, ,
+ input-open-uncertainty = ( , % )
+ input-signs = +-\mp\pm ,
+ input-uncertainty-signs = \pm ,
+ minimum-decimal-digits = 0 ,
+ minimum-integer-digits = 0 ,
+ negative-color = , % (
+ output-close-uncertainty = ) ,
+ output-decimal-marker = . ,
+ output-open-uncertainty = ( , % )
+ parse-numbers = true ,
+ print-implicit-plus = false ,
+ print-unity-mantissa = true ,
+ print-zero-exponent = false ,
+ print-zero-integer = true ,
+ retain-explicit-decimal-marker = false ,
+ retain-explicit-plus = false ,
+ retain-zero-uncertainty = false ,
+ round-half = up ,
+ round-minimum = 0 ,
+ round-mode = none ,
+ round-pad = true ,
+ round-precision = 2 ,
+ tight-spacing = false ,
+ uncertainty-mode = compact ,
+ uncertainty-separator =
}
\RequirePackage { amstext }
\cs_new_eq:NN \__siunitx_print_ams_text:n \text
@@ -7037,7 +7064,11 @@
} ,
add-decimal-zero .default:n = true ,
add-integer-zero .code:n =
- { \__siunitx_option_removed:V \l_keys_key_tl } ,
+ {
+ \__siunitx_option_deprecated:nn
+ { add-integer-zero }
+ { print-zero-integer }
+ } ,
close-bracket .code:n =
{ \__siunitx_option_removed:V \l_keys_key_tl } ,
bracket-numbers .choice: ,