diff options
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md | 22 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/siunitx/siunitx-code.pdf | bin | 617754 -> 620740 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/siunitx/siunitx.pdf | bin | 666266 -> 667977 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/siunitx/siunitx-abbreviation.dtx | 5 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/siunitx/siunitx-emulation.dtx | 33 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx | 158 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/siunitx/siunitx-quantity.dtx | 33 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/siunitx/siunitx-symbol.dtx | 36 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/siunitx/siunitx-table.dtx | 119 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/siunitx/siunitx-unit.dtx | 177 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/siunitx/siunitx.dtx | 6 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/siunitx/siunitx.tex | 119 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/siunitx/siunitx.sty | 330 |
13 files changed, 640 insertions, 398 deletions
diff --git a/Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md b/Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md index 95c60bb247b..e71d02eabba 100644 --- a/Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md +++ b/Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md @@ -7,6 +7,25 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to ## [Unreleased] +## [v3.2.0] - 2023-01-03 + +## Added +- Option `exponent-thresholds` and option setting `exponent-mode = threshold` + to allow selective use of exponent mode output (see issue + [\#204](https://github.com/josephwright/siunitx/issues/204)) +- Options `print-exponent-implicit-plus` and `print-mantissa-implicit-plus` + (see issue + [\#493](https://github.com/josephwright/siunitx/issues/493)) +- Abbreviation `\mF` (see issue + [\#624](https://github.com/josephwright/siunitx/issues/624)) +- New SI prefixes `\ronna`, `\ronto`, `\quetta` and `\quecto` (see issue + [\#629](https://github.com/josephwright/siunitx/issues/629)) + +### Changed +- Extend alignment of uncertainties in tabulars to include decimal marker + (see issue [\#370](https://github.com/josephwright/siunitx/issues/370)) +- Require `expl3` 2022-11-09 or later + ## [v3.1.11] - 2022-12-05 ### Fixed @@ -1838,7 +1857,8 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to ### Added - First public testing release (as `si`) -[Unreleased]: https://github.com/josephwright/siunitx/compare/v3.1.11...HEAD +[Unreleased]: https://github.com/josephwright/siunitx/compare/v3.2.0...HEAD +[v3.2.0]: https://github.com/josephwright/siunitx/compare/v3.1.11...v3.2.0 [v3.1.11]: https://github.com/josephwright/siunitx/compare/v3.1.10...v3.1.11 [v3.1.10]: https://github.com/josephwright/siunitx/compare/v3.1.9...v3.1.10 [v3.1.9]: https://github.com/josephwright/siunitx/compare/v3.1.8...v3.1.9 diff --git a/Master/texmf-dist/doc/latex/siunitx/siunitx-code.pdf b/Master/texmf-dist/doc/latex/siunitx/siunitx-code.pdf Binary files differindex 07880f9c2d4..4984647c28f 100644 --- a/Master/texmf-dist/doc/latex/siunitx/siunitx-code.pdf +++ b/Master/texmf-dist/doc/latex/siunitx/siunitx-code.pdf diff --git a/Master/texmf-dist/doc/latex/siunitx/siunitx.pdf b/Master/texmf-dist/doc/latex/siunitx/siunitx.pdf Binary files differindex 466df8a07cf..6b7ff0d6eeb 100644 --- a/Master/texmf-dist/doc/latex/siunitx/siunitx.pdf +++ b/Master/texmf-dist/doc/latex/siunitx/siunitx.pdf diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-abbreviation.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-abbreviation.dtx index debc9f2a6b9..11ebc290cb9 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx-abbreviation.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx-abbreviation.dtx @@ -114,7 +114,7 @@ % Abbreviations for resistance. % \end{function} % -% \begin{function}{\F, \fF, \pF, \nF, \uF} +% \begin{function}{\F, \fF, \pF, \nF, \uF, \mF} % Abbreviations for capacitance. % \end{function} % @@ -274,7 +274,7 @@ \siunitx_declare_unit:Nn \dB { \deci \bel } % \end{macrocode} % \end{macro} -% \begin{macro}{\F, \fF, \pF, \nF, \uF} +% \begin{macro}{\F, \fF, \pF, \nF, \uF, mF} % Capacitance. % \begin{macrocode} \siunitx_declare_unit:Nn \F { \farad } @@ -282,6 +282,7 @@ \siunitx_declare_unit:Nn \pF { \pico \farad } \siunitx_declare_unit:Nn \nF { \nano \farad } \siunitx_declare_unit:Nn \uF { \micro \farad } +\siunitx_declare_unit:Nn \mF { \milli \farad } % \end{macrocode} % \end{macro} % \begin{macro}{\H, \fH, \pH, \nH, \uH, \mH} diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-emulation.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-emulation.dtx index 96bbaf02d4a..65db65b6645 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx-emulation.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx-emulation.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% File: siunitx-emulation.dtx Copyright (C) 2016-2019,2021,2022 Joseph Wright +% File: siunitx-emulation.dtx Copyright (C) 2016-2019,2021-2023 Joseph Wright % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -941,37 +941,12 @@ % \end{macrocode} % % \begin{macro}{\@@_non_latin:n} -% \begin{macro}{\@@_non_latin:nnnn} -% As in \pkg{siunitx-unit}, but internal in both cases as it's rather -% specialised. +% A shortcut. % \begin{macrocode} -\bool_lazy_or:nnTF - { \sys_if_engine_luatex_p: } - { \sys_if_engine_xetex_p: } - { - \cs_new:Npn \@@_non_latin:n #1 - { - \exp_after:wN \exp_after:wN \exp_after:wN - \exp_not:N \char_generate:nn {#1} { \char_value_catcode:n {#1} } - } - } - { - \cs_new:Npn \@@_non_latin:n #1 - { - \exp_last_unbraced:Nf \@@_non_latin:nnnn - { \char_to_utfviii_bytes:n {#1} } - } - \cs_new:Npn \@@_non_latin:nnnn #1#2#3#4 - { - \exp_after:wN \exp_after:wN \exp_after:wN - \exp_not:N \char_generate:nn {#1} { 13 } - \exp_after:wN \exp_after:wN \exp_after:wN - \exp_not:N \char_generate:nn {#2} { 13 } - } - } +\cs_new:Npn \@@_non_latin:n #1 + { \codepoint_generate:nn {#1} { \char_value_catcode:n {#1} } } % \end{macrocode} % \end{macro} -% \end{macro} % % \begin{macro} % { diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx index f08a6a8c0f1..007d0b08257 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx @@ -286,8 +286,18 @@ % % \begin{function}{exponent-mode} % \begin{syntax} -% |exponent-mode| = |engineering|\verb"|"|fixed|\verb"|"|input|\verb"|"|scientific| +% |exponent-mode| = |engineering|\verb"|"|fixed|\verb"|"|input|\verb"|"|scientific|\verb"|"|threshold| % \end{syntax} +% Choice which determines whether numbers are converted to exponent form. The +% option |engineering| forces exponent form with an exponent which is the +% smallest power of three which gives a mantissa with an integer part. The +% option |fixed| uses a fixed exponent (set in |fixed-exponent|). The +% option |input| leaves the input unchanged (which will therefore produce an +% exponent only if the input contained one). The choice |scientific| gives +% an exponent with the mantissa~$m$ in the range $1 \le m < 10$. Finally, +% the option |threshold| will apply |scientific| if the exponent of input +% is outside of the range stored in |exponent-thresholds|. The standard +% setting is |input|. % \end{function} % % \begin{function}{exponent-product} @@ -442,10 +452,20 @@ % \end{syntax} % \end{function} % -% \begin{function}{print-implicit-plus} +% \begin{function} +% { +% print-implicit-plus , +% print-mantissa-implicit-plus , +% print-exponent-implicit-plus +% } % \begin{syntax} -% |print-implicit-plus| = |true|\verb"|"|false| +% |print-implicit-plus| = |true|\verb"|"|false| +% |print-mantissa-implicit-plus| = |true|\verb"|"|false| +% |print-exponent-implicit-plus| = |true|\verb"|"|false| % \end{syntax} +% Controls whether the plus sign implicit in a positive number is printed; +% this can be controlled at the level of the mantissa or exponent, or +% can be activated for both. % \end{function} % % \begin{function}{print-unity-mantissa} @@ -1867,8 +1887,10 @@ drop-zero-decimal .bool_set:N = \l_@@_drop_zero_decimal_bool , exponent-mode .choices:nn = - { engineering , fixed , input , scientific } + { engineering , fixed , input , scientific , threshold } { \tl_set_eq:NN \l_@@_exponent_mode_tl \l_keys_choice_tl } , + exponent-thresholds .code:n = + { \@@_set_thresholds:n {#1} } , fixed-exponent .int_set:N = \l_@@_exponent_fixed_int , minimum-decimal-digits .int_set:N = @@ -1934,6 +1956,40 @@ % \end{macro} % \end{macro} % +% \begin{variable}{\l_@@_lower_threshold_int, \l_@@_upper_threshold_int} +% For storing the range for exponents. +% \begin{macrocode} +\int_new:N \l_@@_lower_threshold_int +\int_new:N \l_@@_upper_threshold_int +% \end{macrocode} +% \end{variable} +% +% \begin{macro}{\@@_set_round_thresholds:n} +% \begin{macro}{\@@_set_round_thresholds:w} +% \begin{macro}{\@@_set_round_threshold:nn} +% Split the range, parse each part, set the data structures. +% \begin{macrocode} +\cs_new_protected:Npx \@@_set_thresholds:n #1 + { + \exp_not:N \@@_set_thresholds:w + #1 \token_to_str:N : \token_to_str:N : \exp_not:N \q_stop + } +\use:x + { + \cs_new_protected:Npn \exp_not:N \@@_set_thresholds:w + ##1 \token_to_str:N : ##2 \token_to_str:N : ##3 \exp_not:N \q_stop + } + { + \@@_set_threshold:nn { lower } {#1} + \@@_set_threshold:nn { upper } {#2} + } +\cs_new_protected:Npn \@@_set_threshold:nn #1#2 + { \int_set:cn { l__@@_ #1 _threshold_int } { 0 #2 } } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% % \begin{macro}{\siunitx_number_process:NN} % \begin{macro}{\@@_process:nnnnnnnNN} % A top-level interface for the processing tools. Rounding happens in all @@ -2010,6 +2066,9 @@ % \begin{macro}[EXP]{\@@_exponent_engineering:nnNw} % \begin{macro}[EXP]{\@@_exponent_engineering_uncert:nn} % \begin{macro}[EXP]{\@@_exponent_engineering_uncert_S:nnn} +% \begin{macro}[EXP]{\@@_exponent_threshold:nnnnnnn} +% \begin{macro}[EXP]{\@@_exponent_threshold:nn} +% \begin{macro}[EXP]{\@@_exponent_threshold:nnnnnnnn} % Manipulating an exponent is done using a single expansion function % \emph{unless} dealing with engineering-style output. The latter is easier % to handle by first converting to scientific output, then post-processing. @@ -2302,6 +2361,32 @@ } } % \end{macrocode} +% To branch here we need to work out the scientific notation form. +% \begin{macrocode} +\cs_new:Npn \@@_exponent_threshold:nnnnnnn #1#2#3#4#5#6#7 + { + \exp_args:Ne \@@_exponent_threshold:nn + { + \@@_exponent_scientific:nnnnnnn + {#1} {#2} {#3} {#4} {#5} {#6} {#7} + } + { {#1} {#2} {#3} {#4} {#5} {#6} {#7} } + } +\cs_new:Npn \@@_exponent_threshold:nn #1#2 + { \@@_exponent_threshold:nnnnnnnn #1 {#2} } +\cs_new:Npn \@@_exponent_threshold:nnnnnnnn #1#2#3#4#5#6#7#8 + { + \bool_lazy_and:nnTF + { \int_compare_p:nNn {#6#7} > \l_@@_lower_threshold_int } + { \int_compare_p:nNn {#6#7} < \l_@@_upper_threshold_int } + { \exp_not:n {#8} } + { \exp_not:n { {#1} {#2} {#3} {#4} {#5} {#6} {#7} } } + } + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} % \end{macro} % \end{macro} % \end{macro} @@ -3095,7 +3180,8 @@ % \@@_round_uncertainty_engineering:nnn , % \@@_round_uncertainty_fixed:nnn , % \@@_round_uncertainty_input:nnn , -% \@@_round_uncertainty_scientific:nnn +% \@@_round_uncertainty_scientific:nnn , +% \@@_round_uncertainty_threshold:nnn % } % \begin{macro}[EXP] % { @@ -3225,7 +3311,9 @@ % we have a pathological case and need to filter out. They show up as they % have the either the precision greater than the length of the integer % part, or have a value of exactly $10$ when the exponent mode is -% scientific. +% scientific. The latter test has to deal with an exponent threshold too: +% there we are looking for cases where the threshold will have forced +% scientific presentation. % \begin{macrocode} \cs_new:Npn \@@_round_uncertainty_shift:nn #1#2 { \@@_round_uncertainty_shift:nnnw #1 {#2} } @@ -3237,7 +3325,25 @@ { \int_compare_p:nNn {#3} > { \tl_count:n {#1} } } { ! \bool_lazy_and_p:nn - { \str_if_eq_p:Vn \l_@@_exponent_mode_tl { scientific } } + { + \bool_lazy_or_p:nn + { \str_if_eq_p:Vn \l_@@_exponent_mode_tl { scientific } } + { + \bool_lazy_and_p:nn + { \str_if_eq_p:Vn \l_@@_exponent_mode_tl { threshold } } + { + ! \bool_lazy_or_p:nn + { + \int_compare_p:nNn {#5#6} > + \l_@@_lower_threshold_int + } + { + \int_compare_p:nNn {#5#6} < + \l_@@_upper_threshold_int + } + } + } + } { \str_if_eq_p:nn { #1.#2 } { 10. } } } { @@ -3311,6 +3417,18 @@ \@@_exponent_finalise:n { #2#3 + \tl_count:n {#1} - 1 } } % \end{macrocode} +% We need to branch here based on the order of magnitude. +% \begin{macrocode} +\cs_new:Npn \@@_round_uncertainty_threshold:nnn #1#2#3 + { + \bool_lazy_and:nnTF + { \int_compare_p:nNn {#2#3} > \l_@@_lower_threshold_int } + { \int_compare_p:nNn {#2#3} < \l_@@_upper_threshold_int } + { \@@_round_uncertainty_input:nnn } + { \@@_round_uncertainty_scientific:nnn } + {#1} {#2} {#3} + } +% \end{macrocode} % \end{macro} % \end{macro} % \end{macro} @@ -3415,7 +3533,8 @@ % \begin{variable} % { % \l_@@_bracket_negative_bool , -% \l_@@_implicit_plus_bool , +% \l_@@_implicit_plus_mant_bool , +% \l_@@_implicit_plus__exp_bool , % \l_@@_exponent_base_tl , % \l_@@_exponent_product_tl , % \l_@@_group_size_int , @@ -3495,8 +3614,16 @@ \l_@@_output_exp_marker_tl , output-open-uncertainty .tl_set:N = \l_@@_output_uncert_open_tl , - print-implicit-plus .bool_set:N = - \l_@@_implicit_plus_bool , + print-implicit-plus .meta:n = + { + print-mantissa-implicit-plus = {#1} , + print-exponent-implicit-plus = {#1} + } , + print-implicit-plus .default:n = true , + print-mantissa-implicit-plus .bool_set:N = + \l_@@_implicit_plus_mant_bool , + print-exponent-implicit-plus .bool_set:N = + \l_@@_implicit_plus_exp_bool , print-unity-mantissa .bool_set:N = \l_@@_unity_mantissa_bool , print-zero-exponent .bool_set:N = @@ -3703,7 +3830,7 @@ { \tl_if_blank:nTF {#2} { - \bool_if:NT \l_@@_implicit_plus_bool + \bool_if:NT \l_@@_implicit_plus_mant_bool { \@@_output_sign:nN {#1} + } } { @@ -4251,7 +4378,7 @@ \tl_if_blank:nTF {#2} { \bool_lazy_and:nnT - { \l_@@_implicit_plus_bool } + { \l_@@_implicit_plus_exp_bool } { ! \str_if_eq_p:nn {#3} { 0 } } { #1 + } } @@ -4460,7 +4587,9 @@ output-decimal-marker = . , output-open-uncertainty = ( , % ) parse-numbers = true , + print-exponent-implicit-plus = false , print-implicit-plus = false , + print-mantissa-implicit-plus = false , print-unity-mantissa = true , print-zero-exponent = false , print-zero-integer = true , @@ -4484,6 +4613,11 @@ zero-symbol = \mbox { --- } } % \end{macrocode} +% One awkward setting. +% \begin{macrocode} +\keys_set:nx { siunitx } + { exponent-thresholds = -3 \c_colon_str 3 } +% \end{macrocode} % % \begin{macrocode} %</package> diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-quantity.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-quantity.dtx index 69182e37c3c..b7e6352bdd3 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx-quantity.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx-quantity.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% File: siunitx-quantity.dtx Copyright (C) 2018-2022 Joseph Wright +% File: siunitx-quantity.dtx Copyright (C) 2018-2023 Joseph Wright % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -419,37 +419,12 @@ % \subsection{Adjustments to units} % % \begin{macro}{\@@_non_latin:n} -% \begin{macro}{\@@_non_latin:nnnn} -% As in \pkg{siunitx-unit}, but internal in both cases as it's rather -% specialised. +% A shortcut. % \begin{macrocode} -\bool_lazy_or:nnTF - { \sys_if_engine_luatex_p: } - { \sys_if_engine_xetex_p: } - { - \cs_new:Npn \@@_non_latin:n #1 - { - \exp_after:wN \exp_after:wN \exp_after:wN - \exp_not:N \char_generate:nn {#1} { \char_value_catcode:n {#1} } - } - } - { - \cs_new:Npn \@@_non_latin:n #1 - { - \exp_last_unbraced:Nf \@@_non_latin:nnnn - { \char_to_utfviii_bytes:n {#1} } - } - \cs_new:Npn \@@_non_latin:nnnn #1#2#3#4 - { - \exp_after:wN \exp_after:wN \exp_after:wN - \exp_not:N \char_generate:nn {#1} { 13 } - \exp_after:wN \exp_after:wN \exp_after:wN - \exp_not:N \char_generate:nn {#2} { 13 } - } - } +\cs_new:Npn \@@_non_latin:n #1 + { \codepoint_generate:nn {#1} { \char_value_catcode:n {#1} } } % \end{macrocode} % \end{macro} -% \end{macro} % % \begin{macro}{\arcminute, \arcsecond, \degree} % The angles units are re-declared here: this is needed for using it diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-symbol.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-symbol.dtx index 496ea9a9985..6d55931ce7d 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx-symbol.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx-symbol.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% File: siunitx-symbol.dtx Copyright (C) 2018-2022 Joseph Wright +% File: siunitx-symbol.dtx Copyright (C) 2018-2023 Joseph Wright % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -95,40 +95,12 @@ % \end{macrocode} % % \begin{macro}{\@@_non_latin:n} -% \begin{macro}{\@@_non_latin:nnnn} -% As in \pkg{siunitx-unit}, but internal in both cases as it's rather -% specialised. +% A shortcut. % \begin{macrocode} -\bool_lazy_or:nnTF - { \sys_if_engine_luatex_p: } - { \sys_if_engine_xetex_p: } - { - \cs_new:Npn \@@_non_latin:n #1 - { - \exp_after:wN \exp_after:wN \exp_after:wN - \exp_not:N \char_generate:nn {#1} { \char_value_catcode:n {#1} } - } - } - { - \cs_new:Npn \@@_non_latin:n #1 - { - \exp_last_unbraced:Nf \@@_non_latin:nnnn - { \char_to_utfviii_bytes:n {#1} } - } - \cs_new:Npn \@@_non_latin:nnnn #1#2#3#4 - { - \@@_deal_with_utf: - \exp_after:wN \exp_after:wN \exp_after:wN - \exp_not:N \char_generate:nn {#1} { 13 } - \char_generate:nn {#2} { 12 } - \tl_if_blank:nF {#3} - { \char_generate:nn {#3} { 12 } } - } - } -\cs_new:Npn \@@_deal_with_utf: { } +\cs_new:Npn \@@_non_latin:n #1 + { \codepoint_generate:nn {#1} { \char_value_catcode:n {#1} } } % \end{macrocode} % \end{macro} -% \end{macro} % % \begin{macro}{\@@_if_replace:NnT} % A test to see if the unit definition which applies is still one we expect: diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-table.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-table.dtx index b8f5aea8e3f..10b9b9a7cd1 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx-table.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx-table.dtx @@ -701,6 +701,13 @@ % \end{macrocode} % \end{variable} % +% \begin{variable}{\l_@@_uncert_box} +% An extra one for aligning separated uncertainty values. +% \begin{macrocode} +\box_new:N \l_@@_uncert_box +% \end{macrocode} +% \end{variable} +% % \begin{macro}{\@@_fil:, \@@_fill:} % Primitives renamed. % \begin{macrocode} @@ -1152,13 +1159,19 @@ % \begin{macro}[EXP]{\@@_print_format:nnnnnn} % \begin{macro} % { -% \@@_print_format_auxi:w , -% \@@_print_format_auxii:w , -% \@@_print_format_auxiii:w , -% \@@_print_format_auxiv:w , -% \@@_print_format_auxv:w , -% \@@_print_format_auxvi:w , -% \@@_print_format_auxvii:w +% \@@_print_format_auxi:w , +% \@@_print_format_auxii:w , +% \@@_print_format_auxiii:w , +% \@@_print_format_auxiv:w , +% \@@_print_format_auxv:w , +% \@@_print_format_auxvi:w , +% \@@_print_format_auxvii:w , +% \@@_print_format_auxviii:w , +% \@@_print_format_auxix:w , +% \@@_print_format_auxx:w , +% \@@_print_format_auxxi:w , +% \@@_print_format_auxxii:w , +% \@@_print_format_auxxiii:w % } % \begin{macro}{\@@_print_format_box:Nn} % \begin{macro}{\@@_print_format_after:N} @@ -1442,28 +1455,100 @@ { \tl_if_blank:nTF {#1} { \@@_print_format_auxv:w } - { \@@_print_format_auxvi:w } - #1#2 \q_mark #3#4 \q_stop + { \@@_print_format_auxvii:w } + #1 \q_nil #2 \q_mark #3 \q_nil #4 \q_stop } \cs_new_protected:Npn \@@_print_format_auxv:w - #1 \q_nil #2 \q_nil #3 \q_nil #4 \q_mark - #5 \q_nil #6 \q_nil #7 \q_nil #8 \q_stop - { \@@_print_format_auxvii:w #4 \q_mark #8 \q_stop } + #1 \q_nil #2 \q_nil #3 \q_nil #4 \q_nil #5 \q_mark + #6 \q_stop + { \@@_print_format_auxvi:w #5 \q_mark #6 \q_stop } +\cs_new_protected:Npn \@@_print_format_auxvi:w + #1 \q_mark + #2 \q_nil #3 \q_nil #4 \q_nil #5 \q_nil #6 \q_stop + { \@@_print_format_auxxiii:w #1 \q_mark #6 \q_stop } % \end{macrocode} % Sorting out the placement of the uncertainty requires both the model and % real data widths, so we store the former to avoiding needing more boxes. % It's then just a case of putting the carry-over white space in the right % place. % \begin{macrocode} -\cs_new_protected:Npn \@@_print_format_auxvi:w +\cs_new_protected:Npn \@@_print_format_auxvii:w + #1 \q_mark #2 \q_stop + { + \bool_if:NTF \l_@@_align_uncertainty_bool + { \@@_print_format_auxviii:w } + { \@@_print_format_auxx:w } + #1 \q_mark #2 \q_stop + } +% \end{macrocode} +% For an aligned uncertainty, we need to work with the different parts. +% \begin{macrocode} +\cs_new_protected:Npn \@@_print_format_auxviii:w + #1 \q_nil #2 \q_nil #3 \q_mark + #4 \q_nil #5 \q_nil #6 \q_stop + { + \hbox_set:Nn \l_@@_tmp_box + { \siunitx_print_number:n { { } #1#2 { } } } + \hbox_set_to_wd:Nnn \l_@@_uncert_box + { \box_wd:N \l_@@_tmp_box } + { + \siunitx_print_number:n { { } #4 } + \@@_fil: + \tl_if_blank:nTF {#5} + { { } } + { \siunitx_print_number:n {#5} } + } + \@@_print_format_auxix:w + #3 \q_mark #6 \q_stop + } +\cs_new_protected:Npn \@@_print_format_auxix:w + #1 \q_nil #2 \q_nil #3 \q_mark + #4 \q_nil #5 \q_nil #6 \q_stop + { + \@@_print_format_box:Nn \l_@@_tmp_box {#1#2} + \hbox_set_to_wd:Nnn \l_@@_tmp_box + { + \box_wd:N \l_@@_uncert_box + + \box_wd:N \l_@@_tmp_box + } + { + \box_use:N \l_@@_uncert_box + \tl_if_blank:nF {#2#5} + { \siunitx_print_number:n {#4#5} } + \@@_fil: + } + \dim_set:Nn \l_@@_tmp_dim { \box_wd:N \l_@@_tmp_box } + \@@_print_format_auxxii:w #3 \q_mark #6 \q_stop + } +% \end{macrocode} +% Non-aligned uncertainty: we have all of the information needed as +% |#1|/|#3|, so the work is trivial. +% \begin{macrocode} +\cs_new_protected:Npn \@@_print_format_auxx:w #1 \q_nil #2 \q_nil #3 \q_nil #4 \q_mark #5 \q_nil #6 \q_nil #7 \q_nil #8 \q_stop { - \@@_print_format_box:Nn \l_@@_tmp_box { { } #1#2#3 } + \@@_print_format_auxxi:w + #1#2#3#4 \q_mark #5#6#7#8 \q_stop + } +\cs_new_protected:Npn \@@_print_format_auxxi:w + #1 \q_nil #2 \q_mark + #3 \q_nil #4 \q_stop + { + \@@_print_format_box:Nn \l_@@_tmp_box { { } #1 } \dim_set:Nn \l_@@_tmp_dim { \box_wd:N \l_@@_tmp_box } - \@@_print_format_box:Nn \l_@@_tmp_box { { } #5#6#7 } + \@@_print_format_box:Nn \l_@@_tmp_box { { } #3 } + \@@_print_format_auxxii:w #2 \q_mark #4 \q_stop + } +% \end{macrocode} +% Back together to put the uncertainty part onto the main value, then +% move on to the exponent. +% \begin{macrocode} +\cs_new_protected:Npn \@@_print_format_auxxii:w + #1 \q_mark #2 \q_stop + { \@@_print_format_after:N \l_@@_align_uncertainty_bool - \@@_print_format_auxvii:w #4 \q_mark #8 \q_stop + \@@_print_format_auxxiii:w #1 \q_mark #2 \q_stop } % \end{macrocode} % Finally, we get to the exponent part: the multiplication symbol is @@ -1472,7 +1557,7 @@ % be entirely empty, there needs to be a bit of work to ensure alignment % is retained in all cases. % \begin{macrocode} -\cs_new_protected:Npn \@@_print_format_auxvii:w +\cs_new_protected:Npn \@@_print_format_auxxiii:w #1 \q_nil #2 \q_mark #3 \q_nil #4 \q_stop { \tl_if_blank:nF {#2} diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-unit.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-unit.dtx index 713c4c53259..3b2defb6ea9 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx-unit.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx-unit.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% File: siunitx-unit.dtx Copyright (C) 2014-2022 Joseph Wright +% File: siunitx-unit.dtx Copyright (C) 2014-2023 Joseph Wright % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -355,27 +355,31 @@ % % \begin{function} % { -% \yocto , -% \zepto , -% \atto , -% \femto , -% \pico , -% \nano , -% \micro , -% \milli , -% \centi , -% \deci , -% \deca , -% \deka , -% \hecto , -% \kilo , -% \mega , -% \giga , -% \tera , -% \peta , -% \exa , -% \zetta , -% \yotta +% \quecto , +% \ronto , +% \yocto , +% \zepto , +% \atto , +% \femto , +% \pico , +% \nano , +% \micro , +% \milli , +% \centi , +% \deci , +% \deca , +% \deka , +% \hecto , +% \kilo , +% \mega , +% \giga , +% \tera , +% \peta , +% \exa , +% \zetta , +% \yotta , +% \ronna , +% \quetta % } % Prefixes, all of which are integer powers of $10$: the powers are stored % internally by the module and can be used for conversion from prefixes to @@ -2640,43 +2644,12 @@ % \subsection{Non-Latin character support} % % \begin{macro}{\@@_non_latin:n} -% \begin{macro}{\@@_non_latin:nnnn} -% A small amount of code to make it convenient to include non-Latin -% characters in units without having to directly include them in the -% sources directly. We only make the first token active as some packages -% (\foreign{e.g.}~\pkg{kotex}) do this. For Unicode engines, we -% might run into some odd situations where active characters are in -% use (\foreign{e.g.}~\pkg{luainputenc}), so take precautions here -% too, -% \begin{macrocode} -\bool_lazy_or:nnTF - { \sys_if_engine_luatex_p: } - { \sys_if_engine_xetex_p: } - { - \cs_new:Npn \@@_non_latin:n #1 - { - \exp_after:wN \exp_after:wN \exp_after:wN - \exp_not:N \char_generate:nn {#1} { \char_value_catcode:n {#1} } - } - } - { - \cs_new:Npn \@@_non_latin:n #1 - { - \exp_last_unbraced:Nf \@@_non_latin:nnnn - { \char_to_utfviii_bytes:n {#1} } - } - \cs_new:Npn \@@_non_latin:nnnn #1#2#3#4 - { - \exp_after:wN \exp_after:wN \exp_after:wN - \exp_not:N \char_generate:nn {#1} { 13 } - \char_generate:nn {#2} { 12 } - \tl_if_blank:nF {#3} - { \char_generate:nn {#3} { 12 } } - } - } +% A shortcut. +% \begin{macrocode} +\cs_new:Npn \@@_non_latin:n #1 + { \codepoint_generate:nn {#1} { \char_value_catcode:n {#1} } } % \end{macrocode} % \end{macro} -% \end{macro} % % \subsection{Pre-defined unit components} % @@ -2718,59 +2691,67 @@ % % \begin{macro} % { -% \yocto , -% \zepto , -% \atto , -% \femto , -% \pico , -% \nano , -% \micro , -% \milli , -% \centi , +% \quecto , +% \ronto , +% \yocto , +% \zepto , +% \atto , +% \femto , +% \pico , +% \nano , +% \micro , +% \milli , +% \centi , % \deci % } % The various \acro{SI} multiple prefixes are defined here: first the small % ones. % \begin{macrocode} -\siunitx_declare_prefix:Nnn \yocto { -24 } { y } -\siunitx_declare_prefix:Nnn \zepto { -21 } { z } -\siunitx_declare_prefix:Nnn \atto { -18 } { a } -\siunitx_declare_prefix:Nnn \femto { -15 } { f } -\siunitx_declare_prefix:Nnn \pico { -12 } { p } -\siunitx_declare_prefix:Nnn \nano { -9 } { n } -\siunitx_declare_prefix:Nnx \micro { -6 } { \@@_non_latin:n { "03BC } } -\siunitx_declare_prefix:Nnn \milli { -3 } { m } -\siunitx_declare_prefix:Nnn \centi { -2 } { c } -\siunitx_declare_prefix:Nnn \deci { -1 } { d } +\siunitx_declare_prefix:Nnn \quecto { -30 } { q } +\siunitx_declare_prefix:Nnn \ronto { -27 } { r } +\siunitx_declare_prefix:Nnn \yocto { -24 } { y } +\siunitx_declare_prefix:Nnn \zepto { -21 } { z } +\siunitx_declare_prefix:Nnn \atto { -18 } { a } +\siunitx_declare_prefix:Nnn \femto { -15 } { f } +\siunitx_declare_prefix:Nnn \pico { -12 } { p } +\siunitx_declare_prefix:Nnn \nano { -9 } { n } +\siunitx_declare_prefix:Nnx \micro { -6 } { \@@_non_latin:n { "03BC } } +\siunitx_declare_prefix:Nnn \milli { -3 } { m } +\siunitx_declare_prefix:Nnn \centi { -2 } { c } +\siunitx_declare_prefix:Nnn \deci { -1 } { d } % \end{macrocode} % \end{macro} % \begin{macro} % { -% \deca , -% \deka , -% \hecto , -% \kilo , -% \mega , -% \giga , -% \tera , -% \peta , -% \exa , -% \zetta , -% \yotta +% \deca , +% \deka , +% \hecto , +% \kilo , +% \mega , +% \giga , +% \tera , +% \peta , +% \exa , +% \zetta , +% \yotta , +% \ronna , +% \quetta % } % Now the large ones. % \begin{macrocode} -\siunitx_declare_prefix:Nnn \deca { 1 } { da } -\siunitx_declare_prefix:Nnn \deka { 1 } { da } -\siunitx_declare_prefix:Nnn \hecto { 2 } { h } -\siunitx_declare_prefix:Nnn \kilo { 3 } { k } -\siunitx_declare_prefix:Nnn \mega { 6 } { M } -\siunitx_declare_prefix:Nnn \giga { 9 } { G } -\siunitx_declare_prefix:Nnn \tera { 12 } { T } -\siunitx_declare_prefix:Nnn \peta { 15 } { P } -\siunitx_declare_prefix:Nnn \exa { 18 } { E } -\siunitx_declare_prefix:Nnn \zetta { 21 } { Z } -\siunitx_declare_prefix:Nnn \yotta { 24 } { Y } +\siunitx_declare_prefix:Nnn \deca { 1 } { da } +\siunitx_declare_prefix:Nnn \deka { 1 } { da } +\siunitx_declare_prefix:Nnn \hecto { 2 } { h } +\siunitx_declare_prefix:Nnn \kilo { 3 } { k } +\siunitx_declare_prefix:Nnn \mega { 6 } { M } +\siunitx_declare_prefix:Nnn \giga { 9 } { G } +\siunitx_declare_prefix:Nnn \tera { 12 } { T } +\siunitx_declare_prefix:Nnn \peta { 15 } { P } +\siunitx_declare_prefix:Nnn \exa { 18 } { E } +\siunitx_declare_prefix:Nnn \zetta { 21 } { Z } +\siunitx_declare_prefix:Nnn \yotta { 24 } { Y } +\siunitx_declare_prefix:Nnn \ronna { 27 } { R } +\siunitx_declare_prefix:Nnn \quetta { 30 } { Q } % \end{macrocode} % \end{macro} % diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx.dtx index 65004d7eb27..0ca26ecc411 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% File: siunitx.dtx Copyright (C) 2008-2019,2021,2022 Joseph Wright +% File: siunitx.dtx Copyright (C) 2008-2019,2021-2023 Joseph Wright % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -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\ExplLoaderFileDate{2020-01-09} +\@ifl@t@r\ExplLoaderFileDate{2022-11-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} {2022-12-05} {3.1.11} +\ProvidesExplPackage {siunitx} {2023-01-03} {3.2.0} {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 a92d0ee0db8..63e7f86861f 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx.tex +++ b/Master/texmf-dist/source/latex/siunitx/siunitx.tex @@ -635,26 +635,30 @@ The spelling \enquote{\cs{deka}} is provided for US users as an alternative to Prefix & Command & Symbol & \multicolumn{1}{l}{Power} & Prefix & Command & Symbol & \multicolumn{1}{l@{}}{Power} \\ \midrule - \DescribePrefix{yocto} & -24 & - \DescribePrefix{deca} & 1 \\ - \DescribePrefix{zepto} & -21 & - \DescribePrefix{hecto} & 2 \\ - \DescribePrefix{atto} & -18 & - \DescribePrefix{kilo} & 3 \\ - \DescribePrefix{femto} & -15 & - \DescribePrefix{mega} & 6 \\ - \DescribePrefix{pico} & -12 & - \DescribePrefix{giga} & 9 \\ - \DescribePrefix{nano} & -9 & - \DescribePrefix{tera} & 12 \\ - \DescribePrefix{micro} & -6 & - \DescribePrefix{peta} & 15 \\ - \DescribePrefix{milli} & -3 & - \DescribePrefix{exa} & 18 \\ - \DescribePrefix{centi} & -2 & - \DescribePrefix{zetta} & 21 \\ - \DescribePrefix{deci} & -1 & - \DescribePrefix{yotta} & 24 \\ + \DescribePrefix{quecto} & -30 & + \DescribePrefix{deca} & 1 \\ + \DescribePrefix{ronto} & -27 & + \DescribePrefix{hecto} & 2 \\ + \DescribePrefix{yocto} & -24 & + \DescribePrefix{kilo} & 3 \\ + \DescribePrefix{atto} & -18 & + \DescribePrefix{mega} & 6 \\ + \DescribePrefix{zepto} & -21 & + \DescribePrefix{giga} & 9 \\ + \DescribePrefix{femto} & -15 & + \DescribePrefix{tera} & 12 \\ + \DescribePrefix{pico} & -12 & + \DescribePrefix{peta} & 15 \\ + \DescribePrefix{nano} & -9 & + \DescribePrefix{exa} & 18 \\ + \DescribePrefix{micro} & -6 & + \DescribePrefix{zetta} & 21 \\ + \DescribePrefix{milli} & -3 & + \DescribePrefix{yotta} & 24 \\ + \DescribePrefix{centi} & -2 & + \DescribePrefix{ronna} & 27 \\ + \DescribePrefix{deci} & -1 & + \DescribePrefix{quetta} & 30 \\ \bottomrule \end{tabular} \end{table} @@ -860,6 +864,7 @@ occur (for example with the standard \cs{pm} symbol). \DescribeUnit[picofarad]{pF} \\ \DescribeUnit[nanofarad]{nF} \\ \DescribeUnit[microfarad]{uF} \\ + \DescribeUnit[millifarad]{mF} \\ \midrule @@ -1441,19 +1446,20 @@ way; the options are summarised in Table~\ref{tab:opt:num:post}. Type & \multicolumn{1}{l@{}}{Default} \\ \midrule - drop-exponent & Switch & false \\ - drop-uncertainty & Switch & false \\ - drop-zero-decimal & Switch & false \\ - exponent-mode & Switch & input \\ - fixed-exponent & Integer & 0 \\ - minimum-integer-digits & Integer & 0 \\ - minimum-decimal-digits & Integer & 0 \\ - round-half & Choice & up \\ - round-minimum & Literal & 0 \\ - round-mode & Choice & none \\ - round-pad & Switch & true \\ - round-precision & Integer & 2 \\ - round-zero-positive & Switch & true \\ + drop-exponent & Switch & false \\ + drop-uncertainty & Switch & false \\ + drop-zero-decimal & Switch & false \\ + exponent-mode & Switch & input \\ + exponent-thresholds & Literal & -3:3 \\ + fixed-exponent & Integer & 0 \\ + minimum-integer-digits & Integer & 0 \\ + minimum-decimal-digits & Integer & 0 \\ + round-half & Choice & up \\ + round-minimum & Literal & 0 \\ + round-mode & Choice & none \\ + round-pad & Switch & true \\ + round-precision & Integer & 2 \\ + round-zero-positive & Switch & true \\ \bottomrule \end{tabular} \end{table} @@ -1462,9 +1468,9 @@ way; the options are summarised in Table~\ref{tab:opt:num:post}. \DescribeOption{fixed-exponent} Numbers can be converted to scientific notation by the package. This is controlled by the \opt{exponent-mode} option, which takes choices \opt{input}, -\opt{fixed}, \opt{engineering} and \opt{scientific}. The \opt{fixed} setting -will use the exponent value by the \opt{fixed-exponent} option. When -\opt{engineering} is set, the exponent is always a power of three. +\opt{fixed}, \opt{engineering}, \opt{scientific} and \opt{threshold}. The +\opt{fixed} setting will use the exponent value by the \opt{fixed-exponent} +option. When \opt{engineering} is set, the exponent is always a power of three. \begin{LaTeXdemo} \num{0.001} \\ \num{0.0100} \\ @@ -1491,6 +1497,40 @@ scientific notation from the input \num{1.23e4} \\ \num[exponent-mode = fixed, fixed-exponent = 0]{1.23e4} \end{LaTeXdemo} +\DescribeOption{exponent-thresholds} +When the \opt{exponent-mode} is set to \meta{threshold}, values outside of a +threshold range for the exponent are always printed in scientific form. Within +the threshold, they are printed as-given in the input: typically this would be +without an exponent. The threshold range itself is controlled by +\opt{exponent-thresholds}, which is given as +\texttt{\meta{min}:\meta{max}} (Table~\ref{tab:threshold}). +\begin{LaTeXdemo}[code and float] + \begin{table} + \caption{Thresholds for exponents.% + \label{tab:threshold}} + \begin{tabular} + { + @{} + S + S[exponent-mode = threshold] + S[exponent-mode = threshold, exponent-thresholds = -2:2] + @{} + } + \toprule + {Input} & {Threshold $-3:3$} & {Threshold $-2:2$} \\ + \midrule + 0.001 & 0.001 & 0.001 \\ + 0.012 & 0.012 & 0.012 \\ + 0.123 & 0.123 & 0.123 \\ + 1 & 1 & 1 \\ + 12 & 12 & 12 \\ + 123 & 123 & 123 \\ + 1234 & 1234 & 1234 \\ + \bottomrule + \end{tabular} + \end{table} +\end{LaTeXdemo} + Exponent mode applies \emph{after} rounding, such that the number of decimal places for rounding is those which appear in the output. @@ -1653,7 +1693,9 @@ conveys. The options are summarised in Table~\ref{tab:opt:num:out}. output-decimal-marker & Literal & . \\ output-exponent-marker & Literal & \meta{none} \\ output-open-uncertainty & Literal & ( \\ ^^A ) + print-exponent-implicit-plus & Switch & false \\ print-implicit-plus & Switch & false \\ + print-mantissa-implicit-plus & Switch & false \\ print-unity-mantissa & Switch & true \\ print-zero-exponent & Switch & false \\ print-zero-integer & Switch & true \\ @@ -1846,9 +1888,12 @@ compresses spacing where possible. \end{LaTeXdemo} \DescribeOption{print-implicit-plus} +\DescribeOption{print-mantissa-implicit-plus} +\DescribeOption{print-exponent-implicit-plus} It may be useful to force all numbers to have a sign. This behaviour is controlled by the \opt{print-implicit-plus} option: this is used if given and -if no sign was present in the input. +if no sign was present in the input. It is possible to set this behavior for +the exponent and mantissa independently. \begin{LaTeXdemo} \num{345} \\ \num[print-implicit-plus]{345} diff --git a/Master/texmf-dist/tex/latex/siunitx/siunitx.sty b/Master/texmf-dist/tex/latex/siunitx/siunitx.sty index 1ca8cbb2751..0d9d44249ec 100644 --- a/Master/texmf-dist/tex/latex/siunitx/siunitx.sty +++ b/Master/texmf-dist/tex/latex/siunitx/siunitx.sty @@ -31,7 +31,7 @@ \@ifundefined{ExplLoaderFileDate} {\RequirePackage{expl3}} {} -\@ifl@t@r\ExplLoaderFileDate{2020-01-09} +\@ifl@t@r\ExplLoaderFileDate{2022-11-09} {} {% \PackageError{siunitx}{Support package expl3 too old} @@ -42,7 +42,7 @@ }% \endinput }% -\ProvidesExplPackage {siunitx} {2022-12-05} {3.1.11} +\ProvidesExplPackage {siunitx} {2023-01-03} {3.2.0} {A comprehensive (SI) units package} \msg_new:nnnn { siunitx } { incompatible-package } { Package~'#1'~incompatible. } @@ -2431,8 +2431,10 @@ drop-zero-decimal .bool_set:N = \l__siunitx_number_drop_zero_decimal_bool , exponent-mode .choices:nn = - { engineering , fixed , input , scientific } + { engineering , fixed , input , scientific , threshold } { \tl_set_eq:NN \l__siunitx_number_exponent_mode_tl \l_keys_choice_tl } , + exponent-thresholds .code:n = + { \__siunitx_number_set_thresholds:n {#1} } , fixed-exponent .int_set:N = \l__siunitx_number_exponent_fixed_int , minimum-decimal-digits .int_set:N = @@ -2479,6 +2481,24 @@ { \exp_not:n { {#3} {#4} } } } } +\int_new:N \l__siunitx_number_lower_threshold_int +\int_new:N \l__siunitx_number_upper_threshold_int +\cs_new_protected:Npx \__siunitx_number_set_thresholds:n #1 + { + \exp_not:N \__siunitx_number_set_thresholds:w + #1 \token_to_str:N : \token_to_str:N : \exp_not:N \q_stop + } +\use:x + { + \cs_new_protected:Npn \exp_not:N \__siunitx_number_set_thresholds:w + ##1 \token_to_str:N : ##2 \token_to_str:N : ##3 \exp_not:N \q_stop + } + { + \__siunitx_number_set_threshold:nn { lower } {#1} + \__siunitx_number_set_threshold:nn { upper } {#2} + } +\cs_new_protected:Npn \__siunitx_number_set_threshold:nn #1#2 + { \int_set:cn { l__siunitx_number_ #1 _threshold_int } { 0 #2 } } \cs_new_protected:Npn \siunitx_number_process:NN #1#2 { \tl_if_empty:NTF #1 @@ -2754,6 +2774,26 @@ \str_if_eq:nnF {#2} { 0 } {#3} } } +\cs_new:Npn \__siunitx_number_exponent_threshold:nnnnnnn #1#2#3#4#5#6#7 + { + \exp_args:Ne \__siunitx_number_exponent_threshold:nn + { + \__siunitx_number_exponent_scientific:nnnnnnn + {#1} {#2} {#3} {#4} {#5} {#6} {#7} + } + { {#1} {#2} {#3} {#4} {#5} {#6} {#7} } + } +\cs_new:Npn \__siunitx_number_exponent_threshold:nn #1#2 + { \__siunitx_number_exponent_threshold:nnnnnnnn #1 {#2} } +\cs_new:Npn \__siunitx_number_exponent_threshold:nnnnnnnn #1#2#3#4#5#6#7#8 + { + \bool_lazy_and:nnTF + { \int_compare_p:nNn {#6#7} > \l__siunitx_number_lower_threshold_int } + { \int_compare_p:nNn {#6#7} < \l__siunitx_number_upper_threshold_int } + { \exp_not:n {#8} } + { \exp_not:n { {#1} {#2} {#3} {#4} {#5} {#6} {#7} } } + } + \cs_new_protected:Npn \__siunitx_number_digits:NN #1#2 { \tl_set:Nx #2 @@ -3402,7 +3442,25 @@ { \int_compare_p:nNn {#3} > { \tl_count:n {#1} } } { ! \bool_lazy_and_p:nn - { \str_if_eq_p:Vn \l__siunitx_number_exponent_mode_tl { scientific } } + { + \bool_lazy_or_p:nn + { \str_if_eq_p:Vn \l__siunitx_number_exponent_mode_tl { scientific } } + { + \bool_lazy_and_p:nn + { \str_if_eq_p:Vn \l__siunitx_number_exponent_mode_tl { threshold } } + { + ! \bool_lazy_or_p:nn + { + \int_compare_p:nNn {#5#6} > + \l__siunitx_number_lower_threshold_int + } + { + \int_compare_p:nNn {#5#6} < + \l__siunitx_number_upper_threshold_int + } + } + } + } { \str_if_eq_p:nn { #1.#2 } { 10. } } } { @@ -3471,6 +3529,15 @@ { 1 } { } { { S } { 1 } } \__siunitx_number_exponent_finalise:n { #2#3 + \tl_count:n {#1} - 1 } } +\cs_new:Npn \__siunitx_number_round_uncertainty_threshold:nnn #1#2#3 + { + \bool_lazy_and:nnTF + { \int_compare_p:nNn {#2#3} > \l__siunitx_number_lower_threshold_int } + { \int_compare_p:nNn {#2#3} < \l__siunitx_number_upper_threshold_int } + { \__siunitx_number_round_uncertainty_input:nnn } + { \__siunitx_number_round_uncertainty_scientific:nnn } + {#1} {#2} {#3} + } \cs_new_protected:Npn \__siunitx_number_zero_decimal:NN #1#2 { \bool_if:NT \l__siunitx_number_drop_zero_decimal_bool @@ -3570,8 +3637,16 @@ \l__siunitx_number_output_exp_marker_tl , output-open-uncertainty .tl_set:N = \l__siunitx_number_output_uncert_open_tl , - print-implicit-plus .bool_set:N = - \l__siunitx_number_implicit_plus_bool , + print-implicit-plus .meta:n = + { + print-mantissa-implicit-plus = {#1} , + print-exponent-implicit-plus = {#1} + } , + print-implicit-plus .default:n = true , + print-mantissa-implicit-plus .bool_set:N = + \l__siunitx_number_implicit_plus_mant_bool , + print-exponent-implicit-plus .bool_set:N = + \l__siunitx_number_implicit_plus_exp_bool , print-unity-mantissa .bool_set:N = \l__siunitx_number_unity_mantissa_bool , print-zero-exponent .bool_set:N = @@ -3669,7 +3744,7 @@ { \tl_if_blank:nTF {#2} { - \bool_if:NT \l__siunitx_number_implicit_plus_bool + \bool_if:NT \l__siunitx_number_implicit_plus_mant_bool { \__siunitx_number_output_sign:nN {#1} + } } { @@ -4143,7 +4218,7 @@ \tl_if_blank:nTF {#2} { \bool_lazy_and:nnT - { \l__siunitx_number_implicit_plus_bool } + { \l__siunitx_number_implicit_plus_exp_bool } { ! \str_if_eq_p:nn {#3} { 0 } } { #1 + } } @@ -4256,7 +4331,9 @@ output-decimal-marker = . , output-open-uncertainty = ( , % ) parse-numbers = true , + print-exponent-implicit-plus = false , print-implicit-plus = false , + print-mantissa-implicit-plus = false , print-unity-mantissa = true , print-zero-exponent = false , print-zero-integer = true , @@ -4279,6 +4356,8 @@ zero-decimal-as-symbol = false , zero-symbol = \mbox { --- } } +\keys_set:nx { siunitx } + { exponent-thresholds = -3 \c_colon_str 3 } \RequirePackage { amstext } \cs_new_eq:NN \__siunitx_print_ams_text:n \text \AtBeginDocument { \RequirePackage { color } } @@ -5044,6 +5123,7 @@ \cs_generate_variant:Nn \__siunitx_table_print_text:n { V } \box_new:N \l__siunitx_table_integer_box \box_new:N \l__siunitx_table_decimal_box +\box_new:N \l__siunitx_table_uncert_box \cs_new_eq:NN \__siunitx_table_fil: \tex_hfil:D \cs_new_eq:NN \__siunitx_table_fill: \tex_hfill:D \cs_new:Npn \__siunitx_table_cleanup_decimal:w @@ -5557,24 +5637,85 @@ { \tl_if_blank:nTF {#1} { \__siunitx_table_print_format_auxv:w } - { \__siunitx_table_print_format_auxvi:w } - #1#2 \q_mark #3#4 \q_stop + { \__siunitx_table_print_format_auxvii:w } + #1 \q_nil #2 \q_mark #3 \q_nil #4 \q_stop } \cs_new_protected:Npn \__siunitx_table_print_format_auxv:w - #1 \q_nil #2 \q_nil #3 \q_nil #4 \q_mark - #5 \q_nil #6 \q_nil #7 \q_nil #8 \q_stop - { \__siunitx_table_print_format_auxvii:w #4 \q_mark #8 \q_stop } + #1 \q_nil #2 \q_nil #3 \q_nil #4 \q_nil #5 \q_mark + #6 \q_stop + { \__siunitx_table_print_format_auxvi:w #5 \q_mark #6 \q_stop } \cs_new_protected:Npn \__siunitx_table_print_format_auxvi:w + #1 \q_mark + #2 \q_nil #3 \q_nil #4 \q_nil #5 \q_nil #6 \q_stop + { \__siunitx_table_print_format_auxxiii:w #1 \q_mark #6 \q_stop } +\cs_new_protected:Npn \__siunitx_table_print_format_auxvii:w + #1 \q_mark #2 \q_stop + { + \bool_if:NTF \l__siunitx_table_align_uncertainty_bool + { \__siunitx_table_print_format_auxviii:w } + { \__siunitx_table_print_format_auxx:w } + #1 \q_mark #2 \q_stop + } +\cs_new_protected:Npn \__siunitx_table_print_format_auxviii:w + #1 \q_nil #2 \q_nil #3 \q_mark + #4 \q_nil #5 \q_nil #6 \q_stop + { + \hbox_set:Nn \l__siunitx_table_tmp_box + { \siunitx_print_number:n { { } #1#2 { } } } + \hbox_set_to_wd:Nnn \l__siunitx_table_uncert_box + { \box_wd:N \l__siunitx_table_tmp_box } + { + \siunitx_print_number:n { { } #4 } + \__siunitx_table_fil: + \tl_if_blank:nTF {#5} + { { } } + { \siunitx_print_number:n {#5} } + } + \__siunitx_table_print_format_auxix:w + #3 \q_mark #6 \q_stop + } +\cs_new_protected:Npn \__siunitx_table_print_format_auxix:w + #1 \q_nil #2 \q_nil #3 \q_mark + #4 \q_nil #5 \q_nil #6 \q_stop + { + \__siunitx_table_print_format_box:Nn \l__siunitx_table_tmp_box {#1#2} + \hbox_set_to_wd:Nnn \l__siunitx_table_tmp_box + { + \box_wd:N \l__siunitx_table_uncert_box + + \box_wd:N \l__siunitx_table_tmp_box + } + { + \box_use:N \l__siunitx_table_uncert_box + \tl_if_blank:nF {#2#5} + { \siunitx_print_number:n {#4#5} } + \__siunitx_table_fil: + } + \dim_set:Nn \l__siunitx_table_tmp_dim { \box_wd:N \l__siunitx_table_tmp_box } + \__siunitx_table_print_format_auxxii:w #3 \q_mark #6 \q_stop + } +\cs_new_protected:Npn \__siunitx_table_print_format_auxx:w #1 \q_nil #2 \q_nil #3 \q_nil #4 \q_mark #5 \q_nil #6 \q_nil #7 \q_nil #8 \q_stop { - \__siunitx_table_print_format_box:Nn \l__siunitx_table_tmp_box { { } #1#2#3 } + \__siunitx_table_print_format_auxxi:w + #1#2#3#4 \q_mark #5#6#7#8 \q_stop + } +\cs_new_protected:Npn \__siunitx_table_print_format_auxxi:w + #1 \q_nil #2 \q_mark + #3 \q_nil #4 \q_stop + { + \__siunitx_table_print_format_box:Nn \l__siunitx_table_tmp_box { { } #1 } \dim_set:Nn \l__siunitx_table_tmp_dim { \box_wd:N \l__siunitx_table_tmp_box } - \__siunitx_table_print_format_box:Nn \l__siunitx_table_tmp_box { { } #5#6#7 } + \__siunitx_table_print_format_box:Nn \l__siunitx_table_tmp_box { { } #3 } + \__siunitx_table_print_format_auxxii:w #2 \q_mark #4 \q_stop + } +\cs_new_protected:Npn \__siunitx_table_print_format_auxxii:w + #1 \q_mark #2 \q_stop + { \__siunitx_table_print_format_after:N \l__siunitx_table_align_uncertainty_bool - \__siunitx_table_print_format_auxvii:w #4 \q_mark #8 \q_stop + \__siunitx_table_print_format_auxxiii:w #1 \q_mark #2 \q_stop } -\cs_new_protected:Npn \__siunitx_table_print_format_auxvii:w +\cs_new_protected:Npn \__siunitx_table_print_format_auxxiii:w #1 \q_nil #2 \q_mark #3 \q_nil #4 \q_stop { \tl_if_blank:nF {#2} @@ -6745,31 +6886,8 @@ } } } -\bool_lazy_or:nnTF - { \sys_if_engine_luatex_p: } - { \sys_if_engine_xetex_p: } - { - \cs_new:Npn \__siunitx_unit_non_latin:n #1 - { - \exp_after:wN \exp_after:wN \exp_after:wN - \exp_not:N \char_generate:nn {#1} { \char_value_catcode:n {#1} } - } - } - { - \cs_new:Npn \__siunitx_unit_non_latin:n #1 - { - \exp_last_unbraced:Nf \__siunitx_unit_non_latin:nnnn - { \char_to_utfviii_bytes:n {#1} } - } - \cs_new:Npn \__siunitx_unit_non_latin:nnnn #1#2#3#4 - { - \exp_after:wN \exp_after:wN \exp_after:wN - \exp_not:N \char_generate:nn {#1} { 13 } - \char_generate:nn {#2} { 12 } - \tl_if_blank:nF {#3} - { \char_generate:nn {#3} { 12 } } - } - } +\cs_new:Npn \__siunitx_unit_non_latin:n #1 + { \codepoint_generate:nn {#1} { \char_value_catcode:n {#1} } } \siunitx_declare_unit:Nn \kilogram { \kilo \gram } \siunitx_declare_unit:Nn \metre { m } \siunitx_declare_unit:Nn \meter { \metre } @@ -6779,27 +6897,31 @@ \siunitx_declare_unit:Nn \kelvin { K } \siunitx_declare_unit:Nn \candela { cd } \siunitx_declare_unit:Nn \gram { g } -\siunitx_declare_prefix:Nnn \yocto { -24 } { y } -\siunitx_declare_prefix:Nnn \zepto { -21 } { z } -\siunitx_declare_prefix:Nnn \atto { -18 } { a } -\siunitx_declare_prefix:Nnn \femto { -15 } { f } -\siunitx_declare_prefix:Nnn \pico { -12 } { p } -\siunitx_declare_prefix:Nnn \nano { -9 } { n } -\siunitx_declare_prefix:Nnx \micro { -6 } { \__siunitx_unit_non_latin:n { "03BC } } -\siunitx_declare_prefix:Nnn \milli { -3 } { m } -\siunitx_declare_prefix:Nnn \centi { -2 } { c } -\siunitx_declare_prefix:Nnn \deci { -1 } { d } -\siunitx_declare_prefix:Nnn \deca { 1 } { da } -\siunitx_declare_prefix:Nnn \deka { 1 } { da } -\siunitx_declare_prefix:Nnn \hecto { 2 } { h } -\siunitx_declare_prefix:Nnn \kilo { 3 } { k } -\siunitx_declare_prefix:Nnn \mega { 6 } { M } -\siunitx_declare_prefix:Nnn \giga { 9 } { G } -\siunitx_declare_prefix:Nnn \tera { 12 } { T } -\siunitx_declare_prefix:Nnn \peta { 15 } { P } -\siunitx_declare_prefix:Nnn \exa { 18 } { E } -\siunitx_declare_prefix:Nnn \zetta { 21 } { Z } -\siunitx_declare_prefix:Nnn \yotta { 24 } { Y } +\siunitx_declare_prefix:Nnn \quecto { -30 } { q } +\siunitx_declare_prefix:Nnn \ronto { -27 } { r } +\siunitx_declare_prefix:Nnn \yocto { -24 } { y } +\siunitx_declare_prefix:Nnn \zepto { -21 } { z } +\siunitx_declare_prefix:Nnn \atto { -18 } { a } +\siunitx_declare_prefix:Nnn \femto { -15 } { f } +\siunitx_declare_prefix:Nnn \pico { -12 } { p } +\siunitx_declare_prefix:Nnn \nano { -9 } { n } +\siunitx_declare_prefix:Nnx \micro { -6 } { \__siunitx_unit_non_latin:n { "03BC } } +\siunitx_declare_prefix:Nnn \milli { -3 } { m } +\siunitx_declare_prefix:Nnn \centi { -2 } { c } +\siunitx_declare_prefix:Nnn \deci { -1 } { d } +\siunitx_declare_prefix:Nnn \deca { 1 } { da } +\siunitx_declare_prefix:Nnn \deka { 1 } { da } +\siunitx_declare_prefix:Nnn \hecto { 2 } { h } +\siunitx_declare_prefix:Nnn \kilo { 3 } { k } +\siunitx_declare_prefix:Nnn \mega { 6 } { M } +\siunitx_declare_prefix:Nnn \giga { 9 } { G } +\siunitx_declare_prefix:Nnn \tera { 12 } { T } +\siunitx_declare_prefix:Nnn \peta { 15 } { P } +\siunitx_declare_prefix:Nnn \exa { 18 } { E } +\siunitx_declare_prefix:Nnn \zetta { 21 } { Z } +\siunitx_declare_prefix:Nnn \yotta { 24 } { Y } +\siunitx_declare_prefix:Nnn \ronna { 27 } { R } +\siunitx_declare_prefix:Nnn \quetta { 30 } { Q } \siunitx_declare_unit:Nn \becquerel { Bq } \siunitx_declare_unit:Nx \degreeCelsius { \__siunitx_unit_non_latin:n { "00B0 } C } \siunitx_declare_unit:Nn \coulomb { C } @@ -7092,30 +7214,8 @@ quantity-product = \, , separate-uncertainty-units = bracket } -\bool_lazy_or:nnTF - { \sys_if_engine_luatex_p: } - { \sys_if_engine_xetex_p: } - { - \cs_new:Npn \__siunitx_quantity_non_latin:n #1 - { - \exp_after:wN \exp_after:wN \exp_after:wN - \exp_not:N \char_generate:nn {#1} { \char_value_catcode:n {#1} } - } - } - { - \cs_new:Npn \__siunitx_quantity_non_latin:n #1 - { - \exp_last_unbraced:Nf \__siunitx_quantity_non_latin:nnnn - { \char_to_utfviii_bytes:n {#1} } - } - \cs_new:Npn \__siunitx_quantity_non_latin:nnnn #1#2#3#4 - { - \exp_after:wN \exp_after:wN \exp_after:wN - \exp_not:N \char_generate:nn {#1} { 13 } - \exp_after:wN \exp_after:wN \exp_after:wN - \exp_not:N \char_generate:nn {#2} { 13 } - } - } +\cs_new:Npn \__siunitx_quantity_non_latin:n #1 + { \codepoint_generate:nn {#1} { \char_value_catcode:n {#1} } } \siunitx_declare_unit:Nxn \arcminute { \__siunitx_quantity_non_latin:n { "02B9 } } { quantity-product = { } } @@ -7132,33 +7232,8 @@ \cs_if_free:cT { T@TS1 } { \RequirePackage { textcomp } } } -\bool_lazy_or:nnTF - { \sys_if_engine_luatex_p: } - { \sys_if_engine_xetex_p: } - { - \cs_new:Npn \__siunitx_symbol_non_latin:n #1 - { - \exp_after:wN \exp_after:wN \exp_after:wN - \exp_not:N \char_generate:nn {#1} { \char_value_catcode:n {#1} } - } - } - { - \cs_new:Npn \__siunitx_symbol_non_latin:n #1 - { - \exp_last_unbraced:Nf \__siunitx_symbol_non_latin:nnnn - { \char_to_utfviii_bytes:n {#1} } - } - \cs_new:Npn \__siunitx_symbol_non_latin:nnnn #1#2#3#4 - { - \__siunitx_symbol_deal_with_utf: - \exp_after:wN \exp_after:wN \exp_after:wN - \exp_not:N \char_generate:nn {#1} { 13 } - \char_generate:nn {#2} { 12 } - \tl_if_blank:nF {#3} - { \char_generate:nn {#3} { 12 } } - } - } -\cs_new:Npn \__siunitx_symbol_deal_with_utf: { } +\cs_new:Npn \__siunitx_symbol_non_latin:n #1 + { \codepoint_generate:nn {#1} { \char_value_catcode:n {#1} } } \prg_new_protected_conditional:Npnn \__siunitx_symbol_if_replace:Nn #1#2 { T , TF } { \group_begin: @@ -7382,6 +7457,7 @@ \siunitx_declare_unit:Nn \pF { \pico \farad } \siunitx_declare_unit:Nn \nF { \nano \farad } \siunitx_declare_unit:Nn \uF { \micro \farad } +\siunitx_declare_unit:Nn \mF { \milli \farad } \siunitx_declare_unit:Nn \H { \henry } \siunitx_declare_unit:Nn \fH { \femto \henry } \siunitx_declare_unit:Nn \pH { \pico \henry } @@ -8637,30 +8713,8 @@ \siunitx_quantity_range:nnn {#2} {#3} {#4} \group_end: } -\bool_lazy_or:nnTF - { \sys_if_engine_luatex_p: } - { \sys_if_engine_xetex_p: } - { - \cs_new:Npn \__siunitx_emulation_non_latin:n #1 - { - \exp_after:wN \exp_after:wN \exp_after:wN - \exp_not:N \char_generate:nn {#1} { \char_value_catcode:n {#1} } - } - } - { - \cs_new:Npn \__siunitx_emulation_non_latin:n #1 - { - \exp_last_unbraced:Nf \__siunitx_emulation_non_latin:nnnn - { \char_to_utfviii_bytes:n {#1} } - } - \cs_new:Npn \__siunitx_emulation_non_latin:nnnn #1#2#3#4 - { - \exp_after:wN \exp_after:wN \exp_after:wN - \exp_not:N \char_generate:nn {#1} { 13 } - \exp_after:wN \exp_after:wN \exp_after:wN - \exp_not:N \char_generate:nn {#2} { 13 } - } - } +\cs_new:Npn \__siunitx_emulation_non_latin:n #1 + { \codepoint_generate:nn {#1} { \char_value_catcode:n {#1} } } \AtBeginDocument { \cs_new_protected:Npn \SIUnitSymbolArcminute |