diff options
author | Karl Berry <karl@freefriends.org> | 2021-09-14 20:25:36 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-09-14 20:25:36 +0000 |
commit | 1f21169c727289a07ebcdb4a049efc6457259558 (patch) | |
tree | f2e551d225d2f771589919d231e48df6b97bcc3a /Master/texmf-dist/source/latex/siunitx | |
parent | 83422963871d3f8dcb7460e580122b33e78f77c0 (diff) |
siunitx (14sep21)
git-svn-id: svn://tug.org/texlive/trunk@60510 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/siunitx')
4 files changed, 83 insertions, 37 deletions
diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-angle.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-angle.dtx index a3d46080670..9d9a2ac7531 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx-angle.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx-angle.dtx @@ -248,6 +248,7 @@ { \exp_args:Ne \@@_arc_convert:n { \fp_eval:n {#1} } } { \siunitx_number_parse:nN {#1} \l_@@_degrees_tl + \siunitx_number_process:NN \l_@@_degrees_tl \l_@@_degrees_tl \tl_set:Nx \l_@@_degrees_tl { \siunitx_number_output:NN \l_@@_degrees_tl \q_nil } \@@_arc_print:VVV @@ -349,6 +350,8 @@ { \tl_if_empty:cF { l_@@_ ##1 _tl } { + \exp_args:Ncc \siunitx_number_process:NN + { l_@@_ ##1 _tl } { l_@@_ ##1 _tl } \tl_set:cx { l_@@_ ##1 _tl } { \exp_args:Nc \siunitx_number_output:NN diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-print.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-print.dtx index 5b14aa123bc..05ba3d64ea1 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx-print.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx-print.dtx @@ -303,10 +303,15 @@ % % \subsection{Initial set up} % -% The printing routines depend on \pkg{amstext} for text mode working. +% \begin{macro}{\@@_ams_text:n} +% The printing routines depend on \pkg{amstext} for text mode working. +% We also save the definition of \cs{text} here to use it internally, as the +% nature of the \emph{document} command may need to vary. % \begin{macrocode} \RequirePackage { amstext } +\cs_new_eq:NN \@@_ams_text:n \text % \end{macrocode} +% \end{macro} % % Color support is always required. % \begin{macrocode} @@ -511,6 +516,12 @@ % \end{macrocode} % \end{variable} % +% \begin{variable}{\l_@@_math_html_tl} +% \begin{macrocode} +\tl_new:N \l_@@_math_html_tl +% \end{macrocode} +% \end{variable} +% % \begin{macro}{\siunitx_print_math:n} % \begin{macro}[EXP]{\@@_extract_series:Nw} % \begin{macro}[EXP]{\@@_convert_series:n, \@@_convert_series:v} @@ -519,15 +530,20 @@ % { % \@@_math_auxi:n, % \@@_math_auxii:n, +% } +% \begin{macro}{\@@_math_replace:Nn} +% \begin{macro} +% { % \@@_math_auxiii:n, % \@@_math_auxiv:n, % \@@_math_auxv:n % } -% \begin{macro}{\@@_math_aux:N} -% \begin{macro}{\@@_math_aux:w} -% \begin{macro}{\@@_math_aux:Nn, \@@_math_aux:cn} +% \begin{macro}{\@@_math_auxvi:Nn} +% \begin{macro}{\@@_math_auxvii:N} +% \begin{macro}{\@@_math_auxviii:w} +% \begin{macro}{\@@_math_auxix:Nn} % \begin{macro}{\@@_math_sub:n, \@@_math_super:n, \@@_math_script:n} -% \begin{macro}{\@@_math_text:n} +% \begin{macro}{\@@_math_ensure:n} % The first step in setting in math mode is to check on the math version. % The starting point is the question of whether text series needs to % propagate to math mode: if so, check on the mapping, otherwise check on @@ -603,7 +619,25 @@ % commands have different |\long| status. % \begin{macrocode} \cs_new_protected:Npn \@@_math_auxii:n #1 - { \ensuremath { \@@_math_auxiii:n {#1} } } + { + \group_begin: + \cs_set_protected:Npn \text ##1 + { + \cs_set_eq:NN \text \@@_ams_text:n + \siunitx_print_text:n {##1} + } + \tl_set:Nn \l_@@_tmp_tl {#1} + \exp_after:wN \@@_math_replace:Nn + \l_@@_math_html_tl + \q_recursion_tail { } \q_recursion_stop + \exp_args:NV \@@_math_auxiii:n \l_@@_tmp_tl + \group_end: + } +\cs_new_protected:Npn \@@_math_replace:Nn #1#2 + { + \quark_if_recursion_tail_stop:N #1 + \tl_replace_all:Nnn \l_@@_tmp_tl {#1} {#2} + } \cs_new_protected:Npn \@@_math_auxiii:n #1 { \bool_if:NTF \l_@@_math_family_bool @@ -611,8 +645,8 @@ \str_case_e:nnF { \f@family } { { \rmdefault } { \@@_math_auxv:n } - { \sfdefault } { \@@_math_aux:Nn \mathsf } - { \ttdefault } { \@@_math_aux:Nn \mathtt } + { \sfdefault } { \@@_math_auxix:Nn \mathsf } + { \ttdefault } { \@@_math_auxix:Nn \mathtt } } { \@@_math_auxiv:n } } @@ -630,7 +664,7 @@ { \bool_if:NTF \l_@@_math_font_bool { - \@@_math_aux:N + \@@_math_auxvii:N \mathbf \mathit \mathsf \mathtt \q_recursion_tail \q_recursion_stop } @@ -642,28 +676,30 @@ \bool_lazy_or:nnTF { \int_compare_p:nNn \fam = { -1 } } { \int_compare_p:nNn \fam = \symoperators } - { \use:n } - { \mathrm } + { \@@_math_ensure:n } + { \@@_math_auxvi:Nn \mathrm } {#1} } -\cs_new_protected:Npn \@@_math_aux:N #1 +\cs_new_protected:Npn \@@_math_auxvi:Nn #1#2 + { \@@_math_ensure:n { #1 {#2} } } +\cs_new_protected:Npn \@@_math_auxvii:N #1 { - \quark_if_recursion_tail_stop_do:Nn #1 { \use:n } - \exp_after:wN \exp_after:wN \exp_after:wN \@@_math_aux:w + \quark_if_recursion_tail_stop_do:Nn #1 { \@@_math_auxv:n } + \exp_after:wN \exp_after:wN \exp_after:wN \@@_math_auxviii:w \cs:w \cs_to_str:N #1 \c_space_tl \cs_end: \use@mathgroup ? { -2 } \q_stop #1 } -\cs_new_protected:Npn \@@_math_aux:w #1 \use@mathgroup #2#3 #4 \q_stop #5 +\cs_new_protected:Npn \@@_math_auxviii:w #1 \use@mathgroup #2#3 #4 \q_stop #5 { \int_compare:nNnTF \fam = {#3} - { \use_i_delimit_by_q_recursion_stop:nw { \@@_math_aux:Nn #5 } } - { \@@_math_aux:N } + { \use_i_delimit_by_q_recursion_stop:nw { \@@_math_auxix:Nn #5 } } + { \@@_math_auxvii:N } } % \end{macrocode} % Search-and-replace fun: deal with any font commands in the argument and % also inside sub/superscripts. % \begin{macrocode} -\cs_new_protected:Npx \@@_math_aux:Nn #1#2 +\cs_new_protected:Npx \@@_math_auxix:Nn #1#2 { \group_begin: \tl_set:Nn \exp_not:N \l_@@_tmp_tl {#2} @@ -674,10 +710,10 @@ \tl_replace_all:Nnn \exp_not:N \l_@@_tmp_tl { ^ } { \exp_not:N \@@_math_super:n } - #1 { \exp_not:N \tl_use:N \exp_not:N \l_@@_tmp_tl } + \exp_not:N \exp_args:NNV \@@_math_auxvi:Nn + #1 \exp_not:N \l_@@_tmp_tl \group_end: } -\cs_generate_variant:Nn \@@_math_aux:Nn { c } \cs_new_protected:Npx \@@_math_sub:n #1 { \char_generate:nn { `\_ } { 8 } @@ -693,23 +729,23 @@ \tl_use:N \l_@@_tmp_tl \group_end: } +\cs_new_protected:Npn \@@_math_ensure:n #1 + { + \tl_if_blank:nF {#1} + { + \mode_if_math:TF + {#1} + { $ #1 $ } + } + } % \end{macrocode} % For \pkg{tex4ht}, we need to have category code $12$ |^| tokens in math -% mode. We handle that by intercepting at the first auxiliary that makes -% sense. +% mode. % \begin{macrocode} \AtBeginDocument { \@ifpackageloaded { tex4ht } - { - \cs_set_protected:Npn \@@_math_auxii:n #1 - { - \tl_set:Nn \l_@@_tmp_tl {#1} - \exp_args:NNnx \tl_replace_all:Nnn \l_@@_tmp_tl - { ^ } { \token_to_str:N ^ } - \ensuremath { \exp_args:NV \@@_math_auxiii:n \l_@@_tmp_tl } - } - } + { \tl_set:Nx \l_@@_math_html_tl { ^ { \token_to_str:N ^ } } } { } } % \end{macrocode} @@ -723,6 +759,9 @@ % \end{macro} % \end{macro} % \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} % % \begin{macro}{\siunitx_print_text:n} % \begin{macro}{\@@_text_replace:n} diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx.dtx index 1269e5ff90d..45534b9996c 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx.dtx @@ -97,7 +97,7 @@ % Load only the essential support (\pkg{expl3}) \enquote{up-front}, and % only if required. % \begin{macrocode} -\@ifundefined{ExplFileDate} +\@ifundefined{ExplLoaderFileDate} {\RequirePackage{expl3}} {} % \end{macrocode} @@ -106,7 +106,7 @@ % We use \cs{ExplFileDate} as \cs{@ifpackagelater} doesn't work for pre-loaded % \pkg{expl3} in the absence of the package. % \begin{macrocode} -\@ifl@t@r\ExplFileDate{2020-01-09} +\@ifl@t@r\ExplLoaderFileDate{2020-01-09} {} {% \PackageError{siunitx}{Support package expl3 too old} @@ -121,7 +121,7 @@ % % Identify the package and give the over all version information. % \begin{macrocode} -\ProvidesExplPackage {siunitx} {2021-09-06} {3.0.29} +\ProvidesExplPackage {siunitx} {2021-09-14} {3.0.30} {A comprehensive (SI) units package} % \end{macrocode} % diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx.tex b/Master/texmf-dist/source/latex/siunitx/siunitx.tex index 95cad5ca88e..b05cd68fc9b 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx.tex +++ b/Master/texmf-dist/source/latex/siunitx/siunitx.tex @@ -297,8 +297,12 @@ Simple lists and ranges of numbers can be handled. \qtyrange{0.13}{0.67}{\milli\metre} \end{LaTeXdemo} -By default, all text is typeset in the current upright math font. This can be -changed by setting the appropriate options. +A wide range of options are available to control the behavior of the package. +For example, with the standard settings all text is typeset in the current +upright math font. This can be adjusted to use text mode, follow various +aspects of the surrounding formatting, \foreign{etc}. Similarly, the standard +settings are based around an English-speaking locale, but can be adjusted +to follow the traditions of other areas. \section{Using the \pkg{siunitx} package} @@ -1490,7 +1494,7 @@ of figures), before rounding the main value to follow. \num{0.12345(23)} \\ \num{0.12345(234)} \end{LaTeXdemo} -Rounding my \enquote{extend} a short number to more digits (or figures): this +Rounding may \enquote{extend} a short number to more digits (or figures): this is controlled by the switch \opt{round-pad}, which is \opt{true} as standard. \begin{LaTeXdemo} \sisetup{round-mode = figures, round-precision = 4}% |