diff options
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/siunitx/siunitx.pdf | bin | 515671 -> 517263 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/siunitx/siunitx.dtx | 178 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/siunitx/config/siunitx-binary.cfg | 2 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/siunitx/config/siunitx-version-1.cfg | 4 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/siunitx/siunitx.sty | 103 |
5 files changed, 235 insertions, 52 deletions
diff --git a/Master/texmf-dist/doc/latex/siunitx/siunitx.pdf b/Master/texmf-dist/doc/latex/siunitx/siunitx.pdf Binary files differindex 8dd6c1ca0a7..d412762fa3a 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.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx.dtx index a85d51d34ad..ee99cc0708a 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx.dtx @@ -172,8 +172,9 @@ This work consists of the file siunitx.dtx \DeclareSIUnit{\KWH}{kWh} \DeclareSIPrePower\quartic{4} \DeclareSIPostPower\tothefourth{4} -\DeclareSIQualifier\polymer{pol} \DeclareSIQualifier\catalyst{cat} +\DeclareSIQualifier\isotropic{i} +\DeclareSIQualifier\polymer{pol} %\DisableImplementation \begin{document} \DocInput{\jobname.dtx} @@ -234,6 +235,7 @@ This work consists of the file siunitx.dtx % ang, % angstrom, % becquerel, +% bel, % bit, % bottomrule, % byte, @@ -502,6 +504,19 @@ This work consists of the file siunitx.dtx % no number fixed} %\changes{v2.1b}{2010/11/05}{Bug in hyphen printing when detecting mode % sorted} +%\changes{v2.1c}{2010/11/11}{Discourage line break between number and +% unit even when it is permitted} +%\changes{v2.1c}{2010/11/13}{New \opt{text} choice for +% \opt{qualifier-mode} option} +%\changes{v2.1c}{2010/11/14}{After reviewing internals, \cs{numlist}, +% \cs{numrange}, \cs{SIlist} and \cs{SIrange} are documented as +% requiring text mode due to issues with spacing and line breaks} +%\changes{v2.1c}{2010/11/14}{Auto-detect math mode in tables and +% correct output accordingly} +%\changes{v2.1d}{2010/11/14}{Apply unit options when +% \opt{free-standing-units} is active} +%\changes{v2.1d}{2010/11/14}{Error with definition of version 1 option +% \opt{xspace} corrected} % %\begin{abstract} % Typesetting values with units requires care to ensure that the @@ -685,7 +700,12 @@ This work consists of the file siunitx.dtx %\end{syntax} % Lists of numbers may be processed using the \cs{numlist} function. % Each \meta{number} is given within the list of \meta{numbers} within -% a brace pair, as the list can have a flexible length. +% a brace pair, as the list can have a flexible length. This function +% should be used in text mode, a common feature of all of the list and +% range functions provided by \pkg{siunitx}.\footnote{The reason for +% this restriction is that the separators between items may involve +% text-mode spaces which must be able to vanish at line breaks. It is +% not possible to achieve this effect from inside math mode.} %\begin{LaTeXdemo} % \numlist{10;30;50;70} %\end{LaTeXdemo} @@ -696,7 +716,8 @@ This work consists of the file siunitx.dtx %\end{syntax} % Simple ranges of numbers can be handled using the \cs{numrange} % function. This acts in the same way as \cs{num}, but inserts a -% phrase or other text between the two entries. +% phrase or other text between the two entries. This function should +% be used in text mode. %\begin{LaTeXdemo} % \numrange{10}{30} %\end{LaTeXdemo} @@ -791,7 +812,8 @@ This work consists of the file siunitx.dtx %\end{syntax} % Lists of numbers with units can be handled using the \cs{SIlist} % function. The behaviour of this function is similar to \cs{numlist}, -% but with the addition of a unit to each number. +% but with the addition of a unit to each number. This function should +% be used in text mode. %\begin{LaTeXdemo} % \SIlist{10;30;45}{\metre} %\end{LaTeXdemo} @@ -802,7 +824,8 @@ This work consists of the file siunitx.dtx %\end{syntax} % Ranges of numbers with units can be handled using the \cs{SIrange} % function. The behaviour of this function is similar to \cs{numrange}, -% but with the addition of a unit to each number. +% but with the addition of a unit to each number. This function should +% be used in text mode. %\begin{LaTeXdemo} % \SIrange{10}{30}{\metre} %\end{LaTeXdemo} @@ -1745,7 +1768,7 @@ This work consists of the file siunitx.dtx % bracket-numbers & Switch & true \\ ^^A ( % close-bracket & Literal & ) \\ % complex-root-position & Choice & after-number \\ -% copy-` & Choice & false \\ +% copy-complex-root & Choice & false \\ % copy-decimal-marker & Choice & false \\ % exponent-base & Literal & 10 \\ % exponent-product & Math & \cs{times} \\ @@ -2560,15 +2583,19 @@ This work consists of the file siunitx.dtx %\DescribeOption{qualifier-mode} % Unit qualifiers can be printed in three different formats, set by the % \opt{qualifier-mode} option. The standard setting is \opt{subscript}, -% while the options \opt{brackets} and \opt{space} are also possible. -% With the last settings, powers can lead to ambiguity and are +% while the options \opt{brackets}, \opt{space} and \opt{text} are also +% possible. With the last settings, powers can lead to ambiguity and are % automatically detected and brackets added as appropriate. %\begin{LaTeXdemo} % \si{\kilogram\polymer\squared\per\mole\catalyst\per\hour} \\ -% \si[qualifier-mode=brackets] +% \si[qualifier-mode = brackets] % {\kilogram\polymer\squared\per\mole\catalyst\per\hour} \\ -% \si[qualifier-mode=space] -% {\kilogram\polymer\squared\per\mole\catalyst\per\hour} +% \si[qualifier-mode = subscript] +% {\kilogram\polymer\squared\per\mole\catalyst\per\hour} \\ +% \si[qualifier-mode = space] +% {\kilogram\polymer\squared\per\mole\catalyst\per\hour} \\ +% \si[qualifier-mode = text] +% {\deci\bel\isotropic} %\end{LaTeXdemo} % %\DescribeOption{prefixes-as-symbols} @@ -4374,7 +4401,7 @@ This work consists of the file siunitx.dtx % % The usual preliminaries. % \begin{macrocode} -\ProvidesExplPackage {siunitx} {2010/11/05} {2.1b} +\ProvidesExplPackage {siunitx} {2010/11/14} {2.1c} {A comprehensive (SI) units package} % \end{macrocode} % @@ -9839,6 +9866,13 @@ This work consists of the file siunitx.dtx { \ProvideDocumentCommand \exp_not:N #1 { } { + \exp_not:N \cs_if_free:NF + \exp_not:c { l_siunitx_ \token_to_str:N #1 _options_tl } + { + \keys_set:nV { siunitx } + \exp_not:c + { l_siunitx_ \token_to_str:N #1 _options_tl } + } \bool_if:NT \l_siunitx_create_prespace_bool { \exp_not:n @@ -9864,6 +9898,13 @@ This work consists of the file siunitx.dtx { \ProvideDocumentCommand \exp_not:N #1 { o } { + \exp_not:N \cs_if_free:cF + \exp_not:c { l_siunitx_ \token_to_str:N #1 _options_tl } + { + \keys_set:nV { siunitx } + \exp_not:c + { l_siunitx_ \token_to_str:N #1 _options_tl } + } \exp_not:N \IfNoValueTF {####1} { \exp_not:n { \siunitx_unit_output:nn {#1} { } } } { @@ -10366,6 +10407,8 @@ This work consists of the file siunitx.dtx { \tl_set:Nn \l_siunitx_qualifier_mode_tl { space } }, qualifier-mode / subscript .code:n = { \tl_set:Nn \l_siunitx_qualifier_mode_tl { subscript } }, + qualifier-mode / text .code:n = + { \tl_set:Nn \l_siunitx_qualifier_mode_tl { text } }, } \keys_set:nn { siunitx } { bracket-unit-denominator = true, @@ -10848,7 +10891,8 @@ This work consists of the file siunitx.dtx %\begin{macro}{\siunitx_unit_format_qualifier_brackets:} %\begin{macro}{\siunitx_unit_format_qualifier_space:} %\begin{macro}{\siunitx_unit_format_qualifier_subscript:} -% Three methods for showing qualifiers, each with its own sub-function. +%\begin{macro}{\siunitx_unit_format_qualifier_text:} +% Four methods for showing qualifiers, each with its own sub-function. % For the \texttt{space} methods, a warning is set in the property list % as if there is a power then some brackets will be needed. % \begin{macrocode} @@ -10893,11 +10937,15 @@ This work consists of the file siunitx.dtx { @ { \exp_not:V \l_siunitx_tmpa_tl } } } } +\cs_new_protected_nopar:Npn \siunitx_unit_format_qualifier_text: { + \tl_put_right:NV \l_siunitx_unit_current_tl \l_siunitx_tmpa_tl +} % \end{macrocode} %\end{macro} %\end{macro} %\end{macro} %\end{macro} +%\end{macro} % %\begin{macro}{\siunitx_unit_format_sorted:} % For when the powers are sorted with the positive ones first. The only @@ -11089,7 +11137,7 @@ This work consists of the file siunitx.dtx % \begin{macrocode} \cs_new_protected_nopar:Npn \siunitx_unit_output_number_sep: { \bool_if:NTF \l_siunitx_number_unit_breaks_bool - { \allowbreak } { \nobreak } + { \penalty \binoppenalty } { \nobreak } \siunitx_ensuremath:n { \l_siunitx_number_unit_separator_tl } } % \end{macrocode} @@ -11321,11 +11369,7 @@ This work consists of the file siunitx.dtx \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_set:Nx \l_siunitx_tmpa_tl - { - \exp_not:N \text { \exp_not:V \l_siunitx_list_separator_final_tl } - } - \tl_put_right:NV \l_siunitx_list_tl \l_siunitx_tmpa_tl + \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 } @@ -11333,10 +11377,8 @@ This work consists of the file siunitx.dtx \tl_if_empty:NTF \l_siunitx_list_tl { \tl_set_eq:NN \l_siunitx_list_tl \l_siunitx_list_current_tl } { - \tl_set:Nx \l_siunitx_tmpa_tl - { \exp_not:N \text { \exp_not:V \l_siunitx_list_separator_tl } } - \tl_put_right:NV \l_siunitx_list_tl \l_siunitx_tmpa_tl - \tl_put_right:NV \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} } @@ -11428,7 +11470,7 @@ This work consists of the file siunitx.dtx % \begin{macrocode} \cs_new_protected:Npn \siunitx_range_numbers:nn #1#2 { \siunitx_range_numbers_aux:n {#1} - \text { \l_siunitx_range_phrase_tl } + \tl_use:N \l_siunitx_range_phrase_tl \siunitx_range_numbers_aux:n {#2} } \cs_new_protected:Npn \siunitx_range_numbers_aux:n #1 { @@ -11562,6 +11604,15 @@ This work consists of the file siunitx.dtx % \end{macrocode} %\end{macro} % +%\begin{macro}{\l_siunitx_table_math_bool} +% A flag used inside the table cell to track math mode: there is +% a need to do things by hand as otherwise the grouping goes +% wrong. +% \begin{macrocode} +\bool_new:N \l_siunitx_table_math_bool +% \end{macrocode} +%\end{macro} +% %\begin{macro}{\l_siunitx_table_collect_pre_bool} %\begin{macro}{\l_siunitx_table_collect_post_bool} % Flags for having found a number in an \texttt{S} column. @@ -11612,6 +11663,7 @@ This work consists of the file siunitx.dtx %\end{macro} % %\begin{macro}{\siunitx_table_collect_expand:N} +%\begin{macro}[aux]{\siunitx_table_collect_expand_math:N} % The idea here is to expand content if possible. There are a few % things to note. Only macros which are not long or protected are % expanded. There is the possibility that the macro may need the @@ -11642,7 +11694,10 @@ This work consists of the file siunitx.dtx } { \bool_if:NTF \l_siunitx_table_collect_pre_bool - { \tl_put_right:Nn \l_siunitx_table_collect_pre_tl {#1} } + { + \tl_put_right:Nn \l_siunitx_table_collect_pre_tl {#1} + \siunitx_table_collect_expand_math:N #1 + } { \bool_set_true:N \l_siunitx_table_collect_post_bool \tl_put_right:Nn \l_siunitx_table_collect_post_tl {#1} @@ -11651,6 +11706,29 @@ This work consists of the file siunitx.dtx } } % \end{macrocode} +% There is a need to keep a track of math mode, so that there are no +% disasters when the tokens are boxed up later. The ideal is to know +% the math state of the collected tokens so that appropriate +% steps can be taken to insert math shift tokens later. +% \begin{macrocode} +\cs_new_protected:Npn \siunitx_table_collect_expand_math:N #1 { + \token_if_math_shift:NTF #1 + { + \bool_if:NTF \l_siunitx_table_math_bool + { \bool_set_false:N \l_siunitx_table_math_bool } + { \bool_set_true:N \l_siunitx_table_math_bool } + } + { + \cs_if_eq:NNTF #1 \( % \) + { \bool_set_true:N \l_siunitx_table_math_bool } + { % \( + \cs_if_eq:NNT #1 \) + { \bool_set_false:N \l_siunitx_table_math_bool } + } + } +} +% \end{macrocode} +%\end{macro} %\end{macro} % %\begin{macro}{\siunitx_table_collect_get:} @@ -11687,6 +11765,7 @@ This work consists of the file siunitx.dtx \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 } % \end{macrocode} %\end{macro} @@ -12301,6 +12380,7 @@ This work consists of the file siunitx.dtx { \box_wd:N \l_siunitx_table_pre_box } = { \c_zero_skip } { \tl_use:N \l_siunitx_table_collect_pre_tl } { \box_use:N \l_siunitx_table_pre_box } + \bool_if:NT \l_siunitx_table_math_bool { \c_math_shift_token } \siunitx_table_print_S_parse: \siunitx_table_print_S_measure:Nnn \l_siunitx_number_out_prop { integer } { mantissa } @@ -12321,6 +12401,7 @@ This work consists of the file siunitx.dtx { \l_siunitx_table_integer_dim } > { \l_siunitx_table_fill_dim } { \siunitx_table_print_S_centered_integer: } { \siunitx_table_print_S_centered_decimal: } + \bool_if:NT \l_siunitx_table_math_bool { \c_math_shift_token } \bool_if:NTF \l_siunitx_table_align_post_bool { \box_use:N \l_siunitx_table_post_box } { @@ -12340,9 +12421,25 @@ This work consists of the file siunitx.dtx % \begin{macrocode} \cs_new_protected_nopar:Npn \siunitx_table_print_S_centered_ends: { \hbox_set:Nn \l_siunitx_table_pre_box - { { \tl_use:N \l_siunitx_table_collect_pre_tl } } + { + { + \tl_use:N \l_siunitx_table_collect_pre_tl + \bool_if:NT \l_siunitx_table_math_bool + { + \scan_stop: + \c_math_shift_token + } + } + } \hbox_set:Nn \l_siunitx_table_post_box - { \tl_use:N \l_siunitx_table_collect_post_tl } + { + \bool_if:NT \l_siunitx_table_math_bool + { + \c_math_shift_token + \scan_stop: + } + \tl_use:N \l_siunitx_table_collect_post_tl + } \dim_compare:nNnTF { \box_wd:N \l_siunitx_table_pre_box } > { \box_wd:N \l_siunitx_table_post_box } @@ -12403,7 +12500,10 @@ This work consists of the file siunitx.dtx \dim_compare:nNnTF { \box_wd:N \l_siunitx_table_pre_box } = { \c_zero_skip } { \tl_use:N \l_siunitx_table_collect_pre_tl } - { \box_use:N \l_siunitx_table_pre_box } + { + \box_use:N \l_siunitx_table_pre_box + \bool_if:NT \l_siunitx_table_math_bool { \c_math_shift_token } + } \siunitx_table_print_S_model_create: \bool_if:NT \l_siunitx_table_auto_bool { @@ -12446,6 +12546,7 @@ This work consists of the file siunitx.dtx { an~exponent } } } + \bool_if:NT \l_siunitx_table_math_bool { \c_math_shift_token } \bool_if:NTF \l_siunitx_table_align_post_bool { \box_use:N \l_siunitx_table_post_box } { @@ -12466,7 +12567,15 @@ This work consists of the file siunitx.dtx % created spaces. % \begin{macrocode} \cs_new_protected_nopar:Npn \siunitx_table_print_S_reserved_ends: { - \hbox_set:Nn \l_siunitx_tmp_box { \l_siunitx_table_pre_tl } + \hbox_set:Nn \l_siunitx_tmp_box + { + \l_siunitx_table_pre_tl + \bool_if:NT \l_siunitx_table_math_bool + { + \scan_stop: + \c_math_shift_token + } + } \hbox_set_to_wd:Nnn \l_siunitx_table_pre_box { \box_wd:N \l_siunitx_tmp_box } { @@ -12477,6 +12586,11 @@ This work consists of the file siunitx.dtx \hbox_set_to_wd:Nnn \l_siunitx_table_post_box { \box_wd:N \l_siunitx_tmp_box } { + \bool_if:NT \l_siunitx_table_math_bool + { + \c_math_shift_token + \scan_stop: + } \tl_use:N \l_siunitx_table_collect_post_tl \tex_hfil:D } @@ -14273,7 +14387,7 @@ This work consists of the file siunitx.dtx % \end{macrocode} % % \begin{macrocode} -\ProvidesExplFile {siunitx-version-1.cfg} {2010/11/05} {2.1b} +\ProvidesExplFile {siunitx-version-1.cfg} {2010/11/14} {2.1c} {siunitx: Version 1 settings} % \end{macrocode} % @@ -14886,7 +15000,7 @@ This work consists of the file siunitx.dtx valuesep / unknown .meta:n = { number-unit-separator = #1 }, xspace .meta:n = { use-xspace = #1 }, - xpace .default:n = { true }, + xspace .default:n = { true }, } % \end{macrocode} % @@ -15554,7 +15668,7 @@ This work consists of the file siunitx.dtx % \end{macrocode} % % \begin{macrocode} -\ProvidesExplFile {siunitx-binary.cfg} {2010/11/05} {2.1b} +\ProvidesExplFile {siunitx-binary.cfg} {2010/11/14} {2.1c} {siunitx: Binary units} % \end{macrocode} % 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 3557545c710..fbef2f0d7e2 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} {2010/11/05} {2.1b} +\ProvidesExplFile {siunitx-binary.cfg} {2010/11/14} {2.1c} {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 00cd5a02dd8..615dcd983c4 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} {2010/11/05} {2.1b} +\ProvidesExplFile {siunitx-version-1.cfg} {2010/11/14} {2.1c} {siunitx: Version 1 settings} \keys_set:nn { siunitx } { load-configurations = { abbreviations , binary } } @@ -615,7 +615,7 @@ valuesep / unknown .meta:n = { number-unit-separator = #1 }, xspace .meta:n = { use-xspace = #1 }, - xpace .default:n = { true }, + xspace .default:n = { true }, } \keys_define:nn { siunitx } { unknown .code:n = diff --git a/Master/texmf-dist/tex/latex/siunitx/siunitx.sty b/Master/texmf-dist/tex/latex/siunitx/siunitx.sty index f5a4fcb5d00..9b53d47ef63 100644 --- a/Master/texmf-dist/tex/latex/siunitx/siunitx.sty +++ b/Master/texmf-dist/tex/latex/siunitx/siunitx.sty @@ -14,7 +14,7 @@ %% --------------------------------------------------------------- %% \RequirePackage{expl3} -\ProvidesExplPackage {siunitx} {2010/11/05} {2.1b} +\ProvidesExplPackage {siunitx} {2010/11/14} {2.1c} {A comprehensive (SI) units package} \msg_set:nnnn { siunitx } { incompatible-package } { Package~'#1'~incompatible. } @@ -3679,6 +3679,13 @@ { \ProvideDocumentCommand \exp_not:N #1 { } { + \exp_not:N \cs_if_free:NF + \exp_not:c { l_siunitx_ \token_to_str:N #1 _options_tl } + { + \keys_set:nV { siunitx } + \exp_not:c + { l_siunitx_ \token_to_str:N #1 _options_tl } + } \bool_if:NT \l_siunitx_create_prespace_bool { \exp_not:n @@ -3704,6 +3711,13 @@ { \ProvideDocumentCommand \exp_not:N #1 { o } { + \exp_not:N \cs_if_free:cF + \exp_not:c { l_siunitx_ \token_to_str:N #1 _options_tl } + { + \keys_set:nV { siunitx } + \exp_not:c + { l_siunitx_ \token_to_str:N #1 _options_tl } + } \exp_not:N \IfNoValueTF {####1} { \exp_not:n { \siunitx_unit_output:nn {#1} { } } } { @@ -3989,6 +4003,8 @@ { \tl_set:Nn \l_siunitx_qualifier_mode_tl { space } }, qualifier-mode / subscript .code:n = { \tl_set:Nn \l_siunitx_qualifier_mode_tl { subscript } }, + qualifier-mode / text .code:n = + { \tl_set:Nn \l_siunitx_qualifier_mode_tl { text } }, } \keys_set:nn { siunitx } { bracket-unit-denominator = true, @@ -4385,6 +4401,9 @@ { @ { \exp_not:V \l_siunitx_tmpa_tl } } } } +\cs_new_protected_nopar: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: { \tl_set_eq:NN \l_siunitx_unit_tl \l_siunitx_unit_numerator_tl \tl_if_empty:NF \l_siunitx_unit_tl @@ -4513,7 +4532,7 @@ \cs_generate_variant:Nn \siunitx_unit_output:nn { V } \cs_new_protected_nopar:Npn \siunitx_unit_output_number_sep: { \bool_if:NTF \l_siunitx_number_unit_breaks_bool - { \allowbreak } { \nobreak } + { \penalty \binoppenalty } { \nobreak } \siunitx_ensuremath:n { \l_siunitx_number_unit_separator_tl } } \cs_new_protected_nopar:Npn \siunitx_unit_output_pre_print: { @@ -4647,11 +4666,7 @@ \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_set:Nx \l_siunitx_tmpa_tl - { - \exp_not:N \text { \exp_not:V \l_siunitx_list_separator_final_tl } - } - \tl_put_right:NV \l_siunitx_list_tl \l_siunitx_tmpa_tl + \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 } @@ -4659,10 +4674,8 @@ \tl_if_empty:NTF \l_siunitx_list_tl { \tl_set_eq:NN \l_siunitx_list_tl \l_siunitx_list_current_tl } { - \tl_set:Nx \l_siunitx_tmpa_tl - { \exp_not:N \text { \exp_not:V \l_siunitx_list_separator_tl } } - \tl_put_right:NV \l_siunitx_list_tl \l_siunitx_tmpa_tl - \tl_put_right:NV \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} } @@ -4719,7 +4732,7 @@ } \cs_new_protected:Npn \siunitx_range_numbers:nn #1#2 { \siunitx_range_numbers_aux:n {#1} - \text { \l_siunitx_range_phrase_tl } + \tl_use:N \l_siunitx_range_phrase_tl \siunitx_range_numbers_aux:n {#2} } \cs_new_protected:Npn \siunitx_range_numbers_aux:n #1 { @@ -4796,6 +4809,7 @@ \tl_new:N \l_siunitx_table_collect_pre_tl \tl_new:N \l_siunitx_table_collect_post_tl \tl_new:N \l_siunitx_number_valid_tl +\bool_new:N \l_siunitx_table_math_bool \bool_new:N \l_siunitx_table_collect_pre_bool \bool_new:N \l_siunitx_table_collect_post_bool \cs_new_protected:Npn \siunitx_table_collect_begin:Nn #1#2 { @@ -4843,7 +4857,10 @@ } { \bool_if:NTF \l_siunitx_table_collect_pre_bool - { \tl_put_right:Nn \l_siunitx_table_collect_pre_tl {#1} } + { + \tl_put_right:Nn \l_siunitx_table_collect_pre_tl {#1} + \siunitx_table_collect_expand_math:N #1 + } { \bool_set_true:N \l_siunitx_table_collect_post_bool \tl_put_right:Nn \l_siunitx_table_collect_post_tl {#1} @@ -4851,6 +4868,22 @@ } } } +\cs_new_protected:Npn \siunitx_table_collect_expand_math:N #1 { + \token_if_math_shift:NTF #1 + { + \bool_if:NTF \l_siunitx_table_math_bool + { \bool_set_false:N \l_siunitx_table_math_bool } + { \bool_set_true:N \l_siunitx_table_math_bool } + } + { + \cs_if_eq:NNTF #1 \( % \) + { \bool_set_true:N \l_siunitx_table_math_bool } + { % \( + \cs_if_eq:NNT #1 \) + { \bool_set_false:N \l_siunitx_table_math_bool } + } + } +} \cs_new_protected_nopar:Npn \siunitx_table_collect_get: { \cs_set_eq:NN \siunitx_table_collect_next: \siunitx_table_collect_get: @@ -4869,6 +4902,7 @@ \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: { \siunitx_table_collect_init: @@ -5207,6 +5241,7 @@ { \box_wd:N \l_siunitx_table_pre_box } = { \c_zero_skip } { \tl_use:N \l_siunitx_table_collect_pre_tl } { \box_use:N \l_siunitx_table_pre_box } + \bool_if:NT \l_siunitx_table_math_bool { \c_math_shift_token } \siunitx_table_print_S_parse: \siunitx_table_print_S_measure:Nnn \l_siunitx_number_out_prop { integer } { mantissa } @@ -5227,6 +5262,7 @@ { \l_siunitx_table_integer_dim } > { \l_siunitx_table_fill_dim } { \siunitx_table_print_S_centered_integer: } { \siunitx_table_print_S_centered_decimal: } + \bool_if:NT \l_siunitx_table_math_bool { \c_math_shift_token } \bool_if:NTF \l_siunitx_table_align_post_bool { \box_use:N \l_siunitx_table_post_box } { @@ -5239,9 +5275,25 @@ } \cs_new_protected_nopar:Npn \siunitx_table_print_S_centered_ends: { \hbox_set:Nn \l_siunitx_table_pre_box - { { \tl_use:N \l_siunitx_table_collect_pre_tl } } + { + { + \tl_use:N \l_siunitx_table_collect_pre_tl + \bool_if:NT \l_siunitx_table_math_bool + { + \scan_stop: + \c_math_shift_token + } + } + } \hbox_set:Nn \l_siunitx_table_post_box - { \tl_use:N \l_siunitx_table_collect_post_tl } + { + \bool_if:NT \l_siunitx_table_math_bool + { + \c_math_shift_token + \scan_stop: + } + \tl_use:N \l_siunitx_table_collect_post_tl + } \dim_compare:nNnTF { \box_wd:N \l_siunitx_table_pre_box } > { \box_wd:N \l_siunitx_table_post_box } @@ -5285,7 +5337,10 @@ \dim_compare:nNnTF { \box_wd:N \l_siunitx_table_pre_box } = { \c_zero_skip } { \tl_use:N \l_siunitx_table_collect_pre_tl } - { \box_use:N \l_siunitx_table_pre_box } + { + \box_use:N \l_siunitx_table_pre_box + \bool_if:NT \l_siunitx_table_math_bool { \c_math_shift_token } + } \siunitx_table_print_S_model_create: \bool_if:NT \l_siunitx_table_auto_bool { @@ -5328,6 +5383,7 @@ { an~exponent } } } + \bool_if:NT \l_siunitx_table_math_bool { \c_math_shift_token } \bool_if:NTF \l_siunitx_table_align_post_bool { \box_use:N \l_siunitx_table_post_box } { @@ -5342,7 +5398,15 @@ } } \cs_new_protected_nopar:Npn \siunitx_table_print_S_reserved_ends: { - \hbox_set:Nn \l_siunitx_tmp_box { \l_siunitx_table_pre_tl } + \hbox_set:Nn \l_siunitx_tmp_box + { + \l_siunitx_table_pre_tl + \bool_if:NT \l_siunitx_table_math_bool + { + \scan_stop: + \c_math_shift_token + } + } \hbox_set_to_wd:Nnn \l_siunitx_table_pre_box { \box_wd:N \l_siunitx_tmp_box } { @@ -5353,6 +5417,11 @@ \hbox_set_to_wd:Nnn \l_siunitx_table_post_box { \box_wd:N \l_siunitx_tmp_box } { + \bool_if:NT \l_siunitx_table_math_bool + { + \c_math_shift_token + \scan_stop: + } \tl_use:N \l_siunitx_table_collect_post_tl \tex_hfil:D } |