summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-05-24 20:18:54 +0000
committerKarl Berry <karl@freefriends.org>2021-05-24 20:18:54 +0000
commitf1906a0a649f0d3691eb2121e9364d61fce52aa0 (patch)
tree812e8dfc42b8be67a808b90dcb7eff02db05aa8b
parent7053a6c036bf5929f8cf7bc5dd667a4041721917 (diff)
siunitx (24may21)
git-svn-id: svn://tug.org/texlive/trunk@59332 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md15
-rw-r--r--Master/texmf-dist/doc/latex/siunitx/siunitx-code.pdfbin1441845 -> 1443594 bytes
-rw-r--r--Master/texmf-dist/doc/latex/siunitx/siunitx.pdfbin605308 -> 598400 bytes
-rw-r--r--Master/texmf-dist/source/latex/siunitx/siunitx-compound.dtx67
-rw-r--r--Master/texmf-dist/source/latex/siunitx/siunitx-emulation.dtx3
-rw-r--r--Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx6
-rw-r--r--Master/texmf-dist/source/latex/siunitx/siunitx-print.dtx75
-rw-r--r--Master/texmf-dist/source/latex/siunitx/siunitx-table.dtx4
-rw-r--r--Master/texmf-dist/source/latex/siunitx/siunitx.dtx2
-rw-r--r--Master/texmf-dist/source/latex/siunitx/siunitx.tex2
-rw-r--r--Master/texmf-dist/tex/latex/siunitx/siunitx.sty108
11 files changed, 169 insertions, 113 deletions
diff --git a/Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md b/Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md
index 093b87bada3..a473e9cd491 100644
--- a/Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md
+++ b/Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md
@@ -7,6 +7,18 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to
## [Unreleased]
+## [v3.0.5]
+
+### Changed
+- Documentation improvements
+
+### Fixed
+- 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)
+
## [v3.0.4]
### Changed
@@ -1289,7 +1301,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.4...HEAD
+[Unreleased]: https://github.com/josephwright/siunitx/compare/v3.0.5...HEAD
+[v3.0.5]: https://github.com/josephwright/siunitx/compare/v3.0.4...v3.0.5
[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
diff --git a/Master/texmf-dist/doc/latex/siunitx/siunitx-code.pdf b/Master/texmf-dist/doc/latex/siunitx/siunitx-code.pdf
index 718aeef446a..d8f5d6536e1 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 3a8e7d02774..36327498118 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 83da873e6c0..a164d883b70 100644
--- a/Master/texmf-dist/source/latex/siunitx/siunitx-compound.dtx
+++ b/Master/texmf-dist/source/latex/siunitx/siunitx-compound.dtx
@@ -310,8 +310,9 @@
% \end{macrocode}
% \end{variable}
%
-% \begin{variable}{\l_@@_unit_tl}
+% \begin{variable}{\l_@@_unit_bool, \l_@@_unit_tl}
% \begin{macrocode}
+\bool_new:N \l_@@_unit_bool
\tl_new:N \l_@@_unit_tl
% \end{macrocode}
% \end{variable}
@@ -412,6 +413,7 @@
%
% \begin{macro}{\siunitx_compound_number:n}
% \begin{macro}{\@@_format:n}
+% \begin{macro}{\@@_format:nn}
% \begin{macro}{\@@_format:nnn}
% Printing a generic set starts with the question of whether we want to
% extract exponents. If we do, then there is the work to do with extraction.
@@ -421,6 +423,7 @@
\cs_new_protected:Npn \siunitx_compound_number:n #1
{
\group_begin:
+ \bool_set_false:N \l_@@_unit_bool
\@@_format:nn {#1} { }
\@@_print:N \siunitx_print_number:x
\group_end:
@@ -445,16 +448,25 @@
\cs_new_protected:Npn \@@_format:nnn #1#2#3
{
\siunitx_number_parse:nN {#1} \l_@@_tmp_tl
- \tl_if_blank:nTF {#3}
- { \siunitx_number_process:NN \l_@@_tmp_tl \l_@@_first_tl }
+ \bool_if:NTF \l_@@_unit_bool
{ \@@_format_units:nn {#2} {#3} }
+ { \siunitx_number_process:NN \l_@@_tmp_tl \l_@@_first_tl }
\bool_lazy_and:nnTF
{ \l_@@_exp_combine_bool }
{ \int_compare_p:nNn { \tl_count:n {#2} } > 0 }
{ \@@_extract_exponents: }
{
- \tl_set:Nx \l_@@_tmp_tl
- { \siunitx_number_output:N \l_@@_first_tl }
+ \bool_if:NTF \l_@@_unit_bool
+ {
+ \tl_set:Nx \l_@@_tmp_tl
+ { \siunitx_number_output:NN \l_@@_first_tl \q_nil }
+ \tl_set:Nx \l_@@_tmp_tl
+ { \@@_uncert_bracket:N \l_@@_tmp_tl }
+ }
+ {
+ \tl_set:Nx \l_@@_tmp_tl
+ { \siunitx_number_output:N \l_@@_first_tl }
+ }
\seq_put_right:NV \l_@@_tmp_seq \l_@@_tmp_tl
}
\tl_map_function:nN {#2} \@@_parsed:n
@@ -464,7 +476,7 @@
% \end{macro}
% \end{macro}
%
-% \begin{macro}{\@@_extract_exponents:N}
+% \begin{macro}{\@@_extract_exponents:}
% \begin{macro}{\@@_extract_exponents_auxi:w}
% \begin{macro}{\@@_extract_exponents_auxii:nw}
% \begin{macro}{\@@_extract_exponents_auxiii:nnnnnnn}
@@ -508,13 +520,23 @@
% \end{macro}
% \end{macro}
% \end{macro}
+% \end{macro}
%
% \begin{macro}{\@@_parsed:n, \@@_unparsed:n}
% The simple cases for parsing (or not) all entries.
% \begin{macrocode}
\cs_new_protected:Npn \@@_parsed:n #1
{
- \siunitx_number_format:nN {#1} \l_@@_tmp_tl
+ \bool_if:NTF \l_@@_unit_bool
+ {
+ \siunitx_number_parse:nN {#1} \l_@@_tmp_tl
+ \siunitx_number_process:NN \l_@@_tmp_tl \l_@@_tmp_tl
+ \tl_set:Nx \l_@@_tmp_tl
+ { \siunitx_number_output:NN \l_@@_tmp_tl \q_nil }
+ \tl_set:Nx \l_@@_tmp_tl
+ { \@@_uncert_bracket:N \l_@@_tmp_tl }
+ }
+ { \siunitx_number_format:nN {#1} \l_@@_tmp_tl }
\seq_put_right:NV \l_@@_tmp_seq \l_@@_tmp_tl
}
\cs_new_protected:Npn \@@_unparsed:n #1
@@ -642,6 +664,7 @@
{ \l_@@_unit_bracket_bool }
{ ! \l_@@_unit_repeat_bool }
{ \bool_set_false:N \l_siunitx_number_bracket_ambiguous_bool }
+ \bool_set_true:N \l_@@_unit_bool
\@@_format:nn {#1} {#2}
\str_if_eq:VnT \l_siunitx_quantity_prefix_mode_tl { combine-exponent }
{ \tl_clear:N \l_@@_exp_tl }
@@ -785,6 +808,36 @@
% \end{macro}
% \end{macro}
%
+% \begin{macro}[EXP]{\@@_uncert_bracket:N}
+% \begin{macro}[EXP]{\@@_uncert_bracket:w}
+% \begin{macro}[EXP]{\@@_uncert_bracket:nnw}
+% Check for the case where there is a separate uncertainty but not exponent,
+% when we are handling units.
+% \begin{macrocode}
+\cs_new:Npn \@@_uncert_bracket:N #1
+ { \exp_after:wN \@@_uncert_bracket:w #1 \q_stop }
+\cs_new:Npn \@@_uncert_bracket:w
+ #1 \q_nil #2 \q_nil #3 \q_nil #4 \q_nil #5 \q_nil #6 \q_nil #7 \q_nil
+ #8 \q_nil #9 \q_stop
+ { \@@_uncert_bracket:nnw {#1#2#3#4#5#6} {#7#8} #9 \q_stop }
+\cs_new:Npn \@@_uncert_bracket:nnw #1#2 #3 \q_nil #4 \q_nil #5 \q_stop
+ {
+ \bool_lazy_or:nnTF
+ { \tl_if_blank_p:n {#2#3} }
+ { ! \tl_if_blank_p:n {#5} }
+ { \exp_not:n {#1#2#3#4#5} }
+ {
+ \exp_not:V \l_@@_bracket_open_tl
+ \exp_not:n {#1#2#3}
+ \exp_not:V \l_@@_bracket_close_tl
+ \exp_not:n {#4#5}
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
% \subsection{Lists}
%
% Identify the internal prefix (\LaTeX3 \pkg{DocStrip} convention): only
diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-emulation.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-emulation.dtx
index 4ae6cd15905..48648e3c137 100644
--- a/Master/texmf-dist/source/latex/siunitx/siunitx-emulation.dtx
+++ b/Master/texmf-dist/source/latex/siunitx/siunitx-emulation.dtx
@@ -1002,12 +1002,13 @@
{
\angstrom ,
\atomicmassunit ,
+ \bar ,
\bohr ,
\clight ,
\electronmass ,
\elementarycharge ,
\hartree ,
- \plackbar
+ \planckbar
}
{
\siunitx_declare_unit:Nx #1
diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx
index dec433df026..67c9580ca6c 100644
--- a/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx
+++ b/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx
@@ -472,12 +472,6 @@
% \end{syntax}
% \end{function}
%
-% \begin{function}{separate-uncertainty}
-% \begin{syntax}
-% |separate-uncertainty| = |true|\verb"|"|false|
-% \end{syntax}
-% \end{function}
-%
% \begin{function}{tight-spacing}
% \begin{syntax}
% |tight-spacing| = |true|\verb"|"|false|
diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-print.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-print.dtx
index 8cdc068b910..cc26177ef1a 100644
--- a/Master/texmf-dist/source/latex/siunitx/siunitx-print.dtx
+++ b/Master/texmf-dist/source/latex/siunitx/siunitx-print.dtx
@@ -82,6 +82,9 @@
% in text mode
% \item \pkg{amstext}: the \cs{text} command for printing in text mode
% \end{itemize}
+% For detection of math mode fonts, as well as \cs{mathrm}, the existence of
+% \cs{symoperators} is assumed; other math font commands are not
+% \emph{required} to exist.
%
% \begin{function}
% {
@@ -317,52 +320,13 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{variable}{\l_@@_tmp_box, \l_@@_tmp_tl}
+% \begin{variable}{\l_@@_tmp_tl}
% Scratch space.
% \begin{macrocode}
-\box_new:N \l_@@_tmp_box
\tl_new:N \l_@@_tmp_tl
% \end{macrocode}
% \end{variable}
%
-% \begin{macro}{\document}
-% \begin{macro}{\@@_store_fam:n}
-% \begin{variable}{\c_@@_mathrm_int, \c_@@_mathsf_int, \c_@@_mathtt_int}
-% In order to test math fonts, we need information about the \cs{fam} used
-% by the various options. As we are doing typesetting (if only in a box), we
-% need to be right at the start of the document: this also avoids any issue
-% with \pkg{fontspec}. With a sufficiently recent \LaTeXe{} this is easy;
-% for older kernels, we have to do things manually.
-% \begin{macrocode}
-\IfFormatAtLeastTF { 2020-10-01 }
- { \hook_gput_code:nnn { begindocument/end } { siunitx } }
- { \tl_put_right:Nn \document }
- {
- \@@_store_fam:n { rm }
- \@@_store_fam:n { sf }
- \@@_store_fam:n { tt }
- }
-\IfFormatAtLeastTF { 2020-10-01 }
- { }
- { \tl_put_right:Nn \document { \ignorespaces } }
-\cs_new_protected:Npn \@@_store_fam:n #1
- {
- \group_begin:
- \hbox_set:Nn \l_@@_tmp_box
- {
- \ensuremath
- {
- \use:c { math #1 }
- { \int_const:cn { c_@@_math #1 _int } { \fam } }
- }
- }
- \group_end:
- }
-% \end{macrocode}
-% \end{variable}
-% \end{macro}
-% \end{macro}
-%
% \subsection{Printing routines}
%
% \begin{variable}
@@ -559,6 +523,8 @@
% \@@_math_auxiv:n,
% \@@_math_auxv:n
% }
+% \begin{macro}{\@@_math_aux:N}
+% \begin{macro}{\@@_math_aux:w}
% \begin{macro}{\@@_math_aux:Nn, \@@_math_aux:cn}
% \begin{macro}{\@@_math_sub:n, \@@_math_super:n, \@@_math_script:n}
% \begin{macro}{\@@_math_text:n}
@@ -656,20 +622,12 @@
% cases. First, we are retaining the current math font, and the active one is
% \cs{mathsf} or \cs{mathtt}: that needs to be applied to the argument.
% Alternatively, if the current font is not retained, ensure that
-% normal math mode rules are active. The parts here are split up to allow
-% reuse when picking up the text family.
+% normal math mode rules are active.
% \begin{macrocode}
\cs_new_protected:Npn \@@_math_auxiv:n #1
{
\bool_if:NTF \l_@@_math_font_bool
- {
- \int_case:nnF \fam
- {
- \c_@@_mathsf_int { \@@_math_aux:Nn \mathsf }
- \c_@@_mathtt_int { \@@_math_aux:Nn \mathtt }
- }
- { \use:n }
- }
+ { \@@_math_aux:N \mathsf \mathtt \q_recursion_tail \q_recursion_stop }
{ \@@_math_auxv:n }
{#1}
}
@@ -677,11 +635,24 @@
{
\bool_lazy_or:nnTF
{ \int_compare_p:nNn \fam = { -1 } }
- { \int_compare_p:nNn \fam = \c_@@_mathrm_int }
+ { \int_compare_p:nNn \fam = \symoperators }
{ \use:n }
{ \mathrm }
{#1}
}
+\cs_new_protected:Npn \@@_math_aux:N #1
+ {
+ \quark_if_recursion_tail_stop_do:Nn #1 { \use:n }
+ \exp_after:wN \exp_after:wN \exp_after:wN \@@_math_aux:w
+ \cs:w \cs_to_str:N #1 \c_space_tl \cs_end:
+ \use@mathgroup ? { -2 } \q_stop #1
+ }
+\cs_new_protected:Npn \@@_math_aux:w #1 \use@mathgroup #2#3 #4 \q_stop #5
+ {
+ \int_compare:nNnTF \fam = {#3}
+ { \use_i_delimit_by_q_recursion_stop:nw { \@@_math_aux:Nn #5 } }
+ { \@@_math_aux:N }
+ }
% \end{macrocode}
% Search-and-replace fun: deal with any font commands in the argument and
% also inside sub/superscripts.
@@ -744,6 +715,8 @@
% \end{macro}
% \end{macro}
% \end{macro}
+% \end{macro}
+% \end{macro}
%
% \begin{macro}{\siunitx_print_text:n}
% \begin{macro}{\@@_text_replace:n}
diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-table.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-table.dtx
index 3f8673c2fcd..c0330900228 100644
--- a/Master/texmf-dist/source/latex/siunitx/siunitx-table.dtx
+++ b/Master/texmf-dist/source/latex/siunitx/siunitx-table.dtx
@@ -1196,7 +1196,6 @@
\exp_not:N \q_mark
\siunitx_number_output:NN \l_@@_tmp_tl \q_nil
}
- \@@_color_check:N \l_@@_tmp_tl
\exp_after:wN \@@_print_format_auxi:w
\l_@@_tmp_tl \q_stop
\hbox_set:Nn \l_@@_tmp_box { \l_@@_after_model_tl }
@@ -1213,7 +1212,7 @@
\box_use_drop:N \l_@@_before_box
\box_use_drop:N \l_@@_integer_box
\box_use_drop:N \l_@@_decimal_box
- \box_use_drop:N \l_@@_after_box
+ \box_use_drop:N \l_@@_after_box
}
}
\cs_new:Npn \@@_print_format:nnnnnn #1#2#3#4#5#6#7
@@ -1226,6 +1225,7 @@
\cs_new_protected:Npn \@@_print_format_auxi:w
#1 \q_nil #2 \q_mark #3 \q_nil #4 \q_stop
{
+ \@@_color_check:w #3 \q_nil \q_stop
\@@_print_format_box:Nn \l_@@_tmp_box {#1}
\bool_if:NTF \l_@@_align_before_bool
{
diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx.dtx
index 40ba293d81a..7c75d7a9835 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-21} {3.0.4}
+\ProvidesExplPackage {siunitx} {2021-05-24} {3.0.5}
{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 857a1569a6c..8af64c27086 100644
--- a/Master/texmf-dist/source/latex/siunitx/siunitx.tex
+++ b/Master/texmf-dist/source/latex/siunitx/siunitx.tex
@@ -451,7 +451,7 @@ The \meta{number} and \meta{unit} arguments work exactly like those for the
It is possible to set up the unit macros to be available outside of the
\cs{qty} and \cs{unit} functions. This is not the standard behaviour as there
-is the risk of name clashes (for example, \cs{bar} is used by other packages,
+is the risk of name clashes (for example, \cs{day} is a \TeX{} primitive
and several packages define \cs{degree}). Full details of using \enquote{stand
alone} units are found in \ref{sec:units:creating}.
diff --git a/Master/texmf-dist/tex/latex/siunitx/siunitx.sty b/Master/texmf-dist/tex/latex/siunitx/siunitx.sty
index 6bcb2422b9a..1c5da1ff452 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-21} {3.0.4}
+\ProvidesExplPackage {siunitx} {2021-05-24} {3.0.5}
{A comprehensive (SI) units package}
\msg_new:nnnn { siunitx } { incompatible-package }
{ Package~'#1'~incompatible. }
@@ -823,6 +823,7 @@
\tl_new:N \l__siunitx_compound_start_tl
\tl_new:N \l__siunitx_compound_end_tl
\int_new:N \l__siunitx_compound_count_int
+\bool_new:N \l__siunitx_compound_unit_bool
\tl_new:N \l__siunitx_compound_unit_tl
\tl_new:N \l__siunitx_compound_bracket_close_tl
\tl_new:N \l__siunitx_compound_bracket_open_tl
@@ -898,6 +899,7 @@
\cs_new_protected:Npn \siunitx_compound_number:n #1
{
\group_begin:
+ \bool_set_false:N \l__siunitx_compound_unit_bool
\__siunitx_compound_format:nn {#1} { }
\__siunitx_compound_print:N \siunitx_print_number:x
\group_end:
@@ -917,16 +919,25 @@
\cs_new_protected:Npn \__siunitx_compound_format:nnn #1#2#3
{
\siunitx_number_parse:nN {#1} \l__siunitx_compound_tmp_tl
- \tl_if_blank:nTF {#3}
- { \siunitx_number_process:NN \l__siunitx_compound_tmp_tl \l__siunitx_compound_first_tl }
+ \bool_if:NTF \l__siunitx_compound_unit_bool
{ \__siunitx_compound_format_units:nn {#2} {#3} }
+ { \siunitx_number_process:NN \l__siunitx_compound_tmp_tl \l__siunitx_compound_first_tl }
\bool_lazy_and:nnTF
{ \l__siunitx_compound_exp_combine_bool }
{ \int_compare_p:nNn { \tl_count:n {#2} } > 0 }
{ \__siunitx_compound_extract_exponents: }
{
- \tl_set:Nx \l__siunitx_compound_tmp_tl
- { \siunitx_number_output:N \l__siunitx_compound_first_tl }
+ \bool_if:NTF \l__siunitx_compound_unit_bool
+ {
+ \tl_set:Nx \l__siunitx_compound_tmp_tl
+ { \siunitx_number_output:NN \l__siunitx_compound_first_tl \q_nil }
+ \tl_set:Nx \l__siunitx_compound_tmp_tl
+ { \__siunitx_compound_uncert_bracket:N \l__siunitx_compound_tmp_tl }
+ }
+ {
+ \tl_set:Nx \l__siunitx_compound_tmp_tl
+ { \siunitx_number_output:N \l__siunitx_compound_first_tl }
+ }
\seq_put_right:NV \l__siunitx_compound_tmp_seq \l__siunitx_compound_tmp_tl
}
\tl_map_function:nN {#2} \__siunitx_compound_parsed:n
@@ -964,7 +975,16 @@
}
\cs_new_protected:Npn \__siunitx_compound_parsed:n #1
{
- \siunitx_number_format:nN {#1} \l__siunitx_compound_tmp_tl
+ \bool_if:NTF \l__siunitx_compound_unit_bool
+ {
+ \siunitx_number_parse:nN {#1} \l__siunitx_compound_tmp_tl
+ \siunitx_number_process:NN \l__siunitx_compound_tmp_tl \l__siunitx_compound_tmp_tl
+ \tl_set:Nx \l__siunitx_compound_tmp_tl
+ { \siunitx_number_output:NN \l__siunitx_compound_tmp_tl \q_nil }
+ \tl_set:Nx \l__siunitx_compound_tmp_tl
+ { \__siunitx_compound_uncert_bracket:N \l__siunitx_compound_tmp_tl }
+ }
+ { \siunitx_number_format:nN {#1} \l__siunitx_compound_tmp_tl }
\seq_put_right:NV \l__siunitx_compound_tmp_seq \l__siunitx_compound_tmp_tl
}
\cs_new_protected:Npn \__siunitx_compound_unparsed:n #1
@@ -1052,6 +1072,7 @@
{ \l__siunitx_compound_unit_bracket_bool }
{ ! \l__siunitx_compound_unit_repeat_bool }
{ \bool_set_false:N \l_siunitx_number_bracket_ambiguous_bool }
+ \bool_set_true:N \l__siunitx_compound_unit_bool
\__siunitx_compound_format:nn {#1} {#2}
\str_if_eq:VnT \l_siunitx_quantity_prefix_mode_tl { combine-exponent }
{ \tl_clear:N \l__siunitx_compound_exp_tl }
@@ -1170,6 +1191,25 @@
{ \siunitx_print_number:n {#1} }
}
\cs_generate_variant:Nn \__siunitx_compound_print_separator:n { V }
+\cs_new:Npn \__siunitx_compound_uncert_bracket:N #1
+ { \exp_after:wN \__siunitx_compound_uncert_bracket:w #1 \q_stop }
+\cs_new:Npn \__siunitx_compound_uncert_bracket:w
+ #1 \q_nil #2 \q_nil #3 \q_nil #4 \q_nil #5 \q_nil #6 \q_nil #7 \q_nil
+ #8 \q_nil #9 \q_stop
+ { \__siunitx_compound_uncert_bracket:nnw {#1#2#3#4#5#6} {#7#8} #9 \q_stop }
+\cs_new:Npn \__siunitx_compound_uncert_bracket:nnw #1#2 #3 \q_nil #4 \q_nil #5 \q_stop
+ {
+ \bool_lazy_or:nnTF
+ { \tl_if_blank_p:n {#2#3} }
+ { ! \tl_if_blank_p:n {#5} }
+ { \exp_not:n {#1#2#3#4#5} }
+ {
+ \exp_not:V \l__siunitx_compound_bracket_open_tl
+ \exp_not:n {#1#2#3}
+ \exp_not:V \l__siunitx_compound_bracket_close_tl
+ \exp_not:n {#4#5}
+ }
+ }
\tl_new:N \l__siunitx_list_exp_tl
\tl_new:N \l__siunitx_list_units_tl
\keys_define:nn { siunitx }
@@ -3394,32 +3434,7 @@
\RequirePackage { amstext }
\RequirePackage { color }
\cs_generate_variant:Nn \tl_replace_all:Nnn { NV }
-\box_new:N \l__siunitx_print_tmp_box
\tl_new:N \l__siunitx_print_tmp_tl
-\IfFormatAtLeastTF { 2020-10-01 }
- { \hook_gput_code:nnn { begindocument/end } { siunitx } }
- { \tl_put_right:Nn \document }
- {
- \__siunitx_print_store_fam:n { rm }
- \__siunitx_print_store_fam:n { sf }
- \__siunitx_print_store_fam:n { tt }
- }
-\IfFormatAtLeastTF { 2020-10-01 }
- { }
- { \tl_put_right:Nn \document { \ignorespaces } }
-\cs_new_protected:Npn \__siunitx_print_store_fam:n #1
- {
- \group_begin:
- \hbox_set:Nn \l__siunitx_print_tmp_box
- {
- \ensuremath
- {
- \use:c { math #1 }
- { \int_const:cn { c__siunitx_print_math #1 _int } { \fam } }
- }
- }
- \group_end:
- }
\tl_new:N \l__siunitx_print_number_mode_tl
\tl_new:N \l__siunitx_print_unit_mode_tl
\keys_define:nn { siunitx }
@@ -3578,14 +3593,7 @@
\cs_new_protected:Npn \__siunitx_print_math_auxiv:n #1
{
\bool_if:NTF \l__siunitx_print_math_font_bool
- {
- \int_case:nnF \fam
- {
- \c__siunitx_print_mathsf_int { \__siunitx_print_math_aux:Nn \mathsf }
- \c__siunitx_print_mathtt_int { \__siunitx_print_math_aux:Nn \mathtt }
- }
- { \use:n }
- }
+ { \__siunitx_print_math_aux:N \mathsf \mathtt \q_recursion_tail \q_recursion_stop }
{ \__siunitx_print_math_auxv:n }
{#1}
}
@@ -3593,11 +3601,24 @@
{
\bool_lazy_or:nnTF
{ \int_compare_p:nNn \fam = { -1 } }
- { \int_compare_p:nNn \fam = \c__siunitx_print_mathrm_int }
+ { \int_compare_p:nNn \fam = \symoperators }
{ \use:n }
{ \mathrm }
{#1}
}
+\cs_new_protected:Npn \__siunitx_print_math_aux:N #1
+ {
+ \quark_if_recursion_tail_stop_do:Nn #1 { \use:n }
+ \exp_after:wN \exp_after:wN \exp_after:wN \__siunitx_print_math_aux:w
+ \cs:w \cs_to_str:N #1 \c_space_tl \cs_end:
+ \use@mathgroup ? { -2 } \q_stop #1
+ }
+\cs_new_protected:Npn \__siunitx_print_math_aux:w #1 \use@mathgroup #2#3 #4 \q_stop #5
+ {
+ \int_compare:nNnTF \fam = {#3}
+ { \use_i_delimit_by_q_recursion_stop:nw { \__siunitx_print_math_aux:Nn #5 } }
+ { \__siunitx_print_math_aux:N }
+ }
\cs_new_protected:Npx \__siunitx_print_math_aux:Nn #1#2
{
\group_begin:
@@ -4407,7 +4428,6 @@
\exp_not:N \q_mark
\siunitx_number_output:NN \l__siunitx_table_tmp_tl \q_nil
}
- \__siunitx_table_color_check:N \l__siunitx_table_tmp_tl
\exp_after:wN \__siunitx_table_print_format_auxi:w
\l__siunitx_table_tmp_tl \q_stop
\hbox_set:Nn \l__siunitx_table_tmp_box { \l__siunitx_table_after_model_tl }
@@ -4424,7 +4444,7 @@
\box_use_drop:N \l__siunitx_table_before_box
\box_use_drop:N \l__siunitx_table_integer_box
\box_use_drop:N \l__siunitx_table_decimal_box
- \box_use_drop:N \l__siunitx_table_after_box
+ \box_use_drop:N \l__siunitx_table_after_box
}
}
\cs_new:Npn \__siunitx_table_print_format:nnnnnn #1#2#3#4#5#6#7
@@ -4432,6 +4452,7 @@
\cs_new_protected:Npn \__siunitx_table_print_format_auxi:w
#1 \q_nil #2 \q_mark #3 \q_nil #4 \q_stop
{
+ \__siunitx_table_color_check:w #3 \q_nil \q_stop
\__siunitx_table_print_format_box:Nn \l__siunitx_table_tmp_box {#1}
\bool_if:NTF \l__siunitx_table_align_before_bool
{
@@ -7080,12 +7101,13 @@
{
\angstrom ,
\atomicmassunit ,
+ \bar ,
\bohr ,
\clight ,
\electronmass ,
\elementarycharge ,
\hartree ,
- \plackbar
+ \planckbar
}
{
\siunitx_declare_unit:Nx #1