summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/siunitx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-11-16 01:15:54 +0000
committerKarl Berry <karl@freefriends.org>2011-11-16 01:15:54 +0000
commitf4fb829042e4dbbb1c8c05add1060da51b14ca66 (patch)
treec78f1f98c2beb6fd2a8ba54ed21f6381c0acc075 /Master/texmf-dist/tex/latex/siunitx
parent6817d6a40c52768cea928291e7fd015554c86266 (diff)
siunitx 2.4 (14nov11)
git-svn-id: svn://tug.org/texlive/trunk@24604 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/siunitx')
-rw-r--r--Master/texmf-dist/tex/latex/siunitx/config/siunitx-abbreviations.cfg2
-rw-r--r--Master/texmf-dist/tex/latex/siunitx/config/siunitx-binary.cfg2
-rw-r--r--Master/texmf-dist/tex/latex/siunitx/config/siunitx-version-1.cfg94
-rw-r--r--Master/texmf-dist/tex/latex/siunitx/siunitx.sty2352
4 files changed, 1207 insertions, 1243 deletions
diff --git a/Master/texmf-dist/tex/latex/siunitx/config/siunitx-abbreviations.cfg b/Master/texmf-dist/tex/latex/siunitx/config/siunitx-abbreviations.cfg
index b7baf06db7a..cdd37780dd4 100644
--- a/Master/texmf-dist/tex/latex/siunitx/config/siunitx-abbreviations.cfg
+++ b/Master/texmf-dist/tex/latex/siunitx/config/siunitx-abbreviations.cfg
@@ -13,7 +13,7 @@
%% See http://www.latex-project.org/lppl.txt
%% ---------------------------------------------------------------
%%
-\ProvidesExplFile {siunitx-abbreviations.cfg} {2011/10/14} {2.3h}
+\ProvidesExplFile {siunitx-abbreviations.cfg} {2011/11/14} {2.4}
{siunitx: Abbreviated units}
\DeclareSIUnit \A { \ampere }
\DeclareSIUnit \pA { \pico \ampere }
diff --git a/Master/texmf-dist/tex/latex/siunitx/config/siunitx-binary.cfg b/Master/texmf-dist/tex/latex/siunitx/config/siunitx-binary.cfg
index 06b5b97101d..88f31faebf4 100644
--- a/Master/texmf-dist/tex/latex/siunitx/config/siunitx-binary.cfg
+++ b/Master/texmf-dist/tex/latex/siunitx/config/siunitx-binary.cfg
@@ -13,7 +13,7 @@
%% See http://www.latex-project.org/lppl.txt
%% ---------------------------------------------------------------
%%
-\ProvidesExplFile {siunitx-binary.cfg} {2011/10/14} {2.3h}
+\ProvidesExplFile {siunitx-binary.cfg} {2011/11/14} {2.4}
{siunitx: Binary units}
\DeclareBinaryPrefix \kibi { Ki } { 10 }
\DeclareBinaryPrefix \mebi { Mi } { 20 }
diff --git a/Master/texmf-dist/tex/latex/siunitx/config/siunitx-version-1.cfg b/Master/texmf-dist/tex/latex/siunitx/config/siunitx-version-1.cfg
index b78df64c54e..57c10d8ab57 100644
--- a/Master/texmf-dist/tex/latex/siunitx/config/siunitx-version-1.cfg
+++ b/Master/texmf-dist/tex/latex/siunitx/config/siunitx-version-1.cfg
@@ -13,7 +13,7 @@
%% See http://www.latex-project.org/lppl.txt
%% ---------------------------------------------------------------
%%
-\ProvidesExplFile {siunitx-version-1.cfg} {2011/10/14} {2.3h}
+\ProvidesExplFile {siunitx-version-1.cfg} {2011/11/14} {2.4}
{siunitx: Version 1 settings}
\keys_define:nn { siunitx } {
addsign .choice: ,
@@ -41,43 +41,43 @@
anglesep .choice: ,
anglesep /
cdot .meta:n =
- { arc-separator = { } \cdot { } },
+ { arc-separator = \ensuremath { { } \cdot { } } },
anglesep /
- comma .meta:n = { arc-separator = { {,} } },
+ comma .meta:n = { arc-separator = \ensuremath { { {,} } } },
anglesep /
- fullstop .meta:n = { arc-separator = { { . } } },
+ fullstop .meta:n = { arc-separator = \ensuremath { { { . } } } },
anglesep /
- med .meta:n = { arc-separator = \: },
+ med .meta:n = { arc-separator = \ensuremath { \: } },
anglesep /
- medium .meta:n = { arc-separator = \: },
+ medium .meta:n = { arc-separator = \ensuremath { \: } },
anglesep /
none .meta:n = { arc-separator = },
anglesep /
- period .meta:n = { arc-separator = { { . } } },
+ period .meta:n = { arc-separator = \ensuremath { { { . } } } },
anglesep /
space .meta:n = { arc-separator = \text { ~ } },
anglesep /
- stop .meta:n = { arc-separator = { { . } } },
+ stop .meta:n = { arc-separator = \ensuremath { { { . } } } },
anglesep /
- thick .meta:n = { arc-separator = \; },
+ thick .meta:n = { arc-separator = \ensuremath { \; } },
anglesep /
- thin .meta:n = { arc-separator = \, },
+ thin .meta:n = { arc-separator = \ensuremath { \, } },
anglesep /
tightcdot .meta:n =
- { arc-separator = \bgroup \cdot \egroup },
+ { arc-separator = \ensuremath { \bgroup \cdot \egroup } },
anglesep /
tighttimes .meta:n =
- { arc-separator = \bgroup \times \egroup },
+ { arc-separator = \ensuremath { \bgroup \times \egroup } },
anglesep /
- times .meta:n = { arc-separator = \times },
+ times .meta:n = { arc-separator = \ensuremath { \times } },
anglesep /
- unknown .meta:n = { arc-separator = #1 },
+ unknown .meta:n = { arc-separator = \ensuremath {#1} },
astroang .meta:n =
{ angle-symbol-over-decimal = #1 },
astroang .default:n = { true },
- closeerr .meta:n = { close-bracket = #1 },
- closefrac .meta:n = { close-bracket = #1 },
- closerange .meta:n = { close-bracket = #1 },
+ closeerr .meta:n = { close-bracket = \ensuremath {#1} },
+ closefrac .meta:n = { close-bracket = \ensuremath {#1} },
+ closerange .meta:n = { close-bracket = \ensuremath {#1} },
colour .code:n = { color = #1 },
colorall .code:n = ,
colourall .code:n = ,
@@ -90,57 +90,57 @@
decimalsymbol .choice: ,
decimalsymbol /
cdot .meta:n =
- { output-decimal-marker = { } \cdot { } },
+ { output-decimal-marker = \ensuremath { { } \cdot { } } },
decimalsymbol /
- comma .meta:n = { output-decimal-marker = { { , } } },
+ comma .meta:n = { output-decimal-marker = { \ensuremath { { , } } } },
decimalsymbol /
- fullstop .meta:n = { output-decimal-marker = { { . } } },
+ fullstop .meta:n = { output-decimal-marker = { \ensuremath { { . } } } },
decimalsymbol /
- period .meta:n = { output-decimal-marker = { { . } } },
+ period .meta:n = { output-decimal-marker = { \ensuremath { { . } } } },
decimalsymbol /
- stop .meta:n = { output-decimal-marker = { { . } } },
+ stop .meta:n = { output-decimal-marker = { \ensuremath { { . } } } },
decimalsymbol /
tightcdot .code:n =
- { output-decimal-marker = \bgroup \cdot \egroup },
+ { output-decimal-marker = \ensuremath { \bgroup \cdot \egroup } },
decimalsymbol /
- unknown .meta:n = { output-decimal-marker = #1 },
+ unknown .meta:n = { output-decimal-marker = \ensuremath {#1} },
debug .code:n = ,
detectdisplay .meta:n = { detect-display-math = #1 },
detectdisplay .default:n = { true },
digitsep .choice: ,
digitsep /
cdot .meta:n =
- { group-separator = { } \cdot { } },
+ { group-separator = \ensuremath { { } \cdot { } } },
digitsep /
- comma .meta:n = { group-separator = { , } },
+ comma .meta:n = { group-separator = \ensuremath { { , } } },
digitsep /
- fullstop .meta:n = { group-separator = . },
+ fullstop .meta:n = { group-separator = \ensuremath { . } },
digitsep /
- med .meta:n = { group-separator = \: },
+ med .meta:n = { group-separator = \ensuremath { \: } },
digitsep /
- medium .meta:n = { group-separator = \: },
+ medium .meta:n = { group-separator = \ensuremath { \: } },
digitsep /
none .meta:n = { group-separator = },
digitsep /
- period .meta:n = { group-separator = . },
+ period .meta:n = { group-separator = \ensuremath { . } },
digitsep /
space .meta:n = { group-separator = \text { ~ } },
digitsep /
- stop .meta:n = { group-separator = . },
+ stop .meta:n = { group-separator = \ensuremath { . } },
digitsep /
- thick .meta:n = { group-separator = \; },
+ thick .meta:n = { group-separator = \ensuremath { \; } },
digitsep /
- thin .meta:n = { group-separator = \, },
+ thin .meta:n = { group-separator = \ensuremath { \, } },
digitsep /
tightcdot .meta:n =
- { group-separator = \bgroup \cdot \egroup },
+ { group-separator = \ensuremath { \bgroup \cdot \egroup } },
digitsep /
tighttimes .meta:n =
- { group-separator = \bgroup \times \egroup },
+ { group-separator = \ensuremath { \bgroup \times \egroup } },
digitsep /
- times .meta:n = { group-separator = \times },
+ times .meta:n = { group-separator = \ensuremath { \times } },
digitsep /
- unknown .meta:n = { group-separator = #1 },
+ unknown .meta:n = { group-separator = \ensuremath {#1} },
dp .meta:n =
{
round-mode = places,
@@ -149,19 +149,19 @@
emulate .code:n = ,
errspace .choice: ,
errspace /
- med .meta:n = { uncertainty-separator = \: },
+ med .meta:n = { uncertainty-separator = \ensuremath { \: } },
errspace /
- medium .meta:n = { uncertainty-separator = \: },
+ medium .meta:n = { uncertainty-separator = \ensuremath { \: } },
errspace /
none .meta:n = { uncertainty-separator = },
errspace /
space .meta:n = { uncertainty-separator = \text { ~ } },
errspace /
- thick .meta:n = { uncertainty-separator = \; },
+ thick .meta:n = { uncertainty-separator = \ensuremath { \; } },
errspace /
- thin .meta:n = { uncertainty-separator = \, },
+ thin .meta:n = { uncertainty-separator = \ensuremath { \, } },
errspace /
- unknown .meta:n = { uncertainty-separator = #1 },
+ unknown .meta:n = { uncertainty-separator = \ensuremath {#1} },
eVcorra .code:n = ,
eVcorrb .code:n = ,
expbase .choice: ,
@@ -263,9 +263,9 @@
obeyitalic .default:n = { true },
obeymode .meta:n = { detect-mode = #1 },
obeymode .default:n = { true },
- openerr .meta:n = { open-bracket = #1 },
- openfrac .meta:n = { open-bracket = #1 },
- openrange .meta:n = { open-bracket = #1 },
+ openerr .meta:n = { open-bracket = \ensuremath {#1} },
+ openfrac .meta:n = { open-bracket = \ensuremath {#1} },
+ openrange .meta:n = { open-bracket = \ensuremath {#1} },
padangle .choice: ,
padangle /
all .meta:n =
@@ -409,9 +409,9 @@
sign .meta:n = { explicit-sign = #1 },
slash .choice: ,
slash /
- slash .meta:n = { per-symbol = / },
+ slash .meta:n = { per-symbol = \ensuremath { / } },
slash /
- unknown .meta:n = { per-symbol = #1 },
+ unknown .meta:n = { per-symbol = \ensuremath {#1} },
stickyper .meta:n = { sticky-per = #1 },
stickyper .default:n = { true },
strictarc .code:n = ,
diff --git a/Master/texmf-dist/tex/latex/siunitx/siunitx.sty b/Master/texmf-dist/tex/latex/siunitx/siunitx.sty
index fac3155705f..fcf188e6609 100644
--- a/Master/texmf-dist/tex/latex/siunitx/siunitx.sty
+++ b/Master/texmf-dist/tex/latex/siunitx/siunitx.sty
@@ -14,35 +14,23 @@
%% ---------------------------------------------------------------
%%
\RequirePackage{expl3}
-\ProvidesExplPackage {siunitx} {2011/10/14} {2.3h}
+\ProvidesExplPackage {siunitx} {2011/11/14} {2.4}
{A comprehensive (SI) units package}
-\cs_if_exist:NTF \msg_new:nnnn
- {
- \msg_new:nnnn { siunitx } { support-outdated }
- { Support~package~#1~too~old. }
- {
- Please~install~an~up~to~date~version~of~#1. \\
- Loading~siunitx~will~abort!
- }
- }
+\@ifpackagelater { expl3 } { 2011/09/05 }
+ { }
{
\PackageError { siunitx } { Support~package~expl3~too~old. }
{
- Please~install~an~up~to~date~version~of~expl3. \\
+ You~need~to~update~your~installation~of~the~bundles~'l3kernel'~and~
+ 'l3packages'.\\
Loading~siunitx~will~abort!
}
\tex_endinput:D
}
-\@ifpackagelater { expl3 } { 2011/09/05 }
- { }
- {
- \msg_error:nnx { siunitx } { support-outdated } { expl3 }
- \tex_endinput:D
- }
\msg_new:nnnn { siunitx } { incompatible-package }
{ Package~'#1'~incompatible. }
{ The~#1~package~and~siunitx~are~incompatible. }
-\cs_new_protected_nopar:Npn \siunitx_load_check:n #1 {
+\cs_new_protected:Npn \siunitx_load_check:n #1 {
\group_begin:
\@ifpackageloaded {#1}
{ \msg_error:nnx { siunitx } { incompatible-package } {#1} }
@@ -58,6 +46,7 @@
}
\RequirePackage{ amstext , array , l3keys2e }
\cs_new:Npn \siunitx_tmp:w { }
+\cs_generate_variant:Nn \clist_map_function:nN { nc }
\bool_new:N \l_siunitx_tmp_bool
\box_new:N \l_siunitx_tmp_box
\dim_new:N \l_siunitx_tmp_dim
@@ -109,18 +98,14 @@
\cs_if_exist:NT \upOmega
{ \tl_set:Nn \c_siunitx_omega_tl { \upOmega } }
}
-\cs_new_protected:Npn \siunitx_tl_put_left_math:Nn #1#2 {
- \tl_put_left:Nn #1 { \siunitx_ensuremath:n {#2} }
-}
+\cs_new_protected:Npn \siunitx_tl_put_left_math:Nn #1#2
+ { \tl_put_left:Nn #1 { \ensuremath {#2} } }
\cs_generate_variant:Nn \siunitx_tl_put_left_math:Nn { NV }
-\cs_generate_variant:Nn \siunitx_tl_put_left_math:Nn { cV }
-\cs_new_protected:Npn \siunitx_tl_put_right_math:Nn #1#2 {
- \tl_put_right:Nn #1 { \siunitx_ensuremath:n {#2} }
-}
+\cs_new_protected:Npn \siunitx_tl_put_right_math:Nn #1#2
+ { \tl_put_right:Nn #1 { \ensuremath {#2} } }
\cs_generate_variant:Nn \siunitx_tl_put_right_math:Nn { NV }
-\cs_generate_variant:Nn \siunitx_tl_put_right_math:Nn { cV }
\seq_new:N \c_siunitx_old_options_seq
-\cs_set_protected_nopar:Npn \siunitx_tmp:w #1 {
+\cs_set_protected:Npn \siunitx_tmp:w #1 {
\seq_put_right:No \c_siunitx_old_options_seq { \tl_to_str:n {#1} }
}
\siunitx_tmp:w { addsign }
@@ -306,10 +291,10 @@
}
}
}
-\cs_new_protected_nopar:Npn \siunitx_option_deactivate:n #1 {
+\cs_new_protected:Npn \siunitx_option_deactivate:n #1 {
\clist_put_right:Nn \l_siunitx_option_deactivate_clist {#1}
}
-\cs_new_protected_nopar:Npn \siunitx_option_deactivate_aux:n #1 {
+\cs_new_protected:Npn \siunitx_option_deactivate_aux:n #1 {
\keys_define:nn { siunitx }
{
#1 .code:n =
@@ -341,7 +326,7 @@
}
{ \prg_return_false: }
}
- \cs_new_nopar:Npn \siunitx_cs_if_tl_aux:w #1 MACRO #2 \q_stop
+ \cs_new:Npn \siunitx_cs_if_tl_aux:w #1 MACRO #2 \q_stop
{ \tl_if_empty:nTF {#1} }
\prg_new_conditional:Npnn \siunitx_cs_if_macro:N #1
{ T , F , TF , p }
@@ -352,16 +337,15 @@
{ \prg_return_false: }
}
}
-\cs_new_eq:NN \siunitx_ensuremath:n \ensuremath
-\AtBeginDocument {
- \@ifpackageloaded { tex4ht }
- {
- \cs_set_eq:NN \siunitx_ensuremath:n \use:n
- \cs_set_eq:NN \siunitx_print_text_super:n \textsuperscript
- \keys_set:nn { siunitx } { qualifier-mode = brackets, mode = text }
- }
- { }
-}
+\AtBeginDocument
+ {
+ \@ifpackageloaded { tex4ht }
+ {
+ \cs_set_eq:NN \siunitx_print_text_super:n \textsuperscript
+ \keys_set:nn { siunitx } { qualifier-mode = brackets, mode = text }
+ }
+ { }
+ }
\cs_new_eq:NN \siunitx_textsuperscript:n \textsuperscript
\bool_new:N \l_siunitx_display_math_bool
\tex_everydisplay:D \exp_after:wN
@@ -372,7 +356,7 @@
\cs_generate_variant:Nn \prop_get:NnNT { NV }
\cs_generate_variant:Nn \prop_get:NnNF { NV }
\cs_generate_variant:Nn \prop_get:NnNTF { NV }
-\cs_new_protected_nopar:Npn \siunitx_set_math_fam:n #1 {
+\cs_new_protected:Npn \siunitx_set_math_fam:n #1 {
\int_new:c { c_siunitx_math #1 _int }
\group_begin:
\hbox_set:Nn \l_siunitx_tmp_box
@@ -391,7 +375,7 @@
\siunitx_set_math_fam:n { sf }
\siunitx_set_math_fam:n { tt }
}
-\cs_new_protected_nopar:Npn \siunitx_set_text_fam:n #1 {
+\cs_new_protected:Npn \siunitx_set_text_fam:n #1 {
\tl_new:c { c_siunitx_text #1 _tl }
\tl_set:cx { c_siunitx_text #1 _tl } { \use:c { #1 default } }
}
@@ -465,9 +449,9 @@
\bool_new:N \l_siunitx_font_set_bool
\bool_new:N \l_siunitx_font_math_mode_bool
\tl_new:N \l_siunitx_font_family_tl
-\cs_new_nopar:Npn \siunitx_font_shape: { }
-\cs_new_nopar:Npn \siunitx_font_weight: { }
-\cs_new_protected_nopar:Npn \siunitx_detect_font: {
+\cs_new:Npn \siunitx_font_shape: { }
+\cs_new:Npn \siunitx_font_weight: { }
+\cs_new_protected:Npn \siunitx_detect_font: {
\bool_if:NF \l_siunitx_font_set_bool
{
\siunitx_detect_font_init:
@@ -481,7 +465,7 @@
{ \siunitx_detect_font_mode: }
}
}
-\cs_new_protected_nopar:Npn \siunitx_detect_font_init: {
+\cs_new_protected:Npn \siunitx_detect_font_init: {
\bool_set_true:N \l_siunitx_font_set_bool
\cs_set:Npn \siunitx_font_weight:
{
@@ -492,7 +476,7 @@
\tl_set:Nn \l_siunitx_font_family_tl { rm }
\bool_set_true:N \l_siunitx_font_math_mode_bool
}
-\cs_new_protected_nopar:Npn \siunitx_detect_font_weight: {
+\cs_new_protected:Npn \siunitx_detect_font_weight: {
\mode_if_math:TF
{
\bool_if:NTF \l_siunitx_display_math_bool
@@ -512,7 +496,7 @@
}
{ \siunitx_detect_font_weight_text: }
}
-\cs_new_protected_nopar:Npn \siunitx_detect_font_weight_math: {
+\cs_new_protected:Npn \siunitx_detect_font_weight_math: {
\str_if_eq:VnT \math@version { bold }
{
\cs_set:Npn \siunitx_font_weight:
@@ -524,7 +508,7 @@
\str_if_eq:VnT \math@version { light }
{ \cs_set:Npn \siunitx_font_weight: { \lseries } }
}
-\cs_new_protected_nopar:Npn \siunitx_detect_font_weight_text: {
+\cs_new_protected:Npn \siunitx_detect_font_weight_text: {
\tl_set:Nx \l_siunitx_tmpa_tl { \tl_head:V \f@series }
\str_if_eq:VnT \l_siunitx_tmpa_tl { b }
{
@@ -537,7 +521,7 @@
\str_if_eq:VnT \l_siunitx_tmpa_tl { l }
{ \cs_set:Npn \siunitx_font_weight: { \lseries } }
}
-\cs_new_protected_nopar:Npn \siunitx_detect_font_family: {
+\cs_new_protected:Npn \siunitx_detect_font_family: {
\mode_if_math:TF
{
\bool_if:NTF \l_siunitx_display_math_bool
@@ -557,26 +541,26 @@
}
{ \siunitx_detect_font_family_text: }
}
-\cs_new_protected_nopar:Npn \siunitx_detect_font_family_math: {
+\cs_new_protected:Npn \siunitx_detect_font_family_math: {
\tl_set:Nn \l_siunitx_font_family_tl { rm }
\int_compare:nNnT { \fam } = { \c_siunitx_mathsf_int }
{ \tl_set:Nn \l_siunitx_font_family_tl { sf } }
\int_compare:nNnT { \fam } = { \c_siunitx_mathtt_int }
{ \tl_set:Nn \l_siunitx_font_family_tl { tt } }
}
-\cs_new_protected_nopar:Npn \siunitx_detect_font_family_text: {
+\cs_new_protected:Npn \siunitx_detect_font_family_text: {
\tl_if_eq:NNT \f@family \c_siunitx_textsf_tl
{ \tl_set:Nn \l_siunitx_font_family_tl { sf } }
\tl_if_eq:NNT \f@family \c_siunitx_texttt_tl
{ \tl_set:Nn \l_siunitx_font_family_tl { tt } }
}
-\cs_new_protected_nopar:Npn \siunitx_detect_font_shape: {
+\cs_new_protected:Npn \siunitx_detect_font_shape: {
\str_if_eq:VnT \f@shape { it }
- { \cs_set_nopar:Npn \siunitx_font_shape: { \itshape } }
+ { \cs_set:Npn \siunitx_font_shape: { \itshape } }
\str_if_eq:VnT \f@shape { sl }
- { \cs_set_nopar:Npn \siunitx_font_shape: { \slshape } }
+ { \cs_set:Npn \siunitx_font_shape: { \slshape } }
}
-\cs_new_protected_nopar:Npn \siunitx_detect_font_mode: {
+\cs_new_protected:Npn \siunitx_detect_font_mode: {
\mode_if_math:F
{
\bool_set_false:N \l_siunitx_font_math_mode_bool
@@ -589,54 +573,54 @@
\cs_new:Npn \siunitx_number_mathrm:n #1 { }
\cs_new:Npn \siunitx_number_mathsf:n #1 { }
\cs_new:Npn \siunitx_number_mathtt:n #1 { }
-\cs_new_nopar:Npn \siunitx_number_textrm: { }
-\cs_new_nopar:Npn \siunitx_number_textsf: { }
-\cs_new_nopar:Npn \siunitx_number_texttt: { }
+\cs_new:Npn \siunitx_number_textrm: { }
+\cs_new:Npn \siunitx_number_textsf: { }
+\cs_new:Npn \siunitx_number_texttt: { }
\keys_define:nn { siunitx } {
number-color .tl_set:N = \l_siunitx_number_color_tl,
number-math-rm .code:n =
- { \cs_set_nopar:Npn \siunitx_number_mathrm:n ##1 { #1 {##1} } },
+ { \cs_set:Npn \siunitx_number_mathrm:n ##1 { #1 {##1} } },
number-math-sf .code:n =
- { \cs_set_nopar:Npn \siunitx_number_mathsf:n ##1 { #1 {##1} } },
+ { \cs_set:Npn \siunitx_number_mathsf:n ##1 { #1 {##1} } },
number-math-tt .code:n =
- { \cs_set_nopar:Npn \siunitx_number_mathtt:n ##1 { #1 {##1} } },
+ { \cs_set:Npn \siunitx_number_mathtt:n ##1 { #1 {##1} } },
number-mode .choice:,
number-mode / math .code:n =
{ \bool_set_true:N \l_siunitx_number_math_mode_bool },
number-mode / text .code:n =
{ \bool_set_false:N \l_siunitx_number_math_mode_bool },
number-text-rm .code:n =
- { \cs_set_nopar:Npn \siunitx_number_textrm: {#1} },
+ { \cs_set:Npn \siunitx_number_textrm: {#1} },
number-text-sf .code:n =
- { \cs_set_nopar:Npn \siunitx_number_textsf: {#1} },
+ { \cs_set:Npn \siunitx_number_textsf: {#1} },
number-text-tt .code:n =
- { \cs_set_nopar:Npn \siunitx_number_texttt: {#1} }
-}
-\cs_new_nopar:Npn \siunitx_unit_mathrm: { }
-\cs_new_nopar:Npn \siunitx_unit_mathsf: { }
-\cs_new_nopar:Npn \siunitx_unit_mathtt: { }
-\cs_new_nopar:Npn \siunitx_unit_textrm: { }
-\cs_new_nopar:Npn \siunitx_unit_textsf: { }
-\cs_new_nopar:Npn \siunitx_unit_texttt: { }
+ { \cs_set:Npn \siunitx_number_texttt: {#1} }
+}
+\cs_new:Npn \siunitx_unit_mathrm: { }
+\cs_new:Npn \siunitx_unit_mathsf: { }
+\cs_new:Npn \siunitx_unit_mathtt: { }
+\cs_new:Npn \siunitx_unit_textrm: { }
+\cs_new:Npn \siunitx_unit_textsf: { }
+\cs_new:Npn \siunitx_unit_texttt: { }
\keys_define:nn { siunitx } {
unit-color .tl_set:N = \l_siunitx_unit_color_tl,
unit-math-rm .code:n =
- { \cs_set_nopar:Npn \siunitx_unit_mathrm:n ##1 { #1 {##1} } },
+ { \cs_set:Npn \siunitx_unit_mathrm:n ##1 { #1 {##1} } },
unit-math-sf .code:n =
- { \cs_set_nopar:Npn \siunitx_unit_mathsf:n ##1 { #1 {##1} } },
+ { \cs_set:Npn \siunitx_unit_mathsf:n ##1 { #1 {##1} } },
unit-math-tt .code:n =
- { \cs_set_nopar:Npn \siunitx_unit_mathtt:n ##1 { #1 {##1} } },
+ { \cs_set:Npn \siunitx_unit_mathtt:n ##1 { #1 {##1} } },
unit-mode .choice:,
unit-mode / math .code:n =
{ \bool_set_true:N \l_siunitx_unit_math_mode_bool },
unit-mode / text .code:n =
{ \bool_set_false:N \l_siunitx_unit_math_mode_bool },
unit-text-rm .code:n =
- { \cs_set_nopar:Npn \siunitx_unit_textrm: {#1} },
+ { \cs_set:Npn \siunitx_unit_textrm: {#1} },
unit-text-sf .code:n =
- { \cs_set_nopar:Npn \siunitx_unit_textsf: {#1} },
+ { \cs_set:Npn \siunitx_unit_textsf: {#1} },
unit-text-tt .code:n =
- { \cs_set_nopar:Npn \siunitx_unit_texttt: {#1} }
+ { \cs_set:Npn \siunitx_unit_texttt: {#1} }
}
\keys_define:nn { siunitx } {
color .meta:n =
@@ -734,7 +718,7 @@
\group_end:
}
\cs_generate_variant:Nn \siunitx_print:nn { nV }
-\cs_new_protected_nopar:Npn \siunitx_print_aux: {
+\cs_new_protected:Npn \siunitx_print_aux: {
\text
{
\siunitx_print_color:
@@ -750,7 +734,7 @@
{ \siunitx_print_text: }
}
}
-\cs_new_protected_nopar:Npn \siunitx_print_color: {
+\cs_new_protected:Npn \siunitx_print_color: {
\tl_if_empty:cF { l_siunitx_ \l_siunitx_print_type_tl _color_tl }
{
\color
@@ -774,7 +758,7 @@
\char_set_catcode_active:N \!
\tl_to_lowercase:n {
\group_end:
- \cs_set_protected_nopar:Npn \siunitx_print_math:
+ \cs_set_protected:Npn \siunitx_print_math:
{
\cs_set_eq:NN \PrintSubscript @
\cs_set_eq:NN \PrintSuperscript ^
@@ -788,8 +772,10 @@
{ \l_siunitx_print_arg_tl }
}
}
- \cs_set_protected_nopar:Npn \siunitx_print_text:
+ \cs_set_protected:Npn \siunitx_print_text:
{
+ \tl_replace_all:Nnn \l_siunitx_print_arg_tl { - }
+ { \c_siunitx_minus_tl }
\cs_set_eq:NN \PrintSubscript \siunitx_print_text_sub:n
\cs_set_eq:NN \PrintSuperscript \siunitx_print_text_super:n
\tl_replace_all:Nnn \l_siunitx_print_arg_tl { @ }
@@ -817,13 +803,13 @@
}
}
\cs_set_eq:NN \l_peek_search_token \siunitx_print_text_super:n
- \cs_set_nopar:Npn \peek_true:w
+ \cs_set:Npn \peek_true:w
{
\tex_afterassignment:D \peek_true_aux:w
\cs_set_eq:NN \peek_tmp:w
}
- \cs_set_nopar:Npn \peek_true_aux:w { \siunitx_print_text_sub_super:n }
- \cs_set_nopar:Npn \peek_false:w { \ensuremath { @ { \text {#1} } } }
+ \cs_set:Npn \peek_true_aux:w { \siunitx_print_text_sub_super:n }
+ \cs_set:Npn \peek_false:w { \ensuremath { @ { \text {#1} } } }
\peek_after:Nw \peek_execute_branches_meaning:
}
}
@@ -862,11 +848,11 @@
{ \siunitx_number_preprocess_quotient: }
}
\cs_generate_variant:Nn \siunitx_number_preprocess:n { V }
-\cs_new_protected_nopar:Npn \siunitx_number_preprocess_init: {
+\cs_new_protected:Npn \siunitx_number_preprocess_init: {
\bool_set_false:N \l_siunitx_error_bool
\tl_clear:N \l_siunitx_number_multi_tl
}
-\cs_new_protected_nopar:Npn \siunitx_number_preprocess_product: {
+\cs_new_protected:Npn \siunitx_number_preprocess_product: {
\tl_map_function:NN \l_siunitx_input_product_tl
\siunitx_number_preprocess_product_aux:N
}
@@ -887,7 +873,7 @@
\tl_map_break:
}
}
-\cs_new_protected_nopar:Npn \siunitx_number_preprocess_quotient: {
+\cs_new_protected:Npn \siunitx_number_preprocess_quotient: {
\tl_map_function:NN \l_siunitx_input_quotient_tl
\siunitx_number_preprocess_quotient_aux:N
}
@@ -1013,7 +999,7 @@
}
\siunitx_number_in_check:n {#1}
}
-\cs_new_protected_nopar:Npn \siunitx_number_in_init: {
+\cs_new_protected:Npn \siunitx_number_in_init: {
\cs_set_eq:NN \siunitx_number_in_parse_loop:N
\siunitx_number_in_parse_mantissa:N
\cs_set_eq:NN \siunitx_number_in_check:n
@@ -1027,7 +1013,7 @@
\bool_set_false:N \l_siunitx_number_in_uncert_bool
\siunitx_number_in_init_part:n { mantissa }
}
-\cs_new_protected_nopar:Npn \siunitx_number_in_init_part:n #1 {
+\cs_new_protected:Npn \siunitx_number_in_init_part:n #1 {
\bool_set_false:N \l_siunitx_number_in_decimal_bool
\bool_set_true:N \l_siunitx_number_in_first_bool
\bool_set_false:N \l_siunitx_number_in_sign_bool
@@ -1040,14 +1026,14 @@
\tl_set:Nn \l_siunitx_number_part_sign_tl { #1 -sign }
\tl_set:Nn \l_siunitx_number_part_uncert_tl { #1 -uncertainty }
}
-\cs_new_protected_nopar:Npn \siunitx_number_in_protect: {
+\cs_new_protected:Npn \siunitx_number_in_protect: {
\tl_map_function:NN \l_siunitx_input_protect_tl
\siunitx_number_in_protect_aux:N
}
\cs_new_protected:Npn \siunitx_number_in_protect_aux:N #1 {
\cs_set_eq:NN #1 \scan_stop:
}
-\cs_new_protected_nopar:Npn \siunitx_number_in_sign_replace:N #1 {
+\cs_new_protected:Npn \siunitx_number_in_sign_replace:N #1 {
\tl_replace_all:Nnn #1 { -+ } { \mp }
\tl_replace_all:Nnn #1 { +- } { \pm }
\tl_replace_all:Nnn #1 { << } { \ll }
@@ -1331,7 +1317,7 @@
{ \prop_del:Nn \l_siunitx_number_in_prop { mantissa } }
}
}
-\cs_new_protected_nopar:Npn \siunitx_number_in_complex_aux:nn #1#2 {
+\cs_new_protected:Npn \siunitx_number_in_complex_aux:nn #1#2 {
\prop_get:NnNT \l_siunitx_number_in_prop {#1} \l_siunitx_tmpa_tl
{
\prop_del:Nn \l_siunitx_number_in_prop {#1}
@@ -1466,7 +1452,7 @@
\siunitx_number_in_parse_uncert_after:N
}
}
-\cs_new_protected_nopar:Npn \siunitx_number_in_store: {
+\cs_new_protected:Npn \siunitx_number_in_store: {
\prop_put:NVn \l_siunitx_number_in_prop \l_siunitx_number_part_tl
{ true }
\bool_if:NTF \l_siunitx_number_in_decimal_bool
@@ -1480,8 +1466,8 @@
}
\tl_clear:N \l_siunitx_number_parsed_tl
}
-\cs_new_protected_nopar:Npn \siunitx_number_in_check:n #1 { }
-\cs_new_protected_nopar:Npn \siunitx_number_in_check_short:n #1 {
+\cs_new_protected:Npn \siunitx_number_in_check:n #1 { }
+\cs_new_protected:Npn \siunitx_number_in_check_short:n #1 {
\prop_if_in:NVF \l_siunitx_number_in_prop
\l_siunitx_number_part_integer_tl
{
@@ -1507,7 +1493,7 @@
}
}
}
-\cs_new_protected_nopar:Npn \siunitx_number_in_check_full:n #1 {
+\cs_new_protected:Npn \siunitx_number_in_check_full:n #1 {
\tl_if_eq:NNF \l_siunitx_number_part_tl
\c_siunitx_number_part_complex_tl
{ \siunitx_number_in_check_short:n {#1} }
@@ -1540,7 +1526,7 @@
}
}
}
-\cs_new_protected_nopar:Npn \siunitx_number_in_complex_to_uncert:n #1 {
+\cs_new_protected:Npn \siunitx_number_in_complex_to_uncert:n #1 {
\prop_del:Nn \l_siunitx_number_in_prop { complex }
\prop_del:Nn \l_siunitx_number_in_prop { complex-decimal-marker }
\prop_del:Nn \l_siunitx_number_in_prop { complex-sign }
@@ -1561,7 +1547,7 @@
\prop_del:Nn \l_siunitx_number_in_prop { complex-integer }
\prop_del:Nn \l_siunitx_number_in_prop { complex-decimal }
}
-\cs_new_protected_nopar:Npn \siunitx_number_in_complex_to_uncert_int: {
+\cs_new_protected:Npn \siunitx_number_in_complex_to_uncert_int: {
\prop_get:NnNF \l_siunitx_number_in_prop { complex-decimal }
\l_siunitx_tmpa_tl
{ \tl_clear:N \l_siunitx_tmpa_tl }
@@ -1570,7 +1556,7 @@
{ \tl_clear:N \l_siunitx_tmpb_tl }
\siunitx_number_in_complex_to_uncert_pad:
}
-\cs_new_protected_nopar:Npn \siunitx_number_in_complex_to_uncert_dec:n
+\cs_new_protected:Npn \siunitx_number_in_complex_to_uncert_dec:n
#1
{
\tl_clear:N \l_siunitx_number_uncert_tl
@@ -1589,7 +1575,7 @@
{ \siunitx_error:nx { misplaced-sign-token } { \exp_not:n {#1} } }
}
-\cs_new_protected_nopar:Npn
+\cs_new_protected:Npn
\siunitx_number_in_complex_to_uncert_dec_loop:N #1
{
\str_if_eq:nnTF {#1} { 0 }
@@ -1604,7 +1590,7 @@
}
{ \tl_map_break: }
}
-\cs_new_protected_nopar:Npn \siunitx_number_in_complex_to_uncert_pad:
+\cs_new_protected:Npn \siunitx_number_in_complex_to_uncert_pad:
{
\int_set:Nn \l_siunitx_number_uncert_length_int
{ \tl_length:N \l_siunitx_tmpa_tl }
@@ -1660,8 +1646,11 @@
\bool_new:N \l_siunitx_round_bool
\tl_new:N \l_siunitx_round_decimal_in_tl
\tl_new:N \l_siunitx_round_decimal_out_tl
+\tl_new:N \l_siunitx_round_discard_tl
+\tl_new:N \l_siunitx_round_even_bool
\tl_new:N \l_siunitx_round_integer_in_tl
\tl_new:N \l_siunitx_round_integer_out_tl
+\bool_new:N \l_siunitx_round_half_up_bool
\int_new:N \l_siunitx_process_decimal_int
\int_new:N \l_siunitx_process_uncertainty_int
\tl_new:N \l_siunitx_uncertainty_decimal_tl
@@ -1669,84 +1658,104 @@
\bool_new:N \l_siunitx_process_fixed_bool
\bool_new:N \l_siunitx_process_engineering_bool
\bool_new:N \l_siunitx_process_scientific_bool
-\keys_define:nn { siunitx } {
- add-decimal-zero .bool_set:N = \l_siunitx_process_decimal_zero_bool,
- add-integer-zero .bool_set:N = \l_siunitx_process_integer_zero_bool,
- explicit-sign .tl_set:N = \l_siunitx_process_sign_tl,
- fixed-exponent .int_set:N = \l_siunitx_process_fixed_int,
- minimum-integer-digits .int_set:N =
- \l_siunitx_process_integer_min_int,
- retain-explicit-plus .bool_set:N = \l_siunitx_process_plus_tl,
- retain-unity-mantissa .bool_set:N =
- \l_siunitx_process_unity_mantissa_bool,
- retain-zero-exponent .bool_set:N =
- \l_siunitx_process_zero_exponent_bool,
- round-integer-to-decimal .bool_set:N =
- \l_siunitx_process_int_to_dec_bool,
- round-minimum .tl_set:N = \l_siunitx_process_round_min_tl,
- round-mode .choice: ,
- round-mode / figures .code:n =
- { \tl_set:Nn \l_siunitx_round_tl { figures } },
- round-mode / off .code:n = { \tl_clear:N \l_siunitx_round_tl },
- round-mode / places .code:n =
- { \tl_set:Nn \l_siunitx_round_tl { places } },
- round-precision .int_set:N = \l_siunitx_process_precision_int,
- scientific-notation .choice: ,
- scientific-notation
- / false .code:n =
- {
- \bool_set_false:N \l_siunitx_process_fixed_bool
- \bool_set_false:N \l_siunitx_process_engineering_bool
- \bool_set_false:N \l_siunitx_process_scientific_bool
- },
- scientific-notation
- / engineering .code:n =
- {
- \bool_set_false:N \l_siunitx_process_fixed_bool
- \bool_set_true:N \l_siunitx_process_engineering_bool
- \bool_set_true:N \l_siunitx_process_scientific_bool
- },
- scientific-notation
- / fixed .code:n =
- {
- \bool_set_true:N \l_siunitx_process_fixed_bool
- \bool_set_false:N \l_siunitx_process_engineering_bool
- \bool_set_false:N \l_siunitx_process_scientific_bool
- },
- scientific-notation
- / true .code:n =
- {
- \bool_set_false:N \l_siunitx_process_fixed_bool
- \bool_set_false:N \l_siunitx_process_engineering_bool
- \bool_set_true:N \l_siunitx_process_scientific_bool
- },
-}
-\keys_set:nn { siunitx } {
- add-decimal-zero = true,
- add-integer-zero = true,
- retain-unity-mantissa = true,
- round-precision = 2,
-}
-\cs_new_protected_nopar:Npn \siunitx_number_process: {
- \siunitx_number_process_sign:
- \siunitx_number_process_zero_fill:
- \siunitx_number_process_mantissa:
- \prop_if_in:NnF \l_siunitx_number_in_prop { symbolic }
- {
- \siunitx_number_process_exponent:
- \bool_if:NTF \l_siunitx_process_fixed_bool
- { \siunitx_number_process_fixed: }
- {
- \bool_if:NT \l_siunitx_process_scientific_bool
- { \siunitx_number_process_scientific: }
- }
- \siunitx_number_process_uncertainty:
- \prop_if_in:NnF \l_siunitx_number_in_prop { uncertainty }
- { \siunitx_number_process_round: }
- }
- \siunitx_number_process_integer_digits:
-}
-\cs_new_protected_nopar:Npn \siunitx_number_process_exponent: {
+\bool_new:N \l_siunitx_process_drop_exponent_bool
+\keys_define:nn { siunitx }
+ {
+ add-decimal-zero .bool_set:N = \l_siunitx_process_decimal_zero_bool,
+ add-integer-zero .bool_set:N = \l_siunitx_process_integer_zero_bool,
+ explicit-sign .tl_set:N = \l_siunitx_process_sign_tl,
+ fixed-exponent .int_set:N = \l_siunitx_process_fixed_int,
+ minimum-integer-digits .int_set:N =
+ \l_siunitx_process_integer_min_int,
+ retain-explicit-plus .bool_set:N = \l_siunitx_process_plus_tl,
+ retain-unity-mantissa .bool_set:N =
+ \l_siunitx_process_unity_mantissa_bool,
+ retain-zero-exponent .bool_set:N =
+ \l_siunitx_process_zero_exponent_bool,
+ round-half .choice:,
+ round-half / even .code:n =
+ { \bool_set_false:N \l_siunitx_round_half_up_bool },
+ round-half / up .code:n =
+ { \bool_set_true:N \l_siunitx_round_half_up_bool },
+ round-integer-to-decimal .bool_set:N =
+ \l_siunitx_process_int_to_dec_bool,
+ round-minimum .tl_set:N = \l_siunitx_process_round_min_tl,
+ round-mode .choice: ,
+ round-mode / figures .code:n =
+ { \tl_set:Nn \l_siunitx_round_tl { figures } },
+ round-mode / off .code:n = { \tl_clear:N \l_siunitx_round_tl },
+ round-mode / places .code:n =
+ { \tl_set:Nn \l_siunitx_round_tl { places } },
+ round-precision .int_set:N = \l_siunitx_process_precision_int,
+ scientific-notation .choice: ,
+ scientific-notation
+ / false .code:n =
+ {
+ \bool_set_false:N \l_siunitx_process_fixed_bool
+ \bool_set_false:N \l_siunitx_process_engineering_bool
+ \bool_set_false:N \l_siunitx_process_scientific_bool
+ },
+ scientific-notation
+ / engineering .code:n =
+ {
+ \bool_set_false:N \l_siunitx_process_fixed_bool
+ \bool_set_true:N \l_siunitx_process_engineering_bool
+ \bool_set_true:N \l_siunitx_process_scientific_bool
+ },
+ scientific-notation
+ / fixed .code:n =
+ {
+ \bool_set_true:N \l_siunitx_process_fixed_bool
+ \bool_set_false:N \l_siunitx_process_engineering_bool
+ \bool_set_false:N \l_siunitx_process_scientific_bool
+ },
+ scientific-notation
+ / true .code:n =
+ {
+ \bool_set_false:N \l_siunitx_process_fixed_bool
+ \bool_set_false:N \l_siunitx_process_engineering_bool
+ \bool_set_true:N \l_siunitx_process_scientific_bool
+ }
+ }
+\keys_set:nn { siunitx }
+ {
+ add-decimal-zero = true,
+ add-integer-zero = true,
+ retain-unity-mantissa = true,
+ round-half = up,
+ round-precision = 2
+ }
+\cs_new_protected:Npn \siunitx_number_process:
+ {
+ \siunitx_number_process_sign:
+ \siunitx_number_process_zero_fill:
+ \siunitx_number_process_mantissa:
+ \prop_if_in:NnF \l_siunitx_number_in_prop { symbolic }
+ {
+ \siunitx_number_process_exponent:
+ \bool_if:NTF \l_siunitx_process_fixed_bool
+ { \siunitx_number_process_fixed: }
+ {
+ \bool_if:NT \l_siunitx_process_scientific_bool
+ { \siunitx_number_process_scientific: }
+ }
+ \siunitx_number_process_uncertainty:
+ \bool_if:NT \l_siunitx_exp_to_prefix_bool
+ {
+ \tl_if_empty:NF \l_siunitx_unit_tl
+ { \siunitx_number_exp_to_prefix: }
+ }
+ \prop_if_in:NnF \l_siunitx_number_in_prop { uncertainty }
+ { \siunitx_number_process_round: }
+ }
+ \siunitx_number_process_integer_digits:
+ \bool_if:NT \l_siunitx_process_drop_exponent_bool
+ {
+ \prop_del:Nn \l_siunitx_number_in_prop { exponent }
+ \prop_del:Nn \l_siunitx_number_in_prop { exponent-integer }
+ }
+ }
+\cs_new_protected:Npn \siunitx_number_process_exponent: {
\bool_if:NF \l_siunitx_process_zero_exponent_bool
{
\prop_if_in:NnT \l_siunitx_number_in_prop { exponent }
@@ -1766,7 +1775,7 @@
}
}
}
-\cs_new_protected_nopar:Npn \siunitx_number_process_exponent_aux:n #1 {
+\cs_new_protected:Npn \siunitx_number_process_exponent_aux:n #1 {
\prop_get:NnNT \l_siunitx_number_in_prop { exponent- #1 }
\l_siunitx_tmpa_tl
{
@@ -1774,142 +1783,144 @@
{ \bool_set_true:N \l_siunitx_tmp_bool }
}
}
-\cs_new_protected_nopar:Npn \siunitx_number_process_figures:n #1 {
- \int_compare:nNnTF { \l_siunitx_process_precision_int } > { 0 }
- {
- \prop_if_in:NnT \l_siunitx_number_in_prop {#1}
- { \siunitx_number_process_figures_aux:n {#1} }
- }
- {
- \prop_del:Nn \l_siunitx_number_in_prop { #1 -sign }
- \prop_put:Nnn \l_siunitx_number_in_prop { #1 -integer } { 0 }
- \prop_del:Nn \l_siunitx_number_in_prop { #1 -decimal }
- \bool_if:NF \l_siunitx_process_int_to_dec_bool
- {
- \prop_del:Nn \l_siunitx_number_in_prop { #1 -decimal-marker }
- }
- }
-}
-\cs_new_protected_nopar:Npn \siunitx_number_process_figures_aux:n #1 {
- \siunitx_number_process_figures_init:n {#1}
- \siunitx_number_process_figures_count:n { integer }
- \siunitx_number_process_figures_count:n { decimal }
- \bool_if:NTF \l_siunitx_round_bool
- {
- \bool_set_false:N \l_siunitx_round_bool
- \int_compare:nNnTF
- { \l_siunitx_round_int } >
- { \l_siunitx_process_precision_int }
- {
- \siunitx_number_process_figures_round:
- \siunitx_number_process_round_tidy:n {#1}
- }
- { \siunitx_number_process_figures_pad:n {#1} }
- }
- {
- \prop_put:Nnn \l_siunitx_number_in_prop { #1 -integer } { 0 }
- \prop_del:Nn \l_siunitx_number_in_prop { #1 -decimal }
- }
-}
-\cs_new_protected_nopar:Npn \siunitx_number_process_figures_init:n #1 {
- \int_zero:N \l_siunitx_round_int
- \bool_set_false:N \l_siunitx_round_bool
- \prop_get:NnNF \l_siunitx_number_in_prop { #1 -decimal }
- \l_siunitx_round_decimal_in_tl
- { \tl_clear:N \l_siunitx_round_decimal_in_tl }
- \prop_get:NnNF \l_siunitx_number_in_prop { #1 -integer }
- \l_siunitx_round_integer_in_tl
- { \tl_clear:N \l_siunitx_round_integer_in_tl }
- \tl_clear:N \l_siunitx_round_decimal_out_tl
- \tl_clear:N \l_siunitx_round_integer_out_tl
-}
-\cs_new_protected_nopar:Npn
- \siunitx_number_process_figures_count:n #1 {
- \tl_if_empty:cF { l_siunitx_round_ #1 _in_tl }
- {
- \prop_if_in:NnF \l_siunitx_number_in_prop { #1 -uncertainty }
- { \siunitx_number_process_figures_count_aux:n {#1} }
- }
-}
-\cs_new_protected_nopar:Npn
- \siunitx_number_process_figures_count_aux:n #1 {
- \int_set:Nn \l_siunitx_tmp_int
- { \tl_head:v { l_siunitx_round_ #1 _in_tl } }
- \tl_set:cx { l_siunitx_round_ #1 _in_tl }
- { \tl_tail:v { l_siunitx_round_ #1 _in_tl } }
- \tl_put_left:cV { l_siunitx_round_ #1 _out_tl } \l_siunitx_tmp_int
- \bool_if:NF \l_siunitx_round_bool
- {
- \int_compare:nNnF { \l_siunitx_tmp_int } = { 0 }
- { \bool_set_true:N \l_siunitx_round_bool }
- }
- \bool_if:NT \l_siunitx_round_bool
- { \int_incr:N \l_siunitx_round_int }
- \tl_if_empty:cTF { l_siunitx_round_ #1 _in_tl }
- {
- \tl_set_eq:cc { l_siunitx_round_ #1 _in_tl }
- { l_siunitx_round_ #1 _out_tl }
- \tl_clear:c { l_siunitx_round_ #1 _out_tl }
- }
- { \siunitx_number_process_figures_count_aux:n {#1} }
-}
-\cs_new_protected_nopar:Npn \siunitx_number_process_figures_round: {
- \int_set:Nn \l_siunitx_round_int
- { \l_siunitx_round_int - \l_siunitx_process_precision_int }
- \tl_if_empty:NF \l_siunitx_round_decimal_in_tl
- { \siunitx_number_process_figures_round_loop: }
- \tl_if_empty:NF \l_siunitx_round_integer_in_tl
- { \siunitx_number_process_figures_integer: }
- \bool_if:NT \l_siunitx_round_bool
- {
- \tl_put_left:Nn \l_siunitx_round_integer_out_tl { 1 }
- \tl_if_empty:NF \l_siunitx_round_decimal_out_tl
- {
- \tl_reverse:N \l_siunitx_round_decimal_out_tl
- \tl_set:Nx \l_siunitx_round_decimal_out_tl
- { \tl_tail:n \l_siunitx_round_decimal_out_tl }
- \tl_reverse:N \l_siunitx_round_decimal_out_tl
- }
- }
-}
-\cs_new_protected_nopar:Npn
- \siunitx_number_process_figures_round_loop: {
- \siunitx_number_process_round_decimal:
- \tl_if_empty:NF \l_siunitx_round_decimal_in_tl
- { \siunitx_number_process_figures_round_loop: }
-}
-\cs_new_protected_nopar:Npn \siunitx_number_process_figures_integer: {
- \int_compare:nNnT { \l_siunitx_round_int } > { 0 }
- { \tl_put_left:Nn \l_siunitx_round_integer_out_tl { 0 } }
- \int_compare:nNnF { \l_siunitx_round_int } > { 1 }
- {
- \int_set:Nn \l_siunitx_tmp_int
- { \tl_head:V \l_siunitx_round_integer_in_tl }
- \bool_if:NT \l_siunitx_round_bool
- { \int_incr:N \l_siunitx_tmp_int }
- \bool_set_false:N \l_siunitx_round_bool
- \int_compare:nNnTF { \l_siunitx_round_int } = { 1 }
- {
- \int_compare:nNnT { \l_siunitx_tmp_int } > { 4 }
- { \bool_set_true:N \l_siunitx_round_bool }
- }
- {
- \int_compare:nNnT { \l_siunitx_tmp_int } = { 10 }
- {
- \bool_set_true:N \l_siunitx_round_bool
- \int_zero:N \l_siunitx_tmp_int
- }
- \tl_put_left:NV \l_siunitx_round_integer_out_tl
- \l_siunitx_tmp_int
- }
- }
- \int_decr:N \l_siunitx_round_int
- \tl_set:Nx \l_siunitx_round_integer_in_tl
- { \tl_tail:V \l_siunitx_round_integer_in_tl }
- \tl_if_empty:NF \l_siunitx_round_integer_in_tl
- { \siunitx_number_process_figures_integer: }
-}
-\cs_new_protected_nopar:Npn \siunitx_number_process_figures_pad:n #1 {
+\cs_new_protected:Npn \siunitx_number_process_figures:n #1
+ {
+ \int_compare:nNnTF \l_siunitx_process_precision_int > \c_zero
+ {
+ \prop_if_in:NnT \l_siunitx_number_in_prop {#1}
+ { \siunitx_number_process_figures_aux:n {#1} }
+ }
+ {
+ \prop_del:Nn \l_siunitx_number_in_prop { #1 -sign }
+ \prop_put:Nnn \l_siunitx_number_in_prop { #1 -integer } { 0 }
+ \prop_del:Nn \l_siunitx_number_in_prop { #1 -decimal }
+ \bool_if:NF \l_siunitx_process_int_to_dec_bool
+ { \prop_del:Nn \l_siunitx_number_in_prop { #1 -decimal-marker } }
+ }
+ }
+\cs_new_protected:Npn \siunitx_number_process_figures_aux:n #1
+ {
+ \siunitx_number_process_figures_init:n {#1}
+ \siunitx_number_process_figures_count:n { integer }
+ \siunitx_number_process_figures_count:n { decimal }
+ \bool_if:NTF \l_siunitx_round_bool
+ {
+ \bool_set_false:N \l_siunitx_round_bool
+ \int_compare:nNnTF
+ \l_siunitx_round_int > \l_siunitx_process_precision_int
+ {
+ \siunitx_number_process_figures_round:
+ \siunitx_number_process_round_tidy:n {#1}
+ }
+ { \siunitx_number_process_figures_pad:n {#1} }
+ }
+ {
+ \prop_put:Nnn \l_siunitx_number_in_prop { #1 -integer } { 0 }
+ \prop_del:Nn \l_siunitx_number_in_prop { #1 -decimal }
+ }
+ }
+\cs_new_protected:Npn \siunitx_number_process_figures_init:n #1
+ {
+ \int_zero:N \l_siunitx_round_int
+ \bool_set_false:N \l_siunitx_round_bool
+ \bool_set_false:N \l_siunitx_round_even_bool
+ \prop_get:NnNF \l_siunitx_number_in_prop { #1 -decimal }
+ \l_siunitx_round_decimal_in_tl
+ { \tl_clear:N \l_siunitx_round_decimal_in_tl }
+ \prop_get:NnNF \l_siunitx_number_in_prop { #1 -integer }
+ \l_siunitx_round_integer_in_tl
+ { \tl_clear:N \l_siunitx_round_integer_in_tl }
+ \tl_clear:N \l_siunitx_round_decimal_out_tl
+ \tl_clear:N \l_siunitx_round_integer_out_tl
+ \tl_clear:N \l_siunitx_round_discard_tl
+ }
+\cs_new_protected:Npn \siunitx_number_process_figures_count:n #1
+ {
+ \tl_if_empty:cF { l_siunitx_round_ #1 _in_tl }
+ {
+ \prop_if_in:NnF \l_siunitx_number_in_prop { #1 -uncertainty }
+ { \siunitx_number_process_figures_count_aux:n {#1} }
+ }
+ }
+\cs_new_protected:Npn \siunitx_number_process_figures_count_aux:n #1
+ {
+ \int_set:Nn \l_siunitx_tmp_int
+ { \tl_head:v { l_siunitx_round_ #1 _in_tl } }
+ \tl_set:cx { l_siunitx_round_ #1 _in_tl }
+ { \tl_tail:v { l_siunitx_round_ #1 _in_tl } }
+ \tl_put_left:cV { l_siunitx_round_ #1 _out_tl } \l_siunitx_tmp_int
+ \bool_if:NF \l_siunitx_round_bool
+ {
+ \int_compare:nNnF { \l_siunitx_tmp_int } = \c_zero
+ { \bool_set_true:N \l_siunitx_round_bool }
+ }
+ \bool_if:NT \l_siunitx_round_bool
+ { \int_incr:N \l_siunitx_round_int }
+ \tl_if_empty:cTF { l_siunitx_round_ #1 _in_tl }
+ {
+ \tl_set_eq:cc { l_siunitx_round_ #1 _in_tl }
+ { l_siunitx_round_ #1 _out_tl }
+ \tl_clear:c { l_siunitx_round_ #1 _out_tl }
+ }
+ { \siunitx_number_process_figures_count_aux:n {#1} }
+ }
+\cs_new_protected:Npn \siunitx_number_process_figures_round:
+ {
+ \int_set:Nn \l_siunitx_round_int
+ { \l_siunitx_round_int - \l_siunitx_process_precision_int }
+ \tl_if_empty:NF \l_siunitx_round_decimal_in_tl
+ { \siunitx_number_process_figures_round_loop: }
+ \tl_if_empty:NF \l_siunitx_round_integer_in_tl
+ { \siunitx_number_process_figures_integer: }
+ \bool_if:NT \l_siunitx_round_bool
+ {
+ \tl_put_left:Nn \l_siunitx_round_integer_out_tl { 1 }
+ \tl_if_empty:NF \l_siunitx_round_decimal_out_tl
+ {
+ \tl_reverse:N \l_siunitx_round_decimal_out_tl
+ \tl_set:Nx \l_siunitx_round_decimal_out_tl
+ { \tl_tail:n \l_siunitx_round_decimal_out_tl }
+ \tl_reverse:N \l_siunitx_round_decimal_out_tl
+ }
+ }
+ }
+\cs_new_protected:Npn \siunitx_number_process_figures_round_loop:
+ {
+ \siunitx_number_process_round_decimal:
+ \tl_if_empty:NF \l_siunitx_round_decimal_in_tl
+ { \siunitx_number_process_figures_round_loop: }
+ }
+\cs_new_protected:Npn \siunitx_number_process_figures_integer:
+ {
+ \int_compare:nNnT \l_siunitx_round_int > \c_zero
+ { \tl_put_left:Nn \l_siunitx_round_integer_out_tl { 0 } }
+ \int_compare:nNnF \l_siunitx_round_int > \c_one
+ {
+ \int_set:Nn \l_siunitx_tmp_int
+ { \tl_head:V \l_siunitx_round_integer_in_tl }
+ \siunitx_number_process_round_up:
+ \int_compare:nNnTF \l_siunitx_round_int = \c_one
+ {
+ \int_compare:nNnT \l_siunitx_tmp_int > \c_four
+ { \bool_set_true:N \l_siunitx_round_bool }
+ }
+ {
+ \int_compare:nNnT \l_siunitx_tmp_int = \c_ten
+ {
+ \bool_set_true:N \l_siunitx_round_bool
+ \int_zero:N \l_siunitx_tmp_int
+ }
+ \tl_put_left:NV \l_siunitx_round_integer_out_tl
+ \l_siunitx_tmp_int
+ }
+ }
+ \int_decr:N \l_siunitx_round_int
+ \tl_set:Nx \l_siunitx_round_integer_in_tl
+ { \tl_tail:V \l_siunitx_round_integer_in_tl }
+ \tl_if_empty:NF \l_siunitx_round_integer_in_tl
+ { \siunitx_number_process_figures_integer: }
+ }
+\cs_new_protected:Npn \siunitx_number_process_figures_pad:n #1 {
\prop_get:NnN \l_siunitx_number_in_prop { #1 -integer }
\l_siunitx_round_integer_in_tl
\prop_get:NnN \l_siunitx_number_in_prop { #1 -decimal }
@@ -1918,7 +1929,7 @@
{ \l_siunitx_process_precision_int - \l_siunitx_round_int }
\siunitx_number_process_pad:n {#1}
}
-\cs_new_protected_nopar:Npn \siunitx_number_process_fixed: {
+\cs_new_protected:Npn \siunitx_number_process_fixed: {
\prop_if_in:NnF \l_siunitx_number_in_prop { complex }
{
\prop_get:NnNF \l_siunitx_number_in_prop { mantissa-integer }
@@ -1946,7 +1957,7 @@
\l_siunitx_tmpa_tl
}
}
-\cs_new_protected_nopar:Npn
+\cs_new_protected:Npn
\siunitx_number_process_fixed_aux_i:nnn #1#2#3 {
\prop_put:Nnn \l_siunitx_number_in_prop { exponent }
{ true }
@@ -1964,7 +1975,7 @@
\int_compare:nNnF { #1 + 0 #2 } = { 0 }
{ \siunitx_number_process_fixed_aux_ii:nnn {#1} {#2} {#3} }
}
-\cs_new_protected_nopar:Npn
+\cs_new_protected:Npn
\siunitx_number_process_fixed_aux_ii:nnn #1#2#3 {
\int_compare:nNnTF {#3} > { \l_siunitx_process_fixed_int }
{ \siunitx_number_process_fixed_large:nnn {#1} {#2} {#3} }
@@ -1994,15 +2005,15 @@
}
}
}
-\cs_new_protected_nopar:Npn \siunitx_number_process_fixed_large:nnn #1
+\cs_new_protected:Npn \siunitx_number_process_fixed_large:nnn #1
{
\int_compare:nNnTF {#1} = \c_zero
{ \siunitx_number_process_fixed_large_aux:nnn { } }
{ \siunitx_number_process_fixed_large_aux:nnn {#1} }
}
-\cs_new_protected_nopar:Npn \siunitx_number_process_fixed_large_aux:nnn #1#2#3
+\cs_new_protected:Npn \siunitx_number_process_fixed_large_aux:nnn #1#2#3
{
- \cs_set_protected_nopar:Npn
+ \cs_set_protected:Npn
\siunitx_number_process_fixed_large_aux:w ##1##2 \q_stop
{
\tl_if_empty:nTF {##2}
@@ -2034,11 +2045,11 @@
{ \siunitx_number_process_fixed_aux_ii:nnn { #1 0 } { } { #3 - 1 } }
{ \siunitx_number_process_fixed_large_aux:w #2 \q_stop }
}
-\cs_new_protected_nopar:Npn \siunitx_number_process_fixed_large_aux:w
+\cs_new_protected:Npn \siunitx_number_process_fixed_large_aux:w
{ }
-\cs_new_protected_nopar:Npn
+\cs_new_protected:Npn
\siunitx_number_process_fixed_small:nnn #1#2#3 {
- \cs_set_protected_nopar:Npn
+ \cs_set_protected:Npn
\siunitx_number_process_fixed_small_aux:w ##1##2 \q_stop ##3
{
\tl_if_empty:nTF {##2}
@@ -2060,9 +2071,9 @@
}
\siunitx_number_process_fixed_small_aux:w #1 \q_stop { }
}
-\cs_new_protected_nopar:Npn \siunitx_number_process_fixed_small_aux:w
+\cs_new_protected:Npn \siunitx_number_process_fixed_small_aux:w
{ }
-\cs_new_protected_nopar:Npn \siunitx_number_process_integer_digits: {
+\cs_new_protected:Npn \siunitx_number_process_integer_digits: {
\int_compare:nNnT
{ \l_siunitx_process_integer_min_int } > { \c_zero }
{
@@ -2087,7 +2098,7 @@
}
}
}
-\cs_new_protected_nopar:Npn \siunitx_number_process_mantissa: {
+\cs_new_protected:Npn \siunitx_number_process_mantissa: {
\bool_if:NF \l_siunitx_process_unity_mantissa_bool
{
\prop_if_in:NnT \l_siunitx_number_in_prop { exponent }
@@ -2112,7 +2123,7 @@
}
\tl_new:N \c_siunitx_unity_tl
\tl_set:Nn \c_siunitx_unity_tl { 1 }
-\cs_new_protected_nopar:Npn \siunitx_number_process_pad:n #1 {
+\cs_new_protected:Npn \siunitx_number_process_pad:n #1 {
\prop_get:NnNT \l_siunitx_number_in_prop { #1 -decimal }
\l_siunitx_tmpa_tl
{
@@ -2125,233 +2136,263 @@
\l_siunitx_tmpa_tl
}
}
-\cs_new_protected_nopar:Npn \siunitx_number_process_places:n #1 {
- \prop_if_in:NnT \l_siunitx_number_in_prop {#1}
- {
- \prop_if_in:NnF \l_siunitx_number_in_prop { #1 -uncertainty }
- { \siunitx_number_process_places_aux_i:n {#1} }
- }
-}
-\cs_new_protected_nopar:Npn \siunitx_number_process_places_aux_i:n #1 {
- \int_compare:nNnTF { \l_siunitx_process_precision_int } = { 0 }
- {
- \prop_get:NnNT \l_siunitx_number_in_prop { #1 -decimal }
- \l_siunitx_tmpa_tl
- {
- \int_compare:nNnTF
- { \tl_head:V \l_siunitx_tmpa_tl } > { 4 }
- {
- \prop_get:NnNTF \l_siunitx_number_in_prop { #1 -integer }
- \l_siunitx_tmpa_tl
- {
- \tl_set:Nx \l_siunitx_tmpa_tl
- { \int_eval:n { \l_siunitx_tmpa_tl + 1 } }
- \prop_put:NnV \l_siunitx_number_in_prop
- { #1 -integer } \l_siunitx_tmpa_tl
- }
- {
- \prop_put:Nnn \l_siunitx_number_in_prop
- { #1 -integer } { 1 }
- }
-
- }
- {
- \prop_if_in:NnF \l_siunitx_number_in_prop { #1 -integer }
- {
- \prop_put:Nnn \l_siunitx_number_in_prop
- { #1 -integer } { 0 }
- }
- }
- }
- \prop_del:Nn \l_siunitx_number_in_prop { #1 -decimal }
- \bool_if:NF \l_siunitx_process_int_to_dec_bool
- {
- \prop_del:Nn \l_siunitx_number_in_prop { #1 -decimal-marker }
- }
- }
- {
- \prop_get:NnNT \l_siunitx_number_in_prop { #1 -decimal }
- \l_siunitx_tmpa_tl
- {
- \tl_if_empty:NT \l_siunitx_tmpa_tl
- { \tl_set:Nn \l_siunitx_tmpa_tl { 0 } }
- \int_compare:nNnTF { \l_siunitx_tmpa_tl } = { 0 }
- {
- \prop_put:Nnn \l_siunitx_number_in_prop { #1 -decimal }
- { }
- \int_set:Nn \l_siunitx_round_int
- { \l_siunitx_process_precision_int }
- \siunitx_number_process_pad:n {#1}
- }
- {
- \int_set:Nn \l_siunitx_round_int
- { \tl_length:N \l_siunitx_tmpa_tl }
- \siunitx_number_process_places_aux_ii:n {#1}
- }
- }
- }
-}
-\cs_new_protected_nopar:Npn
- \siunitx_number_process_places_aux_ii:n #1 {
- \int_sub:Nn \l_siunitx_round_int
- { \l_siunitx_process_precision_int }
- \int_compare:nNnTF { \l_siunitx_round_int } < { 0 }
- {
- \int_set:Nn \l_siunitx_round_int { - \l_siunitx_round_int }
- \siunitx_number_process_pad:n {#1}
- }
- {
- \siunitx_number_process_places_init:n {#1}
- \siunitx_number_process_places_loop:n {#1}
- \siunitx_number_process_round_tidy:n {#1}
- }
-}
-\cs_new_protected_nopar:Npn \siunitx_number_process_places_init:n #1 {
- \prop_get:NnNF \l_siunitx_number_in_prop { #1 -integer }
- \l_siunitx_round_integer_in_tl
- { \tl_clear:N \l_siunitx_round_integer_in_tl }
- \prop_get:NnN \l_siunitx_number_in_prop { #1 -decimal }
- \l_siunitx_round_decimal_in_tl
- \tl_reverse:N \l_siunitx_round_integer_in_tl
- \tl_reverse:N \l_siunitx_round_decimal_in_tl
- \tl_clear:N \l_siunitx_round_integer_out_tl
- \tl_clear:N \l_siunitx_round_decimal_out_tl
- \bool_set_false:N \l_siunitx_round_bool
-}
-\cs_new_protected_nopar:Npn \siunitx_number_process_places_loop:n #1 {
- \tl_if_empty:NTF \l_siunitx_round_decimal_in_tl
- {
- \tl_if_empty:NF \l_siunitx_round_integer_in_tl
- {
- \siunitx_number_process_places_integer:n {#1}
- \siunitx_number_process_places_loop:n {#1}
- }
- \bool_if:NT \l_siunitx_round_bool
- {
- \tl_put_left:Nn \l_siunitx_round_integer_out_tl { 1 }
- \bool_set_false:N \l_siunitx_round_bool
- }
- }
- {
- \siunitx_number_process_round_decimal:
- \siunitx_number_process_places_loop:n {#1}
- }
-}
-\cs_new_protected_nopar:Npn
- \siunitx_number_process_places_integer:n #1 {
- \int_set:Nn \l_siunitx_tmp_int
- { \tl_head:V \l_siunitx_round_integer_in_tl }
- \tl_set:Nx \l_siunitx_round_integer_in_tl
- { \tl_tail:V \l_siunitx_round_integer_in_tl }
- \bool_if:NT \l_siunitx_round_bool
- { \int_incr:N \l_siunitx_tmp_int }
- \bool_set_false:N \l_siunitx_round_bool
- \int_compare:nNnT { \l_siunitx_tmp_int } = { 10 }
- {
- \int_zero:N \l_siunitx_tmp_int
- \bool_set_true:N \l_siunitx_round_bool
- }
- \tl_put_left:NV \l_siunitx_round_integer_out_tl \l_siunitx_tmp_int
-}
-\cs_new_protected_nopar:Npn \siunitx_number_process_round: {
- \tl_if_empty:NF \l_siunitx_round_tl
- {
- \bool_if:NT \l_siunitx_process_int_to_dec_bool
- {
- \prop_if_in:NnF \l_siunitx_number_in_prop
- { mantissa-decimal }
- {
- \prop_put:Nnn \l_siunitx_number_in_prop
- { mantissa-decimal } { 0 }
- }
- \prop_if_in:NnF \l_siunitx_number_in_prop
- { mantissa-decimal-marker }
- {
- \prop_put:Nnn \l_siunitx_number_in_prop
- { mantissa-decimal-marker } { . }
- }
- }
- \cs_set_nopar:Npx \siunitx_tmp:w
- {
- \exp_not:N \clist_map_function:nN
- { mantissa , complex }
- \exp_not:c
- { siunitx_number_process_ \l_siunitx_round_tl :n }
- }
- \siunitx_tmp:w
- }
-}
-\cs_new_protected_nopar:Npn \siunitx_number_process_round_decimal: {
- \int_compare:nNnF { \l_siunitx_round_int } > { 1 }
- { \siunitx_number_process_round_decimal_aux: }
- \tl_set:Nx \l_siunitx_round_decimal_in_tl
- { \tl_tail:V \l_siunitx_round_decimal_in_tl }
- \int_decr:N \l_siunitx_round_int
-}
-\cs_new_protected_nopar:Npn
- \siunitx_number_process_round_decimal_aux: {
- \int_set:Nn \l_siunitx_tmp_int
- { \tl_head:V \l_siunitx_round_decimal_in_tl }
- \bool_if:NT \l_siunitx_round_bool
- { \int_incr:N \l_siunitx_tmp_int }
- \bool_set_false:N \l_siunitx_round_bool
- \int_compare:nNnTF { \l_siunitx_round_int } = { 1 }
- {
- \int_compare:nNnT { \l_siunitx_tmp_int } > { 4 }
- { \bool_set_true:N \l_siunitx_round_bool }
- }
- {
- \int_compare:nNnT { \l_siunitx_tmp_int } = { 10 }
- {
- \bool_set_true:N \l_siunitx_round_bool
- \int_zero:N \l_siunitx_tmp_int
- }
- \tl_put_left:NV \l_siunitx_round_decimal_out_tl
- \l_siunitx_tmp_int
- }
-}
-\cs_new_protected_nopar:Npn \siunitx_number_process_round_tidy:n #1 {
- \int_compare:nNnTF
- {
- 0 \l_siunitx_round_integer_out_tl +
- 0 \l_siunitx_round_decimal_out_tl
- }
- = { 0 }
- {
- \fp_compare:nNnTF { \l_siunitx_process_round_min_tl } = { 0 }
- {
- \prop_put:Nnn \l_siunitx_number_in_prop { #1 -integer } { 0 }
- \prop_put:NnV \l_siunitx_number_in_prop { #1 -decimal }
- \l_siunitx_round_decimal_out_tl
- }
- {
- \exp_after:wN \siunitx_number_process_round_tidy_aux:w
- \l_siunitx_process_round_min_tl . . \q_stop {#1}
- }
- }
- {
- \prop_put:NnV \l_siunitx_number_in_prop { #1 -integer }
- \l_siunitx_round_integer_out_tl
- \tl_if_empty:NTF \l_siunitx_round_decimal_out_tl
- {
- \prop_del:Nn \l_siunitx_number_in_prop { #1 -decimal }
- \prop_del:Nn \l_siunitx_number_in_prop { #1 -decimal-marker }
- }
- {
- \prop_put:NnV \l_siunitx_number_in_prop { #1 -decimal }
- \l_siunitx_round_decimal_out_tl
- }
- }
-}
-\cs_new_protected_nopar:Npn
- \siunitx_number_process_round_tidy_aux:w #1 . #2 . #3 \q_stop #4 {
- \prop_put:Nnn \l_siunitx_number_in_prop { comparator } { < }
- \prop_put:Nnn \l_siunitx_number_in_prop { #4 -integer } {#1}
- \tl_if_empty:nTF {#2}
- { \prop_del:Nn \l_siunitx_number_in_prop { #4 -decimal } }
- { \prop_put:Nnn \l_siunitx_number_in_prop { #4 -decimal } {#2} }
-}
-\cs_new_protected_nopar:Npn \siunitx_number_process_scientific: {
+\cs_new_protected:Npn \siunitx_number_process_places:n #1
+ {
+ \prop_if_in:NnT \l_siunitx_number_in_prop {#1}
+ {
+ \prop_if_in:NnF \l_siunitx_number_in_prop { #1 -uncertainty }
+ { \siunitx_number_process_places_aux_i:n {#1} }
+ }
+ }
+\cs_new_protected:Npn \siunitx_number_process_places_aux_i:n #1
+ {
+ \int_compare:nNnTF \l_siunitx_process_precision_int = \c_zero
+ { \siunitx_number_process_places_none:n {#1} }
+ {
+ \prop_get:NnNT \l_siunitx_number_in_prop { #1 -decimal }
+ \l_siunitx_tmpa_tl
+ {
+ \tl_if_empty:NT \l_siunitx_tmpa_tl
+ { \tl_set:Nn \l_siunitx_tmpa_tl { 0 } }
+ \int_compare:nNnTF \l_siunitx_tmpa_tl = \c_zero
+ {
+ \prop_put:Nnn \l_siunitx_number_in_prop { #1 -decimal } { }
+ \int_set:Nn \l_siunitx_round_int
+ { \l_siunitx_process_precision_int }
+ \siunitx_number_process_pad:n {#1}
+ }
+ {
+ \int_set:Nn \l_siunitx_round_int
+ { \tl_length:N \l_siunitx_tmpa_tl }
+ \siunitx_number_process_places_aux_ii:n {#1}
+ }
+ }
+ }
+ }
+\cs_new_protected:Npn \siunitx_number_process_places_none:n #1
+ {
+ \prop_get:NnNT \l_siunitx_number_in_prop { #1 -decimal } \l_siunitx_tmpa_tl
+ {
+ \int_compare:nNnTF { \tl_head:V \l_siunitx_tmpa_tl } > \c_four
+ {
+ \prop_get:NnNTF \l_siunitx_number_in_prop { #1 -integer }
+ \l_siunitx_tmpb_tl
+ {
+ \tl_set:Nx \l_siunitx_tmpb_tl
+ { \int_eval:n { \l_siunitx_tmpb_tl + 1 } }
+ \bool_if:NF \l_siunitx_round_half_up_bool
+ {
+ \int_compare:nNnT
+ { 0 \tl_tail:V \l_siunitx_tmpa_tl } = \c_zero
+ {
+ \int_if_odd:nT \l_siunitx_tmpb_tl
+ {
+ \tl_set:Nx \l_siunitx_tmpb_tl
+ { \int_eval:n { \l_siunitx_tmpb_tl - 1 } }
+ }
+ }
+ }
+ }
+ { \tl_set:Nn \l_siunitx_tmpb_tl { 1 } }
+ \prop_put:NnV \l_siunitx_number_in_prop
+ { #1 -integer } \l_siunitx_tmpb_tl
+ }
+ {
+ \prop_if_in:NnF \l_siunitx_number_in_prop { #1 -integer }
+ {
+ \prop_put:Nnn \l_siunitx_number_in_prop
+ { #1 -integer } { 0 }
+ }
+ }
+ }
+ \prop_del:Nn \l_siunitx_number_in_prop { #1 -decimal }
+ \bool_if:NF \l_siunitx_process_int_to_dec_bool
+ { \prop_del:Nn \l_siunitx_number_in_prop { #1 -decimal-marker } }
+ }
+\cs_new_protected:Npn \siunitx_number_process_places_aux_ii:n #1
+ {
+ \int_sub:Nn \l_siunitx_round_int
+ { \l_siunitx_process_precision_int }
+ \int_compare:nNnTF \l_siunitx_round_int < \c_zero
+ {
+ \int_set:Nn \l_siunitx_round_int { - \l_siunitx_round_int }
+ \siunitx_number_process_pad:n {#1}
+ }
+ {
+ \siunitx_number_process_places_init:n {#1}
+ \siunitx_number_process_places_loop:n {#1}
+ \siunitx_number_process_round_tidy:n {#1}
+ }
+ }
+\cs_new_protected:Npn \siunitx_number_process_places_init:n #1
+ {
+ \prop_get:NnNF \l_siunitx_number_in_prop { #1 -integer }
+ \l_siunitx_round_integer_in_tl
+ { \tl_clear:N \l_siunitx_round_integer_in_tl }
+ \prop_get:NnN \l_siunitx_number_in_prop { #1 -decimal }
+ \l_siunitx_round_decimal_in_tl
+ \tl_reverse:N \l_siunitx_round_integer_in_tl
+ \tl_reverse:N \l_siunitx_round_decimal_in_tl
+ \tl_clear:N \l_siunitx_round_integer_out_tl
+ \tl_clear:N \l_siunitx_round_decimal_out_tl
+ \tl_clear:N \l_siunitx_round_discard_tl
+ \bool_set_false:N \l_siunitx_round_bool
+ \bool_set_false:N \l_siunitx_round_even_bool
+ }
+\cs_new_protected:Npn \siunitx_number_process_places_loop:n #1
+ {
+ \tl_if_empty:NTF \l_siunitx_round_decimal_in_tl
+ {
+ \tl_if_empty:NF \l_siunitx_round_integer_in_tl
+ {
+ \siunitx_number_process_places_integer:n {#1}
+ \siunitx_number_process_places_loop:n {#1}
+ }
+ \bool_if:NT \l_siunitx_round_bool
+ {
+ \tl_put_left:Nn \l_siunitx_round_integer_out_tl { 1 }
+ \bool_set_false:N \l_siunitx_round_bool
+ }
+ }
+ {
+ \siunitx_number_process_round_decimal:
+ \siunitx_number_process_places_loop:n {#1}
+ }
+ }
+\cs_new_protected:Npn \siunitx_number_process_places_integer:n #1
+ {
+ \int_set:Nn \l_siunitx_tmp_int
+ { \tl_head:V \l_siunitx_round_integer_in_tl }
+ \tl_set:Nx \l_siunitx_round_integer_in_tl
+ { \tl_tail:V \l_siunitx_round_integer_in_tl }
+ \siunitx_number_process_round_up:
+ \bool_set_false:N \l_siunitx_round_bool
+ \int_compare:nNnT \l_siunitx_tmp_int = \c_ten
+ {
+ \int_zero:N \l_siunitx_tmp_int
+ \bool_set_true:N \l_siunitx_round_bool
+ }
+ \tl_put_left:NV \l_siunitx_round_integer_out_tl \l_siunitx_tmp_int
+ }
+\cs_new_protected:Npn \siunitx_number_process_round:
+ {
+ \tl_if_empty:NF \l_siunitx_round_tl
+ {
+ \bool_if:NT \l_siunitx_process_int_to_dec_bool
+ {
+ \prop_if_in:NnF \l_siunitx_number_in_prop { mantissa-decimal }
+ {
+ \prop_put:Nnn \l_siunitx_number_in_prop { mantissa-decimal }
+ { 0 }
+ }
+ \prop_if_in:NnF \l_siunitx_number_in_prop
+ { mantissa-decimal-marker }
+ {
+ \prop_put:Nnn \l_siunitx_number_in_prop
+ { mantissa-decimal-marker } { . }
+ }
+ }
+ \clist_map_function:nc { mantissa , complex }
+ { siunitx_number_process_ \l_siunitx_round_tl :n }
+ }
+ }
+\cs_new_protected:Npn \siunitx_number_process_round_decimal:
+ {
+ \int_compare:nNnF \l_siunitx_round_int > \c_one
+ { \siunitx_number_process_round_decimal_aux: }
+ \tl_put_right:Nx \l_siunitx_round_discard_tl
+ { \tl_head:V \l_siunitx_round_decimal_in_tl }
+ \tl_set:Nx \l_siunitx_round_decimal_in_tl
+ { \tl_tail:V \l_siunitx_round_decimal_in_tl }
+ \int_decr:N \l_siunitx_round_int
+ }
+\cs_new_protected:Npn \siunitx_number_process_round_decimal_aux:
+ {
+ \int_set:Nn \l_siunitx_tmp_int
+ { \tl_head:V \l_siunitx_round_decimal_in_tl }
+ \siunitx_number_process_round_up:
+ \int_compare:nNnTF \l_siunitx_round_int = \c_one
+ {
+ \int_compare:nNnT \l_siunitx_tmp_int > \c_four
+ {
+ \bool_set_true:N \l_siunitx_round_bool
+ \bool_if:NF \l_siunitx_round_half_up_bool
+ {
+ \int_compare:nNnT
+ { \l_siunitx_round_discard_tl \int_use:N \l_siunitx_tmp_int }
+ = \c_five
+ { \bool_set_true:N \l_siunitx_round_even_bool }
+ }
+ }
+ }
+ {
+ \int_compare:nNnT \l_siunitx_tmp_int = \c_ten
+ {
+ \bool_set_true:N \l_siunitx_round_bool
+ \int_zero:N \l_siunitx_tmp_int
+ }
+ \tl_put_left:NV \l_siunitx_round_decimal_out_tl
+ \l_siunitx_tmp_int
+ }
+ }
+\cs_new_protected:Npn \siunitx_number_process_round_up:
+ {
+ \bool_if:NT \l_siunitx_round_bool
+ {
+ \bool_if:NTF \l_siunitx_round_even_bool
+ {
+ \bool_set_false:N \l_siunitx_round_even_bool
+ \int_if_even:nF \l_siunitx_tmp_int
+ { \int_incr:N \l_siunitx_tmp_int }
+ }
+ { \int_incr:N \l_siunitx_tmp_int }
+ }
+ \bool_set_false:N \l_siunitx_round_bool
+ }
+\cs_new_protected:Npn \siunitx_number_process_round_tidy:n #1
+ {
+ \int_compare:nNnTF
+ {
+ 0 \l_siunitx_round_integer_out_tl +
+ 0 \l_siunitx_round_decimal_out_tl
+ }
+ = \c_zero
+ {
+ \fp_compare:nNnTF { \l_siunitx_process_round_min_tl } = { 0 }
+ {
+ \prop_put:Nnn \l_siunitx_number_in_prop { #1 -integer } { 0 }
+ \prop_put:NnV \l_siunitx_number_in_prop { #1 -decimal }
+ \l_siunitx_round_decimal_out_tl
+ }
+ {
+ \exp_after:wN \siunitx_number_process_round_tidy_aux:w
+ \l_siunitx_process_round_min_tl . . \q_stop {#1}
+ }
+ }
+ {
+ \prop_put:NnV \l_siunitx_number_in_prop { #1 -integer }
+ \l_siunitx_round_integer_out_tl
+ \tl_if_empty:NTF \l_siunitx_round_decimal_out_tl
+ {
+ \prop_del:Nn \l_siunitx_number_in_prop { #1 -decimal }
+ \prop_del:Nn \l_siunitx_number_in_prop { #1 -decimal-marker }
+ }
+ {
+ \prop_put:NnV \l_siunitx_number_in_prop { #1 -decimal }
+ \l_siunitx_round_decimal_out_tl
+ }
+ }
+ }
+\cs_new_protected:Npn \siunitx_number_process_round_tidy_aux:w
+ #1 . #2 . #3 \q_stop #4
+ {
+ \prop_put:Nnn \l_siunitx_number_in_prop { comparator } { < }
+ \prop_put:Nnn \l_siunitx_number_in_prop { #4 -integer } {#1}
+ \tl_if_empty:nTF {#2}
+ { \prop_del:Nn \l_siunitx_number_in_prop { #4 -decimal } }
+ { \prop_put:Nnn \l_siunitx_number_in_prop { #4 -decimal } {#2} }
+ }
+\cs_new_protected:Npn \siunitx_number_process_scientific: {
\prop_if_in:NnF \l_siunitx_number_in_prop { complex }
{
\prop_get:NnNF \l_siunitx_number_in_prop { mantissa-integer }
@@ -2377,12 +2418,12 @@
\l_siunitx_tmpa_tl
}
}
-\cs_new_protected_nopar:Npn
+\cs_new_protected:Npn
\siunitx_number_process_scientific_aux_i:nnn #1#2#3 {
\int_compare:nNnF { #1 + 0 #2 } = { 0 }
{ \siunitx_number_process_scientific_aux_ii:nnn {#1} {#2} {#3} }
}
-\cs_new_protected_nopar:Npn
+\cs_new_protected:Npn
\siunitx_number_process_scientific_aux_ii:nnn #1#2#3 {
\int_compare:nNnTF {#1} > { 9 }
{ \siunitx_number_process_scientific_large:nnn {#1} {#2} {#3} }
@@ -2400,7 +2441,7 @@
}
}
}
-\cs_new_protected_nopar:Npn
+\cs_new_protected:Npn
\siunitx_number_process_scientific_large:nnn #1#2#3 {
\int_set:Nn \l_siunitx_tmp_int { \int_div_truncate:nn {#1} { 10 } }
\tl_set:Nx \l_siunitx_tmpa_tl { \int_use:N \l_siunitx_tmp_int }
@@ -2413,10 +2454,10 @@
\exp_after:wN \siunitx_number_process_scientific_aux_ii:nnn
\l_siunitx_tmpa_tl
}
-\cs_new_protected_nopar:Npn
+\cs_new_protected:Npn
\siunitx_number_process_scientific_small:wn #1#2 \q_stop #3
{ \siunitx_number_process_scientific_aux_ii:nnn {#1} {#2} { #3 - 1 } }
-\cs_new_protected_nopar:Npn
+\cs_new_protected:Npn
\siunitx_number_process_scientific_store:nnn #1#2#3
{
\prop_put:Nnn \l_siunitx_number_in_prop { mantissa-integer } {#1}
@@ -2460,7 +2501,7 @@
}
}
}
-\cs_new_protected_nopar:Npn
+\cs_new_protected:Npn
\siunitx_number_process_scientific_engineering:nnn #1#2#3
{
\use:c
@@ -2483,7 +2524,7 @@
\cs_new_eq:cN
{ siunitx_number_process_scientific_engineering_0:nnn }
\siunitx_number_process_scientific_store:nnn
-\cs_new_protected_nopar:cpn
+\cs_new_protected:cpn
{ siunitx_number_process_scientific_engineering_1:nnn } #1#2#3
{
\tl_if_empty:nTF {#2}
@@ -2497,14 +2538,14 @@
{#1} #2 \q_stop {#3}
}
}
-\cs_new_protected_nopar:cpn
+\cs_new_protected:cpn
{ siunitx_number_process_scientific_engineering_1:nw }
#1#2#3 \q_stop #4
{
\siunitx_number_process_scientific_store:nnn
{#1#2} {#3} { #4 - 1 }
}
-\cs_new_protected_nopar:cpn
+\cs_new_protected:cpn
{ siunitx_number_process_scientific_engineering_2:nnn } #1#2#3
{
\tl_if_empty:nTF {#2}
@@ -2518,7 +2559,7 @@
{#1} #2 \q_stop {#3}
}
}
-\cs_new_protected_nopar:cpn
+\cs_new_protected:cpn
{ siunitx_number_process_scientific_engineering_2_i:nw }
#1#2#3 \q_stop #4
{
@@ -2533,14 +2574,14 @@
{#1#2} #3 \q_stop {#4}
}
}
-\cs_new_protected_nopar:cpn
+\cs_new_protected:cpn
{ siunitx_number_process_scientific_engineering_2_ii:nw }
#1#2#3 \q_stop #4
{
\siunitx_number_process_scientific_store:nnn { #1#2 } {#3}
{ #4 - 2 }
}
-\cs_new_protected_nopar:Npn \siunitx_number_process_sign: {
+\cs_new_protected:Npn \siunitx_number_process_sign: {
\bool_if:NF \l_siunitx_process_plus_tl
{
\prop_if_in:NnTF \l_siunitx_number_in_prop { mantissa-sign }
@@ -2562,7 +2603,7 @@
{ \siunitx_number_process_sign_add:n { complex } }
}
}
-\cs_new_protected_nopar:Npn \siunitx_number_process_sign_add:n #1 {
+\cs_new_protected:Npn \siunitx_number_process_sign_add:n #1 {
\prop_if_in:NnF \l_siunitx_number_in_prop { #1 -sign }
{
\prop_if_in:NnF \l_siunitx_number_in_prop { #1 -had-sign }
@@ -2581,7 +2622,7 @@
}
}
}
-\cs_new_protected_nopar:Npn \siunitx_number_process_sign_plus:n #1 {
+\cs_new_protected:Npn \siunitx_number_process_sign_plus:n #1 {
\prop_get:NnN \l_siunitx_number_in_prop { #1 -sign }
\l_siunitx_tmpa_tl
\tl_if_eq:NNT \c_siunitx_plus_tl \l_siunitx_tmpa_tl
@@ -2592,11 +2633,11 @@
}
\tl_new:N \c_siunitx_plus_tl
\tl_set:Nn \c_siunitx_plus_tl { + }
-\cs_new_protected_nopar:Npn \siunitx_number_process_uncertainty: {
+\cs_new_protected:Npn \siunitx_number_process_uncertainty: {
\clist_map_function:nN { mantissa , complex }
\siunitx_number_process_uncertainty_aux:n
}
-\cs_new_protected_nopar:Npn
+\cs_new_protected:Npn
\siunitx_number_process_uncertainty_aux:n #1 {
\prop_if_in:NnT \l_siunitx_number_in_prop { #1 -uncertainty }
{
@@ -2605,7 +2646,7 @@
{ \siunitx_number_process_uncertainty_integer:n {#1} }
}
}
-\cs_new_protected_nopar:Npn
+\cs_new_protected:Npn
\siunitx_number_process_uncertainty_decimal:n #1 {
\siunitx_number_process_uncertainty_count:nn {#1} { decimal }
\siunitx_number_process_uncertainty_count:nn {#1} { uncertainty }
@@ -2629,14 +2670,14 @@
\prop_put:NnV \l_siunitx_number_in_prop
{ #1 -uncertainty-decimal-marker } \l_siunitx_tmpa_tl
}
-\cs_new_protected_nopar:Npn
+\cs_new_protected:Npn
\siunitx_number_process_uncertainty_count:nn #1#2 {
\prop_get:NnN \l_siunitx_number_in_prop { #1 - #2 }
\l_siunitx_tmpa_tl
\int_set:cn { l_siunitx_process_ #2 _int }
{ \tl_length:N \l_siunitx_tmpa_tl }
}
-\cs_new_protected_nopar:Npn \siunitx_number_process_uncertainty_pad: {
+\cs_new_protected:Npn \siunitx_number_process_uncertainty_pad: {
\int_while_do:nNnn
{ \l_siunitx_process_uncertainty_int } <
{ \l_siunitx_process_decimal_int }
@@ -2647,7 +2688,7 @@
\tl_put_right:NV \l_siunitx_uncertainty_decimal_tl
\l_siunitx_tmpa_tl
}
-\cs_new_protected_nopar:Npn
+\cs_new_protected:Npn
\siunitx_number_process_uncertainty_separate: {
\tl_map_function:NN \l_siunitx_tmpa_tl
\siunitx_number_process_uncertainty_separate_aux:N
@@ -2661,18 +2702,18 @@
{ \tl_put_right:Nn \l_siunitx_uncertainty_decimal_tl {#1} }
\int_decr:N \l_siunitx_process_uncertainty_int
}
-\cs_new_protected_nopar:Npn
+\cs_new_protected:Npn
\siunitx_number_process_uncertainty_integer:n #1 {
\prop_get:NnN \l_siunitx_number_in_prop { #1 -uncertainty }
\l_siunitx_tmpa_tl
\prop_put:NnV \l_siunitx_number_in_prop { #1 -uncertainty-integer }
\l_siunitx_tmpa_tl
}
-\cs_new_protected_nopar:Npn \siunitx_number_process_zero_fill: {
+\cs_new_protected:Npn \siunitx_number_process_zero_fill: {
\siunitx_number_process_zero_fill_aux:n { integer }
\siunitx_number_process_zero_fill_aux:n { decimal }
}
-\cs_new_nopar:Npn \siunitx_number_process_zero_fill_aux:n #1 {
+\cs_new:Npn \siunitx_number_process_zero_fill_aux:n #1 {
\bool_if:cT { l_siunitx_process_ #1 _zero_bool }
{
\siunitx_number_process_zero_fill_aux:nn { mantissa } {#1}
@@ -2680,7 +2721,7 @@
\siunitx_number_process_zero_fill_aux:nn { exponent } {#1}
}
}
-\cs_new_protected_nopar:Npn
+\cs_new_protected:Npn
\siunitx_number_process_zero_fill_aux:nn #1#2 {
\prop_if_in:NnT \l_siunitx_number_in_prop { #1 -decimal-marker }
{
@@ -2688,6 +2729,41 @@
{ \prop_put:Nnn \l_siunitx_number_in_prop { #1 - #2 } { 0 } }
}
}
+\cs_new_protected:Npn \siunitx_number_exp_to_prefix:
+ {
+ \prop_set_eq:NN \l_siunitx_unit_prop \l_siunitx_unit_saved_prop
+ \prop_get:NnNT \l_siunitx_number_in_prop { exponent-integer }
+ \l_siunitx_tmpa_tl
+ {
+ \prop_get:NnNT \l_siunitx_number_in_prop { exponent-sign }
+ \l_siunitx_tmpb_tl
+ { \tl_put_left:NV \l_siunitx_tmpa_tl \l_siunitx_tmpb_tl }
+ \prop_get:NnNT \l_siunitx_unit_prop { prefix-1 } \l_siunitx_tmpb_tl
+ {
+ \prop_del:Nn \l_siunitx_unit_prop { prefix-1 }
+ \prop_del:Nn \l_siunitx_unit_prop { prefix-symbol-1 }
+ \prop_get:NVN \l_siunitx_prefix_forward_prop \l_siunitx_tmpb_tl
+ \l_siunitx_tmpb_tl
+ \tl_set:Nx \l_siunitx_tmpa_tl
+ { \int_eval:n { \l_siunitx_tmpa_tl + \l_siunitx_tmpb_tl } }
+ }
+ \prop_get:NVNTF \l_siunitx_prefix_reverse_prop \l_siunitx_tmpa_tl
+ \l_siunitx_tmpb_tl
+ {
+ \prop_del:Nn \l_siunitx_number_in_prop { exponent }
+ \use:c
+ {
+ siunitx_ \exp_after:wN \token_to_str:N \l_siunitx_tmpb_tl
+ _function:w
+ }
+ \siunitx_unit_format:
+ }
+ {
+ \msg_error:nnx { siunitx } { non-convertible-exponent }
+ { \l_siunitx_tmpa_tl }
+ }
+ }
+ }
\prop_new:N \l_siunitx_number_out_prop
\tl_new:N \l_siunitx_group_sep_tl
\tl_new:N \l_siunitx_output_decimal_tl
@@ -2764,23 +2840,24 @@
tight-spacing .bool_set:N = \l_siunitx_tight_bool,
uncertainty-separator .tl_set:N = \l_siunitx_uncert_sep_tl,
}
-\keys_set:nn { siunitx } {
- bracket-numbers = true, % (
- close-bracket = ),
- complex-root-position = after-number,
- copy-decimal-marker = false,
- exponent-base = 10,
- exponent-product = \times,
- group-digits = true,
- group-minimum-digits = 5,
- group-separator = \,,
- open-bracket = (, % ) (
- output-close-uncertainty = ),
- output-complex-root = \mathrm { i },
- output-decimal-marker = .,
- output-open-uncertainty = (, % )
-}
-\cs_new_protected_nopar:Npn \siunitx_number_format: {
+\keys_set:nn { siunitx }
+ {
+ bracket-numbers = true , % (
+ close-bracket = ) ,
+ complex-root-position = after-number ,
+ copy-decimal-marker = false ,
+ exponent-base = 10 ,
+ exponent-product = \times ,
+ group-digits = true ,
+ group-minimum-digits = 5 ,
+ group-separator = \, ,
+ open-bracket = ( , % ) (
+ output-close-uncertainty = ) ,
+ output-complex-root = \ensuremath { \mathrm { i } } ,
+ output-decimal-marker = . ,
+ output-open-uncertainty = ( % )
+ }
+\cs_new_protected:Npn \siunitx_number_format: {
\prop_if_empty:NF \l_siunitx_number_in_prop
{
\prop_clear:N \l_siunitx_number_out_prop
@@ -2793,7 +2870,7 @@
\siunitx_number_format_final:
}
}
-\cs_new_protected_nopar:Npn \siunitx_number_format_brackets:n #1 {
+\cs_new_protected:Npn \siunitx_number_format_brackets:n #1 {
\bool_if:NT \l_siunitx_brackets_bool
{
\prop_if_in:NnT \l_siunitx_number_out_prop { #1 -bracket }
@@ -2803,16 +2880,14 @@
}
}
}
-\cs_new_protected_nopar:Npn \siunitx_number_format_brackets_aux:n #1 {
+\cs_new_protected:Npn \siunitx_number_format_brackets_aux:n #1 {
\prop_get:NnNF \l_siunitx_number_out_prop { #1 -result }
\l_siunitx_tmpa_tl
{
\prop_get:NnN \l_siunitx_number_out_prop {#1} \l_siunitx_tmpa_tl
}
- \siunitx_tl_put_left_math:NV \l_siunitx_tmpa_tl
- \l_siunitx_bracket_open_tl
- \siunitx_tl_put_right_math:NV \l_siunitx_tmpa_tl
- \l_siunitx_bracket_close_tl
+ \tl_put_left:NV \l_siunitx_tmpa_tl \l_siunitx_bracket_open_tl
+ \tl_put_right:NV \l_siunitx_tmpa_tl \l_siunitx_bracket_close_tl
\str_if_eq:nnTF {#1} { result }
{ \prop_put:NnV \l_siunitx_number_out_prop {#1} \l_siunitx_tmpa_tl }
{
@@ -2820,14 +2895,14 @@
\l_siunitx_tmpa_tl
}
}
-\cs_new_protected_nopar:Npn \siunitx_number_format_color: {
+\cs_new_protected:Npn \siunitx_number_format_color: {
\tl_if_empty:NF \l_siunitx_negative_color_tl
{
\siunitx_number_format_color_aux:n { mantissa-sign }
\siunitx_number_format_color_aux:n { sign }
}
}
-\cs_new_protected_nopar:Npn \siunitx_number_format_color_aux:n #1 {
+\cs_new_protected:Npn \siunitx_number_format_color_aux:n #1 {
\prop_get:NnNT \l_siunitx_number_in_prop {#1} \l_siunitx_tmpa_tl
{
\str_if_eq:VnT \l_siunitx_tmpa_tl { - }
@@ -2837,7 +2912,7 @@
}
}
}
-\cs_new_protected_nopar:Npn \siunitx_number_format_complex: {
+\cs_new_protected:Npn \siunitx_number_format_complex: {
\prop_if_in:NnT \l_siunitx_number_in_prop { complex-root }
{
\prop_if_in:NnTF \l_siunitx_number_out_prop { complex }
@@ -2853,61 +2928,34 @@
}
}
{
- \tl_set:Nx \l_siunitx_tmpa_tl
- {
- \exp_not:N \siunitx_ensuremath:n
- { \exp_not:V \l_siunitx_output_complex_tl }
- }
\prop_put:NnV \l_siunitx_number_out_prop { complex }
- \l_siunitx_tmpa_tl
+ \l_siunitx_output_complex_tl
}
\siunitx_number_format_join_complex:
}
}
-\cs_new_protected_nopar:Npn \siunitx_number_format_complex_aux:n #1 {
- \siunitx_number_format_complex_aux:
- \prop_get:NnN \l_siunitx_number_out_prop {#1} \l_siunitx_tmpb_tl
- \bool_if:NTF \l_siunitx_complex_after_bool
- {
- \siunitx_tl_put_right_math:NV \l_siunitx_tmpb_tl
- \l_siunitx_tmpa_tl
- }
- {
- \siunitx_tl_put_left_math:NV \l_siunitx_tmpb_tl
- \l_siunitx_tmpa_tl
- }
- \prop_put:NnV \l_siunitx_number_out_prop {#1} \l_siunitx_tmpb_tl
-}
-\cs_new_protected_nopar:Npn \siunitx_number_format_complex_aux: {
- \tl_set:Nn \l_siunitx_tmpa_tl
- {
- \use:c
- {
- siunitx_ \l_siunitx_print_type_tl _
- math \l_siunitx_font_family_tl :n
- }
- }
+\cs_new_protected:Npn \siunitx_number_format_complex_aux:n #1 {
\bool_if:NTF \l_siunitx_output_complex_copy_bool
{
\prop_get:NnN \l_siunitx_number_in_prop { complex-root }
- \l_siunitx_tmpb_tl
- \tl_put_right:Nx \l_siunitx_tmpa_tl
- { { \exp_not:V \l_siunitx_tmpb_tl } }
- }
- {
- \tl_put_right:Nx \l_siunitx_tmpa_tl
- { { \exp_not:V \l_siunitx_output_complex_tl } }
+ \l_siunitx_tmpa_tl
}
+ { \tl_set_eq:NN \l_siunitx_tmpa_tl \l_siunitx_output_complex_tl }
+ \prop_get:NnN \l_siunitx_number_out_prop {#1} \l_siunitx_tmpb_tl
+ \bool_if:NTF \l_siunitx_complex_after_bool
+ { \tl_put_right:NV \l_siunitx_tmpb_tl \l_siunitx_tmpa_tl }
+ { \tl_put_left:NV \l_siunitx_tmpb_tl \l_siunitx_tmpa_tl }
+ \prop_put:NnV \l_siunitx_number_out_prop {#1} \l_siunitx_tmpb_tl
}
-\cs_new_protected_nopar:Npn \siunitx_number_format_copy:n #1 {
+\cs_new_protected:Npn \siunitx_number_format_copy:n #1 {
\prop_get:NnN \l_siunitx_number_in_prop {#1} \l_siunitx_tmpa_tl
\prop_put:NnV \l_siunitx_number_out_prop {#1} \l_siunitx_tmpa_tl
}
-\cs_new_protected_nopar:Npn \siunitx_number_format_copy:nn #1#2 {
+\cs_new_protected:Npn \siunitx_number_format_copy:nn #1#2 {
\prop_get:NnN \l_siunitx_number_out_prop {#1} \l_siunitx_tmpa_tl
\prop_put:NnV \l_siunitx_number_out_prop {#2} \l_siunitx_tmpa_tl
}
-\cs_new_protected_nopar:Npn \siunitx_number_format_final: {
+\cs_new_protected:Npn \siunitx_number_format_final: {
\prop_if_in:NnT \l_siunitx_number_out_prop { complex }
{
\prop_if_in:NnF \l_siunitx_number_out_prop { mantissa-result }
@@ -2942,7 +2990,7 @@
\l_siunitx_tmpa_tl
}
}
-\cs_new_protected_nopar:Npn \siunitx_number_format_final_combined: {
+\cs_new_protected:Npn \siunitx_number_format_final_combined: {
\siunitx_number_format_brackets:n { mantissa }
\prop_get:NnN \l_siunitx_number_out_prop { mantissa-result }
\l_siunitx_tmpa_tl
@@ -2966,7 +3014,7 @@
\prop_put:Nnn \l_siunitx_number_out_prop
{ result-bracket-exponent } { true }
}
-\cs_new_protected_nopar:Npn \siunitx_number_format_final_exponent: {
+\cs_new_protected:Npn \siunitx_number_format_final_exponent: {
\prop_get:NnN \l_siunitx_number_out_prop { exponent }
\l_siunitx_tmpa_tl
\tl_if_empty:NTF \l_siunitx_output_exponent_tl
@@ -2985,7 +3033,7 @@
\prop_put:NnV \l_siunitx_number_out_prop { exponent-result }
\l_siunitx_tmpa_tl
}
-\cs_new_protected_nopar:Npn
+\cs_new_protected:Npn
\siunitx_number_format_final_exponent_only: {
\prop_get:NnNT \l_siunitx_number_in_prop { mantissa-sign }
\l_siunitx_tmpa_tl
@@ -3004,7 +3052,7 @@
}
\siunitx_number_format_copy:nn { exponent-result } { result }
}
-\cs_new_protected_nopar:Npn \siunitx_number_format_group:n #1 {
+\cs_new_protected:Npn \siunitx_number_format_group:n #1 {
\siunitx_number_format_group_aux:nn {#1} { integer }
\siunitx_number_format_group_aux:nn {#1} { decimal }
\prop_if_in:NnTF \l_siunitx_number_out_prop { #1 -integer }
@@ -3019,11 +3067,6 @@
\tl_set_eq:NN \l_siunitx_tmpb_tl
\l_siunitx_output_decimal_tl
}
- \tl_set:Nx \l_siunitx_tmpb_tl
- {
- \exp_not:N \siunitx_ensuremath:n
- { \exp_not:V \l_siunitx_tmpb_tl }
- }
\tl_put_right:NV \l_siunitx_tmpa_tl \l_siunitx_tmpb_tl
\prop_put:NnV \l_siunitx_number_out_prop { #1 -decimal-marker }
\l_siunitx_tmpb_tl
@@ -3034,7 +3077,7 @@
\prop_put:NnV \l_siunitx_number_out_prop {#1} \l_siunitx_tmpa_tl
}
}
-\cs_new_protected_nopar:Npn \siunitx_number_format_group_aux:nn #1#2 {
+\cs_new_protected:Npn \siunitx_number_format_group_aux:nn #1#2 {
\prop_if_in:NnT \l_siunitx_number_in_prop { #1 - #2 }
{
\bool_if:cTF { l_siunitx_group_ #2 _bool }
@@ -3042,7 +3085,7 @@
{ \siunitx_number_format_copy:n { #1 - #2 } }
}
}
-\cs_new_protected_nopar:Npn \siunitx_number_format_group:nn #1#2
+\cs_new_protected:Npn \siunitx_number_format_group:nn #1#2
{
\prop_get:NnN \l_siunitx_number_in_prop { #1 - #2 } \l_siunitx_tmpa_tl
\int_compare:nNnTF
@@ -3054,7 +3097,7 @@
\prop_put:NnV \l_siunitx_number_out_prop { #1 - #2 } \l_siunitx_tmpb_tl
}
}
-\cs_new_protected_nopar:Npn \siunitx_number_format_group_decimal: {
+\cs_new_protected:Npn \siunitx_number_format_group_decimal: {
\tl_if_empty:NF \l_siunitx_tmpa_tl
{
\exp_after:wN \siunitx_number_format_group_decimal_aux:NNNN
@@ -3072,14 +3115,13 @@
\tl_put_right:Nn \l_siunitx_tmpb_tl { #1 #2 #3 }
\tl_if_empty:nF {#4}
{
- \siunitx_tl_put_right_math:NV \l_siunitx_tmpb_tl
- \l_siunitx_group_sep_tl
+ \tl_put_right:NV \l_siunitx_tmpb_tl \l_siunitx_group_sep_tl
\siunitx_number_format_group_decimal_aux:NNNN #4
}
}
}
}
-\cs_new_protected_nopar:Npn \siunitx_number_format_group_integer: {
+\cs_new_protected:Npn \siunitx_number_format_group_integer: {
\tl_if_empty:NF \l_siunitx_tmpa_tl
{
\siunitx_number_format_group_integer_setup:V \l_siunitx_tmpa_tl
@@ -3119,12 +3161,11 @@
\tl_put_right:Nn \l_siunitx_tmpb_tl {#1#2#3}
\quark_if_nil:nF {#4}
{
- \siunitx_tl_put_right_math:NV \l_siunitx_tmpb_tl
- \l_siunitx_group_sep_tl
+ \tl_put_right:NV \l_siunitx_tmpb_tl \l_siunitx_group_sep_tl
\siunitx_number_format_group_integer_aux:NNNN #4
}
}
-\cs_new_protected_nopar:Npn \siunitx_number_format_join_complex: {
+\cs_new_protected:Npn \siunitx_number_format_join_complex: {
\siunitx_number_format_sign_complex:
\prop_if_in:NnT \l_siunitx_number_out_prop { mantissa }
{
@@ -3144,11 +3185,11 @@
{ true }
}
}
-\cs_new_protected_nopar:Npn \siunitx_number_format_join_uncert: {
+\cs_new_protected:Npn \siunitx_number_format_join_uncert: {
\siunitx_number_format_join_uncert:n { mantissa }
\siunitx_number_format_join_uncert:n { complex }
}
-\cs_new_protected_nopar:Npn \siunitx_number_format_join_uncert:n #1 {
+\cs_new_protected:Npn \siunitx_number_format_join_uncert:n #1 {
\prop_get:NnNT \l_siunitx_number_out_prop {#1}
\l_siunitx_tmpa_tl
{
@@ -3166,13 +3207,13 @@
{ \siunitx_number_format_copy:nn {#1} { #1 -result } }
}
}
-\cs_new_protected_nopar:Npn \siunitx_number_format_join_uncert_pm:N #1
+\cs_new_protected:Npn \siunitx_number_format_join_uncert_pm:N #1
{
\bool_if:NTF \l_siunitx_tight_bool
- { \tl_put_left:Nn #1 { \siunitx_ensuremath:n { { \pm } } } }
- { \tl_put_left:Nn #1 { \siunitx_ensuremath:n { { } \pm { } } } }
+ { \tl_put_left:Nn #1 { \ensuremath { { \pm } } } }
+ { \tl_put_left:Nn #1 { \ensuremath { { } \pm { } } } }
}
-\cs_new_protected_nopar:Npn \siunitx_number_format_reassemble: {
+\cs_new_protected:Npn \siunitx_number_format_reassemble: {
\prop_if_in:NnT \l_siunitx_number_in_prop { mantissa }
{
\siunitx_number_format_group:n { mantissa }
@@ -3186,7 +3227,7 @@
\prop_if_in:NnT \l_siunitx_number_in_prop { exponent }
{ \siunitx_number_format_group:n { exponent } }
}
-\cs_new_protected_nopar:Npn \siunitx_number_format_relation: {
+\cs_new_protected:Npn \siunitx_number_format_relation: {
\prop_get:NnNT \l_siunitx_number_in_prop { comparator }
\l_siunitx_tmpa_tl
{
@@ -3199,7 +3240,7 @@
\l_siunitx_tmpa_tl
}
}
-\cs_new_protected_nopar:Npn \siunitx_number_format_sign:n #1 {
+\cs_new_protected:Npn \siunitx_number_format_sign:n #1 {
\prop_if_in:NnT \l_siunitx_number_out_prop {#1}
{
\prop_get:NnNT \l_siunitx_number_in_prop { #1 -sign }
@@ -3215,14 +3256,14 @@
}
}
}
-\cs_new_protected_nopar:Npn \siunitx_number_format_sign_aux:n #1 {
+\cs_new_protected:Npn \siunitx_number_format_sign_aux:n #1 {
\bool_if:NT \l_siunitx_tight_bool
{
\tl_set:Nx \l_siunitx_tmpa_tl
{ { \exp_not:V \l_siunitx_tmpa_tl } }
}
\tl_clear:N \l_siunitx_tmpb_tl
- \siunitx_tl_put_left_math:NV \l_siunitx_tmpb_tl \l_siunitx_tmpa_tl
+ \tl_put_left:NV \l_siunitx_tmpb_tl \l_siunitx_tmpa_tl
\prop_put:NnV \l_siunitx_number_out_prop { #1 -sign }
\l_siunitx_tmpb_tl
\prop_get:NnN \l_siunitx_number_out_prop {#1} \l_siunitx_tmpa_tl
@@ -3236,26 +3277,24 @@
\l_siunitx_tmpa_tl
}
}
-\cs_new_protected_nopar:Npn
+\cs_new_protected:Npn
\siunitx_number_format_sign_negative_brackets:n #1
{
\siunitx_number_format_brackets_aux:n {#1}
\prop_get:NnNT \l_siunitx_number_out_prop { #1 }
\l_siunitx_tmpa_tl
{
- \siunitx_tl_put_left_math:NV \l_siunitx_tmpa_tl
- \l_siunitx_bracket_open_tl
- \siunitx_tl_put_right_math:NV \l_siunitx_tmpa_tl
- \l_siunitx_bracket_close_tl
+ \tl_put_left:NV \l_siunitx_tmpa_tl \l_siunitx_bracket_open_tl
+ \tl_put_right:NV \l_siunitx_tmpa_tl \l_siunitx_bracket_close_tl
\prop_put:NnV \l_siunitx_number_out_prop { #1 }
\l_siunitx_tmpa_tl
}
}
-\cs_new_protected_nopar:Npn \siunitx_number_format_sign_complex: {
+\cs_new_protected:Npn \siunitx_number_format_sign_complex: {
\siunitx_number_format_sign_complex:n { complex }
\siunitx_number_format_sign_complex:n { complex-result }
}
-\cs_new_protected_nopar:Npn \siunitx_number_format_sign_complex:n #1 {
+\cs_new_protected:Npn \siunitx_number_format_sign_complex:n #1 {
\prop_if_in:NnT \l_siunitx_number_out_prop {#1}
{
\prop_get:NnNT \l_siunitx_number_in_prop { complex-sign }
@@ -3274,8 +3313,7 @@
}
}
\tl_clear:N \l_siunitx_tmpb_tl
- \siunitx_tl_put_left_math:NV \l_siunitx_tmpb_tl
- \l_siunitx_tmpa_tl
+ \tl_put_left:NV \l_siunitx_tmpb_tl \l_siunitx_tmpa_tl
\prop_put:NnV \l_siunitx_number_out_prop { complex-sign }
\l_siunitx_tmpb_tl
\prop_get:NnN \l_siunitx_number_out_prop {#1}
@@ -3286,7 +3324,7 @@
}
}
}
-\cs_new_protected_nopar:Npn \siunitx_number_format_uncertainty:n #1 {
+\cs_new_protected:Npn \siunitx_number_format_uncertainty:n #1 {
\prop_if_in:NnTF \l_siunitx_number_in_prop { #1 -uncertainty }
{
\bool_if:NTF \l_siunitx_uncert_sep_bool
@@ -3296,22 +3334,19 @@
}
{ \siunitx_number_format_copy:nn {#1} { #1 -result } }
}
-\cs_new_protected_nopar:Npn
+\cs_new_protected:Npn
\siunitx_number_format_uncertainty_joined:n #1 {
\prop_get:NnN \l_siunitx_number_in_prop { #1 -uncertainty }
\l_siunitx_tmpa_tl
\prop_del:Nn \l_siunitx_number_in_prop { #1 -uncertainty }
- \siunitx_tl_put_left_math:NV \l_siunitx_tmpa_tl
- \l_siunitx_output_uncert_open_tl
- \siunitx_tl_put_left_math:NV \l_siunitx_tmpa_tl
- \l_siunitx_uncert_sep_tl
- \siunitx_tl_put_right_math:NV \l_siunitx_tmpa_tl
- \l_siunitx_output_uncert_close_tl
+ \tl_put_left:NV \l_siunitx_tmpa_tl \l_siunitx_output_uncert_open_tl
+ \tl_put_left:NV \l_siunitx_tmpa_tl \l_siunitx_uncert_sep_tl
+ \tl_put_right:NV \l_siunitx_tmpa_tl \l_siunitx_output_uncert_close_tl
\prop_get:NnN \l_siunitx_number_out_prop {#1} \l_siunitx_tmpb_tl
\tl_put_right:NV \l_siunitx_tmpb_tl \l_siunitx_tmpa_tl
\prop_put:NnV \l_siunitx_number_out_prop {#1} \l_siunitx_tmpb_tl
}
-\cs_new_protected_nopar:Npn
+\cs_new_protected:Npn
\siunitx_number_format_uncertainty_sep:n #1 {
\prop_if_in:NnT \l_siunitx_number_out_prop { #1 -integer }
{
@@ -3357,14 +3392,14 @@
\siunitx_combined_output:n {#1}
}
\cs_generate_variant:Nn \siunitx_number_output:n { V }
-\cs_new_protected_nopar:Npn \siunitx_number_output_bracket: {
+\cs_new_protected:Npn \siunitx_number_output_bracket: {
\bool_if:NF \l_siunitx_error_bool
{
\bool_if:NT \l_siunitx_number_compound_bool
{ \siunitx_number_format_brackets:n { result } }
}
}
-\cs_new_protected_nopar:Npn \siunitx_number_output_color: {
+\cs_new_protected:Npn \siunitx_number_output_color: {
\prop_if_in:NnT \l_siunitx_number_out_prop { color }
{
\prop_get:NnN \l_siunitx_number_out_prop { color }
@@ -3384,7 +3419,7 @@
}
}
\cs_generate_variant:Nn \siunitx_number_output_parse:n { V }
-\cs_new_protected_nopar:Npn \siunitx_number_output_parse_aux: {
+\cs_new_protected:Npn \siunitx_number_output_parse_aux: {
\siunitx_number_in_parse:V \l_siunitx_number_arg_tl
\bool_if:NF \l_siunitx_error_bool
{
@@ -3401,7 +3436,7 @@
}
}
}
-\cs_new_protected_nopar:Npn \siunitx_number_output_parts: {
+\cs_new_protected:Npn \siunitx_number_output_parts: {
\bool_if:nTF
{
\tl_if_empty_p:N \l_siunitx_pre_unit_tl &&
@@ -3410,7 +3445,7 @@
{ \siunitx_number_output_single: }
{ \siunitx_number_output_parts_aux: }
}
-\cs_new_protected_nopar:Npn \siunitx_number_output_parts_aux: {
+\cs_new_protected:Npn \siunitx_number_output_parts_aux: {
\bool_if:NTF \l_siunitx_multi_repeat_bool
{
\prop_if_in:NnT \l_siunitx_number_out_prop { mantissa-result }
@@ -3440,30 +3475,24 @@
}
{ \siunitx_number_output_single: }
}
-\cs_new_protected_nopar:Npn \siunitx_number_output_parts_aux:n #1 {
+\cs_new_protected:Npn \siunitx_number_output_parts_aux:n #1 {
\prop_if_in:NnT \l_siunitx_number_out_prop {#1}
{ \siunitx_number_output_parts_print:n {#1} }
\prop_if_in:NnT \l_siunitx_number_out_prop { #1 -uncertainty }
{
\bool_if:NTF \l_siunitx_tight_bool
- {
- \siunitx_print:nn { number }
- { \siunitx_ensuremath:n { { \pm } } }
- }
- {
- \siunitx_print:nn { number }
- { \siunitx_ensuremath:n { { } \pm { } } }
- }
+ { \siunitx_print:nn { number } { \ensuremath { { \pm } } } }
+ { \siunitx_print:nn { number } { \ensuremath { { } \pm { } } } }
\siunitx_number_output_parts_print:n { #1 -uncertainty }
}
}
-\cs_new_protected_nopar:Npn \siunitx_number_output_parts_print:n #1 {
+\cs_new_protected:Npn \siunitx_number_output_parts_print:n #1 {
\siunitx_unit_output_pre_print:
\prop_get:NnN \l_siunitx_number_out_prop {#1} \l_siunitx_tmpa_tl
\siunitx_print:nV { number } \l_siunitx_tmpa_tl
\siunitx_unit_output_print:
}
-\cs_new_protected_nopar:Npn \siunitx_number_output_product: {
+\cs_new_protected:Npn \siunitx_number_output_product: {
\bool_if:NTF \l_siunitx_product_brackets_bool
{
\bool_if:nTF
@@ -3490,10 +3519,9 @@
}
}
}
-\cs_new_protected_nopar:Npn \siunitx_number_output_product_brackets: {
+\cs_new_protected:Npn \siunitx_number_output_product_brackets: {
\siunitx_unit_output_pre_print:
- \siunitx_print:nn { number }
- { \siunitx_ensuremath:n { \l_siunitx_bracket_open_tl } }
+ \siunitx_print:nV { number } \l_siunitx_bracket_open_tl
\nobreak
\tl_set_eq:NN \l_siunitx_unit_saved_tl \l_siunitx_unit_tl
\tl_clear:N \l_siunitx_pre_unit_tl
@@ -3501,11 +3529,10 @@
\siunitx_number_output_product_aux:
\nobreak
\tl_set_eq:NN \l_siunitx_unit_tl \l_siunitx_unit_saved_tl
- \siunitx_print:nn { number }
- { \siunitx_ensuremath:n { \l_siunitx_bracket_close_tl } }
+ \siunitx_print:nV { number } \l_siunitx_bracket_close_tl
\siunitx_unit_output_print:
}
-\cs_new_protected_nopar:Npn \siunitx_number_output_product_aux: {
+\cs_new_protected:Npn \siunitx_number_output_product_aux: {
\bool_set_true:N \l_siunitx_number_compound_bool
\siunitx_number_preprocess:V \l_siunitx_number_arg_tl
\bool_if:NF \l_siunitx_error_bool
@@ -3518,27 +3545,21 @@
\bool_if:NTF \l_siunitx_tight_bool
{
\siunitx_print:nn { number }
- {
- \siunitx_ensuremath:n
- { \l_siunitx_output_product_tl }
- }
+ { \ensuremath { \l_siunitx_output_product_tl } }
}
{
\siunitx_print:nn { number }
- {
- \siunitx_ensuremath:n
- { { } \l_siunitx_output_product_tl { } }
- }
+ { \ensuremath { { } \l_siunitx_output_product_tl { } } }
}
\siunitx_number_output_parse:V \l_siunitx_number_next_tl
}
}
}
-\cs_new_protected_nopar:Npn \siunitx_number_output_quotient: {
+\cs_new_protected:Npn \siunitx_number_output_quotient: {
\use:c
{ siunitx_number_output_quotient_ \l_siunitx_quotient_mode_tl : }
}
-\cs_new_protected_nopar:Npn \siunitx_number_output_quotient_fraction: {
+\cs_new_protected:Npn \siunitx_number_output_quotient_fraction: {
\bool_set_false:N \l_siunitx_number_compound_bool
\siunitx_number_output_quotient_aux_i:
\tl_set:Nx \l_siunitx_number_out_tl
@@ -3554,18 +3575,17 @@
}
\siunitx_number_output_single_aux:
}
-\cs_new_protected_nopar:Npn \siunitx_number_output_quotient_symbol: {
+\cs_new_protected:Npn \siunitx_number_output_quotient_symbol: {
\bool_set_true:N \l_siunitx_number_compound_bool
\siunitx_number_output_quotient_aux_i:
\tl_set_eq:NN \l_siunitx_number_out_tl
\l_siunitx_number_numerator_tl
- \siunitx_tl_put_right_math:NV \l_siunitx_number_out_tl
- \l_siunitx_output_quotient_tl
+ \tl_put_right:NV \l_siunitx_number_out_tl \l_siunitx_output_quotient_tl
\tl_put_right:NV \l_siunitx_number_out_tl
\l_siunitx_number_denominator_tl
\siunitx_number_output_single_aux:
}
-\cs_new_protected_nopar:Npn \siunitx_number_output_quotient_aux_i: {
+\cs_new_protected:Npn \siunitx_number_output_quotient_aux_i: {
\siunitx_number_in_parse:V \l_siunitx_number_numerator_tl
\siunitx_number_output_quotient_aux_ii:
\siunitx_number_output_color:
@@ -3592,11 +3612,11 @@
\prop_get:NnN \l_siunitx_number_out_prop { result }
\l_siunitx_number_denominator_tl
}
-\cs_new_protected_nopar:Npn \siunitx_number_output_quotient_aux_ii: {
+\cs_new_protected:Npn \siunitx_number_output_quotient_aux_ii: {
\siunitx_number_process:
\siunitx_number_format:
}
-\cs_new_protected_nopar:Npn \siunitx_number_output_single: {
+\cs_new_protected:Npn \siunitx_number_output_single: {
\bool_if:nF
{
\tl_if_empty_p:N \l_siunitx_pre_unit_tl &&
@@ -3611,7 +3631,7 @@
\l_siunitx_number_out_tl
\siunitx_number_output_single_aux:
}
-\cs_new_protected_nopar:Npn \siunitx_number_output_single_aux: {
+\cs_new_protected:Npn \siunitx_number_output_single_aux: {
\siunitx_unit_output_pre_print:
\quark_if_no_value:NTF \l_siunitx_number_out_tl
{ \tl_clear:N \l_siunitx_number_unit_product_tl }
@@ -3666,7 +3686,7 @@
{ \siunitx_angle_direct:nnn {#1} {#2} {#3} }
}
}
-\cs_new_protected_nopar:Npn \siunitx_angle_init: {
+\cs_new_protected:Npn \siunitx_angle_init: {
\bool_set_false:N \l_siunitx_angle_degree_space_bool
\bool_set_false:N \l_siunitx_angle_minute_space_bool
\prop_clear:N \l_siunitx_angle_degree_prop
@@ -3755,7 +3775,7 @@
\prop_set_eq:cN { l_siunitx_angle_ #2 _prop }
\l_siunitx_number_in_prop
}
-\cs_new_protected_nopar:Npn \siunitx_angle_check_sign: {
+\cs_new_protected:Npn \siunitx_angle_check_sign: {
\prop_if_empty:NTF \l_siunitx_angle_degree_prop
{
\prop_if_empty:NF \l_siunitx_angle_minute_prop
@@ -3766,7 +3786,7 @@
\siunitx_angle_check_sign_aux:n { second }
}
}
-\cs_new_protected_nopar:Npn \siunitx_angle_check_sign_aux:n #1 {
+\cs_new_protected:Npn \siunitx_angle_check_sign_aux:n #1 {
\prop_if_in:cnTF { l_siunitx_angle_ #1 _prop }
{ mantissa-sign }
{ \msg_error:nn { siunitx } { bad-arc-sign } }
@@ -3776,7 +3796,7 @@
{ \msg_error:nn { siunitx } { bad-arc-sign } }
}
}
-\cs_new_protected_nopar:Npn \siunitx_angle_zero_fill: {
+\cs_new_protected:Npn \siunitx_angle_zero_fill: {
\bool_if:nT
{
\prop_if_empty_p:N \l_siunitx_angle_second_prop &&
@@ -3814,11 +3834,11 @@
\siunitx_angle_sign_shuffle:nn { minute } { degree }
}
}
-\cs_new_protected_nopar:Npn \siunitx_angle_sign_shuffle:nn #1#2 {
+\cs_new_protected:Npn \siunitx_angle_sign_shuffle:nn #1#2 {
\siunitx_angle_sign_shuffle_aux:nnn {#1} {#2} { }
\siunitx_angle_sign_shuffle_aux:nnn {#1} {#2} { -deleted }
}
-\cs_new_protected_nopar:Npn \siunitx_angle_sign_shuffle_aux:nnn
+\cs_new_protected:Npn \siunitx_angle_sign_shuffle_aux:nnn
#1#2#3 {
\prop_get:cnN { l_siunitx_angle_ #1 _prop } { mantissa-sign #3 }
\l_siunitx_tmpa_tl
@@ -3829,22 +3849,22 @@
\l_siunitx_tmpa_tl
}
}
-\cs_new_protected_nopar:Npn \siunitx_angle_print: {
+\cs_new_protected:Npn \siunitx_angle_print: {
\siunitx_angle_print_aux:nn { degree } { \SIUnitSymbolDegree }
\bool_if:NT \l_siunitx_angle_degree_space_bool
{
\nobreak
- \siunitx_ensuremath:n { \l_siunitx_angle_arc_separator_tl }
+ \l_siunitx_angle_arc_separator_tl
}
\siunitx_angle_print_aux:nn { minute } { \SIUnitSymbolArcminute }
\bool_if:NT \l_siunitx_angle_minute_space_bool
{
\nobreak
- \siunitx_ensuremath:n { \l_siunitx_angle_arc_separator_tl }
+ \l_siunitx_angle_arc_separator_tl
}
\siunitx_angle_print_aux:nn { second } { \SIUnitSymbolArcsecond }
}
-\cs_new_protected_nopar:Npn \siunitx_angle_print_aux:nn #1#2 {
+\cs_new_protected:Npn \siunitx_angle_print_aux:nn #1#2 {
\prop_if_empty:cF { l_siunitx_angle_ #1 _prop }
{
\prop_set_eq:Nc \l_siunitx_number_in_prop
@@ -3858,20 +3878,19 @@
{ \siunitx_number_output_single: }
}
}
-\cs_new_protected_nopar:Npn \siunitx_angle_print_astronomy: {
+\cs_new_protected:Npn \siunitx_angle_print_astronomy: {
\prop_if_in:NnTF \l_siunitx_number_in_prop
{ mantissa-decimal-marker }
{ \siunitx_angle_print_astronomy_aux: }
{ \siunitx_number_output_single: }
}
-\cs_new_protected_nopar:Npn \siunitx_angle_print_astronomy_aux: {
+\cs_new_protected:Npn \siunitx_angle_print_astronomy_aux: {
\prop_get:NnNT \l_siunitx_number_out_prop { mantissa-integer }
\l_siunitx_tmpa_tl
{ \siunitx_print:nV { number } \l_siunitx_tmpa_tl }
\hbox_set:Nn \l_siunitx_angle_marker_box
{
- \siunitx_print:nn { number }
- { \siunitx_ensuremath:n { { \l_siunitx_output_decimal_tl } } }
+ \siunitx_print:nn { number } { { \l_siunitx_output_decimal_tl } }
}
\hbox_set:Nn \l_siunitx_angle_unit_box
{
@@ -3893,7 +3912,7 @@
\l_siunitx_tmpa_tl
{ \siunitx_print:nV { number } \l_siunitx_tmpa_tl }
}
-\cs_new_protected_nopar:Npn \siunitx_angle_print_astronomy_aux:n #1 {
+\cs_new_protected:Npn \siunitx_angle_print_astronomy_aux:n #1 {
\dim_set:cn { l_siunitx_angle_ #1 _dim }
{ \box_wd:c { l_siunitx_angle_ #1 _box } }
\hbox_set_to_wd:cnn { l_siunitx_angle_ #1 _box } { \c_zero_skip }
@@ -3903,7 +3922,7 @@
\tex_hss:D
}
}
-\cs_new_protected_nopar:Npn \siunitx_angle_print_astronomy_marker: {
+\cs_new_protected:Npn \siunitx_angle_print_astronomy_marker: {
\hbox_set_to_wd:Nnn \l_siunitx_angle_marker_box
{ \l_siunitx_angle_marker_dim }
{
@@ -3913,7 +3932,7 @@
}
\box_use:N \l_siunitx_angle_marker_box
}
-\cs_new_protected_nopar:Npn \siunitx_angle_print_astronomy_unit: {
+\cs_new_protected:Npn \siunitx_angle_print_astronomy_unit: {
\hbox_set_to_wd:Nnn \l_siunitx_angle_marker_box
{ \l_siunitx_angle_unit_dim }
{
@@ -3929,21 +3948,21 @@
\bool_if:NT \l_siunitx_angle_degree_space_bool
{
\nobreak
- \siunitx_ensuremath:n { \l_siunitx_angle_arc_separator_tl }
+ \l_siunitx_angle_arc_separator_tl
}
\siunitx_angle_print_direct_aux:nn {#2} { \SIUnitSymbolArcminute }
\bool_if:NT \l_siunitx_angle_minute_space_bool
{
\nobreak
- \siunitx_ensuremath:n { \l_siunitx_angle_arc_separator_tl }
+ \l_siunitx_angle_arc_separator_tl
}
\siunitx_angle_print_direct_aux:nn {#3} { \SIUnitSymbolArcsecond }
}
-\cs_new_protected_nopar:Npn \siunitx_angle_print_direct_aux:nn #1#2 {
+\cs_new_protected:Npn \siunitx_angle_print_direct_aux:nn #1#2 {
\tl_if_empty:nF {#1}
{
\tl_set:Nn \l_siunitx_unit_tl {#2}
- \siunitx_print:nn { number } { \siunitx_ensuremath:n {#1} }
+ \siunitx_print:nn { number } { \ensuremath {#1} }
\siunitx_unit_output_print:
}
}
@@ -3964,16 +3983,21 @@
\cs_set:cpn { siunitx_ \token_to_str:N #1 _function:w }
{ \siunitx_unit_parse_power_before:n {#2} }
}
-\cs_new_protected:Npn \siunitx_declare_prefix:Nnnn #1#2#3#4 {
- \tl_put_right:Nn \l_siunitx_declare_list_tl {#1}
- \cs_set:cpn { siunitx_ \token_to_str:N #1 _literal:w } {#2}
- \cs_set:cpn { siunitx_ \token_to_str:N #1 _function:w }
- {
- \bool_if:NTF \l_siunitx_prefix_symbols_bool
- { \siunitx_unit_parse_prefix:n {#2} }
- { \siunitx_unit_parse_prefix:nn {#3} {#4} }
- }
-}
+\cs_new_protected:Npn \siunitx_declare_prefix:Nnnn #1#2#3#4
+ {
+ \tl_put_right:Nn \l_siunitx_declare_list_tl {#1}
+ \prop_put:Nnn \l_siunitx_prefix_forward_prop {#1} {#4}
+ \prop_put:Nnn \l_siunitx_prefix_reverse_prop {#4} {#1}
+ \cs_set:cpn { siunitx_ \token_to_str:N #1 _literal:w } {#2}
+ \cs_set:cpn { siunitx_ \token_to_str:N #1 _function:w }
+ {
+ \bool_if:NTF \l_siunitx_prefix_symbols_bool
+ { \siunitx_unit_parse_prefix:Nn #1 {#2} }
+ { \siunitx_unit_parse_prefix:nn {#3} {#4} }
+ }
+ }
+\prop_new:N \l_siunitx_prefix_forward_prop
+\prop_new:N \l_siunitx_prefix_reverse_prop
\cs_new_protected:Npn \siunitx_declare_qualifier:Nn #1#2 {
\tl_put_right:Nn \l_siunitx_declare_list_tl {#1}
\cs_set:cpn { siunitx_ \token_to_str:N #1 _literal:w }
@@ -4056,15 +4080,15 @@
unit-optional-argument ,
use-xspace ,
}
-\cs_new_protected_nopar:Npn \siunitx_unit_create_empty_functions: {
+\cs_new_protected:Npn \siunitx_unit_create_empty_functions: {
\tl_map_function:NN \l_siunitx_declare_list_tl
\siunitx_unit_create_empty_functions_aux:N
}
-\cs_new_protected_nopar:Npn
+\cs_new_protected:Npn
\siunitx_unit_create_empty_functions_aux:N #1 {
- \cs_if_free:NT #1 { \cs_set_protected_nopar:Npn #1 { \ERROR } }
+ \cs_if_free:NT #1 { \cs_set_protected:Npn #1 { \ERROR } }
}
-\cs_new_protected_nopar:Npn \siunitx_unit_create_functions: {
+\cs_new_protected:Npn \siunitx_unit_create_functions: {
\bool_if:NT \l_siunitx_create_overwrite_bool
{ \tl_map_function:NN \l_siunitx_declare_list_tl \cs_undefine:N }
\bool_if:NTF \l_siunitx_create_optional_bool
@@ -4098,10 +4122,7 @@
\bool_if:NT \l_siunitx_create_prespace_bool
{
\exp_not:n
- {
- \siunitx_ensuremath:n
- { \l_siunitx_number_unit_product_tl }
- }
+ { \ensuremath { \l_siunitx_number_unit_product_tl } }
}
\exp_not:n { \siunitx_unit_output:nn {#1} { } }
\group_end:
@@ -4136,7 +4157,7 @@
{
\exp_not:n
{
- \siunitx_ensuremath:n
+ \ensuremath
{ \l_siunitx_number_unit_product_tl }
}
}
@@ -4154,18 +4175,18 @@
\AtBeginDocument {
\cs_if_eq:NNT \color \use_none:n
{ \cs_set_protected:Npn \color #1 { } }
- \cs_set_nopar:Npn \siunitx_tmp:w #1 { }
+ \cs_set:Npn \siunitx_tmp:w #1 { }
\cs_if_eq:NNT \color \siunitx_tmp:w
{ \cs_set_protected:Npn \color #1 { } }
\tl_map_function:nN { \bar \color \ng \pm \array@row@rst }
\siunitx_protect_symbols:N
}
\tl_put_right:Nn \document { \siunitx_protect_symbols:N \fg }
-\cs_new_protected_nopar:Npn \siunitx_protect_symbols:N #1 {
+\cs_new_protected:Npn \siunitx_protect_symbols:N #1 {
\cs_if_exist:NT #1
{
\siunitx_cs_if_macro:NT #1
- { \cs_set_protected_nopar:Npx #1 { \exp_not:V #1 } }
+ { \cs_set_protected:Npx #1 { \exp_not:V #1 } }
}
}
\keys_define:nn { siunitx } {
@@ -4200,6 +4221,7 @@
\cs_set_eq:NN \siunitx_pm: \pm
\siunitx_unit_parse:nn {#1} {#2}
\siunitx_unit_format:
+ \prop_set_eq:NN \l_siunitx_unit_saved_prop \l_siunitx_unit_prop
\cs_set_eq:NN \pm \siunitx_pm:
}
}
@@ -4207,7 +4229,7 @@
{ \siunitx_unit_format_literal:n {#1} }
}
\cs_generate_variant:Nn \siunitx_unit_in:nn { V }
-\cs_new_nopar:Npn \siunitx_pm: { }
+\cs_new:Npn \siunitx_pm: { }
\cs_new_protected:Npn \siunitx_unit_if_literal:nTF #1#2#3 {
\group_begin:
\tl_map_function:NN \l_siunitx_declare_list_tl
@@ -4226,20 +4248,21 @@
}
\int_new:N \l_siunitx_unit_int
\prop_new:N \l_siunitx_unit_prop
+\prop_new:N \l_siunitx_unit_saved_prop
\bool_new:N \l_siunitx_per_bool
-\keys_define:nn { siunitx } {
- prefixes-as-symbols .bool_set:N = \l_siunitx_prefix_symbols_bool,
- sticky-per .bool_set:N = \l_siunitx_sticky_per_bool,
-}
-\keys_set:nn { siunitx } {
- prefixes-as-symbols = true
-}
+\keys_define:nn { siunitx }
+ {
+ exponent-to-prefix .bool_set:N = \l_siunitx_exp_to_prefix_bool ,
+ prefixes-as-symbols .bool_set:N = \l_siunitx_prefix_symbols_bool ,
+ sticky-per .bool_set:N = \l_siunitx_sticky_per_bool
+ }
+\keys_set:nn { siunitx } { prefixes-as-symbols = true }
\cs_new_protected:Npn \siunitx_unit_parse:nn #1#2 {
\siunitx_unit_parse_init:
\siunitx_unit_parse_options:nn {#1} {#2}
#1
}
-\cs_new_protected_nopar:Npn \siunitx_unit_parse_init: {
+\cs_new_protected:Npn \siunitx_unit_parse_init: {
\prop_clear:N \l_siunitx_unit_prop
\int_zero:N \l_siunitx_unit_int
\bool_set_false:N \l_siunitx_per_bool
@@ -4271,26 +4294,31 @@
{ power- \int_use:N \l_siunitx_unit_int }
\prop_put:NVn \l_siunitx_unit_prop \l_siunitx_tmpa_tl {#1}
}
-\cs_new_protected:Npn \siunitx_unit_parse_prefix:n #1 {
- \int_incr:N \l_siunitx_unit_int
- \tl_set:Nx \l_siunitx_tmpa_tl
- { prefix- \int_use:N \l_siunitx_unit_int }
- \prop_put:NVn \l_siunitx_unit_prop \l_siunitx_tmpa_tl {#1}
-}
-\cs_new_protected:Npn \siunitx_unit_parse_prefix:nn #1#2 {
- \siunitx_unit_parse_prefix:n {#2}
- \tl_set:Nx \l_siunitx_tmpa_tl
- { prefix-base- \int_use:N \l_siunitx_unit_int }
- \prop_put:NVn \l_siunitx_unit_prop \l_siunitx_tmpa_tl {#1}
-}
-\cs_new_protected_nopar:Npn \siunitx_unit_parse_per: {
+\cs_new_protected:Npn \siunitx_unit_parse_prefix:Nn #1#2
+ {
+ \int_incr:N \l_siunitx_unit_int
+ \tl_set:Nx \l_siunitx_tmpa_tl
+ { prefix- \int_use:N \l_siunitx_unit_int }
+ \prop_put:NVn \l_siunitx_unit_prop \l_siunitx_tmpa_tl {#1}
+ \tl_set:Nx \l_siunitx_tmpa_tl
+ { prefix-symbol- \int_use:N \l_siunitx_unit_int }
+ \prop_put:NVn \l_siunitx_unit_prop \l_siunitx_tmpa_tl {#2}
+ }
+\cs_new_protected:Npn \siunitx_unit_parse_prefix:nn #1#2
+ {
+ \siunitx_unit_parse_prefix:Nn \ERROR {#2}
+ \tl_set:Nx \l_siunitx_tmpa_tl
+ { prefix-base- \int_use:N \l_siunitx_unit_int }
+ \prop_put:NVn \l_siunitx_unit_prop \l_siunitx_tmpa_tl {#1}
+ }
+\cs_new_protected:Npn \siunitx_unit_parse_per: {
\tl_set:Nx \l_siunitx_tmpa_tl
{ per- \int_eval:n { \l_siunitx_unit_int + 1 } }
\prop_put:NVn \l_siunitx_unit_prop \l_siunitx_tmpa_tl { true }
\bool_if:NT \l_siunitx_sticky_per_bool
{ \cs_set_eq:NN \per \siunitx_unit_parse_per_error: }
}
-\cs_new_protected_nopar:Npn \siunitx_unit_parse_per_error: {
+\cs_new_protected:Npn \siunitx_unit_parse_per_error: {
\msg_error:nn { siunitx } { duplicate-sticky-per }
}
\cs_new_protected:Npn \siunitx_unit_parse_qualifier:n #1 {
@@ -4309,7 +4337,7 @@
}
\cs_new_protected:Npn \siunitx_unit_parse_unit:Nn #1#2 {
\tl_set:Nx \l_siunitx_tmpa_tl
- { prefix- \int_use:N \l_siunitx_unit_int }
+ { prefix-symbol- \int_use:N \l_siunitx_unit_int }
\prop_if_in:NVTF \l_siunitx_unit_prop \l_siunitx_tmpa_tl
{
\tl_set:Nx \l_siunitx_tmpa_tl
@@ -4326,7 +4354,7 @@
\prop_put:NVn \l_siunitx_unit_prop \l_siunitx_tmpa_tl {#2}
\siunitx_unit_parse_unit_per:
}
-\cs_new_protected_nopar:Npn \siunitx_unit_parse_unit_per: {
+\cs_new_protected:Npn \siunitx_unit_parse_unit_per: {
\bool_if:NT \l_siunitx_sticky_per_bool
{
\bool_if:NT \l_siunitx_per_bool
@@ -4435,7 +4463,7 @@
power-font = number,
qualifier-mode = subscript
}
-\cs_new_protected_nopar:Npn \siunitx_unit_format: {
+\cs_new_protected:Npn \siunitx_unit_format: {
\siunitx_unit_format_init:
\int_while_do:nNnn { \l_siunitx_unit_int } > { 0 }
{
@@ -4453,7 +4481,7 @@
{ \siunitx_unit_format_sorted: }
}
}
-\cs_new_protected_nopar:Npn \siunitx_unit_format_add: {
+\cs_new_protected:Npn \siunitx_unit_format_add: {
\bool_if:NTF \l_siunitx_per_two_parts_bool
{
\tl_set:Nx \l_siunitx_tmpb_tl
@@ -4471,7 +4499,7 @@
{ \siunitx_unit_format_add_aux:n { } }
\tl_clear:N \l_siunitx_unit_current_tl
}
-\cs_new_protected_nopar:Npn \siunitx_unit_format_add_aux:n #1 {
+\cs_new_protected:Npn \siunitx_unit_format_add_aux:n #1 {
\tl_if_empty:cF { l_siunitx_unit #1 _tl }
{
\str_if_eq:VnTF \l_siunitx_per_mode_tl { repeat }
@@ -4505,7 +4533,7 @@
\l_siunitx_unit_current_tl
}
}
-\cs_new_protected_nopar:Npn \siunitx_unit_format_fraction: {
+\cs_new_protected:Npn \siunitx_unit_format_fraction: {
\int_compare:nNnT { \l_siunitx_unit_numerator_int } = { 0 }
{
\str_if_eq:VnT \l_siunitx_per_mode_tl { symbol }
@@ -4522,7 +4550,7 @@
}
{ \tl_set_eq:NN \l_siunitx_unit_tl \l_siunitx_unit_numerator_tl }
}
-\cs_new_protected_nopar:Npn \siunitx_unit_format_fraction_fraction: {
+\cs_new_protected:Npn \siunitx_unit_format_fraction_fraction: {
\tl_if_empty:NT \l_siunitx_unit_numerator_tl
{ \tl_set:Nn \l_siunitx_unit_numerator_tl { 1 } }
\tl_set:Nx \l_siunitx_unit_numerator_tl
@@ -4543,7 +4571,7 @@
\tl_set:Nx \l_siunitx_unit_tl
{ \exp_not:N \ensuremath { \exp_not:V \l_siunitx_unit_tl } }
}
-\cs_new_protected_nopar:Npn \siunitx_unit_format_fraction_auto: {
+\cs_new_protected:Npn \siunitx_unit_format_fraction_auto: {
\mode_if_math:TF
{
\group_begin:
@@ -4572,31 +4600,28 @@
}
{ \siunitx_unit_format_fraction_symbol: }
}
-\cs_new_protected_nopar:Npn \siunitx_unit_format_fraction_symbol: {
+\cs_new_protected:Npn \siunitx_unit_format_fraction_symbol: {
\siunitx_unit_format_fraction_symbol_aux:
\int_compare:nNnT { \l_siunitx_unit_denominator_int } > { 1 }
{
\bool_if:NT \l_siunitx_unit_denominator_bracket_bool
{
- \siunitx_tl_put_left_math:NV \l_siunitx_unit_denominator_tl
- \l_siunitx_bracket_open_tl
- \siunitx_tl_put_right_math:NV \l_siunitx_unit_denominator_tl
- \l_siunitx_bracket_close_tl
+ \tl_put_left:NV \l_siunitx_unit_denominator_tl \l_siunitx_bracket_open_tl
+ \tl_put_right:NV \l_siunitx_unit_denominator_tl \l_siunitx_bracket_close_tl
}
}
\tl_set_eq:NN \l_siunitx_unit_tl \l_siunitx_unit_numerator_tl
- \siunitx_tl_put_right_math:NV \l_siunitx_unit_tl
- \l_siunitx_per_symbol_tl
+ \tl_put_right:NV \l_siunitx_unit_tl \l_siunitx_per_symbol_tl
\tl_put_right:NV \l_siunitx_unit_tl \l_siunitx_unit_denominator_tl
}
-\cs_new_protected_nopar:Npn
+\cs_new_protected:Npn
\siunitx_unit_format_fraction_symbol_aux: { }
-\cs_new_protected_nopar:Npn
+\cs_new_protected:Npn
\siunitx_unit_format_fraction_symbol_aux_alt: {
\tl_if_empty:NT \l_siunitx_unit_numerator_tl
{ \tl_set:Nn \l_siunitx_unit_numerator_tl { 1 } }
}
-\cs_new_protected_nopar:Npn \siunitx_unit_format_init: {
+\cs_new_protected:Npn \siunitx_unit_format_init: {
\bool_set_false:N \l_siunitx_omit_unit_space_bool
\tl_clear:N \l_siunitx_unit_tl
\tl_clear:N \l_siunitx_unit_current_tl
@@ -4618,10 +4643,7 @@
\siunitx_unit_print_literal_aux:N
\tl_set:Nn \l_siunitx_unit_tl {#1}
\tl_set:Nx \l_siunitx_tmpa_tl
- {
- \exp_not:N \siunitx_ensuremath:n
- { \exp_not:o \l_siunitx_unit_product_tl }
- }
+ { \exp_not:N \ensuremath { \exp_not:V \l_siunitx_unit_product_tl } }
\tl_replace_all:NnV \l_siunitx_unit_tl { . } \l_siunitx_tmpa_tl
\tl_replace_all:NnV \l_siunitx_unit_tl { ~ } \l_siunitx_tmpa_tl
\bool_if:NT \l_siunitx_literal_power_bool
@@ -4637,7 +4659,7 @@
\cs_new_protected:Npn \siunitx_unit_format_literal_power:n #1
{ \PrintSuperscript { \siunitx_unit_format_power_aux:n {#1} } }
%\end{macro}
-\cs_new_protected_nopar:Npn \siunitx_unit_format_literal_extras: {
+\cs_new_protected:Npn \siunitx_unit_format_literal_extras: {
\siunitx_unit_format_literal_extras_aux:nN { 176 }
\SIUnitSymbolDegree
\siunitx_unit_format_literal_extras_aux:nN { 181 }
@@ -4645,7 +4667,7 @@
\siunitx_unit_format_literal_extras_aux:nN { 197 }
\SIUnitSymbolAngstrom
}
-\cs_new_protected_nopar:Npn
+\cs_new_protected:Npn
\siunitx_unit_format_literal_extras_aux:nN #1#2 {
\char_set_lccode:nn { `\@ } {#1}
\tl_to_lowercase:n
@@ -4654,28 +4676,26 @@
\l_siunitx_unit_tl
}
}
-\xetex_if_engine:F {
- \luatex_if_engine:F
- {
- \AtBeginDocument
- {
- \cs_if_exist:NTF \inputencodingname
- {
- \tl_set:Nn \l_siunitx_tmpa_tl { latin1 , latin5 , latin9 }
- \clist_if_in:NVF \l_siunitx_tmpa_tl \inputencodingname
- {
- \cs_set_eq:NN \siunitx_unit_format_literal_extras:
- \scan_stop:
- }
- }
- {
- \cs_set_eq:NN \siunitx_unit_format_literal_extras:
- \scan_stop:
- }
- }
- }
-}
-\cs_new_protected_nopar:Npn \siunitx_unit_format_power: {
+\pdftex_if_engine:T
+ {
+ \AtBeginDocument
+ {
+ \cs_if_exist:NTF \inputencodingname
+ {
+ \tl_set:Nn \l_siunitx_tmpa_tl { latin1 , latin5 , latin9 }
+ \clist_if_in:NVF \l_siunitx_tmpa_tl \inputencodingname
+ {
+ \cs_set_eq:NN \siunitx_unit_format_literal_extras:
+ \scan_stop:
+ }
+ }
+ {
+ \cs_set_eq:NN \siunitx_unit_format_literal_extras:
+ \scan_stop:
+ }
+ }
+ }
+\cs_new_protected:Npn \siunitx_unit_format_power: {
\tl_set:Nx \l_siunitx_tmpa_tl
{ power- \int_use:N \l_siunitx_unit_int }
\prop_get:NVNTF \l_siunitx_unit_prop \l_siunitx_tmpa_tl
@@ -4691,7 +4711,7 @@
}
}
}
-\cs_new_protected_nopar:Npn \siunitx_unit_format_power_aux: {
+\cs_new_protected:Npn \siunitx_unit_format_power_aux: {
\str_if_eq:VnTF \l_siunitx_per_mode_tl { repeat }
{ \siunitx_unit_format_power_repeat: }
{ \siunitx_unit_format_power_per: }
@@ -4723,18 +4743,16 @@
\siunitx_print:nV {#1} \l_siunitx_tmpa_tl
}
}
-\cs_new_protected_nopar:Npn \siunitx_unit_format_power_brackets: {
+\cs_new_protected:Npn \siunitx_unit_format_power_brackets: {
\tl_set:Nx \l_siunitx_tmpb_tl
{ bracket- \int_use:N \l_siunitx_unit_int }
\prop_if_in:NVT \l_siunitx_unit_prop \l_siunitx_tmpb_tl
{
- \siunitx_tl_put_left_math:NV \l_siunitx_unit_current_tl
- \l_siunitx_bracket_open_tl
- \siunitx_tl_put_right_math:NV \l_siunitx_unit_current_tl
- \l_siunitx_bracket_close_tl
+ \tl_put_left:NV \l_siunitx_unit_current_tl \l_siunitx_bracket_open_tl
+ \tl_put_right:NV \l_siunitx_unit_current_tl \l_siunitx_bracket_close_tl
}
}
-\cs_new_protected_nopar:Npn \siunitx_unit_format_power_per: {
+\cs_new_protected:Npn \siunitx_unit_format_power_per: {
\tl_set:Nx \l_siunitx_tmpb_tl
{ per- \int_use:N \l_siunitx_unit_int }
\prop_if_in:NVT \l_siunitx_unit_prop \l_siunitx_tmpb_tl
@@ -4751,18 +4769,17 @@
}
}
}
-\cs_new_protected_nopar:Npn \siunitx_unit_format_power_repeat: {
+\cs_new_protected:Npn \siunitx_unit_format_power_repeat: {
\tl_set:Nx \l_siunitx_tmpb_tl
{ per- \int_use:N \l_siunitx_unit_int }
\prop_if_in:NVT \l_siunitx_unit_prop \l_siunitx_tmpb_tl
{
- \siunitx_tl_put_left_math:NV \l_siunitx_unit_current_tl
- \l_siunitx_per_symbol_tl
+ \tl_put_left:NV \l_siunitx_unit_current_tl \l_siunitx_per_symbol_tl
}
}
-\cs_new_protected_nopar:Npn \siunitx_unit_format_prefix: {
+\cs_new_protected:Npn \siunitx_unit_format_prefix: {
\tl_set:Nx \l_siunitx_tmpa_tl
- { prefix- \int_use:N \l_siunitx_unit_int }
+ { prefix-symbol- \int_use:N \l_siunitx_unit_int }
\prop_if_in:NVT \l_siunitx_unit_prop \l_siunitx_tmpa_tl
{
\prop_get:NVN \l_siunitx_unit_prop \l_siunitx_tmpa_tl
@@ -4772,7 +4789,7 @@
{ \siunitx_unit_format_prefix_number: }
}
}
-\cs_new_protected_nopar:Npn \siunitx_unit_format_prefix_number: {
+\cs_new_protected:Npn \siunitx_unit_format_prefix_number: {
\tl_set:Nx \l_siunitx_tmpa_tl
{ prefix-base- \int_use:N \l_siunitx_unit_int }
\prop_get:NVN \l_siunitx_unit_prop \l_siunitx_tmpa_tl
@@ -4787,7 +4804,7 @@
{ \siunitx_unit_format_prefix_number_calc: }
{ \msg_error:nn { siunitx } { prefix-base-mismatch } }
}
-\cs_new_protected_nopar:Npn \siunitx_unit_format_prefix_number_calc: {
+\cs_new_protected:Npn \siunitx_unit_format_prefix_number_calc: {
\tl_set:Nx \l_siunitx_tmpa_tl
{ power- \int_use:N \l_siunitx_unit_int }
\prop_get:NVNF \l_siunitx_unit_prop \l_siunitx_tmpa_tl
@@ -4828,11 +4845,11 @@
}
}
}
-\cs_new_protected_nopar:Npn \siunitx_unit_format_prefix_symbol: {
+\cs_new_protected:Npn \siunitx_unit_format_prefix_symbol: {
\tl_set_eq:NN \l_siunitx_unit_current_tl
\l_siunitx_unit_prefix_current_tl
}
-\cs_new_protected_nopar:Npn \siunitx_unit_format_qualifier: {
+\cs_new_protected:Npn \siunitx_unit_format_qualifier: {
\tl_set:Nx \l_siunitx_tmpa_tl
{ qualifier- \int_use:N \l_siunitx_unit_int }
\prop_get:NVNT \l_siunitx_unit_prop \l_siunitx_tmpa_tl
@@ -4845,15 +4862,13 @@
}
}
}
-\cs_new_protected_nopar:Npn \siunitx_unit_format_qualifier_brackets: {
- \siunitx_tl_put_right_math:NV \l_siunitx_unit_current_tl
- \l_siunitx_bracket_open_tl
+\cs_new_protected:Npn \siunitx_unit_format_qualifier_brackets: {
+ \tl_put_right:NV \l_siunitx_unit_current_tl \l_siunitx_bracket_open_tl
\tl_put_right:NV \l_siunitx_unit_current_tl \l_siunitx_tmpa_tl
- \siunitx_tl_put_right_math:NV \l_siunitx_unit_current_tl
- \l_siunitx_bracket_close_tl
+ \tl_put_right:NV \l_siunitx_unit_current_tl \l_siunitx_bracket_close_tl
}
\char_set_catcode_active:N \~
-\cs_new_protected_nopar:Npn \siunitx_unit_format_qualifier_space: {
+\cs_new_protected:Npn \siunitx_unit_format_qualifier_space: {
\tl_put_right:Nn \l_siunitx_unit_current_tl { \text { ~ } }
\tl_put_right:NV \l_siunitx_unit_current_tl \l_siunitx_tmpa_tl
\tl_set:Nx \l_siunitx_tmpa_tl
@@ -4861,14 +4876,14 @@
\prop_put:NVn \l_siunitx_unit_prop \l_siunitx_tmpa_tl { true }
}
\char_set_catcode_space:N \~
-\cs_new_protected_nopar:Npn \siunitx_unit_format_qualifier_subscript: {
+\cs_new_protected:Npn \siunitx_unit_format_qualifier_subscript: {
\tl_put_right:Nx \l_siunitx_unit_current_tl
{ \exp_not:N \PrintSubscript { \exp_not:V \l_siunitx_tmpa_tl } }
}
-\cs_new_protected_nopar:Npn \siunitx_unit_format_qualifier_text: {
+\cs_new_protected:Npn \siunitx_unit_format_qualifier_text: {
\tl_put_right:NV \l_siunitx_unit_current_tl \l_siunitx_tmpa_tl
}
-\cs_new_protected_nopar:Npn \siunitx_unit_format_sorted: {
+\cs_new_protected:Npn \siunitx_unit_format_sorted: {
\tl_set_eq:NN \l_siunitx_unit_tl \l_siunitx_unit_numerator_tl
\tl_if_empty:NTF \l_siunitx_unit_tl
{
@@ -4880,7 +4895,7 @@
}
\tl_put_right:NV \l_siunitx_unit_tl \l_siunitx_unit_denominator_tl
}
-\cs_new_protected_nopar:Npn \siunitx_unit_format_symbol: {
+\cs_new_protected:Npn \siunitx_unit_format_symbol: {
\tl_set:Nx \l_siunitx_tmpa_tl
{ symbol- \int_use:N \l_siunitx_unit_int }
\prop_get:NVNTF \l_siunitx_unit_prop \l_siunitx_tmpa_tl
@@ -4890,13 +4905,14 @@
}
{ \siunitx_unit_format_symbol_aux: }
}
-\cs_new_protected_nopar:Npn \siunitx_unit_format_symbol_aux: {
+\cs_new_protected:Npn \siunitx_unit_format_symbol_aux: {
\msg_error:nn { siunitx } { prefix-only }
}
-\cs_new_protected_nopar:Npn \siunitx_unit_format_symbol_aux_alt: {
+\cs_new_protected:Npn \siunitx_unit_format_symbol_aux_alt: {
\int_compare:nNnTF { \l_siunitx_unit_int } = { 1 }
{
\prop_del:Nn \l_siunitx_unit_prop { prefix-1 }
+ \prop_del:Nn \l_siunitx_unit_prop { prefix-symbol-1 }
\prop_del:Nn \l_siunitx_unit_prop { prefix-base-1 }
\prop_if_empty:NF \l_siunitx_unit_prop
{ \msg_error:nn { siunitx } { prefix-only } }
@@ -5003,7 +5019,7 @@
\siunitx_print:nV { unit } \l_siunitx_unit_tl
}
\cs_generate_variant:Nn \siunitx_unit_output:nn { V }
-\cs_new_protected_nopar:Npn \siunitx_unit_output_number_sep: {
+\cs_new_protected:Npn \siunitx_unit_output_number_sep: {
\bool_if:NTF \l_siunitx_number_unit_breaks_bool
{ \penalty \binoppenalty } { \nobreak }
\bool_if:NTF \l_siunitx_per_auto_bool
@@ -5023,18 +5039,18 @@
}
{ \siunitx_unit_output_number_sep_aux: }
}
-\cs_new_protected_nopar:Npn \siunitx_unit_output_number_sep_aux: {
+\cs_new_protected:Npn \siunitx_unit_output_number_sep_aux: {
\bool_if:NF \l_siunitx_omit_unit_space_bool
- { \siunitx_ensuremath:n { \l_siunitx_number_unit_product_tl } }
+ { \ensuremath { \l_siunitx_number_unit_product_tl } }
}
-\cs_new_protected_nopar:Npn \siunitx_unit_output_pre_print: {
+\cs_new_protected:Npn \siunitx_unit_output_pre_print: {
\tl_if_empty:NF \l_siunitx_pre_unit_tl
{
\nobreak
\siunitx_print:nV { unit } \l_siunitx_pre_unit_tl
}
}
-\cs_new_protected_nopar:Npn \siunitx_unit_output_print: {
+\cs_new_protected:Npn \siunitx_unit_output_print: {
\int_compare:nNnF { \l_siunitx_unit_prefix_int } = { 0 }
{
\tl_set:Nx \l_siunitx_tmpa_tl
@@ -5088,7 +5104,7 @@
}
{
\siunitx_unit_output_pre_print:
- \siunitx_print:nn { number } { \siunitx_ensuremath:n {#1} }
+ \siunitx_print:nn { number } { \ensuremath {#1} }
\siunitx_unit_output_print:
}
}
@@ -5127,80 +5143,100 @@
\bool_new:N \l_siunitx_list_repeat_bool
\tl_new:N \l_siunitx_list_current_tl
\tl_new:N \l_siunitx_list_tl
-\keys_define:nn { siunitx } {
- list-final-separator .tl_set:N = \l_siunitx_list_separator_final_tl,
- list-separator .tl_set:N = \l_siunitx_list_separator_tl,
- list-units .choice:,
- list-units
- / brackets .code:n =
- {
- \bool_set_true:N \l_siunitx_list_brackets_bool
- \bool_set_false:N \l_siunitx_list_repeat_bool
- },
- list-units
- / repeat .code:n =
- {
- \bool_set_false:N \l_siunitx_list_brackets_bool
- \bool_set_true:N \l_siunitx_list_repeat_bool
- },
- list-units
- / single .code:n =
- {
- \bool_set_false:N \l_siunitx_list_brackets_bool
- \bool_set_false:N \l_siunitx_list_repeat_bool
- },
-}
-\keys_set:nn { siunitx } {
- list-final-separator = { ~ and ~ },
- list-separator = { , ~ },
- list-units = repeat,
-}
-\cs_new_protected:Npn \siunitx_list_numbers:n #1 {
- \tl_clear:N \l_siunitx_unit_tl
- \tl_clear:N \l_siunitx_preunit_tl
- \siunitx_list_numbers_aux_i:n {#1}
-}
-\cs_new_protected:Npn \siunitx_list_numbers_aux_i:n #1 {
- \tl_clear:N \l_siunitx_list_tl
- \tl_clear:N \l_siunitx_list_current_tl
- \tl_map_function:nN {#1} \siunitx_list_numbers_aux_ii:n
- \tl_put_right:NV \l_siunitx_list_tl \l_siunitx_list_separator_final_tl
- \tl_put_right:NV \l_siunitx_list_tl \l_siunitx_list_current_tl
- \tl_use:N \l_siunitx_list_tl
-}
-\cs_new_protected:Npn \siunitx_list_numbers_aux_ii:n #1 {
- \tl_if_empty:NTF \l_siunitx_list_tl
- { \tl_set_eq:NN \l_siunitx_list_tl \l_siunitx_list_current_tl }
- {
- \tl_put_right:NV \l_siunitx_list_tl \l_siunitx_list_separator_tl
- \tl_put_right:NV \l_siunitx_list_tl \l_siunitx_list_current_tl
- }
- \tl_set:Nn \l_siunitx_list_current_tl
- { \siunitx_combined_output:n {#1} }
-}
-\cs_new_protected:Npn \siunitx_list_units:nnn #1#2#3 {
- \siunitx_unit_parse_options:nn {#2} {#3}
- \bool_if:NTF \l_siunitx_list_repeat_bool
- {
- \siunitx_unit_in:nn {#2} {#3}
- \siunitx_list_numbers_aux_i:n {#1}
- }
- {
- \bool_if:NT \l_siunitx_list_brackets_bool
+\keys_define:nn { siunitx }
+ {
+ list-final-separator .tl_set:N = \l_siunitx_list_separator_final_tl ,
+ list-pair-separator .tl_set:N = \l_siunitx_list_separator_pair_tl ,
+ list-separator .tl_set:N = \l_siunitx_list_separator_tl ,
+ list-units .choice:,
+ list-units
+ / brackets .code:n =
+ {
+ \bool_set_true:N \l_siunitx_list_brackets_bool
+ \bool_set_false:N \l_siunitx_list_repeat_bool
+ },
+ list-units
+ / repeat .code:n =
{
- \siunitx_print:nn { number }
- { \siunitx_ensuremath:n { \l_siunitx_bracket_open_tl } }
- }
- \siunitx_list_numbers:n {#1}
- \bool_if:NT \l_siunitx_list_brackets_bool
+ \bool_set_false:N \l_siunitx_list_brackets_bool
+ \bool_set_true:N \l_siunitx_list_repeat_bool
+ },
+ list-units
+ / single .code:n =
{
- \siunitx_print:nn { number }
- { \siunitx_ensuremath:n { \l_siunitx_bracket_close_tl } }
+ \bool_set_false:N \l_siunitx_list_brackets_bool
+ \bool_set_false:N \l_siunitx_list_repeat_bool
}
- \siunitx_unit_output_number_sep:
- \siunitx_unit_output:nn {#2} {#3}
- }
+ }
+\keys_set:nn { siunitx }
+ {
+ list-final-separator = { ~ and ~ } ,
+ list-pair-separator = { ~ and ~ } ,
+ list-separator = { , ~ } ,
+ list-units = repeat
}
+\cs_new_protected:Npn \siunitx_list_numbers:n #1
+ {
+ \tl_clear:N \l_siunitx_unit_tl
+ \tl_clear:N \l_siunitx_preunit_tl
+ \siunitx_list_numbers_aux_i:n {#1}
+ }
+\cs_new_protected:Npn \siunitx_list_numbers_aux_i:n #1
+ {
+ \bool_set_true:N \l_siunitx_list_first_bool
+ \tl_clear:N \l_siunitx_list_current_tl
+ \int_compare:nNnTF { \tl_length:n {#1} } > \c_two
+ {
+ \tl_map_function:nN {#1} \siunitx_list_numbers_aux_ii:n
+ \l_siunitx_list_tl
+ \l_siunitx_list_separator_final_tl
+ \l_siunitx_list_current_tl
+ }
+ {
+ \int_compare:nNnTF { \tl_length:n {#1} } = \c_two
+ { \siunitx_list_numbers_aux:nn #1 }
+ { \siunitx_combined_output:n {#1} }
+ }
+ \tl_put_right:NV \l_siunitx_list_tl \l_siunitx_list_separator_final_tl
+ \tl_put_right:NV \l_siunitx_list_tl \l_siunitx_list_current_tl
+ }
+\cs_new_protected:Npn \siunitx_list_numbers_aux_ii:n #1
+ {
+ \tl_if_empty:NTF \l_siunitx_list_tl
+ { \tl_set_eq:NN \l_siunitx_list_tl \l_siunitx_list_current_tl }
+ {
+ \tl_put_right:NV \l_siunitx_list_tl \l_siunitx_list_separator_tl
+ \tl_put_right:NV \l_siunitx_list_tl \l_siunitx_list_current_tl
+ }
+ \tl_set:Nn \l_siunitx_list_current_tl { \siunitx_combined_output:n {#1} }
+ }
+\cs_new_protected:Npn \siunitx_list_numbers_aux:nn #1#2
+ {
+ \siunitx_combined_output:n {#1}
+ \l_siunitx_list_separator_pair_tl
+ \siunitx_combined_output:n {#2}
+ }
+\cs_new_protected:Npn \siunitx_list_units:nnn #1#2#3
+ {
+ \siunitx_unit_parse_options:nn {#2} {#3}
+ \bool_if:NTF \l_siunitx_list_repeat_bool
+ {
+ \siunitx_unit_in:nn {#2} {#3}
+ \siunitx_list_numbers_aux_i:n {#1}
+ }
+ {
+ \bool_if:NT \l_siunitx_process_fixed_bool
+ { \bool_set_true:N \l_siunitx_process_drop_exponent_bool }
+ \bool_if:NT \l_siunitx_list_brackets_bool
+ { \siunitx_print:nV { number } \l_siunitx_bracket_open_tl }
+ \siunitx_list_numbers:n {#1}
+ \bool_if:NT \l_siunitx_list_brackets_bool
+ { \siunitx_print:nV { number } \l_siunitx_bracket_close_tl }
+ \siunitx_range_exponent:
+ \siunitx_unit_output_number_sep:
+ \siunitx_unit_output:nn {#2} {#3}
+ }
+ }
\bool_new:N \l_siunitx_range_brackets_bool
\bool_new:N \l_siunitx_range_repeat_bool
\keys_define:nn { siunitx } {
@@ -5229,27 +5265,29 @@
range-phrase = { ~ to ~ },
range-units = repeat,
}
-\cs_new_protected:Npn \siunitx_range_numbers:nn #1#2 {
- \siunitx_range_numbers_aux:n {#1}
- \l_siunitx_range_phrase_tl
- \siunitx_range_numbers_aux:n {#2}
-}
-\cs_new_protected:Npn \siunitx_range_numbers_aux:n #1 {
- \bool_if:NTF \l_siunitx_number_parse_bool
- {
- \tl_clear:N \l_siunitx_number_out_tl
- \tl_clear:N \l_siunitx_number_out_saved_tl
- \bool_set_false:N \l_siunitx_number_compound_bool
- \siunitx_number_output_parse:n {#1}
- \bool_if:NT \l_siunitx_number_compound_bool
- { \msg_error:nnx { siunitx } { multi-part-range } {#1} }
- }
- {
- \siunitx_unit_output_pre_print:
- \siunitx_print:nn { number } {#1}
- \siunitx_unit_output_print:
- }
-}
+\cs_new_protected:Npn \siunitx_range_numbers:nn #1#2
+ {
+ \siunitx_range_numbers_aux:n {#1}
+ \l_siunitx_range_phrase_tl
+ \siunitx_range_numbers_aux:n {#2}
+ }
+\cs_new_protected:Npn \siunitx_range_numbers_aux:n #1
+ {
+ \bool_if:NTF \l_siunitx_number_parse_bool
+ {
+ \tl_clear:N \l_siunitx_number_out_tl
+ \tl_clear:N \l_siunitx_number_out_saved_tl
+ \bool_set_false:N \l_siunitx_number_compound_bool
+ \siunitx_number_output_parse:n {#1}
+ \bool_if:NT \l_siunitx_number_compound_bool
+ { \msg_error:nnx { siunitx } { multi-part-range } {#1} }
+ }
+ {
+ \siunitx_unit_output_pre_print:
+ \siunitx_print:nn { number } {#1}
+ \siunitx_unit_output_print:
+ }
+ }
\cs_new_protected:Npn \siunitx_range_unit:nnnn #1#2#3#4 {
\siunitx_unit_parse_options:nn {#1} {#2}
\bool_if:NTF \l_siunitx_range_repeat_bool
@@ -5260,21 +5298,34 @@
\siunitx_range_numbers_aux:n {#4}
}
{
+ \bool_if:NT \l_siunitx_process_fixed_bool
+ { \bool_set_true:N \l_siunitx_process_drop_exponent_bool }
\bool_if:NT \l_siunitx_range_brackets_bool
- {
- \siunitx_print:nn { number }
- { \siunitx_ensuremath:n { \l_siunitx_bracket_open_tl } }
- }
+ { \siunitx_print:nV { number } \l_siunitx_bracket_open_tl }
\siunitx_range_numbers:nn {#3} {#4}
\bool_if:NT \l_siunitx_range_brackets_bool
- {
- \siunitx_print:nn { number }
- { \siunitx_ensuremath:n { \l_siunitx_bracket_close_tl } }
- }
+ { \siunitx_print:nV { number } \l_siunitx_bracket_close_tl }
+ \siunitx_range_exponent:
\siunitx_unit_output_number_sep:
\siunitx_unit_output:nn {#1} {#2}
}
}
+\cs_new_protected:Npn \siunitx_range_exponent:
+ {
+ \bool_if:NT \l_siunitx_process_fixed_bool
+ {
+ \tl_set_eq:NN \l_siunitx_tmpa_tl \l_siunitx_exponent_product_tl
+ \bool_if:NT \l_siunitx_tight_bool
+ { \tl_set:Nx \l_siunitx_tmpa_tl { { \exp_not:o \l_siunitx_tmpa_tl } } }
+ \tl_set:Nx \l_siunitx_tmpa_tl
+ {
+ \exp_not:N \ensuremath { { } \exp_not:o \l_siunitx_tmpa_tl { } }
+ 10 \exp_not:N \PrintSuperscript
+ { \int_use:N \l_siunitx_process_fixed_int }
+ }
+ \siunitx_print:nV { number } \l_siunitx_tmpa_tl
+ }
+ }
\AtBeginDocument {
\@ifpackageloaded { cellspace }
{
@@ -5287,9 +5338,9 @@
}
{ }
}
-\cs_new_protected_nopar:Npn \siunitx_table_rewrite_create:N #1 {
+\cs_new_protected:Npn \siunitx_table_rewrite_create:N #1 {
\newcolumntype {#1} { }
- \cs_set_protected_nopar:Npn
+ \cs_set_protected:Npn
\siunitx_table_rewrite_create_aux:w \NC@do ##1##2 \NC@do #1
{ \NC@list { \NC@do ##1 \NC@do #1 ##2 } }
\exp_after:wN \siunitx_table_rewrite_create_aux:w \tex_the:D \NC@list
@@ -5305,7 +5356,7 @@
\NC@find
}
}
-\cs_new_protected_nopar:Npn \siunitx_table_rewrite_create_aux:w { }
+\cs_new_protected:Npn \siunitx_table_rewrite_create_aux:w { }
\AtBeginDocument { \siunitx_table_rewrite_create:N s }
\AtBeginDocument { \siunitx_table_rewrite_create:N S }
\tl_new:N \l_siunitx_table_collect_tl
@@ -5319,14 +5370,14 @@
\keys_set:nn { siunitx } {#2}
\use:c { siunitx_table_collect_begin_ #1 : }
}
-\cs_new_protected_nopar:Npn \siunitx_table_collect_begin_s: {
+\cs_new_protected:Npn \siunitx_table_collect_begin_s: {
\cs_set_eq:NN \siunitx_table_collect_token:N
\siunitx_table_collect_token_s:N
\cs_set_eq:NN \siunitx_table_print: \siunitx_table_print_s:
\siunitx_table_collect_init_s:
\siunitx_table_collect_get:
}
-\cs_new_protected_nopar:Npn \siunitx_table_collect_begin_S: {
+\cs_new_protected:Npn \siunitx_table_collect_begin_S: {
\cs_set_eq:NN \siunitx_table_collect_token:N
\siunitx_table_collect_token_S:N
\cs_set_eq:NN \siunitx_table_print: \siunitx_table_print_S:
@@ -5356,7 +5407,7 @@
{
\tl_use:N \l_siunitx_table_collect_pre_tl
\tl_clear:N \l_siunitx_table_collect_pre_tl
- \cs_set_nopar:Npn \siunitx_table_collect_next:
+ \cs_set:Npn \siunitx_table_collect_next:
{ \exp_after:wN \siunitx_table_collect_get: #1 }
}
{
@@ -5388,10 +5439,10 @@
}
}
}
-\cs_new_protected_nopar:Npn \siunitx_table_collect_get: {
+\cs_new_protected:Npn \siunitx_table_collect_get: {
\cs_set_eq:NN \siunitx_table_collect_next:
\siunitx_table_collect_get:
- \cs_set_nopar:Npn \peek_execute_branches:
+ \cs_set:Npn \peek_execute_branches:
{
\if_catcode:w \exp_not:N \l_peek_token \c_group_begin_token
\exp_after:wN \siunitx_table_collect_braced:n
@@ -5401,14 +5452,14 @@
}
\peek_after:Nw \peek_ignore_spaces_execute_branches:
}
-\cs_new_protected_nopar:Npn \siunitx_table_collect_init: {
+\cs_new_protected:Npn \siunitx_table_collect_init: {
\tl_clear:N \l_siunitx_table_collect_tl
\tl_clear:N \l_siunitx_table_collect_pre_tl
\tl_clear:N \l_siunitx_table_collect_post_tl
\bool_set_false:N \l_siunitx_table_collect_post_bool
\bool_set_false:N \l_siunitx_table_math_bool
}
-\cs_new_protected_nopar:Npn \siunitx_table_collect_init_s: {
+\cs_new_protected:Npn \siunitx_table_collect_init_s: {
\siunitx_table_collect_init:
\bool_set_false:N \l_siunitx_table_collect_pre_bool
\cs_set_protected:Npn \siunitx_table_collect_braced:n ##1
@@ -5417,7 +5468,7 @@
\siunitx_table_collect_next:
}
}
-\cs_new_protected_nopar:Npn \siunitx_table_collect_init_S: {
+\cs_new_protected:Npn \siunitx_table_collect_init_S: {
\siunitx_number_in_init:
\tl_set:Nx \l_siunitx_number_valid_tl
{
@@ -5444,13 +5495,13 @@
\siunitx_table_collect_next:
}
}
-\cs_new_protected_nopar:Npn \siunitx_table_collect_next: { }
-\cs_new_protected_nopar:Npn \siunitx_table_collect_newline: {
+\cs_new_protected:Npn \siunitx_table_collect_next: { }
+\cs_new_protected:Npn \siunitx_table_collect_newline: {
\siunitx_table_print:
\cs_set_eq:NN \siunitx_table_print: \prg_do_nothing:
\tabularnewline
}
-\cs_new_protected_nopar:Npn \siunitx_table_collect_end: {
+\cs_new_protected:Npn \siunitx_table_collect_end: {
\siunitx_table_print:
\cs_set_eq:NN \siunitx_table_print: \prg_do_nothing:
\end
@@ -5513,21 +5564,21 @@
{
\@ifpackageloaded { colortbl }
{
- \cs_new_protected_nopar:Npn \siunitx_table_colortbl_correction:
+ \cs_new_protected:Npn \siunitx_table_colortbl_correction:
{
\skip_horizontal:n { \c_zero_skip plus -0.5 fill }
\tex_kern:D \c_zero_skip
}
}
- { \cs_new_protected_nopar:Npn \siunitx_table_colortbl_correction: { } }
+ { \cs_new_protected:Npn \siunitx_table_colortbl_correction: { } }
}
-\cs_new_protected_nopar:Npn \siunitx_table_align_left:n #1
+\cs_new_protected:Npn \siunitx_table_align_left:n #1
{
\siunitx_table_colortbl_correction:
\skip_horizontal:n {#1}
\tex_kern:D \c_zero_skip
}
-\cs_new_protected_nopar:Npn \siunitx_table_align_right:n #1
+\cs_new_protected:Npn \siunitx_table_align_right:n #1
{
\skip_horizontal:n { \c_siunitx_one_fill_skip - #1 }
\tex_kern:D \c_zero_skip
@@ -5547,7 +5598,7 @@
\siunitx_table_align_right:n
}
{
- \cs_set_protected_nopar:Npn \siunitx_table_column_begin:n ##1
+ \cs_set_protected:Npn \siunitx_table_column_begin:n ##1
{
\siunitx_table_colortbl_correction:
\tex_hbox:D to \dim_eval:n {#1}
@@ -5555,7 +5606,7 @@
\skip_horizontal:n {##1}
\tex_kern:D \c_zero_skip
}
- \cs_set_protected_nopar:Npn \siunitx_table_column_end:n ##1
+ \cs_set_protected:Npn \siunitx_table_column_end:n ##1
{
\skip_horizontal:n { \c_siunitx_one_fill_skip - ##1 }
\tex_kern:D \c_zero_skip
@@ -5586,7 +5637,7 @@
}
}
\keys_set:nn { siunitx } { table-unit-alignment = center }
-\cs_new_protected_nopar:Npn \siunitx_table_print_s:
+\cs_new_protected:Npn \siunitx_table_print_s:
{
\siunitx_table_column_begin:n { \l_siunitx_table_unit_align_skip }
\siunitx_unit_output:Vn \l_siunitx_table_collect_tl { }
@@ -5608,16 +5659,9 @@
\box_new:N \l_siunitx_table_result_box
\skip_new:N \l_siunitx_table_number_align_skip
\skip_new:N \l_siunitx_table_text_align_skip
-\cs_new_protected_nopar:Npn \siunitx_table_print_S_direct_main: { }
-\cs_new_protected_nopar:Npn \siunitx_table_print_S_main: { }
-\cs_new_protected_nopar:Npn \siunitx_table_print_S_parsed: { }
-\cs_new_protected_nopar:Npn \siunitx_table_print_S_pre: { }
-\cs_new_protected_nopar:Npn \siunitx_table_print_S_post: { }
-\cs_new_protected_nopar:Npn \siunitx_table_print_S_reserved_exponent_aux: { }
-\cs_new_protected_nopar:Npn
- \siunitx_table_print_S_reserved_mantissa_uncert_aux: { }
-\cs_new_protected_nopar:Npn \siunitx_table_print_S_reserved_round: { }
-\cs_new_protected_nopar:Npn \siunitx_table_print_S_reserved_store_fill:n #1 { }
+\cs_new_protected:Npn \siunitx_table_print_S_direct_main: { }
+\cs_new_protected:Npn \siunitx_table_print_S_parsed: { }
+\cs_new_protected:Npn \siunitx_table_print_S_reserved_store_fill:n #1 { }
\keys_define:nn { siunitx }
{
table-align-comparator .choice:,
@@ -5634,73 +5678,14 @@
\siunitx_table_print_S_reserved_store_fill_mid:n
},
table-align-comparator .default:n = true,
- table-align-exponent .choice:,
- table-align-exponent /
- false .code:n =
- {
- \cs_set_eq:NN \siunitx_table_print_S_reserved_exponent_aux:
- \siunitx_table_print_S_reserved_exponent_not_aligned:
- },
- table-align-exponent /
- true .code:n =
- {
- \cs_set_eq:NN \siunitx_table_print_S_reserved_exponent_aux:
- \siunitx_table_print_S_reserved_exponent_aligned:
- },
- table-align-exponent .default:n = true,
- table-align-text-pre .choice:,
- table-align-text-pre /
- false .code:n =
- {
- \cs_set_eq:NN \siunitx_table_print_S_pre:
- \siunitx_table_print_S_pre_not_aligned:
- },
- table-align-text-pre /
- true .code:n =
- {
- \cs_set_eq:NN \siunitx_table_print_S_pre:
- \siunitx_table_print_S_pre_aligned:
- },
- table-align-text-pre .default:n = true ,
- table-align-text-post .choice:,
- table-align-text-post /
- false .code:n =
- {
- \cs_set_eq:NN \siunitx_table_print_S_post:
- \siunitx_table_print_S_post_not_aligned:
- },
- table-align-text-post /
- true .code:n =
- {
- \cs_set_eq:NN \siunitx_table_print_S_post:
- \siunitx_table_print_S_post_aligned:
- },
- table-align-text-post .default:n = true ,
- table-align-uncertainty .choice:,
- table-align-uncertainty /
- false .code:n =
- {
- \cs_set_eq:NN \siunitx_table_print_S_reserved_mantissa_uncert_aux:
- \siunitx_table_print_S_reserved_mantissa_uncert_not_aligned:
- },
- table-align-uncertainty /
- true .code:n =
- {
- \cs_set_eq:NN \siunitx_table_print_S_reserved_mantissa_uncert_aux:
- \siunitx_table_print_S_reserved_mantissa_uncert_aligned:
- },
- table-align-uncertainty .default:n = true,
- table-auto-round .choice:,
- table-auto-round /
- false .code:n =
- { \cs_set_eq:NN \prg_do_nothing: },
- table-auto-round /
- true .code:n =
- {
- \cs_set_eq:NN \siunitx_table_print_S_reserved_round:
- \siunitx_table_print_S_reserved_round_auto:
- },
- table-auto-round .default:n = true,
+ table-align-exponent .bool_set:N =
+ \l_siunitx_table_align_exponent_bool,
+ table-align-text-pre .bool_set:N =
+ \l_siunitx_table_align_text_pre_bool,
+ table-align-text-post .bool_set:N =
+ \l_siunitx_table_align_text_post_bool,
+ table-align-uncertainty .bool_set:N = \l_siunitx_table_align_uncert_bool,
+ table-auto-round .bool_set:N = \l_siunitx_table_auto_round_bool,
table-number-alignment .choice:,
table-number-alignment /
center .code:n =
@@ -5741,20 +5726,8 @@
\cs_set_eq:NN \siunitx_table_print_S_parsed:
\siunitx_table_print_S_reserved:
},
- table-omit-exponent .choice:,
- table-omit-exponent /
- false .code:n =
- {
- \cs_set_eq:NN \siunitx_table_print_S_parse_aux:
- \siunitx_number_process:
- },
- table-omit-exponent /
- true .code:n =
- {
- \cs_set_eq:NN \siunitx_table_print_S_parse_aux:
- \siunitx_table_print_S_parse_omit_exp:
- },
- table-omit-exponent .default:n = true,
+ table-omit-exponent .bool_set:N =
+ \l_siunitx_table_omit_exponent_bool,
table-text-alignment .choice:,
table-text-alignment /
center .code:n =
@@ -5841,20 +5814,7 @@
{ \prg_replicate:nn {#1} { 8 } }
}
},
- table-parse-only .choice: ,
- table-parse-only /
- false .code:n =
- {
- \cs_set_eq:NN \siunitx_table_print_S_main:
- \siunitx_table_print_S_alignment:
- },
- table-parse-only /
- true .code:n =
- {
- \cs_set_eq:NN \siunitx_table_print_S_main:
- \siunitx_table_print_S_no_alignment:
- },
- table-parse-only .default:n = true,
+ table-parse-only .bool_set:N = \l_siunitx_table_parse_only_bool,
table-space-text-pre .tl_set:N = \l_siunitx_table_pre_tl,
table-space-text-post .tl_set:N = \l_siunitx_table_post_tl,
table-sign-exponent .code:n =
@@ -5907,7 +5867,7 @@
\keys_set:nV { siunitx } \l_siunitx_tmpa_tl
}
}
-\cs_new_protected_nopar:Npn \siunitx_table_print_S:
+\cs_new_protected:Npn \siunitx_table_print_S:
{
\bool_if:NTF \l_siunitx_table_collect_pre_bool
{
@@ -5918,40 +5878,46 @@
{
\siunitx_table_column_begin:n { \l_siunitx_table_number_align_skip }
\siunitx_detect_font:
- \siunitx_table_print_S_main:
- \siunitx_table_print_S_pre:
+ \bool_if:NTF \l_siunitx_table_parse_only_bool
+ { \siunitx_table_print_S_no_alignment: }
+ { \siunitx_table_print_S_alignment: }
+ \bool_if:NTF \l_siunitx_table_align_text_pre_bool
+ { \siunitx_table_print_S_pre_aligned: }
+ { \siunitx_table_print_S_pre_not_aligned: }
\box_use:N \l_siunitx_table_result_box
- \siunitx_table_print_S_post:
+ \bool_if:NTF \l_siunitx_table_align_text_post_bool
+ { \siunitx_table_print_S_post_aligned: }
+ { \siunitx_table_print_S_post_not_aligned: }
\siunitx_table_column_end:n { \l_siunitx_table_number_align_skip }
}
}
-\cs_new_protected_nopar:Npn \siunitx_table_print_S_no_alignment:
+\cs_new_protected:Npn \siunitx_table_print_S_no_alignment:
{
\l_siunitx_table_collect_pre_tl
\siunitx_number_output:V \l_siunitx_table_collect_tl
\l_siunitx_table_collect_post_tl
}
-\cs_new_protected_nopar:Npn \siunitx_table_print_S_alignment:
+\cs_new_protected:Npn \siunitx_table_print_S_alignment:
{ \siunitx_table_print_S_parsed: }
-\cs_new_protected_nopar:Npn \siunitx_table_print_S_parse:
+\cs_new_protected:Npn \siunitx_table_print_S_parse:
{
\bool_set_false:N \l_siunitx_error_bool
\siunitx_number_in_parse:V \l_siunitx_table_collect_tl
\bool_if:NF \l_siunitx_error_bool
{
- \siunitx_table_print_S_parse_aux:
+ \bool_if:NTF \l_siunitx_table_omit_exponent_bool
+ {
+ \bool_set_true:N \l_siunitx_process_fixed_bool
+ \siunitx_number_process:
+ \prop_del:Nn \l_siunitx_number_in_prop { exponent }
+ \prop_del:Nn \l_siunitx_number_in_prop { exponent-integer }
+ }
+ { \siunitx_number_process: }
\siunitx_number_format:
\siunitx_number_output_color:
}
}
-\cs_new_protected_nopar:Npn \siunitx_table_print_S_parse_omit_exp:
- {
- \bool_set_true:N \l_siunitx_process_fixed_bool
- \siunitx_number_process:
- \prop_del:Nn \l_siunitx_number_in_prop { exponent }
- \prop_del:Nn \l_siunitx_number_in_prop { exponent-integer }
-}
-\cs_new_protected_nopar:Npn \siunitx_table_print_S_measure:NN #1#2
+\cs_new_protected:Npn \siunitx_table_print_S_measure:NN #1#2
{
\tl_if_empty:NTF #1
{ \dim_zero:N #2 }
@@ -5960,30 +5926,30 @@
\hbox_set:Nn \l_siunitx_tmp_box
{ \siunitx_print:nV { number } #1 }
\exp_args:NNNo \group_end:
- \dim_set:Nn #2 { \tex_the:D \box_wd:N \l_siunitx_tmp_box }
+ \dim_set:Nn #2 { \dim_use:N \box_wd:N \l_siunitx_tmp_box }
}
}
-\cs_new_protected_nopar:Npn \siunitx_table_print_S_pre_aligned:
+\cs_new_protected:Npn \siunitx_table_print_S_pre_aligned:
{
\box_use:N \l_siunitx_table_pre_box
\hbox_to_wd:nn { \l_siunitx_table_fill_pre_dim } { \tex_hfil:D }
}
-\cs_new_protected_nopar:Npn \siunitx_table_print_S_pre_not_aligned:
+\cs_new_protected:Npn \siunitx_table_print_S_pre_not_aligned:
{
\hbox_to_wd:nn { \l_siunitx_table_fill_pre_dim } { \tex_hfil:D }
\box_use:N \l_siunitx_table_pre_box
}
-\cs_new_protected_nopar:Npn \siunitx_table_print_S_post_aligned:
+\cs_new_protected:Npn \siunitx_table_print_S_post_aligned:
{
\hbox_to_wd:nn { \l_siunitx_table_fill_post_dim } { \tex_hfil:D }
\box_use:N \l_siunitx_table_post_box
}
-\cs_new_protected_nopar:Npn \siunitx_table_print_S_post_not_aligned:
+\cs_new_protected:Npn \siunitx_table_print_S_post_not_aligned:
{
\box_use:N \l_siunitx_table_post_box
\hbox_to_wd:nn { \l_siunitx_table_fill_post_dim } { \tex_hfil:D }
}
-\cs_new_protected_nopar:Npn \siunitx_table_print_S_centered:
+\cs_new_protected:Npn \siunitx_table_print_S_centered:
{
\siunitx_table_print_S_centered_ends:
\bool_if:NT \l_siunitx_table_math_bool { \c_math_toggle_token }
@@ -6006,7 +5972,7 @@
{ \siunitx_table_print_S_centered_decimal: }
}
}
-\cs_new_protected_nopar:Npn \siunitx_table_print_S_centered_ends:
+\cs_new_protected:Npn \siunitx_table_print_S_centered_ends:
{
\hbox_set:Nn \l_siunitx_table_pre_box
{
@@ -6051,13 +6017,13 @@
}
}
}
-\cs_new_protected_nopar:Npn \siunitx_table_print_S_centered_measure:
+\cs_new_protected:Npn \siunitx_table_print_S_centered_measure:
{
\siunitx_table_print_S_centered_measure_int_part:
\siunitx_table_print_S_centered_measure_marker:
\siunitx_table_print_S_centered_measure_result:
}
-\cs_new_protected_nopar:Npn \siunitx_table_print_S_centered_measure_int_part:
+\cs_new_protected:Npn \siunitx_table_print_S_centered_measure_int_part:
{
\prop_get:NnNF \l_siunitx_number_out_prop { comparator } \l_siunitx_tmpa_tl
{ \tl_clear:N \l_siunitx_tmpa_tl }
@@ -6070,17 +6036,12 @@
\siunitx_table_print_S_measure:NN \l_siunitx_tmpa_tl
\l_siunitx_table_integer_dim
}
-\cs_new_protected_nopar:Npn \siunitx_table_print_S_centered_measure_marker:
+\cs_new_protected:Npn \siunitx_table_print_S_centered_measure_marker:
{
- \tl_set:Nx \l_siunitx_tmpa_tl
- {
- \exp_not:N \siunitx_ensuremath:n
- { \exp_not:o \l_siunitx_output_decimal_tl }
- }
- \siunitx_table_print_S_measure:NN \l_siunitx_tmpa_tl
+ \siunitx_table_print_S_measure:NN \l_siunitx_output_decimal_tl
\l_siunitx_table_marker_dim
}
-\cs_new_protected_nopar:Npn \siunitx_table_print_S_centered_measure_result:
+\cs_new_protected:Npn \siunitx_table_print_S_centered_measure_result:
{
\prop_get:NnN \l_siunitx_number_out_prop { result } \l_siunitx_tmpa_tl
\hbox_set:Nn \l_siunitx_table_result_box
@@ -6088,23 +6049,24 @@
\dim_set:Nn \l_siunitx_table_result_dim
{ \box_wd:N \l_siunitx_table_result_box }
}
-\cs_new_protected_nopar:Npn \siunitx_table_print_S_centered_integer:
+\cs_new_protected:Npn \siunitx_table_print_S_centered_integer:
{
\dim_set:Nn \l_siunitx_table_fill_post_dim
{ \l_siunitx_table_integer_dim - \l_siunitx_table_fill_pre_dim }
\dim_zero:N \l_siunitx_table_fill_pre_dim
}
-\cs_new_protected_nopar:Npn \siunitx_table_print_S_centered_decimal:
+\cs_new_protected:Npn \siunitx_table_print_S_centered_decimal:
{
\dim_sub:Nn \l_siunitx_table_fill_pre_dim
{ \l_siunitx_table_integer_dim }
\dim_zero:N \l_siunitx_table_fill_post_dim
}
-\cs_new_protected_nopar:Npn \siunitx_table_print_S_reserved:
+\cs_new_protected:Npn \siunitx_table_print_S_reserved:
{
\siunitx_table_print_S_reserved_init:
\siunitx_table_print_S_reserved_ends:
- \siunitx_table_print_S_reserved_round:
+ \bool_if:NT \l_siunitx_table_auto_round_bool
+ { \siunitx_table_print_S_reserved_round_auto: }
\siunitx_table_print_S_parse:
\bool_if:NF \l_siunitx_error_bool
{
@@ -6115,7 +6077,7 @@
\bool_if:NT \l_siunitx_table_math_bool { \c_math_toggle_token }
}
}
-\cs_new_protected_nopar:Npn \siunitx_table_print_S_reserved_init:
+\cs_new_protected:Npn \siunitx_table_print_S_reserved_init:
{
\dim_zero:N \l_siunitx_table_fill_mid_dim
\dim_zero:N \l_siunitx_table_fill_post_dim
@@ -6134,7 +6096,7 @@
}
\prop_set_eq:NN \l_siunitx_table_model_prop \l_siunitx_number_out_prop
}
-\cs_new_protected_nopar:Npn \siunitx_table_print_S_reserved_ends:
+\cs_new_protected:Npn \siunitx_table_print_S_reserved_ends:
{
\hbox_set:Nn \l_siunitx_table_pre_box
{
@@ -6172,7 +6134,7 @@
\tex_hfil:D
}
}
-\cs_new_protected_nopar:Npn \siunitx_table_print_S_reserved_round_auto:
+\cs_new_protected:Npn \siunitx_table_print_S_reserved_round_auto:
{
\prop_get:NnNTF \l_siunitx_table_model_prop { mantissa-decimal-raw }
\l_siunitx_tmpa_tl
@@ -6180,7 +6142,7 @@
{ \int_zero:N \l_siunitx_process_precision_int }
\tl_set:Nn \l_siunitx_round_tl { places }
}
-\cs_new_protected_nopar:Npn \siunitx_table_print_S_reserved_comparator:
+\cs_new_protected:Npn \siunitx_table_print_S_reserved_comparator:
{
\prop_get:NnNTF \l_siunitx_table_model_prop { comparator }
\l_siunitx_tmpa_tl
@@ -6211,11 +6173,11 @@
}
}
}
-\cs_new_protected_nopar:Npn \siunitx_table_print_S_reserved_store_fill_pre:n
+\cs_new_protected:Npn \siunitx_table_print_S_reserved_store_fill_pre:n
{ \dim_add:Nn \l_siunitx_table_fill_pre_dim }
-\cs_new_protected_nopar:Npn \siunitx_table_print_S_reserved_store_fill_mid:n
+\cs_new_protected:Npn \siunitx_table_print_S_reserved_store_fill_mid:n
{ \dim_add:Nn \l_siunitx_table_fill_mid_dim }
-\cs_new_protected_nopar:Npn \siunitx_table_print_S_reserved_mantissa:
+\cs_new_protected:Npn \siunitx_table_print_S_reserved_mantissa:
{
\prop_get:NnNTF \l_siunitx_table_model_prop { mantissa }
\l_siunitx_tmpa_tl
@@ -6244,7 +6206,7 @@
}
}
}
-\cs_new_protected_nopar:Npn \siunitx_table_print_S_reserved_mantissa_parts:
+\cs_new_protected:Npn \siunitx_table_print_S_reserved_mantissa_parts:
{
\siunitx_table_print_S_reserved_mantissa_integer:
\hbox_set:Nn \l_siunitx_table_result_box
@@ -6261,7 +6223,7 @@
}
\siunitx_table_print_S_reserved_mantissa_uncert:
}
-\cs_new_protected_nopar:Npn \siunitx_table_print_S_reserved_mantissa_integer:
+\cs_new_protected:Npn \siunitx_table_print_S_reserved_mantissa_integer:
{
\prop_get:NnNF \l_siunitx_table_model_prop { mantissa-sign }
\l_siunitx_tmpa_tl
@@ -6286,7 +6248,7 @@
\siunitx_table_print_S_reserved_store_fill:n
{ \l_siunitx_table_integer_dim }
}
-\cs_new_protected_nopar:Npn \siunitx_table_print_S_reserved_mantissa_uncert:
+\cs_new_protected:Npn \siunitx_table_print_S_reserved_mantissa_uncert:
{
\prop_get:NnNT \l_siunitx_table_model_prop { mantissa-uncertainty }
\l_siunitx_tmpa_tl
@@ -6302,7 +6264,9 @@
\siunitx_number_format_join_uncert_pm:N \l_siunitx_tmpa_tl
\hbox_set:Nn \l_siunitx_tmp_box
{ \siunitx_print:nV { number } \l_siunitx_tmpa_tl }
- \siunitx_table_print_S_reserved_mantissa_uncert_aux:
+ \bool_if:NTF \l_siunitx_table_align_uncert_bool
+ { \siunitx_table_print_S_reserved_mantissa_uncert_aligned: }
+ { \siunitx_table_print_S_reserved_mantissa_uncert_not_aligned: }
}
{
\siunitx_table_print_S_reserved_store_fill:n
@@ -6310,7 +6274,7 @@
}
}
}
-\cs_new_protected_nopar:Npn
+\cs_new_protected:Npn
\siunitx_table_print_S_reserved_mantissa_uncert_aligned:
{
\hbox_set:Nn \l_siunitx_table_result_box
@@ -6322,7 +6286,7 @@
\dim_set:Nn \l_siunitx_table_fill_mid_dim
{ \l_siunitx_table_uncert_dim - \box_wd:N \l_siunitx_tmp_box }
}
-\cs_new_protected_nopar:Npn
+\cs_new_protected:Npn
\siunitx_table_print_S_reserved_mantissa_uncert_not_aligned:
{
\hbox_set:Nn \l_siunitx_table_result_box
@@ -6336,7 +6300,7 @@
- \box_wd:N \l_siunitx_tmp_box
}
}
-\cs_new_protected_nopar:Npn \siunitx_table_print_S_reserved_exponent:
+\cs_new_protected:Npn \siunitx_table_print_S_reserved_exponent:
{
\prop_get:NnNTF \l_siunitx_table_model_prop { exponent-result }
\l_siunitx_tmpa_tl
@@ -6355,7 +6319,9 @@
{ \siunitx_table_print_S_reserved_exponent_product_correction: }
\hbox_set:Nn \l_siunitx_tmp_box
{ \siunitx_print:nV { number } \l_siunitx_tmpa_tl }
- \siunitx_table_print_S_reserved_exponent_aux:
+ \bool_if:NTF \l_siunitx_table_align_exponent_bool
+ { \siunitx_table_print_S_reserved_exponent_aligned: }
+ { \siunitx_table_print_S_reserved_exponent_not_aligned: }
}
{
\dim_set:Nn \l_siunitx_table_fill_post_dim
@@ -6372,19 +6338,18 @@
\l_siunitx_table_fill_mid_dim
}
}
-\cs_new_protected_nopar:Npn \siunitx_table_print_S_reserved_exponent_product:
+\cs_new_protected:Npn \siunitx_table_print_S_reserved_exponent_product:
{
\tl_set_eq:NN \l_siunitx_tmpb_tl \l_siunitx_exponent_product_tl
\bool_if:NT \l_siunitx_tight_bool
{ \tl_set:Nx \l_siunitx_tmpb_tl { { \exp_not:o \l_siunitx_tmpb_tl } } }
\tl_set:Nx \l_siunitx_tmpa_tl
{
- \exp_not:N \siunitx_ensuremath:n
- { { } \exp_not:o \l_siunitx_tmpb_tl { } }
+ \exp_not:N \ensuremath { { } \exp_not:o \l_siunitx_tmpb_tl { } }
\exp_not:o \l_siunitx_tmpa_tl
}
}
-\cs_new_protected_nopar:Npn
+\cs_new_protected:Npn
\siunitx_table_print_S_reserved_exponent_product_correction:
{
\group_begin:
@@ -6398,7 +6363,7 @@
\siunitx_table_print_S_reserved_store_fill:n { \l_siunitx_tmp_dim }
\dim_sub:Nn \l_siunitx_table_exponent_dim { \l_siunitx_tmp_dim }
}
-\cs_new_protected_nopar:Npn \siunitx_table_print_S_reserved_exponent_aligned:
+\cs_new_protected:Npn \siunitx_table_print_S_reserved_exponent_aligned:
{
\hbox_set:Nn \l_siunitx_table_result_box
{
@@ -6412,7 +6377,7 @@
- \box_wd:N \l_siunitx_tmp_box
}
}
-\cs_new_protected_nopar:Npn
+\cs_new_protected:Npn
\siunitx_table_print_S_reserved_exponent_not_aligned:
{
\hbox_set:Nn \l_siunitx_table_result_box
@@ -6427,18 +6392,18 @@
- \box_wd:N \l_siunitx_tmp_box
}
}
-\cs_new_protected_nopar:Npn \siunitx_table_print_S_direct:
+\cs_new_protected:Npn \siunitx_table_print_S_direct:
{
\m@th
\siunitx_table_print_S_direct_main:
}
\char_set_catcode_active:N \@
-\cs_new_protected_nopar:Npn \siunitx_table_print_S_direct_centered:
+\cs_new_protected:Npn \siunitx_table_print_S_direct_centered:
{
\cs_set_eq:NN \siunitx_table_print:
\siunitx_table_print_S_direct_centered_end:
\hbox_set:Nn \l_siunitx_tmp_box
- { \siunitx_ensuremath:n { \l_siunitx_output_decimal_tl } }
+ { \ensuremath { \l_siunitx_output_decimal_tl } }
\hbox_set_to_wd:Nnn \l_siunitx_table_post_box
{ \box_wd:N \l_siunitx_tmp_box }
{ \tex_hfil:D }
@@ -6448,11 +6413,11 @@
\tl_map_function:NN \l_siunitx_input_decimal_tl
\siunitx_table_print_S_direct_centered_aux:N
}
-\cs_new_protected_nopar:Npn \siunitx_table_print_S_direct_centered_aux:N #1
+\cs_new_protected:Npn \siunitx_table_print_S_direct_centered_aux:N #1
{
\char_set_lccode:nn { `\@ } { `#1 }
\char_set_mathcode:nn { `#1 } { 32768 }
- \tl_to_lowercase:n { \cs_set_nopar:Npn @ }
+ \tl_to_lowercase:n { \cs_set:Npn @ }
{
\c_math_toggle_token
\c_group_end_token
@@ -6463,7 +6428,7 @@
}
}
\char_set_catcode_letter:N \@
-\cs_new_protected_nopar:Npn \siunitx_table_print_S_direct_centered_end:
+\cs_new_protected:Npn \siunitx_table_print_S_direct_centered_end:
{
\c_math_toggle_token
\c_group_end_token
@@ -6490,7 +6455,7 @@
\box_use:N \l_siunitx_table_post_box
}
\char_set_catcode_active:N \@
-\cs_new_protected_nopar:Npn \siunitx_table_print_S_direct_reserved:
+\cs_new_protected:Npn \siunitx_table_print_S_direct_reserved:
{
\cs_set_eq:NN \siunitx_table_print:
\siunitx_table_print_S_direct_reserved_end:
@@ -6499,7 +6464,7 @@
{ \tl_clear:N \l_siunitx_tmpa_tl }
\hbox_set:Nn \l_siunitx_tmp_box
{
- \siunitx_ensuremath:n
+ \ensuremath
{
\prop_get:NnNT \l_siunitx_table_model_prop { mantissa-sign }
\l_siunitx_tmpb_tl
@@ -6514,7 +6479,7 @@
{ \tl_clear:N \l_siunitx_tmpa_tl }
\hbox_set:Nn \l_siunitx_tmp_box
{
- \siunitx_ensuremath:n
+ \ensuremath
{
\l_siunitx_output_decimal_tl
\l_siunitx_tmpa_tl
@@ -6531,11 +6496,11 @@
\siunitx_table_print_S_direct_reserved_aux:N
\tex_hfill:D
}
-\cs_new_protected_nopar:Npn \siunitx_table_print_S_direct_reserved_aux:N #1
+\cs_new_protected:Npn \siunitx_table_print_S_direct_reserved_aux:N #1
{
\char_set_lccode:nn { `\@ } { `#1 }
\char_set_mathcode:nn { `#1 } { 32768 }
- \tl_to_lowercase:n { \cs_set_nopar:Npn @ }
+ \tl_to_lowercase:n { \cs_set:Npn @ }
{
\c_math_toggle_token
\c_group_end_token
@@ -6547,7 +6512,7 @@
}
}
\char_set_catcode_letter:N \@
-\cs_new_protected_nopar:Npn \siunitx_table_print_S_direct_reserved_end:
+\cs_new_protected:Npn \siunitx_table_print_S_direct_reserved_end:
{
\c_math_toggle_token
\tex_hfil:D
@@ -6647,7 +6612,7 @@
text-ohm = \ensuremath { \c_siunitx_omega_tl },
}
\cs_new_protected:Npn \siunitx_symbol_new:n #1 {
- \cs_set_protected_nopar:cpn { SIUnitSymbol #1 }
+ \cs_set_protected:cpn { SIUnitSymbol #1 }
{
\mode_if_math:TF
{ \tl_to_lowercase:n { \use:c { l_siunitx_ #1 _math_tl } } }
@@ -6662,7 +6627,7 @@
\siunitx_symbol_new:n { Micro }
\siunitx_symbol_new:n { Ohm }
\clist_new:N \l_siunitx_pgf_link_clist
-\cs_new_protected_nopar:Npn \siunitx_pgf_link: {
+\cs_new_protected:Npn \siunitx_pgf_link: {
\clist_clear:N \l_siunitx_pgf_link_clist
\str_if_eq:VnT \l_siunitx_round_tl { figure }
{
@@ -6678,10 +6643,7 @@
{ { \exp_not:V \l_siunitx_output_decimal_tl } }
}
\clist_put_right:Nx \l_siunitx_pgf_link_clist
- {
- set~thousands~separator =
- { \exp_not:V \l_siunitx_group_sep_tl }
- }
+ { set~thousands~separator = { \exp_not:V \l_siunitx_group_sep_tl } }
\clist_put_right:Nn \l_siunitx_pgf_link_clist
{ min~exponent~for~1000~sep = \int_use:N \l_siunitx_group_min_int }
\bool_if:nF
@@ -6712,7 +6674,7 @@
{ showpos = false }
}
\group_begin:
- \cs_set_nopar:Npx \siunitx_tmp:w
+ \cs_set:Npx \siunitx_tmp:w
{
\group_end:
\exp_not:N \pgfqkeys
@@ -6815,6 +6777,8 @@
The~input~'#1'~is~a~number~which~has~more~than~one~part: \\
ranges~can~only~contain~one~number~in~each~part.
}
+\msg_new:nnn { siunitx } { non-convertible-exponent }
+ { Exponent~'#1'~cannot~be~converted~into~a~symbolic~prefix. }
\msg_new:nnn { siunitx } { option-not-available }
{ Option~'#1'~not~available~in~strict~mode. }
\msg_new:nnn { siunitx } { option-preamble-only }
@@ -6893,7 +6857,7 @@
\@onlypreamble \DeclareSIQualifier
\@onlypreamble \DeclareSIUnit
\@onlypreamble \DeclareSIUnitWithOptions
-\cs_new_protected_nopar:Npn \SendSettingsToPgf { \siunitx_pgf_link: }
+\cs_new_protected:Npn \SendSettingsToPgf { \siunitx_pgf_link: }
\NewDocumentCommand \ang { o > { \SplitArgument { 2 } { ; } } m } {
\group_begin:
\IfNoValueF {#1}
@@ -6991,9 +6955,9 @@
{ \token_to_str:N \@writefile {#1} {#2} }
}
}
-\cs_new_protected_nopar:Npn \siunitx_contents_add:N #1
- { \cs_set_nopar:Npn #1 { \token_to_str:N #1 } }
-\cs_new_protected_nopar:Npn \siunitx_contents_bookmarks:
+\cs_new_protected:Npn \siunitx_contents_add:N #1
+ { \cs_set:Npn #1 { \token_to_str:N #1 } }
+\cs_new_protected:Npn \siunitx_contents_bookmarks:
{
\tl_map_function:NN \l_siunitx_declare_list_tl
\siunitx_unit_print_literal_aux:N
@@ -7005,13 +6969,13 @@
\cs_set_eq:NN \SIrange \siunitx_bookmark_SIrange:w
\cs_set_eq:NN \si \siunitx_bookmark_si:w
\cs_set_eq:NN \siunitx_textsuperscript:n \use:n
- \cs_set_nopar:Npn \SIUnitSymbolAngstrom { \AA }
- \cs_set_nopar:Npn \SIUnitSymbolArcminute { ' }
- \cs_set_nopar:Npn \SIUnitSymbolArcsecond { '' }
- \cs_set_nopar:Npn \SIUnitSymbolCelsius { \textcelsius }
- \cs_set_nopar:Npn \SIUnitSymbolDegree { \textdegree }
- \cs_set_nopar:Npn \SIUnitSymbolMicro { \textmu }
- \cs_set_nopar:Npn \SIUnitSymbolOhm { [ohm] }
+ \cs_set:Npn \SIUnitSymbolAngstrom { \AA }
+ \cs_set:Npn \SIUnitSymbolArcminute { ' }
+ \cs_set:Npn \SIUnitSymbolArcsecond { '' }
+ \cs_set:Npn \SIUnitSymbolCelsius { \textcelsius }
+ \cs_set:Npn \SIUnitSymbolDegree { \textdegree }
+ \cs_set:Npn \SIUnitSymbolMicro { \textmu }
+ \cs_set:Npn \SIUnitSymbolOhm { [ohm] }
}
\DeclareExpandableDocumentCommand \siunitx_bookmark_num:w { o m } {#2}
\DeclareExpandableDocumentCommand \siunitx_bookmark_numrange:w { o m m }
@@ -7187,10 +7151,10 @@
}
}
\siunitx_option_deactivate:n { strict }
-\cs_new_protected_nopar:Npn \siunitx_strict_option:n #1 {
+\cs_new_protected:Npn \siunitx_strict_option:n #1 {
\clist_map_function:nN {#1} \siunitx_strict_option_aux:n
}
-\cs_new_protected_nopar:Npn \siunitx_strict_option_aux:n #1 {
+\cs_new_protected:Npn \siunitx_strict_option_aux:n #1 {
\keys_define:nn { siunitx }
{ #1 .code:n =
{ \msg_warning:nnx { siunitx } { option-not-available } {#1} }
@@ -7265,12 +7229,12 @@
false .code:n = { } ,
binary-units .default:n = true
}
-\cs_new_protected_nopar:Npn \siunitx_load_abbreviations:
+\cs_new_protected:Npn \siunitx_load_abbreviations:
{
\@onefilewithoptions { siunitx-abbreviations } [ ] [ ]
\c_siunitx_configuration_ext_tl
}
-\cs_new_protected_nopar:Npn \siunitx_load_binary:
+\cs_new_protected:Npn \siunitx_load_binary:
{
\@onefilewithoptions { siunitx-binary } [ ] [ ]
\c_siunitx_configuration_ext_tl