summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/siunitx
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 /Master/texmf-dist/source/latex/siunitx
parent7053a6c036bf5929f8cf7bc5dd667a4041721917 (diff)
siunitx (24may21)
git-svn-id: svn://tug.org/texlive/trunk@59332 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/siunitx')
-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
7 files changed, 90 insertions, 69 deletions
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}.