diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/siunitx/siunitx.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/siunitx/siunitx.dtx | 437 |
1 files changed, 228 insertions, 209 deletions
diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx.dtx index 2842c9b939c..4f27817aa86 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx.dtx @@ -34,7 +34,7 @@ siunitx.dtx` will extract it and also typeset the documentation. The package requires LaTeX3 support as provided in the `l3kernel` and `l3packages` bundles. Both of these are available on [CTAN](http://www.ctan.org/) as ready-to-install zip files. -Suitable versions are available in MiKTeX 2.9 and TeX Live 2012 +Suitable versions are available in MiKTeX 2.9 and TeX Live 2015 (updating the relevant packages online may be necessary). LaTeX3, and so `siunitx`, requires the e-TeX extensions: these are available on all modern TeX systems. @@ -125,7 +125,8 @@ This work consists of the file siunitx.dtx \fi %</internal> %<*driver|package> -\RequirePackage{expl3,xparse} +\RequirePackage{expl3}[2015/03/01] +\RequirePackage{xparse} %</driver|package> %<*driver> \documentclass[german,french,spanish,english,UKenglish]{l3doc} @@ -565,7 +566,7 @@ This work consists of the file siunitx.dtx % nine digits to scientific notation} %\changes{v2.5}{2012/04/07}{Minor change to table code to give fewer underfull % boxes when comparators are used} -%\changes{v2.5}{2012/04/08}{Reduced number of intrinsically-mathematical +%\changes{v2.5}{2012/04/08}{Reduced number of intrinsically-mathematical % options} %\changes{v2.5a}{2012/04/19}{When creating free-standing unit, allow % for \enquote{dynamic} nature of spacing (bug introduced in v2.5)} @@ -620,7 +621,7 @@ This work consists of the file siunitx.dtx % detected} % \changes{v2.6c}{2014/10/01}{Fix use of \cs{micro} when \pkg{fontspec} % is loaded but \pkg{unicode-math} is not} -% \changes{v2.6d}{2014/10/07}{Fix conversion of \enquote{long} to +% \changes{v2.6d}{2014/10/07}{Fix conversion of \enquote{long} to % \enquote{short} uncertainty values with integer mantissas} % \changes{v2.6e}{2015/01/21}{Auto-detect some packages where \pkg{fontspec} % should not affect default symbol use} @@ -629,6 +630,10 @@ This work consists of the file siunitx.dtx % \changes{v2.6f}{2015/04/04}{Further work on \pkg{mathspec}} % \changes{v2.6g}{2015/06/24}{Fix issue with empty table cells} % \changes{v2.6h}{2015/07/17}{Update internals to track \pkg{expl3} changes} +% \changes{v2.6i}{2015/08/18}{Fix rounding of numbers with large numbers of +% digits} +% \changes{v2.6i}{2015/08/18}{Fix behaviour of \cs{cancel} when printing +% in math mode} % %\begin{abstract} % Physical quantities have both numbers and units, and each physical @@ -686,7 +691,7 @@ This work consists of the file siunitx.dtx % \pkg{l3kernel} and \pkg{l3packages} bundles. Both of these are available % on \href{http://www.ctan.org}{\textsc{ctan}} as ready-to-install % zip files. Suitable versions are available in MiK\TeX{}~2.9 and -% \TeX{}~Live 2012 (updating the relevant packages online may be +% \TeX{}~Live 2015 (updating the relevant packages online may be % necessary). \LaTeX3, and so \pkg{siunitx}, requires the \eTeX{} % extensions: these are available on all modern \TeX{} systems. % @@ -3015,7 +3020,7 @@ This work consists of the file siunitx.dtx % \opt{qualifier-mode} option} % \changes{v2.5d}{2012/06/11}{New \opt{phrase} choice for \opt{qualifier-mode} % option} -% \DescribeOption{qualifier-phrase} +% \DescribeOption{qualifier-phrase} % \changes{v2.5d}{2012/06/11}{New \opt{qualifier-phrase} option} % Unit qualifiers can be printed in three different formats, set by the % \opt{qualifier-mode} option. The standard setting is \opt{subscript}, @@ -3039,7 +3044,7 @@ This work consists of the file siunitx.dtx % \si[qualifier-mode = phrase] % {\kilogram\polymer\squared\per\mole\catalyst\per\hour} \\ % \si[qualifier-mode = phrase, qualifier-phrase = { by }] -% {\kilogram\polymer\squared\per\mole\catalyst\per\hour} \\ +% {\kilogram\polymer\squared\per\mole\catalyst\per\hour} \\ %\end{LaTeXdemo} % %\DescribeOption{prefixes-as-symbols} @@ -4789,7 +4794,7 @@ This work consists of the file siunitx.dtx % math or text mode, the \enquote{intrinsic} math mode options could lead to % inconsistent output. The only options which now force math mode are those % for products, which will almost always require the use of math mode. -% +% % \subsection{Upgrading from version 2.4} % % The process of removing options which assume math mode, begun with @@ -5143,7 +5148,7 @@ This work consists of the file siunitx.dtx % \begin{macrocode} %<*package> % \end{macrocode} -% +% % \begin{macrocode} %<@@=siunitx> % \end{macrocode} @@ -5152,7 +5157,7 @@ This work consists of the file siunitx.dtx % % The usual preliminaries. % \begin{macrocode} -\ProvidesExplPackage {siunitx} {2015/07/17} {2.6h} +\ProvidesExplPackage {siunitx} {2015/08/18} {2.6i} {A comprehensive (SI) units package} % \end{macrocode} % @@ -5160,7 +5165,7 @@ This work consists of the file siunitx.dtx % This will also trap any problems with \pkg{l3packages} (as the two are now % tied together, version-wise). % \begin{macrocode} -\@ifpackagelater { expl3 } { 2012/11/21 } +\@ifpackagelater { expl3 } { 2015/03/01 } { } { \PackageError { siunitx } { Support~package~expl3~too~old } @@ -5213,18 +5218,12 @@ This work consists of the file siunitx.dtx % \end{macrocode} %\end{macro} % -% \begin{macro}{\clist_map_function:nc} +% Add some variants. % \begin{macrocode} \cs_generate_variant:Nn \clist_map_function:nN { nc } +\cs_generate_variant:Nn \tl_if_blank:nTF { V } +\cs_generate_variant:Nn \tl_replace_all:Nnn { No, NV } % \end{macrocode} -% \end{macro} -% -% \begin{macro}{\tl_if_blank:VTF} -% Needed for the literal test. -% \begin{macrocode} -\cs_generate_variant:Nn \tl_if_blank:nTF { V } -% \end{macrocode} -% \end{macro} % %\begin{macro}{ % \l_@@_tmp_bool , @@ -5288,7 +5287,7 @@ This work consists of the file siunitx.dtx % To allow the correct symbol to appear in text mode: this is the same % as \cs{textminus} from \pkg{textcomp}. If \pkg{fontspec} is loaded % then the real character can be used unless there's a good reason -% to suspect +% to suspect % \begin{macrocode} \DeclareTextSymbolDefault \c_@@_minus_tl { TS1 } \DeclareTextSymbol \c_@@_minus_tl { TS1 } { 61 } @@ -5591,55 +5590,54 @@ This work consists of the file siunitx.dtx % \end{macrocode} % \end{macro} % -% \begin{macro}{\tl_if_in:NVTF, \tl_replace_all:NnV} % Variants needed which are not in \pkg{expl3}. % \begin{macrocode} +\cs_generate_variant:Nn \tl_if_empty_p:n { f } +\cs_generate_variant:Nn \tl_if_empty:nT { f } \cs_generate_variant:Nn \tl_if_in:NnTF { NV } \cs_generate_variant:Nn \tl_replace_all:Nnn { NnV } % \end{macrocode} -% \end{macro} % -%\begin{macro}[pTF]{ -% \@@_cs_if_tl:N , -% \@@_cs_if_macro:N -%} -%\begin{macro}[aux]{\@@_cs_if_tl_aux:w} -% This is basically a re-hash of stuff from \pkg{expl3}, but to test for -% short macros only. The second test (with the \cs{cs_to_str:N} part) -% is checking for \LaTeXe{} robust commands. +% \begin{macro}[pTF]{\@@_cs_if_tl:N} +% A test for token lists (more or less). % \begin{macrocode} -\group_begin: -\tl_map_inline:nn { \M \A \C \R \O } - { \char_set_catcode_other:n { `#1 } } -\tl_map_inline:nn { \F \N \T } - { \char_set_lccode:nn { `#1 } { `#1 } } -\tl_to_lowercase:n { - \group_end: - \prg_new_conditional:Npnn \@@_cs_if_tl:N #1 { T , F, TF , p } - { - \exp_last_unbraced:No \@@_cs_if_tl_aux:w - { \token_to_meaning:N #1 MACRO \q_stop } +\prg_new_conditional:Npnn \@@_cs_if_tl:N #1 { T, F , TF , p } + { + \bool_if:nTF + { + \tl_if_empty_p:f { - \cs_if_exist:cTF { \cs_to_str:N #1 ~ } - { \prg_return_false: } - { \prg_return_true: } + \token_get_prefix_spec:N #1 + \token_get_arg_spec:N #1 } - { \prg_return_false: } - } - \cs_new:Npn \@@_cs_if_tl_aux:w #1 MACRO #2 \q_stop - { \tl_if_empty:nTF {#1} } - \prg_new_conditional:Npnn \@@_cs_if_macro:N #1 - { T , F , TF , p } - { - \exp_last_unbraced:No \@@_cs_if_tl_aux:w - { \token_to_meaning:N #1 MACRO \q_stop } - { \prg_return_true: } - { \prg_return_false: } - } -} + && ! \cs_if_exist_p:c { \cs_to_str:N #1 ~ } + } + { \prg_return_true: } + { \prg_return_false: } + } % \end{macrocode} -%\end{macro} -%\end{macro} +% \end{macro} +% +% \begin{macro}[EXP] +% {\@@_number_if_zero:nTF, \@@_number_if_zero_p:n \@@_number_if_zero_p:V} +% \begin{macro}[EXP, aux]{\@@_number_if_zero_aux:n} +% A test for all of the input to a function being made up of zeros: +% needed to avoid overflowing \TeX{}'s integer range. +% \begin{macrocode} +\prg_new_conditional:Npnn \@@_number_if_zero:n #1 { p , TF } + { + \tl_map_function:nN {#1} \@@_number_if_zero_aux:n + \prg_return_true: + } +\cs_generate_variant:Nn \@@_number_if_zero_p:n { V } +\cs_new:Npn \@@_number_if_zero_aux:n #1 + { + \token_if_eq_charcode:NNF #1 0 + { \tl_map_break:n { \prg_return_false: \use_none:n } } + } +% \end{macrocode} +% \end{macro} +% \end{macro} % % If \pkg{tex4ht} is in use, make a few changes to give nicer looking % conversion to other formats. @@ -5657,7 +5655,7 @@ This work consists of the file siunitx.dtx { } } % \end{macrocode} -% +% % \begin{macro}{\@@_ensure_ltr:n} % When the \pkg{bidi} package is loaded with \XeTeX{} we need to make sure % that \cs{text} is doing the correct thing. The \pkg{bidi} package seems to @@ -5750,7 +5748,7 @@ This work consists of the file siunitx.dtx } \group_end: } -\tl_put_right:Nn \document +\tl_put_right:Nn \document { \@@_set_math_fam:n { sf } \@@_set_math_fam:n { tt } @@ -6412,11 +6410,9 @@ This work consists of the file siunitx.dtx % \end{macrocode} %\end{macro} % -%\begin{macro}{ -% \@@_print_math: , -% \@@_print_text:, -% \@@_print_text_aux: -%} +% \begin{macro}{\@@_print_math:, \@@_print_text:} +% \begin{macro}[aux]{\@@_print_text_aux:} +% \begin{macro}[aux]{\@@_print_text_aux:NnN} % Printing the text means replacing any awkward characters, which is % dependent on the output mode. The rest of the package uses "_" and % "^" to represent sub- and superscripts, respectively. In this way, @@ -6438,43 +6434,39 @@ This work consists of the file siunitx.dtx { \l_@@_print_arg_tl } } } -\group_begin: - \char_set_lccode:nn { `\@ } { `\_ } - \char_set_catcode_math_subscript:N \@ - \char_set_lccode:nn { `\! } { `\_ } - \char_set_catcode_active:N \! - \char_set_lccode:nn { `\= } { `\_ } - \char_set_lccode:nn { `\+ } { `\^ } -\tl_to_lowercase:n { - \group_end: - \cs_new_protected:Npn \@@_print_text: - { - \tl_replace_all:Nnn \l_@@_print_arg_tl { - } - { \c_@@_minus_tl } - \@@_print_text_aux: - \tl_replace_all:Nnn \l_@@_print_arg_tl { \mp } - { \ensuremath { \mp } } - \tl_remove_all:Nn \l_@@_print_arg_tl { \mathord } - \cs_set_eq:NN \PrintSubscript \@@_print_text_sub:n - \cs_set_eq:NN \PrintSuperscript \@@_print_text_super:n - \tl_replace_all:Nnn \l_@@_print_arg_tl { @ } - { \@@_print_text_sub:n } - \tl_replace_all:Nnn \l_@@_print_arg_tl { ! } - { \@@_print_text_sub:n } - \tl_replace_all:Nnn \l_@@_print_arg_tl { = } - { \@@_print_text_sub:n } - \tl_replace_all:Nnn \l_@@_print_arg_tl { ^ } - { \@@_print_text_super:n } - \tl_replace_all:Nnn \l_@@_print_arg_tl { + } - { \@@_print_text_super:n } - \l_@@_print_arg_tl - } -} +\cs_new_protected_nopar:Npn \@@_print_text: + { + \tl_replace_all:Nnn \l_@@_print_arg_tl { - } + { \c_@@_minus_tl } + \@@_print_text_aux: + \tl_replace_all:Nnn \l_@@_print_arg_tl { \mp } + { \ensuremath { \mp } } + \tl_remove_all:Nn \l_@@_print_arg_tl { \mathord } + \cs_set_eq:NN \PrintSubscript \@@_print_text_sub:n + \cs_set_eq:NN \PrintSuperscript \@@_print_text_super:n + \__siunitx_print_text_aux:NnN + _ { math_subscript } \@@_print_text_sub:n + _ { active } \@@_print_text_sub:n + ^ { math_superscript } \@@_print_text_super:n + ^ { active } \@@_print_text_super:n + \q_recursion_tail ? ? + \q_recursion_stop + \l_@@_print_arg_tl + } \cs_new_protected:Npn \@@_print_text_aux: { \tl_replace_all:Nnn \l_@@_print_arg_tl { \pm } { \ensuremath { \pm } } } +\cs_new_protected:Npn \@@_print_text_aux:NnN #1#2#3 + { + \quark_if_recursion_tail_stop:N #1 + \tl_set_rescan:Nnn \l_@@_tmp_tl + { \use:c { char_set_catcode_ #2 :N } #1 } + {#1} + \tl_replace_all:NVn \l_@@_print_arg_tl \l_@@_tmp_tl {#3} + \_@@_print_text_aux:NnN + } \AtBeginDocument { \@ifpackageloaded { textcomp } @@ -6488,7 +6480,9 @@ This work consists of the file siunitx.dtx { } } % \end{macrocode} -%\end{macro} +% \end{macro} +% \end{macro} +% \end{macro} % %\begin{macro}{ % \@@_print_text_sub:n , @@ -6892,7 +6886,7 @@ This work consists of the file siunitx.dtx {% \char_set_catcode_ignore:N\ % \char_set_catcode_other:N\,% - \char_set_catcode_other:N\.% + \char_set_catcode_other:N\.% }% {#1}% \exp_args:NNNV\group_end: @@ -6984,28 +6978,41 @@ This work consists of the file siunitx.dtx %\end{macro} %\end{macro} % -%\begin{macro}{\@@_number_in_sign_replace:N} -% A short spin-out to keep the replacement of tokens clear. +% \begin{macro}[int]{\@@_number_in_sign_replace:N} +% \begin{macro}[aux]{\@@_number_in_sign_replace_aux:N} +% \begin{macro}[aux]{\@@_number_in_sign_replace_aux:NnN} +% A short spin-out to keep the replacement of tokens clear. +% The case where |-| is active needs special treatment and +% needs to come first. % \begin{macrocode} +\cs_new_protected:Npn \@@_number_in_sign_replace:N #1 + { + \@@_number_in_sign_replace_aux:N #1 + \@@_number_in_sign_replace_aux:NnN #1 + { -+ } \mp + { +- } \pm + { << } \ll + { <= } \le + { >> } \gg + { >= } \ge + { ?? } \q_recursion_tail + \q_recursion_stop + } \group_begin: -\char_set_catcode_active:N \* -\char_set_lccode:nn { `\* } { `\- } -\tl_to_lowercase:n + \char_set_catcode_active:N - + \cs_new_protected:Npx \_@@_number_in_sign_replace_aux:N #1 + { \tl_replace_all:Nnn #1 { \exp_not:N - } { \token_to_str:N - } } +\group_end: +\cs_new_protected:Npn \@@_number_in_sign_replace_aux:NnN #1#2#3 { - \group_end: - \cs_new_protected:Npn \@@_number_in_sign_replace:N #1 - { - \tl_replace_all:Nnn #1 { * } { - } - \tl_replace_all:Nnn #1 { -+ } { \mp } - \tl_replace_all:Nnn #1 { +- } { \pm } - \tl_replace_all:Nnn #1 { << } { \ll } - \tl_replace_all:Nnn #1 { <= } { \le } - \tl_replace_all:Nnn #1 { >> } { \gg } - \tl_replace_all:Nnn #1 { >= } { \ge } - } + \quark_if_recursion_tail_stop:N #3 + \tl_replace_all:Nnn #1 {#2} {#3} + \@@_number_in_sign_replace_aux:NnN #1 } % \end{macrocode} -%\end{macro} +% \end{macro} +% \end{macro} +% \end{macro} % %\begin{macro}{ % \@@_number_in_parse_error:nn , @@ -8364,7 +8371,7 @@ This work consists of the file siunitx.dtx } } { - \int_compare:nNnTF { 0 #1 } = { 0 } + \@@_number_if_zero:nTF {#1} { \@@_number_process_fixed_aux_ii:nnn {##1} {##2} { #3 - 1 } @@ -8804,12 +8811,11 @@ This work consists of the file siunitx.dtx % \begin{macrocode} \cs_new_protected:Npn \@@_number_process_round_tidy:n #1 { - \int_compare:nNnTF - { - 0 \l_@@_round_integer_out_tl + - 0 \l_@@_round_decimal_out_tl + \bool_if:nTF + { + \@@_number_if_zero_p:V \l_@@_round_integer_out_tl + && \@@_number_if_zero_p:V \l_@@_round_decimal_out_tl } - = \c_zero { \str_if_eq:VnTF \l_@@_process_round_min_tl { 0 } { @@ -8854,6 +8860,7 @@ This work consists of the file siunitx.dtx % \@@_number_process_scientific_aux_i:nnn , % \@@_number_process_scientific_aux_ii:nnn , % \@@_number_process_scientific_large:nnn , +% \@@_number_process_scientific_large_loop:nNN , % \@@_number_process_scientific_small:wn , % \@@_number_process_scientific_store:nnn , % \@@_number_process_scientific_engineering:nnn , @@ -8914,40 +8921,43 @@ This work consists of the file siunitx.dtx % \begin{macrocode} \cs_new_protected:Npn \@@_number_process_scientific_aux_ii:nnn #1#2#3 { - \int_compare:nNnTF {#1} > { 9 } + \int_compare:nNnTF { \tl_count:n {#1} } > \c_one { \@@_number_process_scientific_large:nnn {#1} {#2} {#3} } { - \int_compare:nNnTF {#1} > { 0 } + \@@_number_if_zero:nTF {#1} + { + \@@_number_process_scientific_small:wn + #2 \q_stop {#3} + } { \bool_if:NTF \l_@@_process_engineering_bool { \@@_number_process_scientific_engineering:nnn } { \@@_number_process_scientific_store:nnn } {#1} {#2} {#3} } - { - \@@_number_process_scientific_small:wn - #2 \q_stop {#3} - } + } } % \end{macrocode} -% The fastest way to find the smallest digit of the integer part is -% using some mathematics. This does limit the range of the input, but -% in real cases this should not be an issue. +% A faster approach here is to use integer maths to do the digit move, +% but that runs into problems with the range available for the input. +% Instead, we use a loop to find the last digit. % \begin{macrocode} -\cs_new_protected:Npn - \@@_number_process_scientific_large:nnn #1#2#3 { - \int_set:Nn \l_@@_tmp_int { \int_div_truncate:nn {#1} { 10 } } - \tl_set:Nx \l_@@_tmpa_tl { \int_use:N \l_@@_tmp_int } - \int_set:Nn \l_@@_tmp_int { #1 - 10 * \l_@@_tmp_int } - \tl_set:Nx \l_@@_tmpa_tl - { - { \l_@@_tmpa_tl } { \int_use:N \l_@@_tmp_int #2 } - { #3 + 1 } - } - \exp_after:wN \@@_number_process_scientific_aux_ii:nnn - \l_@@_tmpa_tl -} +\cs_new_protected:Npn \@@_number_process_scientific_large:nnn #1#2#3 + { + \cs_set_protected:Npn \@@_number_process_scientific_large_loop:nNN + ##1##2##3 + { + \quark_if_recursion_tail_stop_do:Nn ##3 + { + \@@_number_process_scientific_aux_ii:nnn {##1} { ##2 #2 } + { #3 + \c_one } + } + \@@_number_process_scientific_large_loop:nNN { ##1 ##2 } ##3 + } + \@@_number_process_scientific_large_loop:nNN { } #1 + \q_recursion_tail \q_recursion_stop + } % \end{macrocode} % For small numbers, the important digit is easy to find. % \begin{macrocode} @@ -10149,7 +10159,7 @@ This work consists of the file siunitx.dtx \bool_if:NTF \l_@@_tight_bool { \tl_set:Nx \l_@@_tmpa_tl - { \exp_not:N \mathord \exp_not:V \l_@@_tmpa_tl } + { \exp_not:N \mathord \exp_not:V \l_@@_tmpa_tl } } { \prop_if_in:NnT \l_@@_number_out_prop { mantissa } @@ -11311,6 +11321,7 @@ This work consists of the file siunitx.dtx %\end{macro} % %\begin{macro}{\cancel} +%\begin{macro}[aux]{\@@_real_cancel:n} %\begin{macro}[aux]{\@@_cancel:n} % The \cs{cancel} macro is odd as it is only defined if the appropriate % package is loaded. @@ -11318,7 +11329,9 @@ This work consists of the file siunitx.dtx \AtBeginDocument { \cs_if_exist:NT \cancel { - \cs_set_eq:NN \@@_cancel:n \cancel + \cs_set_protected:Npn \@@_cancel:n #1 + { \@@__real_cancel:n { \@@_print:nn { unit } {#1} } } + \cs_set_eq:NN \@@__real_cancel:n \cancel \seq_put_right:Nn \l_@@_declare_list_seq { \cancel } \cs_new_protected:cpn { @@_ \token_to_str:N \cancel _function:w } @@ -11328,6 +11341,7 @@ This work consists of the file siunitx.dtx % \end{macrocode} %\end{macro} %\end{macro} +%\end{macro} % %\begin{macro}{\highlight} % Another special function: selective colour. @@ -11534,7 +11548,7 @@ This work consists of the file siunitx.dtx \cs_new_protected:Npn \@@_protect_symbols:N #1 { \cs_if_exist:NT #1 { - \@@_cs_if_macro:NT #1 + \tl_if_empty:fT { \token_get_prefix_spec:N #1 } { \cs_set_protected:Npx #1 { \exp_not:V #1 } } } } @@ -12277,29 +12291,27 @@ This work consists of the file siunitx.dtx % the outer level. % \begin{macrocode} \group_begin: - \char_set_lccode:nn { `\+ } { `\^ } \char_set_catcode_active:N \~ -\tl_to_lowercase:n - { - \group_end: - \cs_new_protected:Npn \@@_unit_format_literal:n #1 - { - \int_zero:N \l_@@_unit_prefix_int - \seq_map_inline:Nn \l_@@_declare_list_seq - { \@@_unit_print_literal_aux:N ##1 } - \tl_set:Nn \l_@@_unit_tl {#1} - \tl_replace_all:NnV \l_@@_unit_tl { . } \l_@@_unit_product_tl - \tl_replace_all:NnV \l_@@_unit_tl { ~ } \l_@@_unit_product_tl - \bool_if:NT \l_@@_literal_power_bool - { - \tl_replace_all:Nnn \l_@@_unit_tl { ^ } - { \@@_unit_format_literal_power:n } - \tl_replace_all:Nnn \l_@@_unit_tl { + } - { \@@_unit_format_literal_power:n } - } - \@@_unit_format_literal_extras: - } - } + \cs_new_protected:Npn \@@_unit_format_literal:n #1 + { + \int_zero:N \l_@@_unit_prefix_int + \seq_map_inline:Nn \l_@@_declare_list_seq + { \@@_unit_print_literal_aux:N ##1 } + \tl_set:Nn \l_@@_unit_tl {#1} + \tl_replace_all:NnV \l_@@_unit_tl { . } + \l_@@_unit_product_tl + \tl_replace_all:NnV \l_@@_unit_tl { ~ } + \l_@@_unit_product_tl + \bool_if:NT \l_@@_literal_power_bool + { + \tl_replace_all:Nnn \l_@@_unit_tl { ^ } + { \@@_unit_format_literal_power:n } + \tl_replace_all:Non \l_@@_unit_tl { \token_to_str:N ^ } + { \@@_unit_format_literal_power:n } + } + \@@_unit_format_literal_extras: + } +\group_end: \cs_new_protected:Npn \@@_unit_print_literal_aux:N #1 { \cs_set_eq:Nc #1 { @@_ \token_to_str:N #1 _literal:w } } \cs_new_protected:Npn \@@_unit_format_literal_power:n #1 @@ -13273,7 +13285,7 @@ This work consists of the file siunitx.dtx { \tl_set_eq:NN \l_@@_tmpa_tl \l_@@_exponent_product_tl \bool_if:NT \l_@@_tight_bool - { + { \tl_set:Nx \l_@@_tmpa_tl { \exp_not:N \mathord \exp_not:o \l_@@_tmpa_tl } } @@ -13309,7 +13321,7 @@ This work consists of the file siunitx.dtx \cs_undefine:N \NC@find@S \msg_new:nnn { siunitx } { moved-cellspace-column } { Column~type~for~cellspace~package~moved~to~'#1'. } - \msg_warning:nnn { siunitx } { moved-cellspace-column } { C } + \msg_warning:nnn { siunitx } { moved-cellspace-column } { C } } { } } @@ -13852,7 +13864,7 @@ This work consists of the file siunitx.dtx { \skip_horizontal:n { \c_@@_one_fill_skip - ##1 } \tex_kern:D \c_zero_skip - \hbox_set_inline_end: + \hbox_set_end: \@@_table_colortbl_correction: } } @@ -14859,7 +14871,7 @@ This work consists of the file siunitx.dtx { \cs_set_eq:NN \@@_table_print_S_reserved_store_fill:n \@@_table_print_S_reserved_store_fill_mid:n - \@@_table_print_S_reserved_store_fill:n + \@@_table_print_S_reserved_store_fill:n { \box_wd:N \l_@@_tmp_box } } } @@ -14928,7 +14940,7 @@ This work consists of the file siunitx.dtx \dim_set:Nn \l_@@_table_exponent_dim { \box_wd:N \l_@@_tmp_box } \tl_if_empty:NT \l_@@_output_exponent_tl - { + { \prop_if_in:NnTF \l_@@_number_out_prop { mantissa } { \@@_table_print_S_reserved_exponent_product: } { \@@_table_print_S_reserved_exponent_product_correction: } @@ -15388,19 +15400,25 @@ This work consists of the file siunitx.dtx %\end{macro} %\end{macro} % -%\begin{macro}{\@@_symbol_new:n} -% For creating the outer symbol macro. +% \begin{macro}{\@@_symbol_new:n} +% For creating the outer symbol macro. % \begin{macrocode} -\cs_new_protected:Npn \@@_symbol_new:n #1 { - \cs_set_protected:cpn { SIUnitSymbol #1 } - { - \mode_if_math:TF - { \tl_to_lowercase:n { \use:c { l_@@_ #1 _math_tl } } } - { \tl_to_lowercase:n { \use:c { l_@@_ #1 _text_tl } } } - } -} +\cs_new_protected:Npn \@@_symbol_new:n #1 + { + \cs_set_protected:cpn { SIUnitSymbol #1 } + { + \use:c + { + l__@@_ + \str_fold_case:n {#1} + _ + \mode_if_math:TF { math } { text } + _tl + } + } + } % \end{macrocode} -%\end{macro} +% \end{macro} % %\begin{macro}{\SIUnitSymbolAngstrom} %\begin{macro}{\SIUnitSymbolArcminute} @@ -15551,7 +15569,7 @@ This work consists of the file siunitx.dtx { set~thousands~separator = { \exp_not:V \l_@@_group_sep_tl } } \clist_put_right:Nx \l_@@_pgf_link_clist { - min~exponent~for~1000~sep = \int_eval:n { \l_@@_group_min_int - \c_one } + min~exponent~for~1000~sep = \int_eval:n { \l_@@_group_min_int - \c_one } } \bool_if:nF { @@ -16347,14 +16365,15 @@ This work consists of the file siunitx.dtx % A set of \enquote{natural units}. % \begin{macrocode} \group_begin: - \char_set_lccode:nn { `\@ } { `\_ } - \char_set_catcode_math_subscript:N \@ -\tl_to_lowercase:n { - \group_end: - \DeclareSIUnit \clight { \text { \ensuremath { c @ { 0 } } } } - \DeclareSIUnit \electronmass - { \text { \ensuremath { m @ { \text { e } } } } } -} +\cs_set_eq:NN \endgroup \group_end: +\char_set_catcode_math_subscript:N \_ +\use:n + { + \endgroup + \DeclareSIUnit \clight { \text { \ensuremath { c _ { 0 } } } } + \DeclareSIUnit \electronmass + { \text { \ensuremath { m _ { \textup { e } } } } } + } \DeclareSIUnit \planckbar { \text { \ensuremath { \hbar } } } % \end{macrocode} %\end{macro} @@ -16367,15 +16386,15 @@ This work consists of the file siunitx.dtx % \begin{macrocode} \DeclareSIUnit \elementarycharge { \text { \ensuremath { e } } } \group_begin: - \char_set_lccode:nn { `\@ } { `\_ } - \char_set_lccode:nn { `\E } { `\E } - \char_set_catcode_math_subscript:N \@ -\tl_to_lowercase:n { - \group_end: - \DeclareSIUnit \bohr { \text { \ensuremath { a @ { 0 } } } } - \DeclareSIUnit \hartree - { \text { \ensuremath { E @ { \textup { h } } } } } -} +\cs_set_eq:NN \endgroup \group_end: +\char_set_catcode_math_subscript:N \_ +\use:n + { + \endgroup + \DeclareSIUnit \bohr { \text { \ensuremath { a _ { 0 } } } } + \DeclareSIUnit \hartree + { \text { \ensuremath { E _ { \textup { h } } } } } + } % \end{macrocode} %\end{macro} %\end{macro} @@ -16650,7 +16669,7 @@ This work consists of the file siunitx.dtx % \begin{macrocode} \ProcessKeysOptions { siunitx } % \end{macrocode} -% +% % Creating document commands has to happen here so it is after any load-time % changes to the units available. % \begin{macrocode} @@ -16672,7 +16691,7 @@ This work consists of the file siunitx.dtx % \end{macrocode} % % \begin{macrocode} -\ProvidesExplFile {siunitx-version-1.cfg} {2015/07/17} {2.6h} +\ProvidesExplFile {siunitx-version-1.cfg} {2015/08/18} {2.6i} {siunitx: Version 1 settings} % \end{macrocode} % @@ -17614,7 +17633,7 @@ This work consists of the file siunitx.dtx % \end{macrocode} % % \begin{macrocode} -\ProvidesExplFile {siunitx-abbreviations.cfg} {2015/07/17} {2.6h} +\ProvidesExplFile {siunitx-abbreviations.cfg} {2015/08/18} {2.6i} {siunitx: Abbreviated units} % \end{macrocode} % @@ -17796,7 +17815,7 @@ This work consists of the file siunitx.dtx % \end{macrocode} % % \begin{macrocode} -\ProvidesExplFile {siunitx-binary.cfg} {2015/07/17} {2.6h} +\ProvidesExplFile {siunitx-binary.cfg} {2015/08/18} {2.6i} {siunitx: Binary units} % \end{macrocode} % |