diff options
author | Karl Berry <karl@freefriends.org> | 2010-09-11 00:47:00 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-09-11 00:47:00 +0000 |
commit | 402d20deb247916e32bef5a89144445b2cd31c8e (patch) | |
tree | ef9298f66cb801a9cf0a6ca5527ca6d58c6a1fa7 /Master/texmf-dist | |
parent | 58d31edb0a4d32f223ea9e65277982ba88f145a3 (diff) |
siunitx 2.0s (12aug10)
git-svn-id: svn://tug.org/texlive/trunk@19653 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/latex/siunitx/siunitx.pdf | bin | 497672 -> 500816 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/siunitx/siunitx.dtx | 195 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/siunitx/config/siunitx-abbreviations.cfg | 2 | ||||
-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 | 8 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/siunitx/siunitx.sty | 90 |
6 files changed, 205 insertions, 92 deletions
diff --git a/Master/texmf-dist/doc/latex/siunitx/siunitx.pdf b/Master/texmf-dist/doc/latex/siunitx/siunitx.pdf Binary files differindex c5c3e15decd..34465547318 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 f8ca85384e5..5ef50e53cdf 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx.dtx @@ -142,8 +142,8 @@ This work consists of the file siunitx.dtx %<*driver> \documentclass[german,french,english,UKenglish]{l3doc} -\usepackage{amsmath,babel,booktabs,caption,csquotes,datatool,helvet} -\usepackage{pgfplots,siunitx,xcolor,xtab} +\usepackage{amsmath,babel,booktabs,caption,colortbl,csquotes,datatool} +\usepackage{helvet,pgfplots,siunitx,xcolor,xtab} \IfFileExists{xfrac.sty} {\usepackage{xfrac}} {% @@ -230,6 +230,7 @@ This work consists of the file siunitx.dtx % language = [LaTeX]{TeX}, % moretexcs = % { +% addto, % ampere, % ang, % angstrom, @@ -295,6 +296,7 @@ This work consists of the file siunitx.dtx % radian, % raiseto, % robustify, +% rowcolor, % second, % selectlanguage, % SendSettingsToPgf, @@ -448,6 +450,20 @@ This work consists of the file siunitx.dtx %\changes{v2.0l}{2010/07/07}{Further adjustments to \pkg{babel} support} %\changes{v2.0m}{2010/07/09}{Re-introduce \opt{locale} option} %\changes{v2.0n}{2010/07/15}{More abbreviated units} +%\changes{v2.0o}{2010/07/21}{Extend \opt{detect-italic} option +% to other shapes, renaming as \opt{detect-shape} as a result} +%\changes{v2.0p}{2010/07/28}{Actually get change from v2.0o working} +%\changes{v2.0q}{2010/07/29}{Errors with free-standing unit code fixed} +%\changes{v2.0q}{2010/07/29}{Deal with bad definition of \cs{color} +% by \pkg{textpos} package} +%\changes{v2.0r}{2010/08/02}{Error in definition for old +% \opt{decimalsymbol} option corrected} +%\changes{v2.0s}{2010/08/08}{Correct errors in rounding code when +% precision requested is zero decimal places} +%\changes{v2.0s}{2010/08/12}{Document how to do mixed bold and normal +% numbers in tables} +%\changes{v2.0t}{2010/08/24}{Replace \cs{exp_afer:wN} in code for +% \cs{per} with \cs{exp_after:wN}} % %\begin{abstract} % Typesetting values with units requires care to ensure that the @@ -1241,9 +1257,9 @@ This work consists of the file siunitx.dtx % detect-display-math & Switch & false \\ % detect-family & Switch & false \\ % detect-inline-weight & Choice & text \\ -% detect-italic & Switch & false \\ % detect-mode & Switch & false \\ % detect-none & Meta & \meta{none} \\ +% detect-shape & Switch & false \\ % detect-weight & Switch & false \\ % \bottomrule % \end{tabular} @@ -1251,12 +1267,14 @@ This work consists of the file siunitx.dtx % %\DescribeOption{detect-weight} %\DescribeOption{detect-family} -%\DescribeOption{detect-italic} +%\DescribeOption{detect-shape} %\DescribeOption{detect-mode} -% The options \opt{detect-weight} and \opt{detect-italic} set detection -% of the prevailing font weight and italic states, respectively. The -% italic state is only checked if the surrounding material is not in -% math mode (as math text is always italic). Detecting the current +% The options \opt{detect-weight} and \opt{detect-shape} set detection +% of the prevailing font weight and font shape states, respectively. The +% font shape state is only checked if the surrounding material is not in +% math mode (as math text is always italic). The \opt{detect-shape} +% option is an extension of the older \opt{detect-italic} option, which +% is retained for backward compatibility. Detecting the current % family (roman, sans serif or monospaced) is controlled by the % \opt{detect-family} setting, while the current mode (text or math) % is detected using the \opt{detect-mode} switch. @@ -1265,7 +1283,7 @@ This work consists of the file siunitx.dtx % For convenience, all of the preceding options can be turned on or % off in one go using the \opt{detect-all} and \opt{detect-none} % options. As the names indicate, \opt{detect-all} sets all -% of \opt{detect-weight}, \opt{detect-family}, \opt{detect-italic} +% of \opt{detect-weight}, \opt{detect-family}, \opt{detect-shape} % and \opt{detect-mode} to \texttt{true}, while \opt{detect-none} % sets all of them to \texttt{false}. % @@ -2171,7 +2189,7 @@ This work consists of the file siunitx.dtx % % \midrule % -% \DescribeNamedUnit{pascal}{P} \\ +% \DescribeNamedUnit{pascal}{Pa} \\ % \DescribeNamedUnit{kilopascal}{kPa} \\ % \DescribeNamedUnit{megapacal}{MPa} \\ % \DescribeNamedUnit{gigapascal}{GPa} \\ @@ -3208,6 +3226,7 @@ This work consists of the file siunitx.dtx % prevent TeX including more space around the \( > \). % %\subsection{Expanding content in tables} +%\label{sec:expanding} % % When processing tables, \pkg{siunitx} will expand anything stored % inside a macro, unless it is long or protected. LaTeX2e robust @@ -3514,17 +3533,17 @@ This work consists of the file siunitx.dtx % Usually, numbers in a table should be given with the units in the % column heading. However, there are cases where a series of data are % best presented in a table but have different units. There are two -% ways to do this (\cref{tab:mixed}). The first is to place the units in -% the first column of the table, which makes sense if there are several -% related items in the table. The second method is to generate two -% columns, one for numbers and a second for units, and then to format -% these to give the visual effect of a single column. The later effect -% is most appropriate when only one set of numbers are presented in a -% table. +% ways to do this (\cref{tab:xmpl:mixed}). The first is to place the +% units in the first column of the table, which makes sense if there +% are several related items in the table. The second method is to +% generate two columns, one for numbers and a second for units, and then +% to format these to give the visual effect of a single column. The +% later effect is most appropriate when only one set of numbers are +% presented in a table. %\begin{LaTeXdemo}[code and float] % \begin{table} % \caption{Tables where numbers have different units} -% \label{tab:mixed} +% \label{tab:xmpl:mixed} % \hfil % \begin{tabular} % { @@ -3554,7 +3573,33 @@ This work consists of the file siunitx.dtx % \hfil % \end{table} %\end{LaTeXdemo} -% +% +%\subsection{Tables with heading rows} +% +% A common format for tables is to make the heading row visually +% distinct using a background colour and bold text. If numbers appear +% in such a heading row within an \texttt{S} column then getting the +% appearance right can be challenging. The best approach is to +% make the \cs{bfseries} macro \enquote{robust} (as demonstrated in +% \cref{sec:expanding}), then to use this macro to make the heading +% cells bold. This approach is illustrated in \cref{tab:xmpl:headers}, +% along with the use of \cs{rowcolor} to provide a background colour. +%\begin{LaTeXdemo}[code and float] +% \begin{table} +% \caption{Header row in a table} +% \label{tab:xmpl:headers} +% \robustify\bfseries +% \centering +% \begin{tabular} +% {S[detect-weight,table-format = 3.3]} +% \rowcolor[gray]{0.9} +% \bfseries 123.456 \\ +% 23.45 \\ +% 123.4 \\ +% 3.456 \\ +% \end{tabular} +% \end{table} +%\end{LaTeXdemo} % %\subsection{Associating a locale with a \pkg{babel} language} % @@ -3674,7 +3719,7 @@ This work consists of the file siunitx.dtx % obeyall & detect-all \\ % obeybold & detect-weight \\ % obeyfamily & detect-family \\ -% obeyitalic & detect-italic \\ +% obeyitalic & detect-shape \\ % obeymode & detect-mode \\ % openerr & open-bracket \\ % openfrac & open-bracket \\ @@ -4112,7 +4157,7 @@ This work consists of the file siunitx.dtx % % The usual preliminaries. % \begin{macrocode} -\ProvidesExplPackage {siunitx} {2010/07/15} {2.0n} +\ProvidesExplPackage {siunitx} {2010/08/24} {2.0t} {A comprehensive (SI) units package} % \end{macrocode} % @@ -4635,7 +4680,7 @@ This work consists of the file siunitx.dtx %\begin{macro}{\l_siunitx_detect_display_math_bool} %\begin{macro}{\l_siunitx_detect_family_bool} %\begin{macro}{\l_siunitx_detect_inline_weight_bool} -%\begin{macro}{\l_siunitx_detect_italic_bool} +%\begin{macro}{\l_siunitx_detect_shape_bool} %\begin{macro}{\l_siunitx_detect_mode_bool} %\begin{macro}{\l_siunitx_detect_weight_bool} % Font detection is all about creating switches, with just a little @@ -4647,15 +4692,15 @@ This work consists of the file siunitx.dtx detect-all / false .meta:n = { detect-family = false, - detect-italic = false, detect-mode = false, + detect-shape = false, detect-weight = false }, detect-all / true .meta:n = { detect-family = true, - detect-italic = true, detect-mode = true, + detect-shape = true, detect-weight = true }, detect-display-math .bool_set:N = @@ -4672,24 +4717,25 @@ This work consists of the file siunitx.dtx detect-inline-weight / text .code:n = { \tl_set:Nn \l_siunitx_detect_inline_weight_tl { text } }, - detect-italic .bool_set:N = \l_siunitx_detect_italic_bool, + detect-italic .bool_set:N = \l_siunitx_detect_shape_bool, detect-mode .bool_set:N = \l_siunitx_detect_mode_bool, detect-none .choice:, detect-none .default:n = true, detect-none / false .meta:n = { detect-family = true, - detect-italic = true, detect-mode = true, + detect-shape = true, detect-weight = true }, detect-none / true .meta:n = { detect-family = false, - detect-italic = false, detect-mode = false, - detect-weight = false + detect-shape = false, + detect-weight = false }, + detect-shape .bool_set:N = \l_siunitx_detect_shape_bool, detect-weight .bool_set:N = \l_siunitx_detect_weight_bool } % \end{macrocode} @@ -4718,11 +4764,11 @@ This work consists of the file siunitx.dtx % \end{macrocode} %\end{macro} % -%\begin{macro}{\siunitx_font_italic:} +%\begin{macro}{\siunitx_font_shape:} %\begin{macro}{\siunitx_font_weight:} % These could be token lists or functions! % \begin{macrocode} -\cs_new_nopar:Npn \siunitx_font_italic: { } +\cs_new_nopar:Npn \siunitx_font_shape: { } \cs_new_nopar:Npn \siunitx_font_weight: { } % \end{macrocode} %\end{macro} @@ -4741,8 +4787,8 @@ This work consists of the file siunitx.dtx { \siunitx_detect_font_weight: } \bool_if:NT \l_siunitx_detect_family_bool { \siunitx_detect_font_family: } - \bool_if:NT \l_siunitx_detect_italic_bool - { \siunitx_detect_font_italic: } + \bool_if:NT \l_siunitx_detect_shape_bool + { \siunitx_detect_font_shape: } \bool_if:NT \l_siunitx_detect_mode_bool { \siunitx_detect_font_mode: } } @@ -4760,7 +4806,7 @@ This work consists of the file siunitx.dtx \unboldmath \mdseries } - \cs_set:Npn \siunitx_font_italic: { \upshape } + \cs_set:Npn \siunitx_font_shape: { \upshape } \tl_set:Nn \l_siunitx_font_family_tl { rm } \bool_set_true:N \l_siunitx_font_math_mode_bool } @@ -4879,12 +4925,14 @@ This work consists of the file siunitx.dtx %\end{macro} %\end{macro} % -%\begin{macro}{\siunitx_detect_font_italic:} -% The italic test uses \cs{f@shape} as a handy indicator. +%\begin{macro}{\siunitx_detect_font_shape:} +% The shape test uses \cs{f@shape} as a handy indicator. % \begin{macrocode} -\cs_new_protected_nopar:Npn \siunitx_detect_font_italic: { +\cs_new_protected_nopar:Npn \siunitx_detect_font_shape: { \tl_if_eq:nVT { it } \f@shape - { \cs_set_nopar:Npn \siunitx_font_italic: { \itshape } } + { \cs_set_nopar:Npn \siunitx_font_shape: { \itshape } } + \tl_if_eq:nVT { sl } \f@shape + { \cs_set_nopar:Npn \siunitx_font_shape: { \slshape } } } % \end{macrocode} %\end{macro} @@ -5150,8 +5198,8 @@ This work consists of the file siunitx.dtx \text { \siunitx_print_color: + \siunitx_font_shape: \siunitx_font_weight: - \siunitx_font_italic: \use:c { siunitx_ \l_siunitx_print_type_tl _ @@ -6683,7 +6731,32 @@ This work consists of the file siunitx.dtx } \cs_new_protected_nopar:Npn \siunitx_number_process_places_aux_i:n #1 { \intexpr_compare:nNnTF { \l_siunitx_process_precision_int } = { 0 } - { \prop_del:Nn \l_siunitx_number_in_prop { #1 -decimal } } + { + \prop_get:NnN \l_siunitx_number_in_prop { #1 -decimal } + \l_siunitx_tmpa_tl + \quark_if_no_value:NF \l_siunitx_tmpa_tl + { + \intexpr_compare:nNnT + { \exp_args:NV \tl_head:n \l_siunitx_tmpa_tl } > { 4 } + { + \prop_get:NnN \l_siunitx_number_in_prop { #1 -integer } + \l_siunitx_tmpa_tl + \quark_if_no_value:NTF \l_siunitx_tmpa_tl + { + \prop_put:Nnn \l_siunitx_number_in_prop + { #1 -integer } { 1 } + } + { + \tl_set:Nx \l_siunitx_tmpa_tl + { \intexpr_eval:n { \l_siunitx_tmpa_tl + 1 } } + \prop_put:NnV \l_siunitx_number_in_prop + { #1 -integer } \l_siunitx_tmpa_tl + } + } + } + \prop_del:Nn \l_siunitx_number_in_prop { #1 -decimal } + \prop_del:Nn \l_siunitx_number_in_prop { #1 -decimal-marker } + } { \prop_get:NnN \l_siunitx_number_in_prop { #1 -decimal } \l_siunitx_tmpa_tl @@ -6828,7 +6901,6 @@ This work consists of the file siunitx.dtx { \siunitx_number_process_round_decimal_aux: } \tl_set:Nx \l_siunitx_round_decimal_in_tl { \exp_args:NV \tl_tail:n \l_siunitx_round_decimal_in_tl } - \int_decr:N \l_siunitx_round_int } \cs_new_protected_nopar:Npn @@ -9097,10 +9169,12 @@ This work consists of the file siunitx.dtx \exp_not:n { \siunitx_ensuremath:n - { \l_siunitx_number_unit_sep_tl } + { \l_siunitx_number_unit_separator_tl } } } - \exp_not:n { \siunitx_unit_output:nn {#1} { } } + \group_begin: + \exp_not:n { \siunitx_unit_output:nn {#1} { } } + \group_end: \bool_if:NT \l_siunitx_create_xspace_bool { \exp_not:N \xspace } } @@ -9123,7 +9197,7 @@ This work consists of the file siunitx.dtx \exp_not:n { \siunitx_ensuremath:n - { \l_siunitx_number_unit_sep_tl } + { \l_siunitx_number_unit_separator_tl } } } \SI {####1} { \exp_not:N #1 } @@ -9148,6 +9222,8 @@ This work consists of the file siunitx.dtx % a table cell. % \begin{macrocode} \AtBeginDocument { + \cs_if_eq:NNT \color \use_none:n + { \cs_set_protected:Npn \color #1 { } } \tl_map_function:nN { \bar \color \ng \pm } \siunitx_protect_symbols:N } @@ -9961,7 +10037,7 @@ This work consists of the file siunitx.dtx { \cs_set:Npn \siunitx_tmp:w ##1 - ##2 \q_stop { \tl_set:Nn \l_siunitx_tmpa_tl {##2} } - \exp_afer:wN \siunitx_tmp:w \l_siunitx_tmpa_tl \q_stop + \exp_after:wN \siunitx_tmp:w \l_siunitx_tmpa_tl \q_stop } { \tl_put_left:Nn \l_siunitx_tmpa_tl { - } } } @@ -13201,8 +13277,8 @@ This work consists of the file siunitx.dtx \keys_set:nn { siunitx } { bracket-numbers = true, - detect-italic = false, detect-mode = false, + detect-shape = false, detect-weight = false, multi-part-units = bracket, parse-numbers = true, @@ -13211,14 +13287,15 @@ This work consists of the file siunitx.dtx } \siunitx_strict_option:n { - bracket-numbers , - detect-italic , - detect-mode , - detect-weight , - multi-part-units , - parse-numbers , - parse-units , - product-units , + bracket-numbers , + detect-italic , + detect-mode , + detect-shape , + detect-weight , + multi-part-units , + parse-numbers , + parse-units , + product-units , } \keys_define:nn { siunitx } { @@ -13381,7 +13458,7 @@ This work consists of the file siunitx.dtx % \end{macrocode} % % \begin{macrocode} -\ProvidesExplFile {siunitx-version-1.cfg} {2010/07/15} {2.0n} +\ProvidesExplFile {siunitx-version-1.cfg} {2010/08/24} {2.0t} {siunitx: Version 1 settings} % \end{macrocode} % @@ -13472,7 +13549,9 @@ This work consists of the file siunitx.dtx decimalsymbol / cdot .meta:n = { output-decimal-marker = { } \cdot { } }, - decimalsymbol + decimalsymbol / + comma .meta:n = { output-decimal-marker = { { , } } }, + decimalsymbol / fullstop .meta:n = { output-decimal-marker = { { . } } }, decimalsymbol / period .meta:n = { output-decimal-marker = { { . } } }, @@ -13638,7 +13717,7 @@ This work consists of the file siunitx.dtx obeybold .default:n = { true }, obeyfamily .meta:n = { detect-family = #1 }, obeyfamily .default:n = { true }, - obeyitalic .meta:n = { detect-italic = #1 }, + obeyitalic .meta:n = { detect-shape = #1 }, obeyitalic .default:n = { true }, obeymode .meta:n = { detect-mode = #1 }, obeymode .default:n = { true }, @@ -14370,7 +14449,7 @@ This work consists of the file siunitx.dtx % \end{macrocode} % % \begin{macrocode} -\ProvidesExplFile {siunitx-abbreviations.cfg} {2010/07/15} {2.0n} +\ProvidesExplFile {siunitx-abbreviations.cfg} {2010/08/12} {2.0s} {siunitx: Abbreviated units} % \end{macrocode} % @@ -14659,7 +14738,7 @@ This work consists of the file siunitx.dtx % \end{macrocode} % % \begin{macrocode} -\ProvidesExplFile {siunitx-binary.cfg} {2010/07/15} {2.0n} +\ProvidesExplFile {siunitx-binary.cfg} {2010/08/24} {2.0t} {siunitx: Binary units} % \end{macrocode} % diff --git a/Master/texmf-dist/tex/latex/siunitx/config/siunitx-abbreviations.cfg b/Master/texmf-dist/tex/latex/siunitx/config/siunitx-abbreviations.cfg index 88c2ca4da80..dd0cdc46abc 100644 --- a/Master/texmf-dist/tex/latex/siunitx/config/siunitx-abbreviations.cfg +++ b/Master/texmf-dist/tex/latex/siunitx/config/siunitx-abbreviations.cfg @@ -13,7 +13,7 @@ %% See http://www.latex-project.org/lppl.txt %% --------------------------------------------------------------- %% -\ProvidesExplFile {siunitx-abbreviations.cfg} {2010/07/15} {2.0n} +\ProvidesExplFile {siunitx-abbreviations.cfg} {2010/08/12} {2.0s} {siunitx: Abbreviated units} \DeclareSIUnit \A { \ampere } \DeclareSIUnit \pA { \pico \ampere } 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 11b97a0150f..3ea65b3502e 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/07/15} {2.0n} +\ProvidesExplFile {siunitx-binary.cfg} {2010/08/24} {2.0t} {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 0eff852f512..80c17aca560 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/07/15} {2.0n} +\ProvidesExplFile {siunitx-version-1.cfg} {2010/08/24} {2.0t} {siunitx: Version 1 settings} \keys_set:nn { siunitx } { load-configurations = { abbreviations , binary } } @@ -93,7 +93,9 @@ decimalsymbol / cdot .meta:n = { output-decimal-marker = { } \cdot { } }, - decimalsymbol + decimalsymbol / + comma .meta:n = { output-decimal-marker = { { , } } }, + decimalsymbol / fullstop .meta:n = { output-decimal-marker = { { . } } }, decimalsymbol / period .meta:n = { output-decimal-marker = { { . } } }, @@ -259,7 +261,7 @@ obeybold .default:n = { true }, obeyfamily .meta:n = { detect-family = #1 }, obeyfamily .default:n = { true }, - obeyitalic .meta:n = { detect-italic = #1 }, + obeyitalic .meta:n = { detect-shape = #1 }, obeyitalic .default:n = { true }, obeymode .meta:n = { detect-mode = #1 }, obeymode .default:n = { true }, diff --git a/Master/texmf-dist/tex/latex/siunitx/siunitx.sty b/Master/texmf-dist/tex/latex/siunitx/siunitx.sty index 2c0fe3d864e..f347814fe6f 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/07/15} {2.0n} +\ProvidesExplPackage {siunitx} {2010/08/24} {2.0t} {A comprehensive (SI) units package} \msg_set:nnnn { siunitx } { incompatible-package } { Package~'#1'~incompatible. } @@ -355,15 +355,15 @@ detect-all / false .meta:n = { detect-family = false, - detect-italic = false, detect-mode = false, + detect-shape = false, detect-weight = false }, detect-all / true .meta:n = { detect-family = true, - detect-italic = true, detect-mode = true, + detect-shape = true, detect-weight = true }, detect-display-math .bool_set:N = @@ -380,30 +380,31 @@ detect-inline-weight / text .code:n = { \tl_set:Nn \l_siunitx_detect_inline_weight_tl { text } }, - detect-italic .bool_set:N = \l_siunitx_detect_italic_bool, + detect-italic .bool_set:N = \l_siunitx_detect_shape_bool, detect-mode .bool_set:N = \l_siunitx_detect_mode_bool, detect-none .choice:, detect-none .default:n = true, detect-none / false .meta:n = { detect-family = true, - detect-italic = true, detect-mode = true, + detect-shape = true, detect-weight = true }, detect-none / true .meta:n = { detect-family = false, - detect-italic = false, detect-mode = false, - detect-weight = false + detect-shape = false, + detect-weight = false }, + detect-shape .bool_set:N = \l_siunitx_detect_shape_bool, detect-weight .bool_set:N = \l_siunitx_detect_weight_bool } \bool_new:N \l_siunitx_font_set_bool \bool_new:N \l_siunitx_font_math_mode_bool \tl_new:N \l_siunitx_font_family_tl -\cs_new_nopar:Npn \siunitx_font_italic: { } +\cs_new_nopar:Npn \siunitx_font_shape: { } \cs_new_nopar:Npn \siunitx_font_weight: { } \cs_new_protected_nopar:Npn \siunitx_detect_font: { \bool_if:NF \l_siunitx_font_set_bool @@ -413,8 +414,8 @@ { \siunitx_detect_font_weight: } \bool_if:NT \l_siunitx_detect_family_bool { \siunitx_detect_font_family: } - \bool_if:NT \l_siunitx_detect_italic_bool - { \siunitx_detect_font_italic: } + \bool_if:NT \l_siunitx_detect_shape_bool + { \siunitx_detect_font_shape: } \bool_if:NT \l_siunitx_detect_mode_bool { \siunitx_detect_font_mode: } } @@ -426,7 +427,7 @@ \unboldmath \mdseries } - \cs_set:Npn \siunitx_font_italic: { \upshape } + \cs_set:Npn \siunitx_font_shape: { \upshape } \tl_set:Nn \l_siunitx_font_family_tl { rm } \bool_set_true:N \l_siunitx_font_math_mode_bool } @@ -506,9 +507,11 @@ \tl_if_eq:NNT \f@family \c_siunitx_texttt_tl { \tl_set:Nn \l_siunitx_font_family_tl { tt } } } -\cs_new_protected_nopar:Npn \siunitx_detect_font_italic: { +\cs_new_protected_nopar:Npn \siunitx_detect_font_shape: { \tl_if_eq:nVT { it } \f@shape - { \cs_set_nopar:Npn \siunitx_font_italic: { \itshape } } + { \cs_set_nopar:Npn \siunitx_font_shape: { \itshape } } + \tl_if_eq:nVT { sl } \f@shape + { \cs_set_nopar:Npn \siunitx_font_shape: { \slshape } } } \cs_new_protected_nopar:Npn \siunitx_detect_font_mode: { \mode_if_math:F @@ -663,8 +666,8 @@ \text { \siunitx_print_color: + \siunitx_font_shape: \siunitx_font_weight: - \siunitx_font_italic: \use:c { siunitx_ \l_siunitx_print_type_tl _ @@ -1667,7 +1670,32 @@ } \cs_new_protected_nopar:Npn \siunitx_number_process_places_aux_i:n #1 { \intexpr_compare:nNnTF { \l_siunitx_process_precision_int } = { 0 } - { \prop_del:Nn \l_siunitx_number_in_prop { #1 -decimal } } + { + \prop_get:NnN \l_siunitx_number_in_prop { #1 -decimal } + \l_siunitx_tmpa_tl + \quark_if_no_value:NF \l_siunitx_tmpa_tl + { + \intexpr_compare:nNnT + { \exp_args:NV \tl_head:n \l_siunitx_tmpa_tl } > { 4 } + { + \prop_get:NnN \l_siunitx_number_in_prop { #1 -integer } + \l_siunitx_tmpa_tl + \quark_if_no_value:NTF \l_siunitx_tmpa_tl + { + \prop_put:Nnn \l_siunitx_number_in_prop + { #1 -integer } { 1 } + } + { + \tl_set:Nx \l_siunitx_tmpa_tl + { \intexpr_eval:n { \l_siunitx_tmpa_tl + 1 } } + \prop_put:NnV \l_siunitx_number_in_prop + { #1 -integer } \l_siunitx_tmpa_tl + } + } + } + \prop_del:Nn \l_siunitx_number_in_prop { #1 -decimal } + \prop_del:Nn \l_siunitx_number_in_prop { #1 -decimal-marker } + } { \prop_get:NnN \l_siunitx_number_in_prop { #1 -decimal } \l_siunitx_tmpa_tl @@ -1772,7 +1800,6 @@ { \siunitx_number_process_round_decimal_aux: } \tl_set:Nx \l_siunitx_round_decimal_in_tl { \exp_args:NV \tl_tail:n \l_siunitx_round_decimal_in_tl } - \int_decr:N \l_siunitx_round_int } \cs_new_protected_nopar:Npn @@ -3296,10 +3323,12 @@ \exp_not:n { \siunitx_ensuremath:n - { \l_siunitx_number_unit_sep_tl } + { \l_siunitx_number_unit_separator_tl } } } - \exp_not:n { \siunitx_unit_output:nn {#1} { } } + \group_begin: + \exp_not:n { \siunitx_unit_output:nn {#1} { } } + \group_end: \bool_if:NT \l_siunitx_create_xspace_bool { \exp_not:N \xspace } } @@ -3322,7 +3351,7 @@ \exp_not:n { \siunitx_ensuremath:n - { \l_siunitx_number_unit_sep_tl } + { \l_siunitx_number_unit_separator_tl } } } \SI {####1} { \exp_not:N #1 } @@ -3335,6 +3364,8 @@ } } \AtBeginDocument { + \cs_if_eq:NNT \color \use_none:n + { \cs_set_protected:Npn \color #1 { } } \tl_map_function:nN { \bar \color \ng \pm } \siunitx_protect_symbols:N } @@ -3848,7 +3879,7 @@ { \cs_set:Npn \siunitx_tmp:w ##1 - ##2 \q_stop { \tl_set:Nn \l_siunitx_tmpa_tl {##2} } - \exp_afer:wN \siunitx_tmp:w \l_siunitx_tmpa_tl \q_stop + \exp_after:wN \siunitx_tmp:w \l_siunitx_tmpa_tl \q_stop } { \tl_put_left:Nn \l_siunitx_tmpa_tl { - } } } @@ -5852,8 +5883,8 @@ \keys_set:nn { siunitx } { bracket-numbers = true, - detect-italic = false, detect-mode = false, + detect-shape = false, detect-weight = false, multi-part-units = bracket, parse-numbers = true, @@ -5862,14 +5893,15 @@ } \siunitx_strict_option:n { - bracket-numbers , - detect-italic , - detect-mode , - detect-weight , - multi-part-units , - parse-numbers , - parse-units , - product-units , + bracket-numbers , + detect-italic , + detect-mode , + detect-shape , + detect-weight , + multi-part-units , + parse-numbers , + parse-units , + product-units , } \keys_define:nn { siunitx } { |