summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/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/tex/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/tex/latex/siunitx')
-rw-r--r--Master/texmf-dist/tex/latex/siunitx/siunitx.sty108
1 files changed, 65 insertions, 43 deletions
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