From bd912649ca172469f47040b69c5544b32f1fc51d Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 28 May 2021 20:51:02 +0000 Subject: siunitx (28may21) git-svn-id: svn://tug.org/texlive/trunk@59381 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md | 13 +- .../texmf-dist/doc/latex/siunitx/siunitx-code.pdf | Bin 1444886 -> 1442135 bytes Master/texmf-dist/doc/latex/siunitx/siunitx.pdf | Bin 598829 -> 598863 bytes .../source/latex/siunitx/siunitx-emulation.dtx | 8 +- .../source/latex/siunitx/siunitx-number.dtx | 71 ++++--- .../source/latex/siunitx/siunitx-print.dtx | 8 +- .../source/latex/siunitx/siunitx-symbol.dtx | 56 ------ .../source/latex/siunitx/siunitx-unit.dtx | 122 +++++++----- Master/texmf-dist/source/latex/siunitx/siunitx.dtx | 2 +- Master/texmf-dist/source/latex/siunitx/siunitx.tex | 12 +- Master/texmf-dist/tex/latex/siunitx/siunitx.sty | 221 ++++++++++----------- 11 files changed, 257 insertions(+), 256 deletions(-) (limited to 'Master') diff --git a/Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md b/Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md index 0ff02b04432..f91a3e17e46 100644 --- a/Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md +++ b/Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md @@ -7,6 +7,16 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to ## [Unreleased] +## [v3.0.7] + +### Fixed +- Formatting of some literal units (issue #449) +- Issue a warning for removed option `load-configurations` + (issue #455) +- Printing of `\times` and `\cdot` in text mode when using a + locale (issue #457) +- Implement missing `output-exponent-marker` (issue #458) + ## [v3.0.6] ### Changed @@ -1312,7 +1322,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.0.6...HEAD +[Unreleased]: https://github.com/josephwright/siunitx/compare/v3.0.7...HEAD +[v3.0.7]: https://github.com/josephwright/siunitx/compare/v3.0.6...v3.0.7 [v3.0.6]: https://github.com/josephwright/siunitx/compare/v3.0.5...v3.0.6 [v3.0.5]: https://github.com/josephwright/siunitx/compare/v3.0.4...v3.0.5 [v3.0.4]: https://github.com/josephwright/siunitx/compare/v3.0.3...v3.0.4 diff --git a/Master/texmf-dist/doc/latex/siunitx/siunitx-code.pdf b/Master/texmf-dist/doc/latex/siunitx/siunitx-code.pdf index ec731faa3f1..09c3c9538d6 100644 Binary files a/Master/texmf-dist/doc/latex/siunitx/siunitx-code.pdf and b/Master/texmf-dist/doc/latex/siunitx/siunitx-code.pdf differ diff --git a/Master/texmf-dist/doc/latex/siunitx/siunitx.pdf b/Master/texmf-dist/doc/latex/siunitx/siunitx.pdf index a13fa3ea8bb..5e0b6c269da 100644 Binary files a/Master/texmf-dist/doc/latex/siunitx/siunitx.pdf and b/Master/texmf-dist/doc/latex/siunitx/siunitx.pdf differ diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-emulation.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-emulation.dtx index 48648e3c137..dc2e9f90350 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx-emulation.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx-emulation.dtx @@ -125,7 +125,13 @@ % \subsection{Load-time option} % % \begin{macrocode} -\clist_map_inline:nn { abbreviations , binary-units , version-1-compatibility } +\clist_map_inline:nn + { + abbreviations , + binary-units , + load-configurations , + version-1-compatibility + } { \keys_define:nn { siunitx } { #1 .code:n = \@@_option_removed:n {#1} } } diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx index 22fff7cdb9c..cfbff37d9c9 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx @@ -2860,6 +2860,7 @@ % \l_@@_group_minimum_int , % \l_@@_group_separator_tl , % \l_@@_negative_color_tl , +% \l_@@_output_exp_marker_tl , % \l_@@_output_uncert_close_tl , % \l_@@_output_uncert_open_tl , % \l_@@_uncert_mode_tl , @@ -2912,6 +2913,8 @@ \l_@@_output_uncert_close_tl , output-decimal-marker .tl_set:N = \l_siunitx_number_output_decimal_tl , + output-exponent-marker .tl_set:N = + \l_@@_output_exp_marker_tl , output-open-uncertainty .tl_set:N = \l_@@_output_uncert_open_tl , print-implicit-plus .bool_set:N = @@ -2980,7 +2983,13 @@ % \@@_output_uncert_S_compact-marker:nn , % \@@_output_uncert_S_full:nn % } -% \begin{macro}[rEXP]{\@@_output_exponent:nnnn} +% \begin{macro}[rEXP] +% { +% \@@_output_exponent:nnnn , +% \@@_output_exponent_auxi:nnnn , +% \@@_output_exponent_auxii:nnnn +% } +% \begin{macro}[rEXP]{\@@_output_exponent_auxiii:nn} % \begin{macro}[rEXP]{\@@_output_end:} % The approach to formatting a single number is to split into % the constituent parts. All of the parts are assembled including @@ -3371,31 +3380,46 @@ { \l_@@_zero_exponent_bool } { ! \str_if_eq_p:nn {#2} { 0 } } { - \bool_lazy_and:nnTF - { \str_if_eq_p:nn {#3} { 1. } } - { ! \l_@@_unity_mantissa_bool } - { \exp_not:n {#4} } - { - \bool_if:NTF \l_@@_tight_bool - { \exp_not:N \mathord } - { \use:n } - { \exp_not:V \l_@@_exponent_product_tl } - \exp_not:n {#4} - } - \exp_not:V \l_@@_exponent_base_tl - ^ - { - \tl_if_blank:nTF {#1} - { - \bool_if:NT \l_@@_implicit_plus_bool - { \@@_output_sign:N + } - } - { \@@_output_sign:N #1 } - \@@_output_digits:nn { integer } {#2} - } + \tl_if_empty:NTF \l_@@_output_exp_marker_tl + { \@@_output_exponent_auxi:nnnn } + { \@@_output_exponent_auxii:nnnn } + {#1} {#2} {#3} {#4} } { \exp_not:n {#4} } } +\cs_new:Npn \@@_output_exponent_auxi:nnnn #1#2#3#4 + { + \bool_lazy_and:nnTF + { \str_if_eq_p:nn {#3} { 1. } } + { ! \l_@@_unity_mantissa_bool } + { \exp_not:n {#4} } + { + \bool_if:NTF \l_@@_tight_bool + { \exp_not:N \mathord } + { \use:n } + { \exp_not:V \l_@@_exponent_product_tl } + \exp_not:n {#4} + } + \exp_not:V \l_@@_exponent_base_tl + ^ + { \@@_output_exponent_auxiii:nn {#1} {#2} } + } +\cs_new:Npn \@@_output_exponent_auxii:nnnn #1#2#3#4 + { + \exp_not:n {#4} + \exp_not:V \l_@@_output_exp_marker_tl + \@@_output_exponent_auxiii:nn {#1} {#2} + } +\cs_new:Npn \@@_output_exponent_auxiii:nn #1#2 + { + \tl_if_blank:nTF {#1} + { + \bool_if:NT \l_@@_implicit_plus_bool + { \@@_output_sign:N + } + } + { \@@_output_sign:N #1 } + \@@_output_digits:nn { integer } {#2} + } % \end{macrocode} % A do-nothing marker used to allow shuffling of the output and so expandable % operations for formatting. @@ -3437,6 +3461,7 @@ % \end{macro} % \end{macro} % \end{macro} +% \end{macro} % % \subsection{Miscellaneous tools} % diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-print.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-print.dtx index cc26177ef1a..15d44520555 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx-print.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx-print.dtx @@ -78,8 +78,8 @@ % also required to provide the functionality detailed. % \begin{itemize} % \item \pkg{color}: support for color using \cs{textcolor} -% \item \pkg{textcomp}: \cs{textminus} and \cs{textpm} for printing -% in text mode +% \item \pkg{textcomp}: \cs{textminus}, \cs{textpm} \cs{texttimes} and +% \cs{textcenteredperiod} for printing in text mode % \item \pkg{amstext}: the \cs{text} command for printing in text mode % \end{itemize} % For detection of math mode fonts, as well as \cs{mathrm}, the existence of @@ -779,6 +779,10 @@ { \exp_not:n { \ensuremath { \mp } } } - { \exp_not:N \textminus } + \exp_not:N \times + { \exp_not:N \texttimes } + \exp_not:N \cdot + { \exp_not:N \textperiodcentered } \char_generate:nn { `\_ } { 8 } { \exp_not:N \@@_text_sub:n } ^ diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-symbol.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-symbol.dtx index a517c4e34f2..8ba65fc4175 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx-symbol.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx-symbol.dtx @@ -253,62 +253,6 @@ } % \end{macrocode} % -% For the times symbol, only \LuaTeX{} allows us to use the math mode symbol -% directly. However, that likely won't follow the surrounding font appearance, -% so in all cases we use the |TS1| version for text. Otherwise much the -% same as |\textmu| support. It's hard to check for the product symbol, so -% we just go with it an hope for the best! -% \begin{macrocode} -\keys_set:nn { siunitx } - { product-symbol = \ifmmode \times \else \texttimes \fi } -\AtBeginDocument - { - \group_begin: - \tl_set:Nn \l_@@_tmpa_tl - { { } { } { 2 } { } { } { } { 1 } } - \tl_set:Nx \l_@@_tmpa_tl - { \siunitx_number_output:N \l_@@_tmpa_tl } - \tl_set:Nn \l_@@_tmpb_tl { 2 \times 10 ^ { 1 } } - \tl_if_eq:NNTF \l_@@_tmpa_tl \l_@@_tmpb_tl - { - \group_end: - \keys_set:nn { siunitx } - { - exponent-product = - \ifmmode \times \else \texttimes \fi - } - } - { - \tl_set:Nn \l_@@_tmpb_tl { 2 \cdot 10 ^ { 1 } } - \tl_if_eq:NNTF \l_@@_tmpa_tl \l_@@_tmpb_tl - { - \group_end: - \keys_set:nn { siunitx } - { - exponent-product = - \ifmmode \cdot \else \textperiodcentered \fi - } - } - { \group_end: } - } - \group_begin: - \keys_set:nn { siunitx } { forbid-literal-units = false } - \tl_set:Nn \l_@@_tmpa_tl { \mathrm { m } \cdot \mathrm { s } } - \tl_set:Nn \l_siunitx_unit_font_tl { \mathrm } - \siunitx_unit_format:nN { m . s } \l_@@_tmpb_tl - \tl_if_eq:NNTF \l_@@_tmpa_tl \l_@@_tmpb_tl - { - \group_end: - \keys_set:nn { siunitx } - { - inter-unit-product = - \ifmmode \cdot \else \textperiodcentered \fi - } - } - { \group_end: } - } -% \end{macrocode} -% % \subsection{Bookmark definitions} % % Inside PDF strings we disable the text printing function. The definition of diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-unit.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-unit.dtx index f066530439a..604883dfa6e 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx-unit.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx-unit.dtx @@ -1179,8 +1179,12 @@ % \begin{macro}{\@@_format_literal_auxi:w} % \begin{macro}{\@@_format_literal_auxii:w} % \begin{macro}{\@@_format_literal_auxiii:w} -% \begin{macro}{\@@_format_literal_auxiv:w} -% \begin{macro}{\@@_format_literal_auxv:w} +% \begin{macro}{\@@_format_literal_auxiv:n} +% \begin{macro}{\@@_format_literal_auxv:nw} +% \begin{macro}{\@@_format_literal_auxvi:nN} +% \begin{macro}{\@@_format_literal_super:nn, \@@_format_literal_sub:nn} +% \begin{macro}{\@@_format_literal_add:n} +% \begin{macro}{\@@_format_literal_auxvii:nn} % \begin{variable}{\l_@@_separator_tl} % To format literal units, there are two tasks to do. The input is % \texttt{x}-type expanded to force any symbolic units to be converted into @@ -1254,71 +1258,79 @@ \cs_new_protected:Npn \@@_format_literal_auxiii:w #1 / { \quark_if_recursion_tail_stop:n {#1} - \@@_format_literal_auxiv:w #1 ^ ^ \q_stop + \@@_format_literal_auxiv:n {#1} \tl_set:Nn \l_@@_separator_tl { / } \@@_format_literal_auxiii:w } +\cs_new_protected:Npn \@@_format_literal_auxiv:n #1 + { + \@@_format_literal_auxv:nw { } + #1 \q_recursion_tail \q_recursion_stop + } % \end{macrocode} -% Within each unit any sub- and superscript parts need to be separated out: -% wrapping everything in the font command is incorrect. The superscript part -% is relatively easy as there is no catcode issue or font command to add, -% while the subscript part needs a bit more work. As the user might have the -% two parts in either order, picking up the subscript needs to look in two -% places. We assume that only one is given: odd input here is simply accepted. +% To deal properly with literal formatting, we have to worry about super- +% and subscript markers. That can be complicated as they could come anywhere +% in the input: we handle that by iterating through the input and picking +% them out. This avoids any issue with loosing braces for mid-input scripts. +% We also have to deal with fractions, hence needing a series of nested +% loops and a change of separator. % \begin{macrocode} -\use:x +\cs_new_protected:Npn \@@_format_literal_auxv:nw + #1#2 \q_recursion_stop + { + \tl_if_head_is_N_type:nTF {#2} + { \@@_format_literal_auxvi:nN } + { \@@_format_literal_auxvii:nn } + {#1} #2 \q_recursion_stop + } +\cs_new_protected:Npx \@@_format_literal_auxvi:nN #1#2 { - \cs_new_protected:Npn \exp_not:N \@@_format_literal_auxiv:w - ##1 ^ ##2 ^ ##3 \exp_not:N \q_stop + \exp_not:N \quark_if_recursion_tail_stop_do:Nn #2 + { \exp_not:N \@@_format_literal_add:n {#1} } + \exp_not:N \token_if_eq_meaning:NNTF #2 ^ + { \exp_not:N \@@_format_literal_super:nn {#1} } { - \exp_not:N \@@_format_literal_auxv:w - ##1 - \c_@@_math_subscript_tl - \c_@@_math_subscript_tl - \exp_not:N \q_mark - ##2 - \c_@@_math_subscript_tl - \c_@@_math_subscript_tl - \exp_not:N \q_stop + \exp_not:N \token_if_eq_meaning:NNTF + #2 \c_@@_math_subscript_tl + { \exp_not:N \@@_format_literal_sub:nn {#1} } + { \exp_not:N \@@_format_literal_auxvi:nN {#1#2} } } - \cs_new_protected:Npn \exp_not:N \@@_format_literal_auxv:w - ##1 \c_@@_math_subscript_tl - ##2 \c_@@_math_subscript_tl ##3 - \exp_not:N \q_mark - ##4 \c_@@_math_subscript_tl - ##5 \c_@@_math_subscript_tl ##6 - \exp_not:N \q_stop + } +\cs_new_protected:Npn \@@_format_literal_super:nn #1#2 + { + \quark_if_recursion_tail_stop:n {#2} + \@@_format_literal_add:n {#1} + \tl_put_right:Nn \l_@@_formatted_tl { ^ {#2} } + \@@_format_literal_auxvi:nN { } + } +\cs_new_protected:Npx \@@_format_literal_sub:nn #1#2 + { + \exp_not:N \quark_if_recursion_tail_stop:n {#2} + \exp_not:N \@@_format_literal_add:n {#1} + \tl_put_right:Nx \exp_not:N \l_@@_formatted_tl { - \tl_set:Nx \exp_not:N \l_@@_formatted_tl + \c_@@_math_subscript_tl { \exp_not:N \exp_not:V - \exp_not:N \l_@@_formatted_tl - \exp_not:N \tl_if_empty:NF - \exp_not:N \l_@@_formatted_tl - { - \exp_not:N \exp_not:V - \exp_not:N \l_@@_separator_tl - } - \exp_not:N \tl_if_blank:nF {##1} - { - \exp_not:N \exp_not:V - \exp_not:N \l_siunitx_unit_font_tl - { \exp_not:N \exp_not:n {##1} } - } - \exp_not:N \tl_if_blank:nF {##4} - { ^ { \exp_not:N \exp_not:n {##4} } } - \exp_not:N \tl_if_blank:nF {##2##5} - { - \c_@@_math_subscript_tl - { - \exp_not:N \exp_not:V - \exp_not:N \l_siunitx_unit_font_tl - { \exp_not:N \exp_not:n {##2##5} } - } - } + \exp_not:N \l_siunitx_unit_font_tl + { \exp_not:N \exp_not:n {#2} } } } + \exp_not:N \@@_format_literal_auxvi:nN { } } +\cs_new_protected:Npn \@@_format_literal_add:n #1 + { + \tl_put_right:Nx \l_@@_formatted_tl + { + \tl_if_empty:NF \l_@@_formatted_tl + { \exp_not:V \l_@@_separator_tl } + \tl_if_empty:nF {#1} + { \exp_not:V \l_siunitx_unit_font_tl { \exp_not:n {#1} } } + } + \tl_clear:N \l_@@_separator_tl + } +\cs_new_protected:Npn \@@_format_literal_auxvii:nn #1#2 + { \@@_format_literal_auxvi:nN { #1 {#2} } } \tl_new:N \l_@@_separator_tl % \end{macrocode} % \end{variable} @@ -1329,6 +1341,10 @@ % \end{macro} % \end{macro} % \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} % % \subsection{(PDF) String creation} % diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx.dtx index 5c86624afb8..e553abc6b08 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx.dtx @@ -121,7 +121,7 @@ % % Identify the package and give the over all version information. % \begin{macrocode} -\ProvidesExplPackage {siunitx} {2021-05-25} {3.0.6} +\ProvidesExplPackage {siunitx} {2021-05-28} {3.0.7} {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 a45c979be16..3cb5f25ed55 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx.tex +++ b/Master/texmf-dist/source/latex/siunitx/siunitx.tex @@ -484,7 +484,7 @@ Runs of products of of numbers with units can be handled using the \cs{qtyrange}\oarg{options}\marg{number1}\marg{number2}\marg{unit} \end{syntax} \end{function} -Products of numbers with units can be handled using the \cs{qtyrange} +Ranges of numbers with units can be handled using the \cs{qtyrange} function. The behaviour of this function is similar to \cs{numrange}, but with the addition of a unit to each number. \begin{LaTeXdemo} @@ -493,7 +493,7 @@ with the addition of a unit to each number. The input of lists, products and ranges of quantities using a single command allows them to be adjusted together. These commands are intended to allow -consistent formatting of related values: as such, they apply a a single +consistent formatting of related values: as such, they apply a single unit to all of the values. This is particularly notable when using adjustment of the numerical values. @@ -1580,6 +1580,7 @@ conveys. The options are summarised in Table~\ref{tab:opt:num:out}. negative-color & Literal & \meta{none} \\ ^^A ( output-close-uncertainty & Literal & ) \\ output-decimal-marker & Literal & . \\ + output-exponent-marker & Literal & \meta{none} \\ output-open-uncertainty & Literal & ( \\ ^^A ) print-implicit-plus & Switch & false \\ print-unity-mantissa & Switch & true \\ @@ -1648,6 +1649,13 @@ When exponents are present in the input, the \opt{exponent-base} and \num[exponent-product = \cdot]{1e2} \\ \num[exponent-base = 2]{1e2} \end{LaTeXdemo} +\DescribeOption{output-exponent-marker} +Alternatively, if the \opt{output-exponent-marker} option is set then the value +stored will be used in place of the normal product and base combination. +\begin{LaTeXdemo} + \num[output-exponent-marker = e]{1e2} \\ + \num[output-exponent-marker = \mathrm{E}]{1e2} +\end{LaTeXdemo} \DescribeOption{uncertainty-separator} \DescribeOption{output-open-uncertainty} diff --git a/Master/texmf-dist/tex/latex/siunitx/siunitx.sty b/Master/texmf-dist/tex/latex/siunitx/siunitx.sty index 977f56d9efd..7c0d3387b3a 100644 --- a/Master/texmf-dist/tex/latex/siunitx/siunitx.sty +++ b/Master/texmf-dist/tex/latex/siunitx/siunitx.sty @@ -42,7 +42,7 @@ }% \endinput }% -\ProvidesExplPackage {siunitx} {2021-05-25} {3.0.6} +\ProvidesExplPackage {siunitx} {2021-05-28} {3.0.7} {A comprehensive (SI) units package} \msg_new:nnnn { siunitx } { incompatible-package } { Package~'#1'~incompatible. } @@ -2986,6 +2986,8 @@ \l__siunitx_number_output_uncert_close_tl , output-decimal-marker .tl_set:N = \l_siunitx_number_output_decimal_tl , + output-exponent-marker .tl_set:N = + \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 = @@ -3323,31 +3325,46 @@ { \l__siunitx_number_zero_exponent_bool } { ! \str_if_eq_p:nn {#2} { 0 } } { - \bool_lazy_and:nnTF - { \str_if_eq_p:nn {#3} { 1. } } - { ! \l__siunitx_number_unity_mantissa_bool } - { \exp_not:n {#4} } - { - \bool_if:NTF \l__siunitx_number_tight_bool - { \exp_not:N \mathord } - { \use:n } - { \exp_not:V \l__siunitx_number_exponent_product_tl } - \exp_not:n {#4} - } - \exp_not:V \l__siunitx_number_exponent_base_tl - ^ - { - \tl_if_blank:nTF {#1} - { - \bool_if:NT \l__siunitx_number_implicit_plus_bool - { \__siunitx_number_output_sign:N + } - } - { \__siunitx_number_output_sign:N #1 } - \__siunitx_number_output_digits:nn { integer } {#2} - } + \tl_if_empty:NTF \l__siunitx_number_output_exp_marker_tl + { \__siunitx_number_output_exponent_auxi:nnnn } + { \__siunitx_number_output_exponent_auxii:nnnn } + {#1} {#2} {#3} {#4} } { \exp_not:n {#4} } } +\cs_new:Npn \__siunitx_number_output_exponent_auxi:nnnn #1#2#3#4 + { + \bool_lazy_and:nnTF + { \str_if_eq_p:nn {#3} { 1. } } + { ! \l__siunitx_number_unity_mantissa_bool } + { \exp_not:n {#4} } + { + \bool_if:NTF \l__siunitx_number_tight_bool + { \exp_not:N \mathord } + { \use:n } + { \exp_not:V \l__siunitx_number_exponent_product_tl } + \exp_not:n {#4} + } + \exp_not:V \l__siunitx_number_exponent_base_tl + ^ + { \__siunitx_number_output_exponent_auxiii:nn {#1} {#2} } + } +\cs_new:Npn \__siunitx_number_output_exponent_auxii:nnnn #1#2#3#4 + { + \exp_not:n {#4} + \exp_not:V \l__siunitx_number_output_exp_marker_tl + \__siunitx_number_output_exponent_auxiii:nn {#1} {#2} + } +\cs_new:Npn \__siunitx_number_output_exponent_auxiii:nn #1#2 + { + \tl_if_blank:nTF {#1} + { + \bool_if:NT \l__siunitx_number_implicit_plus_bool + { \__siunitx_number_output_sign:N + } + } + { \__siunitx_number_output_sign:N #1 } + \__siunitx_number_output_digits:nn { integer } {#2} + } \cs_new:Npn \__siunitx_number_output_end: { } \tl_new:N \l__siunitx_number_valid_tl \prg_new_protected_conditional:Npnn \siunitx_if_number:n #1 @@ -3733,6 +3750,10 @@ { \exp_not:n { \ensuremath { \mp } } } - { \exp_not:N \textminus } + \exp_not:N \times + { \exp_not:N \texttimes } + \exp_not:N \cdot + { \exp_not:N \textperiodcentered } \char_generate:nn { `\_ } { 8 } { \exp_not:N \__siunitx_print_text_sub:n } ^ @@ -4936,63 +4957,71 @@ \cs_new_protected:Npn \__siunitx_unit_format_literal_auxiii:w #1 / { \quark_if_recursion_tail_stop:n {#1} - \__siunitx_unit_format_literal_auxiv:w #1 ^ ^ \q_stop + \__siunitx_unit_format_literal_auxiv:n {#1} \tl_set:Nn \l__siunitx_unit_separator_tl { / } \__siunitx_unit_format_literal_auxiii:w } -\use:x +\cs_new_protected:Npn \__siunitx_unit_format_literal_auxiv:n #1 + { + \__siunitx_unit_format_literal_auxv:nw { } + #1 \q_recursion_tail \q_recursion_stop + } +\cs_new_protected:Npn \__siunitx_unit_format_literal_auxv:nw + #1#2 \q_recursion_stop { - \cs_new_protected:Npn \exp_not:N \__siunitx_unit_format_literal_auxiv:w - ##1 ^ ##2 ^ ##3 \exp_not:N \q_stop + \tl_if_head_is_N_type:nTF {#2} + { \__siunitx_unit_format_literal_auxvi:nN } + { \__siunitx_unit_format_literal_auxvii:nn } + {#1} #2 \q_recursion_stop + } +\cs_new_protected:Npx \__siunitx_unit_format_literal_auxvi:nN #1#2 + { + \exp_not:N \quark_if_recursion_tail_stop_do:Nn #2 + { \exp_not:N \__siunitx_unit_format_literal_add:n {#1} } + \exp_not:N \token_if_eq_meaning:NNTF #2 ^ + { \exp_not:N \__siunitx_unit_format_literal_super:nn {#1} } { - \exp_not:N \__siunitx_unit_format_literal_auxv:w - ##1 - \c__siunitx_unit_math_subscript_tl - \c__siunitx_unit_math_subscript_tl - \exp_not:N \q_mark - ##2 - \c__siunitx_unit_math_subscript_tl - \c__siunitx_unit_math_subscript_tl - \exp_not:N \q_stop + \exp_not:N \token_if_eq_meaning:NNTF + #2 \c__siunitx_unit_math_subscript_tl + { \exp_not:N \__siunitx_unit_format_literal_sub:nn {#1} } + { \exp_not:N \__siunitx_unit_format_literal_auxvi:nN {#1#2} } } - \cs_new_protected:Npn \exp_not:N \__siunitx_unit_format_literal_auxv:w - ##1 \c__siunitx_unit_math_subscript_tl - ##2 \c__siunitx_unit_math_subscript_tl ##3 - \exp_not:N \q_mark - ##4 \c__siunitx_unit_math_subscript_tl - ##5 \c__siunitx_unit_math_subscript_tl ##6 - \exp_not:N \q_stop + } +\cs_new_protected:Npn \__siunitx_unit_format_literal_super:nn #1#2 + { + \quark_if_recursion_tail_stop:n {#2} + \__siunitx_unit_format_literal_add:n {#1} + \tl_put_right:Nn \l__siunitx_unit_formatted_tl { ^ {#2} } + \__siunitx_unit_format_literal_auxvi:nN { } + } +\cs_new_protected:Npx \__siunitx_unit_format_literal_sub:nn #1#2 + { + \exp_not:N \quark_if_recursion_tail_stop:n {#2} + \exp_not:N \__siunitx_unit_format_literal_add:n {#1} + \tl_put_right:Nx \exp_not:N \l__siunitx_unit_formatted_tl { - \tl_set:Nx \exp_not:N \l__siunitx_unit_formatted_tl + \c__siunitx_unit_math_subscript_tl { \exp_not:N \exp_not:V - \exp_not:N \l__siunitx_unit_formatted_tl - \exp_not:N \tl_if_empty:NF - \exp_not:N \l__siunitx_unit_formatted_tl - { - \exp_not:N \exp_not:V - \exp_not:N \l__siunitx_unit_separator_tl - } - \exp_not:N \tl_if_blank:nF {##1} - { - \exp_not:N \exp_not:V - \exp_not:N \l_siunitx_unit_font_tl - { \exp_not:N \exp_not:n {##1} } - } - \exp_not:N \tl_if_blank:nF {##4} - { ^ { \exp_not:N \exp_not:n {##4} } } - \exp_not:N \tl_if_blank:nF {##2##5} - { - \c__siunitx_unit_math_subscript_tl - { - \exp_not:N \exp_not:V - \exp_not:N \l_siunitx_unit_font_tl - { \exp_not:N \exp_not:n {##2##5} } - } - } + \exp_not:N \l_siunitx_unit_font_tl + { \exp_not:N \exp_not:n {#2} } } } + \exp_not:N \__siunitx_unit_format_literal_auxvi:nN { } + } +\cs_new_protected:Npn \__siunitx_unit_format_literal_add:n #1 + { + \tl_put_right:Nx \l__siunitx_unit_formatted_tl + { + \tl_if_empty:NF \l__siunitx_unit_formatted_tl + { \exp_not:V \l__siunitx_unit_separator_tl } + \tl_if_empty:nF {#1} + { \exp_not:V \l_siunitx_unit_font_tl { \exp_not:n {#1} } } + } + \tl_clear:N \l__siunitx_unit_separator_tl } +\cs_new_protected:Npn \__siunitx_unit_format_literal_auxvii:nn #1#2 + { \__siunitx_unit_format_literal_auxvi:nN { #1 {#2} } } \tl_new:N \l__siunitx_unit_separator_tl \cs_new_protected:Npn \siunitx_unit_pdfstring_context: { @@ -6116,54 +6145,6 @@ } } } -\keys_set:nn { siunitx } - { product-symbol = \ifmmode \times \else \texttimes \fi } -\AtBeginDocument - { - \group_begin: - \tl_set:Nn \l__siunitx_symbol_tmpa_tl - { { } { } { 2 } { } { } { } { 1 } } - \tl_set:Nx \l__siunitx_symbol_tmpa_tl - { \siunitx_number_output:N \l__siunitx_symbol_tmpa_tl } - \tl_set:Nn \l__siunitx_symbol_tmpb_tl { 2 \times 10 ^ { 1 } } - \tl_if_eq:NNTF \l__siunitx_symbol_tmpa_tl \l__siunitx_symbol_tmpb_tl - { - \group_end: - \keys_set:nn { siunitx } - { - exponent-product = - \ifmmode \times \else \texttimes \fi - } - } - { - \tl_set:Nn \l__siunitx_symbol_tmpb_tl { 2 \cdot 10 ^ { 1 } } - \tl_if_eq:NNTF \l__siunitx_symbol_tmpa_tl \l__siunitx_symbol_tmpb_tl - { - \group_end: - \keys_set:nn { siunitx } - { - exponent-product = - \ifmmode \cdot \else \textperiodcentered \fi - } - } - { \group_end: } - } - \group_begin: - \keys_set:nn { siunitx } { forbid-literal-units = false } - \tl_set:Nn \l__siunitx_symbol_tmpa_tl { \mathrm { m } \cdot \mathrm { s } } - \tl_set:Nn \l_siunitx_unit_font_tl { \mathrm } - \siunitx_unit_format:nN { m . s } \l__siunitx_symbol_tmpb_tl - \tl_if_eq:NNTF \l__siunitx_symbol_tmpa_tl \l__siunitx_symbol_tmpb_tl - { - \group_end: - \keys_set:nn { siunitx } - { - inter-unit-product = - \ifmmode \cdot \else \textperiodcentered \fi - } - } - { \group_end: } - } \AtBeginDocument { \@ifpackageloaded { hyperref } @@ -6404,7 +6385,13 @@ {#1} } \cs_generate_variant:Nn \__siunitx_option_removed:n { V } -\clist_map_inline:nn { abbreviations , binary-units , version-1-compatibility } +\clist_map_inline:nn + { + abbreviations , + binary-units , + load-configurations , + version-1-compatibility + } { \keys_define:nn { siunitx } { #1 .code:n = \__siunitx_option_removed:n {#1} } } -- cgit v1.2.3