From 2e431097750226d3b07e434a16a319574a5370ad Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 19 Aug 2015 22:20:10 +0000 Subject: siunitx (19aug15) git-svn-id: svn://tug.org/texlive/trunk@38158 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/siunitx/LICENSE.md | 5 + Master/texmf-dist/doc/latex/siunitx/README | 55 --- Master/texmf-dist/doc/latex/siunitx/README.md | 55 +++ Master/texmf-dist/doc/latex/siunitx/README.txt | 55 +++ Master/texmf-dist/doc/latex/siunitx/siunitx.pdf | Bin 621615 -> 613031 bytes Master/texmf-dist/source/latex/siunitx/siunitx.dtx | 437 +++++++++++---------- Master/texmf-dist/source/latex/siunitx/siunitx.ins | 73 ++++ .../tex/latex/siunitx/siunitx-abbreviations.cfg | 2 +- .../tex/latex/siunitx/siunitx-binary.cfg | 2 +- .../tex/latex/siunitx/siunitx-version-1.cfg | 2 +- Master/texmf-dist/tex/latex/siunitx/siunitx.sty | 312 ++++++++------- 11 files changed, 581 insertions(+), 417 deletions(-) create mode 100644 Master/texmf-dist/doc/latex/siunitx/LICENSE.md delete mode 100644 Master/texmf-dist/doc/latex/siunitx/README create mode 100644 Master/texmf-dist/doc/latex/siunitx/README.md create mode 100644 Master/texmf-dist/doc/latex/siunitx/README.txt create mode 100644 Master/texmf-dist/source/latex/siunitx/siunitx.ins (limited to 'Master/texmf-dist') diff --git a/Master/texmf-dist/doc/latex/siunitx/LICENSE.md b/Master/texmf-dist/doc/latex/siunitx/LICENSE.md new file mode 100644 index 00000000000..69cdc42a1a3 --- /dev/null +++ b/Master/texmf-dist/doc/latex/siunitx/LICENSE.md @@ -0,0 +1,5 @@ +Released under the [LaTeX Project Public +License](http://www.latex-project.org/lppl.txt), v1.3c or later. + +The package has status 'maintained': the current maintainer is +[Joseph Wright](joseph.wright@morningstar2.co.uk). \ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/siunitx/README b/Master/texmf-dist/doc/latex/siunitx/README deleted file mode 100644 index abccc7d4465..00000000000 --- a/Master/texmf-dist/doc/latex/siunitx/README +++ /dev/null @@ -1,55 +0,0 @@ -siunitx - A comprehensive (SI) units package -============================================== - -Physical quantities have both numbers and units, and each -physical quantity should be expressed as the product of a number -and a unit. Typesetting physical quantities requires care to -ensure that the combined mathematical meaning of the number-unit -combination is clear. In particular, the SI units system lays -down a consistent set of units with rules on how these are to be -used. However, different countries and publishers have differing -conventions on the exact appearance of numbers (and units). The -`siunitx` package provides a set of tools for authors to typeset -quantities in a consistent way. The package has an extended set -of configuration options which make it possible to follow -varying typographic conventions with the same input syntax. The -package includes automated processing of numbers and units, and -the ability to control tabular alignment of numbers. - -Installation ------------- - -The package is supplied in `dtx` format and as a pre-extracted -zip file, `siunitx.tds.zip`. The later is most convenient for -most users: simply unzip this in your local texmf directory . If -you want to unpack the `.dtx` yourself, running `tex -siunitx.dtx` will extract the package whereas `latex -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 -(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. - -Typesetting the documentation requires a number of packages in -addition to those needed to use the package. This is mainly -because of the number of demonstration items included in the -text. To compile the documentation without error, you will -need the packages: - - `amsmath` - - `booktabs` - - `cancel` - - `caption` - - `cleveref` - - `colortbl` - - `csquotes` - - `datatool` - - `helvet` - - `mathpazo` - - `multirow` - - `listings` - - `pgfplots` - - `xcolor` \ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/siunitx/README.md b/Master/texmf-dist/doc/latex/siunitx/README.md new file mode 100644 index 00000000000..abccc7d4465 --- /dev/null +++ b/Master/texmf-dist/doc/latex/siunitx/README.md @@ -0,0 +1,55 @@ +siunitx - A comprehensive (SI) units package +============================================== + +Physical quantities have both numbers and units, and each +physical quantity should be expressed as the product of a number +and a unit. Typesetting physical quantities requires care to +ensure that the combined mathematical meaning of the number-unit +combination is clear. In particular, the SI units system lays +down a consistent set of units with rules on how these are to be +used. However, different countries and publishers have differing +conventions on the exact appearance of numbers (and units). The +`siunitx` package provides a set of tools for authors to typeset +quantities in a consistent way. The package has an extended set +of configuration options which make it possible to follow +varying typographic conventions with the same input syntax. The +package includes automated processing of numbers and units, and +the ability to control tabular alignment of numbers. + +Installation +------------ + +The package is supplied in `dtx` format and as a pre-extracted +zip file, `siunitx.tds.zip`. The later is most convenient for +most users: simply unzip this in your local texmf directory . If +you want to unpack the `.dtx` yourself, running `tex +siunitx.dtx` will extract the package whereas `latex +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 +(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. + +Typesetting the documentation requires a number of packages in +addition to those needed to use the package. This is mainly +because of the number of demonstration items included in the +text. To compile the documentation without error, you will +need the packages: + - `amsmath` + - `booktabs` + - `cancel` + - `caption` + - `cleveref` + - `colortbl` + - `csquotes` + - `datatool` + - `helvet` + - `mathpazo` + - `multirow` + - `listings` + - `pgfplots` + - `xcolor` \ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/siunitx/README.txt b/Master/texmf-dist/doc/latex/siunitx/README.txt new file mode 100644 index 00000000000..cf80911234b --- /dev/null +++ b/Master/texmf-dist/doc/latex/siunitx/README.txt @@ -0,0 +1,55 @@ +siunitx - A comprehensive (SI) units package +============================================== + +Physical quantities have both numbers and units, and each +physical quantity should be expressed as the product of a number +and a unit. Typesetting physical quantities requires care to +ensure that the combined mathematical meaning of the number-unit +combination is clear. In particular, the SI units system lays +down a consistent set of units with rules on how these are to be +used. However, different countries and publishers have differing +conventions on the exact appearance of numbers (and units). The +`siunitx` package provides a set of tools for authors to typeset +quantities in a consistent way. The package has an extended set +of configuration options which make it possible to follow +varying typographic conventions with the same input syntax. The +package includes automated processing of numbers and units, and +the ability to control tabular alignment of numbers. + +Installation +------------ + +The package is supplied in `dtx` format and as a pre-extracted +zip file, `siunitx.tds.zip`. The later is most convenient for +most users: simply unzip this in your local texmf directory . If +you want to unpack the `.dtx` yourself, running `tex +siunitx.dtx` will extract the package whereas `latex +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 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. + +Typesetting the documentation requires a number of packages in +addition to those needed to use the package. This is mainly +because of the number of demonstration items included in the +text. To compile the documentation without error, you will +need the packages: + - `amsmath` + - `booktabs` + - `cancel` + - `caption` + - `cleveref` + - `colortbl` + - `csquotes` + - `datatool` + - `helvet` + - `mathpazo` + - `multirow` + - `listings` + - `pgfplots` + - `xcolor` diff --git a/Master/texmf-dist/doc/latex/siunitx/siunitx.pdf b/Master/texmf-dist/doc/latex/siunitx/siunitx.pdf index b69deb012ac..8b3384be734 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.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 % %<*driver|package> -\RequirePackage{expl3,xparse} +\RequirePackage{expl3}[2015/03/01] +\RequirePackage{xparse} % %<*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} % diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx.ins b/Master/texmf-dist/source/latex/siunitx/siunitx.ins new file mode 100644 index 00000000000..5e14df6d890 --- /dev/null +++ b/Master/texmf-dist/source/latex/siunitx/siunitx.ins @@ -0,0 +1,73 @@ +%% +%% This is file `siunitx.ins', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% siunitx.dtx (with options: `install') +%% --------------------------------------------------------------- +%% The siunitx package --- A comprehensive (SI) units package +%% Maintained by Joseph Wright +%% E-mail: joseph.wright@morningstar2.co.uk +%% Released under the LaTeX Project Public License v1.3c or later +%% See http://www.latex-project.org/lppl.txt +%% --------------------------------------------------------------- +%% +\input l3docstrip.tex +\keepsilent +\askforoverwritefalse +\preamble +--------------------------------------------------------------- +The siunitx package --- A comprehensive (SI) units package +Maintained by Joseph Wright +E-mail: joseph.wright@morningstar2.co.uk +Released under the LaTeX Project Public License v1.3c or later +See http://www.latex-project.org/lppl.txt +--------------------------------------------------------------- + +\endpreamble +\postamble +Copyright (C) 2008-2014 by + 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 license or (at your option) any later version. The latest +version of this license is in the file: + http://www.latex-project.org/lppl.txt + +This work is "maintained" (as per LPPL maintenance status) by + Joseph Wright. + +This work consists of the file siunitx.dtx + and the derived files siunitx.pdf, + siunitx.sty and + siunitx.ins. +\endpostamble +\usedir{tex/latex/siunitx} +\generate{ + \file{\jobname.sty}{\from{\jobname.dtx}{package}} + \file{siunitx-abbreviations.cfg} + {\from{\jobname.dtx}{config,abbreviations}} + \file{siunitx-binary.cfg}{\from{\jobname.dtx}{config,binary}} + \file{siunitx-version-1.cfg}{\from{\jobname.dtx}{config,version-1}} +} +\endbatchfile +%% Copyright (C) 2008-2014 by +%% 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 license or (at your option) any later version. The latest +%% version of this license is in the file: +%% http://www.latex-project.org/lppl.txt +%% +%% This work is "maintained" (as per LPPL maintenance status) by +%% Joseph Wright. +%% +%% This work consists of the file siunitx.dtx +%% and the derived files siunitx.pdf, +%% siunitx.sty and +%% siunitx.ins. +%% +%% End of file `siunitx.ins'. diff --git a/Master/texmf-dist/tex/latex/siunitx/siunitx-abbreviations.cfg b/Master/texmf-dist/tex/latex/siunitx/siunitx-abbreviations.cfg index 1ff08112265..93a190e8a84 100644 --- a/Master/texmf-dist/tex/latex/siunitx/siunitx-abbreviations.cfg +++ b/Master/texmf-dist/tex/latex/siunitx/siunitx-abbreviations.cfg @@ -13,7 +13,7 @@ %% See http://www.latex-project.org/lppl.txt %% --------------------------------------------------------------- %% -\ProvidesExplFile {siunitx-abbreviations.cfg} {2015/07/17} {2.6h} +\ProvidesExplFile {siunitx-abbreviations.cfg} {2015/08/18} {2.6i} {siunitx: Abbreviated units} \DeclareSIUnit \A { \ampere } \DeclareSIUnit \pA { \pico \ampere } diff --git a/Master/texmf-dist/tex/latex/siunitx/siunitx-binary.cfg b/Master/texmf-dist/tex/latex/siunitx/siunitx-binary.cfg index b528ebdf461..7ae64a2772e 100644 --- a/Master/texmf-dist/tex/latex/siunitx/siunitx-binary.cfg +++ b/Master/texmf-dist/tex/latex/siunitx/siunitx-binary.cfg @@ -13,7 +13,7 @@ %% See http://www.latex-project.org/lppl.txt %% --------------------------------------------------------------- %% -\ProvidesExplFile {siunitx-binary.cfg} {2015/07/17} {2.6h} +\ProvidesExplFile {siunitx-binary.cfg} {2015/08/18} {2.6i} {siunitx: Binary units} \DeclareBinaryPrefix \kibi { Ki } { 10 } \DeclareBinaryPrefix \mebi { Mi } { 20 } diff --git a/Master/texmf-dist/tex/latex/siunitx/siunitx-version-1.cfg b/Master/texmf-dist/tex/latex/siunitx/siunitx-version-1.cfg index 24b7aec823b..9ffcee26a6f 100644 --- a/Master/texmf-dist/tex/latex/siunitx/siunitx-version-1.cfg +++ b/Master/texmf-dist/tex/latex/siunitx/siunitx-version-1.cfg @@ -13,7 +13,7 @@ %% See http://www.latex-project.org/lppl.txt %% --------------------------------------------------------------- %% -\ProvidesExplFile {siunitx-version-1.cfg} {2015/07/17} {2.6h} +\ProvidesExplFile {siunitx-version-1.cfg} {2015/08/18} {2.6i} {siunitx: Version 1 settings} \keys_define:nn { siunitx } { addsign .choice: , diff --git a/Master/texmf-dist/tex/latex/siunitx/siunitx.sty b/Master/texmf-dist/tex/latex/siunitx/siunitx.sty index 8bc958cb278..c040fe415d8 100644 --- a/Master/texmf-dist/tex/latex/siunitx/siunitx.sty +++ b/Master/texmf-dist/tex/latex/siunitx/siunitx.sty @@ -13,10 +13,11 @@ %% See http://www.latex-project.org/lppl.txt %% --------------------------------------------------------------- %% -\RequirePackage{expl3,xparse} -\ProvidesExplPackage {siunitx} {2015/07/17} {2.6h} +\RequirePackage{expl3}[2015/03/01] +\RequirePackage{xparse} +\ProvidesExplPackage {siunitx} {2015/08/18} {2.6i} {A comprehensive (SI) units package} -\@ifpackagelater { expl3 } { 2012/11/21 } +\@ifpackagelater { expl3 } { 2015/03/01 } { } { \PackageError { siunitx } { Support~package~expl3~too~old } @@ -48,6 +49,7 @@ \cs_new:Npn \__siunitx_tmp:w { } \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 } \bool_new:N \l__siunitx_tmp_bool \box_new:N \l__siunitx_tmp_box \dim_new:N \l__siunitx_tmp_dim @@ -313,37 +315,35 @@ \str_if_eq:VnT #1 {#2} { \tl_set:Nn #1 {#3} } } +\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 } -\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 \__siunitx_cs_if_tl:N #1 { T , F, TF , p } - { - \exp_last_unbraced:No \__siunitx_cs_if_tl_aux:w - { \token_to_meaning:N #1 MACRO \q_stop } +\prg_new_conditional:Npnn \__siunitx_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 \__siunitx_cs_if_tl_aux:w #1 MACRO #2 \q_stop - { \tl_if_empty:nTF {#1} } - \prg_new_conditional:Npnn \__siunitx_cs_if_macro:N #1 - { T , F , TF , p } - { - \exp_last_unbraced:No \__siunitx_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: } + } +\prg_new_conditional:Npnn \__siunitx_number_if_zero:n #1 { p , TF } + { + \tl_map_function:nN {#1} \__siunitx_number_if_zero_aux:n + \prg_return_true: + } +\cs_generate_variant:Nn \__siunitx_number_if_zero_p:n { V } +\cs_new:Npn \__siunitx_number_if_zero_aux:n #1 + { + \token_if_eq_charcode:NNF #1 0 + { \tl_map_break:n { \prg_return_false: \use_none:n } } + } \AtBeginDocument { \@ifpackageloaded { tex4ht } @@ -820,43 +820,39 @@ { \l__siunitx_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 \__siunitx_print_text: - { - \tl_replace_all:Nnn \l__siunitx_print_arg_tl { - } - { \c__siunitx_minus_tl } - \__siunitx_print_text_aux: - \tl_replace_all:Nnn \l__siunitx_print_arg_tl { \mp } - { \ensuremath { \mp } } - \tl_remove_all:Nn \l__siunitx_print_arg_tl { \mathord } - \cs_set_eq:NN \PrintSubscript \__siunitx_print_text_sub:n - \cs_set_eq:NN \PrintSuperscript \__siunitx_print_text_super:n - \tl_replace_all:Nnn \l__siunitx_print_arg_tl { @ } - { \__siunitx_print_text_sub:n } - \tl_replace_all:Nnn \l__siunitx_print_arg_tl { ! } - { \__siunitx_print_text_sub:n } - \tl_replace_all:Nnn \l__siunitx_print_arg_tl { = } - { \__siunitx_print_text_sub:n } - \tl_replace_all:Nnn \l__siunitx_print_arg_tl { ^ } - { \__siunitx_print_text_super:n } - \tl_replace_all:Nnn \l__siunitx_print_arg_tl { + } - { \__siunitx_print_text_super:n } - \l__siunitx_print_arg_tl - } -} +\cs_new_protected_nopar:Npn \__siunitx_print_text: + { + \tl_replace_all:Nnn \l__siunitx_print_arg_tl { - } + { \c__siunitx_minus_tl } + \__siunitx_print_text_aux: + \tl_replace_all:Nnn \l__siunitx_print_arg_tl { \mp } + { \ensuremath { \mp } } + \tl_remove_all:Nn \l__siunitx_print_arg_tl { \mathord } + \cs_set_eq:NN \PrintSubscript \__siunitx_print_text_sub:n + \cs_set_eq:NN \PrintSuperscript \__siunitx_print_text_super:n + \__siunitx_print_text_aux:NnN + _ { math_subscript } \__siunitx_print_text_sub:n + _ { active } \__siunitx_print_text_sub:n + ^ { math_superscript } \__siunitx_print_text_super:n + ^ { active } \__siunitx_print_text_super:n + \q_recursion_tail ? ? + \q_recursion_stop + \l__siunitx_print_arg_tl + } \cs_new_protected:Npn \__siunitx_print_text_aux: { \tl_replace_all:Nnn \l__siunitx_print_arg_tl { \pm } { \ensuremath { \pm } } } +\cs_new_protected:Npn \__siunitx_print_text_aux:NnN #1#2#3 + { + \quark_if_recursion_tail_stop:N #1 + \tl_set_rescan:Nnn \l__siunitx_tmp_tl + { \use:c { char_set_catcode_ #2 :N } #1 } + {#1} + \tl_replace_all:NVn \l__siunitx_print_arg_tl \l__siunitx_tmp_tl {#3} + \__siunitx_print_text_aux:NnN + } \AtBeginDocument { \@ifpackageloaded { textcomp } @@ -1125,22 +1121,29 @@ \cs_new_protected:Npn \__siunitx_number_in_protect_aux:N #1 { \cs_set_eq:NN #1 \scan_stop: } +\cs_new_protected:Npn \__siunitx_number_in_sign_replace:N #1 + { + \__siunitx_number_in_sign_replace_aux:N #1 + \__siunitx_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 \__siunitx_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 \__siunitx_number_in_sign_replace_aux:NnN #1#2#3 { - \group_end: - \cs_new_protected:Npn \__siunitx_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} + \__siunitx_number_in_sign_replace_aux:NnN #1 } \cs_new_protected:Npn \__siunitx_number_in_parse_error:nn #1#2 { \__siunitx_error:nx {#1} { \exp_not:n {#2} } @@ -2145,7 +2148,7 @@ } } { - \int_compare:nNnTF { 0 #1 } = { 0 } + \__siunitx_number_if_zero:nTF {#1} { \__siunitx_number_process_fixed_aux_ii:nnn {##1} {##2} { #3 - 1 } @@ -2479,12 +2482,11 @@ } \cs_new_protected:Npn \__siunitx_number_process_round_tidy:n #1 { - \int_compare:nNnTF + \bool_if:nTF { - 0 \l__siunitx_round_integer_out_tl + - 0 \l__siunitx_round_decimal_out_tl + \__siunitx_number_if_zero_p:V \l__siunitx_round_integer_out_tl + && \__siunitx_number_if_zero_p:V \l__siunitx_round_decimal_out_tl } - = \c_zero { \str_if_eq:VnTF \l__siunitx_process_round_min_tl { 0 } { @@ -2562,35 +2564,38 @@ } \cs_new_protected:Npn \__siunitx_number_process_scientific_aux_ii:nnn #1#2#3 { - \int_compare:nNnTF {#1} > { 9 } + \int_compare:nNnTF { \tl_count:n {#1} } > \c_one { \__siunitx_number_process_scientific_large:nnn {#1} {#2} {#3} } { - \int_compare:nNnTF {#1} > { 0 } + \__siunitx_number_if_zero:nTF {#1} + { + \__siunitx_number_process_scientific_small:wn + #2 \q_stop {#3} + } { \bool_if:NTF \l__siunitx_process_engineering_bool { \__siunitx_number_process_scientific_engineering:nnn } { \__siunitx_number_process_scientific_store:nnn } {#1} {#2} {#3} } - { - \__siunitx_number_process_scientific_small:wn - #2 \q_stop {#3} - } + } } -\cs_new_protected:Npn - \__siunitx_number_process_scientific_large:nnn #1#2#3 { - \int_set:Nn \l__siunitx_tmp_int { \int_div_truncate:nn {#1} { 10 } } - \tl_set:Nx \l__siunitx_tmpa_tl { \int_use:N \l__siunitx_tmp_int } - \int_set:Nn \l__siunitx_tmp_int { #1 - 10 * \l__siunitx_tmp_int } - \tl_set:Nx \l__siunitx_tmpa_tl - { - { \l__siunitx_tmpa_tl } { \int_use:N \l__siunitx_tmp_int #2 } - { #3 + 1 } - } - \exp_after:wN \__siunitx_number_process_scientific_aux_ii:nnn - \l__siunitx_tmpa_tl -} +\cs_new_protected:Npn \__siunitx_number_process_scientific_large:nnn #1#2#3 + { + \cs_set_protected:Npn \__siunitx_number_process_scientific_large_loop:nNN + ##1##2##3 + { + \quark_if_recursion_tail_stop_do:Nn ##3 + { + \__siunitx_number_process_scientific_aux_ii:nnn {##1} { ##2 #2 } + { #3 + \c_one } + } + \__siunitx_number_process_scientific_large_loop:nNN { ##1 ##2 } ##3 + } + \__siunitx_number_process_scientific_large_loop:nNN { } #1 + \q_recursion_tail \q_recursion_stop + } \cs_new_protected:Npn \__siunitx_number_process_scientific_small:wn #1#2 \q_stop #3 { \__siunitx_number_process_scientific_aux_ii:nnn {#1} {#2} { #3 - 1 } } @@ -4217,7 +4222,9 @@ \AtBeginDocument { \cs_if_exist:NT \cancel { - \cs_set_eq:NN \__siunitx_cancel:n \cancel + \cs_set_protected:Npn \__siunitx_cancel:n #1 + { \__siunitx__real_cancel:n { \__siunitx_print:nn { unit } {#1} } } + \cs_set_eq:NN \__siunitx__real_cancel:n \cancel \seq_put_right:Nn \l__siunitx_declare_list_seq { \cancel } \cs_new_protected:cpn { __siunitx_ \token_to_str:N \cancel _function:w } @@ -4364,7 +4371,7 @@ \cs_new_protected:Npn \__siunitx_protect_symbols:N #1 { \cs_if_exist:NT #1 { - \__siunitx_cs_if_macro:NT #1 + \tl_if_empty:fT { \token_get_prefix_spec:N #1 } { \cs_set_protected:Npx #1 { \exp_not:V #1 } } } } @@ -4817,29 +4824,27 @@ { \__siunitx_unit_print_literal_aux:N ##1 } } \group_begin: - \char_set_lccode:nn { `\+ } { `\^ } \char_set_catcode_active:N \~ -\tl_to_lowercase:n - { - \group_end: - \cs_new_protected:Npn \__siunitx_unit_format_literal:n #1 - { - \int_zero:N \l__siunitx_unit_prefix_int - \seq_map_inline:Nn \l__siunitx_declare_list_seq - { \__siunitx_unit_print_literal_aux:N ##1 } - \tl_set:Nn \l__siunitx_unit_tl {#1} - \tl_replace_all:NnV \l__siunitx_unit_tl { . } \l__siunitx_unit_product_tl - \tl_replace_all:NnV \l__siunitx_unit_tl { ~ } \l__siunitx_unit_product_tl - \bool_if:NT \l__siunitx_literal_power_bool - { - \tl_replace_all:Nnn \l__siunitx_unit_tl { ^ } - { \__siunitx_unit_format_literal_power:n } - \tl_replace_all:Nnn \l__siunitx_unit_tl { + } - { \__siunitx_unit_format_literal_power:n } - } - \__siunitx_unit_format_literal_extras: - } - } + \cs_new_protected:Npn \__siunitx_unit_format_literal:n #1 + { + \int_zero:N \l__siunitx_unit_prefix_int + \seq_map_inline:Nn \l__siunitx_declare_list_seq + { \__siunitx_unit_print_literal_aux:N ##1 } + \tl_set:Nn \l__siunitx_unit_tl {#1} + \tl_replace_all:NnV \l__siunitx_unit_tl { . } + \l__siunitx_unit_product_tl + \tl_replace_all:NnV \l__siunitx_unit_tl { ~ } + \l__siunitx_unit_product_tl + \bool_if:NT \l__siunitx_literal_power_bool + { + \tl_replace_all:Nnn \l__siunitx_unit_tl { ^ } + { \__siunitx_unit_format_literal_power:n } + \tl_replace_all:Non \l__siunitx_unit_tl { \token_to_str:N ^ } + { \__siunitx_unit_format_literal_power:n } + } + \__siunitx_unit_format_literal_extras: + } +\group_end: \cs_new_protected:Npn \__siunitx_unit_print_literal_aux:N #1 { \cs_set_eq:Nc #1 { __siunitx_ \token_to_str:N #1 _literal:w } } \cs_new_protected:Npn \__siunitx_unit_format_literal_power:n #1 @@ -5840,7 +5845,7 @@ { \skip_horizontal:n { \c__siunitx_one_fill_skip - ##1 } \tex_kern:D \c_zero_skip - \hbox_set_inline_end: + \hbox_set_end: \__siunitx_table_colortbl_correction: } } @@ -6889,14 +6894,20 @@ text-micro = \c__siunitx_mu_tl , text-ohm = \ensuremath { \c__siunitx_omega_tl }, } -\cs_new_protected:Npn \__siunitx_symbol_new:n #1 { - \cs_set_protected:cpn { SIUnitSymbol #1 } - { - \mode_if_math:TF - { \tl_to_lowercase:n { \use:c { l__siunitx_ #1 _math_tl } } } - { \tl_to_lowercase:n { \use:c { l__siunitx_ #1 _text_tl } } } - } -} +\cs_new_protected:Npn \__siunitx_symbol_new:n #1 + { + \cs_set_protected:cpn { SIUnitSymbol #1 } + { + \use:c + { + l__siunitx_ + \str_fold_case:n {#1} + _ + \mode_if_math:TF { math } { text } + _tl + } + } + } \__siunitx_symbol_new:n { Angstrom } \__siunitx_symbol_new:n { Arcminute } \__siunitx_symbol_new:n { Arcsecond } @@ -7446,26 +7457,27 @@ \DeclareSIUnit \electronvolt { eV } \DeclareSIUnit \dalton { Da } \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 } } } \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 } } } } } + } \DeclareSIUnit \angstrom { \SIUnitSymbolAngstrom } \DeclareSIUnit \bar { bar } \DeclareSIUnit \barn { b } -- cgit v1.2.3