diff options
author | Karl Berry <karl@freefriends.org> | 2008-09-28 22:41:56 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2008-09-28 22:41:56 +0000 |
commit | a67fcd0c52585e36929a2228293ddc24f07c68c2 (patch) | |
tree | efe9a49f1738a5a3764831338a72b09478f6bda6 /Master/texmf-dist/tex/latex | |
parent | 0fdbfd30e202ef2ac464b3b1a0137d03babb4576 (diff) |
siunitx 1.1 (28sep08)
git-svn-id: svn://tug.org/texlive/trunk@10777 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
23 files changed, 310 insertions, 67 deletions
diff --git a/Master/texmf-dist/tex/latex/siunitx/config/si-DE.cfg b/Master/texmf-dist/tex/latex/siunitx/config/si-DE.cfg index 46f0c886d01..61767cdce16 100644 --- a/Master/texmf-dist/tex/latex/siunitx/config/si-DE.cfg +++ b/Master/texmf-dist/tex/latex/siunitx/config/si-DE.cfg @@ -14,7 +14,7 @@ %% ---------------------------------------------------------------- %% \ProvidesFile{si-DE.cfg} - [2008/09/03 v1.0l siunitx: Germany locale] + [2008/09/28 v1.1 siunitx: Germany locale] \sisetup{ unitsep=cdot, valuesep=thin, diff --git a/Master/texmf-dist/tex/latex/siunitx/config/si-SIunits.cfg b/Master/texmf-dist/tex/latex/siunitx/config/si-SIunits.cfg index 3e3f452f090..3103921552f 100644 --- a/Master/texmf-dist/tex/latex/siunitx/config/si-SIunits.cfg +++ b/Master/texmf-dist/tex/latex/siunitx/config/si-SIunits.cfg @@ -14,7 +14,8 @@ %% ---------------------------------------------------------------- %% \ProvidesFile{si-SIunits.cfg} - [2008/09/03 v1.0l siunitx: Emulation of SIunits] + [2008/09/28 v1.1 siunitx: Emulation of + SIunits] \si@emulating{SIunits}{2007/12/02 v1.36} \sisetup{ unitsep=thick, diff --git a/Master/texmf-dist/tex/latex/siunitx/config/si-UK.cfg b/Master/texmf-dist/tex/latex/siunitx/config/si-UK.cfg index 738b61d8787..99d93b7e6d9 100644 --- a/Master/texmf-dist/tex/latex/siunitx/config/si-UK.cfg +++ b/Master/texmf-dist/tex/latex/siunitx/config/si-UK.cfg @@ -14,7 +14,7 @@ %% ---------------------------------------------------------------- %% \ProvidesFile{si-UK.cfg} - [2008/09/03 v1.0l siunitx: UK locale] + [2008/09/28 v1.1 siunitx: UK locale] \sisetup{ unitsep=thin, expproduct=times, diff --git a/Master/texmf-dist/tex/latex/siunitx/config/si-USA.cfg b/Master/texmf-dist/tex/latex/siunitx/config/si-USA.cfg index ec429c18443..622fb8ddccf 100644 --- a/Master/texmf-dist/tex/latex/siunitx/config/si-USA.cfg +++ b/Master/texmf-dist/tex/latex/siunitx/config/si-USA.cfg @@ -14,7 +14,7 @@ %% ---------------------------------------------------------------- %% \ProvidesFile{si-USA.cfg} - [2008/09/03 v1.0l siunitx: USA locale] + [2008/09/28 v1.1 siunitx: USA locale] \sisetup{ unitsep=thin, expproduct=times, diff --git a/Master/texmf-dist/tex/latex/siunitx/config/si-ZA.cfg b/Master/texmf-dist/tex/latex/siunitx/config/si-ZA.cfg index 6dc518eb08a..e0dba73265c 100644 --- a/Master/texmf-dist/tex/latex/siunitx/config/si-ZA.cfg +++ b/Master/texmf-dist/tex/latex/siunitx/config/si-ZA.cfg @@ -14,7 +14,7 @@ %% ---------------------------------------------------------------- %% \ProvidesFile{si-ZA.cfg} - [2008/09/03 v1.0l siunitx: South Africa locale] + [2008/09/28 v1.1 siunitx: South Africa locale] \sisetup{ unitsep=cdot, valuesep=thin, diff --git a/Master/texmf-dist/tex/latex/siunitx/config/si-abbr.cfg b/Master/texmf-dist/tex/latex/siunitx/config/si-abbr.cfg index 4e18e3fc370..c93c7a7b75b 100644 --- a/Master/texmf-dist/tex/latex/siunitx/config/si-abbr.cfg +++ b/Master/texmf-dist/tex/latex/siunitx/config/si-abbr.cfg @@ -14,7 +14,7 @@ %% ---------------------------------------------------------------- %% \ProvidesFile{si-abbr.cfg} - [2008/09/03 v1.0l siunitx: Abbreviated units] + [2008/09/28 v1.1 siunitx: Abbreviated units] \requiresiconfigs{prefix,named,accepted,physical} \newunit{\pA}{\pico\ampere} \newunit{\nA}{\nano\ampere} diff --git a/Master/texmf-dist/tex/latex/siunitx/config/si-accepted.cfg b/Master/texmf-dist/tex/latex/siunitx/config/si-accepted.cfg index 4f050c7ebd9..2236969c914 100644 --- a/Master/texmf-dist/tex/latex/siunitx/config/si-accepted.cfg +++ b/Master/texmf-dist/tex/latex/siunitx/config/si-accepted.cfg @@ -14,7 +14,7 @@ %% ---------------------------------------------------------------- %% \ProvidesFile{si-accepted.cfg} - [2008/09/03 v1.0l siunitx: SI Accepted units] + [2008/09/28 v1.1 siunitx: SI Accepted units] \newunit{\minute}{min} \newunit{\hour}{h} \newunit{\Day}{d} diff --git a/Master/texmf-dist/tex/latex/siunitx/config/si-addn.cfg b/Master/texmf-dist/tex/latex/siunitx/config/si-addn.cfg index 52def9ca5ab..f6ef0e272a2 100644 --- a/Master/texmf-dist/tex/latex/siunitx/config/si-addn.cfg +++ b/Master/texmf-dist/tex/latex/siunitx/config/si-addn.cfg @@ -14,7 +14,7 @@ %% ---------------------------------------------------------------- %% \ProvidesFile{si-addn.cfg} - [2008/09/03 v1.0l siunitx: SI Additional units] + [2008/09/28 v1.1 siunitx: SI Additional units] \newunit{\angstrom}{\si@sym@ringA} \newunit{\are}{a} \newunit{\hectare}{\hecto\are} diff --git a/Master/texmf-dist/tex/latex/siunitx/config/si-astro.cfg b/Master/texmf-dist/tex/latex/siunitx/config/si-astro.cfg index a39cce154c5..95a702c7e4a 100644 --- a/Master/texmf-dist/tex/latex/siunitx/config/si-astro.cfg +++ b/Master/texmf-dist/tex/latex/siunitx/config/si-astro.cfg @@ -14,7 +14,7 @@ %% ---------------------------------------------------------------- %% \ProvidesFile{si-astro.cfg} - [2008/09/03 v1.0l siunitx: Units for astronomy] + [2008/09/28 v1.1 siunitx: Units for astronomy] \newunit{\parsec}{pc} \newunit{\lightyear}{ly} \endinput diff --git a/Master/texmf-dist/tex/latex/siunitx/config/si-binary.cfg b/Master/texmf-dist/tex/latex/siunitx/config/si-binary.cfg index f90bae2cd62..0481dbd628d 100644 --- a/Master/texmf-dist/tex/latex/siunitx/config/si-binary.cfg +++ b/Master/texmf-dist/tex/latex/siunitx/config/si-binary.cfg @@ -14,7 +14,7 @@ %% ---------------------------------------------------------------- %% \ProvidesFile{si-binary.cfg} - [2008/09/03 v1.0l siunitx: Binary units] + [2008/09/28 v1.1 siunitx: Binary units] \newprefix[binary]{\kibi}{10}{Ki} \newprefix[binary]{\mebi}{20}{Mi} \newprefix[binary]{\gibi}{30}{Gi} diff --git a/Master/texmf-dist/tex/latex/siunitx/config/si-fancynum.cfg b/Master/texmf-dist/tex/latex/siunitx/config/si-fancynum.cfg index 849a1c52043..9c34f5dc04c 100644 --- a/Master/texmf-dist/tex/latex/siunitx/config/si-fancynum.cfg +++ b/Master/texmf-dist/tex/latex/siunitx/config/si-fancynum.cfg @@ -14,7 +14,8 @@ %% ---------------------------------------------------------------- %% \ProvidesFile{si-fancynum.cfg} - [2008/09/03 v1.0l siunitx: Emulation of fancynum] + [2008/09/28 v1.1 siunitx: Emulation of + fancynum] \si@emulating{fancynum}{2000/08/08 0.92} \sisetup{decimalsymbol=cdot,digitsep=comma} \let\fnum\num diff --git a/Master/texmf-dist/tex/latex/siunitx/config/si-fancyunits.cfg b/Master/texmf-dist/tex/latex/siunitx/config/si-fancyunits.cfg index f73010149df..89212451f54 100644 --- a/Master/texmf-dist/tex/latex/siunitx/config/si-fancyunits.cfg +++ b/Master/texmf-dist/tex/latex/siunitx/config/si-fancyunits.cfg @@ -14,7 +14,8 @@ %% ---------------------------------------------------------------- %% \ProvidesFile{si-fancyunits.cfg} - [2008/09/03 v1.0l siunitx: Emulation of fancyunits] + [2008/09/28 v1.1 siunitx: Emulation of + fancyunits] \si@emulating{fancyunits}{2007/02/01 v1.0.1} \si@ifloaded{SIunits} {\si@log@err{SIunits emulation loaded\MessageBreak before diff --git a/Master/texmf-dist/tex/latex/siunitx/config/si-hep.cfg b/Master/texmf-dist/tex/latex/siunitx/config/si-hep.cfg index 8825525b522..4a704aee51a 100644 --- a/Master/texmf-dist/tex/latex/siunitx/config/si-hep.cfg +++ b/Master/texmf-dist/tex/latex/siunitx/config/si-hep.cfg @@ -14,7 +14,7 @@ %% ---------------------------------------------------------------- %% \ProvidesFile{si-hep.cfg} - [2008/09/03 v1.0l siunitx: Units for high-energy physics] + [2008/09/28 v1.1 siunitx: Units for high-energy physics] \requiresiconfigs{prefix,named} \provideunit{\micron}{\micro\metre} \newunit{\mrad}{\milli\rad} diff --git a/Master/texmf-dist/tex/latex/siunitx/config/si-hepunits.cfg b/Master/texmf-dist/tex/latex/siunitx/config/si-hepunits.cfg index 1e57ff7c5dd..e0bb32063f8 100644 --- a/Master/texmf-dist/tex/latex/siunitx/config/si-hepunits.cfg +++ b/Master/texmf-dist/tex/latex/siunitx/config/si-hepunits.cfg @@ -14,7 +14,8 @@ %% ---------------------------------------------------------------- %% \ProvidesFile{si-hepunits.cfg} - [2008/09/03 v1.0l siunitx: Emulation of hepunits] + [2008/09/28 v1.1 siunitx: Emulation of + hepunits] \si@emulating{hepunits}{2007/09/27} \requiresiconfigs{SIunits,accepted,prefix,hep} \ifsi@old@noprefixcmds\else diff --git a/Master/texmf-dist/tex/latex/siunitx/config/si-named.cfg b/Master/texmf-dist/tex/latex/siunitx/config/si-named.cfg index ad9af4617d5..748cf20d7db 100644 --- a/Master/texmf-dist/tex/latex/siunitx/config/si-named.cfg +++ b/Master/texmf-dist/tex/latex/siunitx/config/si-named.cfg @@ -14,7 +14,7 @@ %% ---------------------------------------------------------------- %% \ProvidesFile{si-named.cfg} - [2008/09/03 v1.0l siunitx: SI Named units] + [2008/09/28 v1.1 siunitx: SI Named units] \newunit{\becquerel}{Bq} \newunit{\coulomb}{C} \newunit{\farad}{F} diff --git a/Master/texmf-dist/tex/latex/siunitx/config/si-physical.cfg b/Master/texmf-dist/tex/latex/siunitx/config/si-physical.cfg index 3b6ab1f6018..4cb1f8cce0a 100644 --- a/Master/texmf-dist/tex/latex/siunitx/config/si-physical.cfg +++ b/Master/texmf-dist/tex/latex/siunitx/config/si-physical.cfg @@ -14,7 +14,7 @@ %% ---------------------------------------------------------------- %% \ProvidesFile{si-physical.cfg} - [2008/09/03 v1.0l siunitx: SI Physically-measured units] + [2008/09/28 v1.1 siunitx: SI Physically-measured units] \newcommand*{\si@eVspacea}{\text{\kern-\si@eVcorra}}% \newcommand*{\si@eVspaceb}{\text{\kern-\si@eVcorrb}}% \newunit{\electronvolt}{e\protect\si@eVspacea V\protect% diff --git a/Master/texmf-dist/tex/latex/siunitx/config/si-prefix.cfg b/Master/texmf-dist/tex/latex/siunitx/config/si-prefix.cfg index 2969dd8c71e..0330987ccfc 100644 --- a/Master/texmf-dist/tex/latex/siunitx/config/si-prefix.cfg +++ b/Master/texmf-dist/tex/latex/siunitx/config/si-prefix.cfg @@ -14,7 +14,7 @@ %% ---------------------------------------------------------------- %% \ProvidesFile{si-prefix.cfg} - [2008/09/03 v1.0l siunitx: SI Multiple prefixes] + [2008/09/28 v1.1 siunitx: SI Multiple prefixes] \newprefix{\yocto}{-24}{y} \newprefix{\zepto}{-21}{z} \newprefix{\atto}{-18}{a} diff --git a/Master/texmf-dist/tex/latex/siunitx/config/si-prefixed.cfg b/Master/texmf-dist/tex/latex/siunitx/config/si-prefixed.cfg index 99593b2561e..32030fa1f2b 100644 --- a/Master/texmf-dist/tex/latex/siunitx/config/si-prefixed.cfg +++ b/Master/texmf-dist/tex/latex/siunitx/config/si-prefixed.cfg @@ -14,7 +14,7 @@ %% ---------------------------------------------------------------- %% \ProvidesFile{si-prefixed.cfg} - [2008/09/03 v1.0l siunitx: SI Prefixed units] + [2008/09/28 v1.1 siunitx: SI Prefixed units] \requiresiconfigs{prefix,named,accepted,physical} \newunit{\picometre}{\pico\metre} \newunit{\nanometre}{\nano\metre} diff --git a/Master/texmf-dist/tex/latex/siunitx/config/si-sistyle.cfg b/Master/texmf-dist/tex/latex/siunitx/config/si-sistyle.cfg index 3f7977ed19e..18a516494a4 100644 --- a/Master/texmf-dist/tex/latex/siunitx/config/si-sistyle.cfg +++ b/Master/texmf-dist/tex/latex/siunitx/config/si-sistyle.cfg @@ -14,7 +14,8 @@ %% ---------------------------------------------------------------- %% \ProvidesFile{si-sistyle.cfg} - [2008/09/03 v1.0l siunitx: Emulation of SIstyle] + [2008/09/28 v1.1 siunitx: Emulation of + SIstyle] \si@emulating{sistyle}{2006/12/20 v2.3} \sisetup{% sepfour=true, diff --git a/Master/texmf-dist/tex/latex/siunitx/config/si-synchem.cfg b/Master/texmf-dist/tex/latex/siunitx/config/si-synchem.cfg index 97048463852..d1dff21c562 100644 --- a/Master/texmf-dist/tex/latex/siunitx/config/si-synchem.cfg +++ b/Master/texmf-dist/tex/latex/siunitx/config/si-synchem.cfg @@ -14,7 +14,7 @@ %% ---------------------------------------------------------------- %% \ProvidesFile{si-synchem.cfg} - [2008/09/03 v1.0l siunitx: Units for synthetic chemists] + [2008/09/28 v1.1 siunitx: Units for synthetic chemists] \requiresiconfigs{prefix} \newunit{\mmHg}{mmHg} \newunit{\molar}{\mole\per\cubic\deci\metre} diff --git a/Master/texmf-dist/tex/latex/siunitx/config/si-units.cfg b/Master/texmf-dist/tex/latex/siunitx/config/si-units.cfg index 799b0f99142..ce3c24034aa 100644 --- a/Master/texmf-dist/tex/latex/siunitx/config/si-units.cfg +++ b/Master/texmf-dist/tex/latex/siunitx/config/si-units.cfg @@ -15,7 +15,7 @@ %% \si@ifloaded{units}{\endinput}{} \ProvidesFile{si-units.cfg} - [2008/09/03 v1.0l siunitx: Emulation of units] + [2008/09/28 v1.1 siunitx: Emulation of units] \si@emulating{units}{1998/08/04 v0.9b} \si@ifloaded{SIunits} {\si@emclash{units}{SIunits}\endinput}{} diff --git a/Master/texmf-dist/tex/latex/siunitx/config/si-unitsdef.cfg b/Master/texmf-dist/tex/latex/siunitx/config/si-unitsdef.cfg index c0a7bebdc86..322f7b5691e 100644 --- a/Master/texmf-dist/tex/latex/siunitx/config/si-unitsdef.cfg +++ b/Master/texmf-dist/tex/latex/siunitx/config/si-unitsdef.cfg @@ -14,7 +14,8 @@ %% ---------------------------------------------------------------- %% \ProvidesFile{si-unitsdef.cfg} - [2008/09/03 v1.0l siunitx: Emulation of unitsdef] + [2008/09/28 v1.1 siunitx: + Emulation of unitsdef] \si@emulating{unitsdef}{2005/01/04 v0.2} \si@ifloaded{SIunits} {\si@emclash{unitsdef}{SIunits}\endinput}{} diff --git a/Master/texmf-dist/tex/latex/siunitx/siunitx.sty b/Master/texmf-dist/tex/latex/siunitx/siunitx.sty index 3d5eb1260d7..b0d0bf5285b 100644 --- a/Master/texmf-dist/tex/latex/siunitx/siunitx.sty +++ b/Master/texmf-dist/tex/latex/siunitx/siunitx.sty @@ -15,7 +15,7 @@ %% \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{siunitx} - [2008/09/03 v1.0l A comprehensive (SI) units package] + [2008/09/28 v1.1 A comprehensive (SI) units package] \begingroup \@ifundefined{eTeXversion} {\PackageError{siunitx} @@ -30,6 +30,7 @@ \catcode\string`\string ` \the\catcode\string`\`\relax \catcode\string`\string = \the\catcode\string`\=\relax \catcode\string`\string ^ \the\catcode\string`\^\relax + \catcode\string`\string _ \the\catcode\string`\_\relax \catcode\string`\string ~ \the\catcode\string`\~\relax \catcode\string`\string : \the\catcode\string`\:\relax \catcode\string`\string - \the\catcode\string`\-\relax @@ -40,6 +41,7 @@ \catcode\string`\` 12\relax \catcode`\= 12\relax \catcode`\^ 7\relax +\catcode`\_ 8\relax \catcode`\~ \active\relax \@makeother{\:} \@makeother{\-} @@ -377,11 +379,11 @@ \si@opt@key{textsf}{\sisetup{unittextsf=#1,valuetextsf=#1}} \si@opt@key{texttt}{\sisetup{unittexttt=#1,valuetexttt=#1}} \si@opt@cmdkeys{numdigits,numdecimal,numexp,numgobble,numsign,% - numcloseerr,numopenerr,numaddn,numprod} + numcloseerr,numopenerr,numaddn,numprod,numdiv} \newcommand*{\si@numextra}{% \si@numopenerr\si@numcloseerr\si@numaddn} \newcommand*{\si@numvalid}{\si@numgobble\si@numexp\si@numsign - \si@numdecimal\si@numdigits\si@numextra\si@numprod} + \si@numdecimal\si@numdigits\si@numextra\si@numprod\si@numdiv} \si@opt@boolkey{seperr} \si@opt@boolkey{trapambigerr} \si@opt@cmdkeys{openerr,closeerr} @@ -531,6 +533,7 @@ \si@opt@boolkey{astroang} \si@opt@boolkey{strictarc} \newif\ifsi@tab@fixed +\si@opt@boolkey{tabparseonly} \si@opt@choicekey{tabnumalign} {centredecimal,centerdecimal,right,left,centre,center} {\si@tab@fixedtrue @@ -639,15 +642,35 @@ \ifx\si@tempa\si@tempb \let\si@tab@lfill@s\relax \fi} -\si@opt@boolkey{fixdp} +\si@opt@boolkey[% + \ifsi@fixdp + \expandafter\si@fixsffalse + \fi]{fixdp} \newcount\si@num@dp \si@opt@key{dp}{% \si@str@ifonlychrs{#1}{0123456789} - {} + {\si@num@dp#1\relax + \si@fixdptrue + \si@fixsffalse} {\si@log@err{Invalid input for dp option} - {The dp option must be given a positive integer}}% - \si@num@dp#1\relax - \si@fixdptrue} + {The dp option must be given a positive integer}}} +\si@opt@boolkey[% + \ifsi@fixsf + \expandafter\si@fixdpfalse + \fi]{fixsf} +\newcount\si@num@sf +\si@opt@key{sf}{% + \si@str@ifonlychrs{#1}{0123456789} + {\si@num@sf#1\relax + \ifnum\si@num@sf=\z@\relax + \si@log@warn{Setting sf=0 disables function}% + \si@fixsffalse + \else + \si@fixsftrue + \si@fixdpfalse + \fi} + {\si@log@err{Invalid input for sf option} + {The sf option must be given a positive integer}}} \si@opt@boolkey{tabautofit} \si@opt@boolkey{xspace} \si@opt@boolkey @@ -1240,6 +1263,7 @@ \def\,{}% \catcode`\~=\active\relax \catcode`\^=\active\relax + \catcode`\_=\active\relax \everyeof{\noexpand}% \endlinechar\m@ne \protected@xdef\si@tempa{\scantokens{#1}}% @@ -1700,8 +1724,10 @@ \expandafter\si@str@ifonlychrs\expandafter{\si@tempa} {0123456789} {\ifx\@empty\si@num@err\@empty - \ifsi@fixdp - \expandafter\expandafter\expandafter\si@num@fixdp + \renewcommand*{\si@tempb}{mant}% + \renewcommand*{\si@tempc}{#1}% + \ifx\si@tempb\si@tempc + \expandafter\expandafter\expandafter\si@num@fixlength \fi \fi}{}% \si@num@ifextra{\si@num@predec}{} @@ -1837,7 +1863,7 @@ \si@tempcntb\si@tempcnta\relax \si@num@lerr \protected@edef\si@num@err{% - \si@tempa\ensuremath{\si@decimalsymbol}\si@tempb}} + \si@tempa\expandafter\@car\si@numdecimal\@nil\si@tempb}} \newcommand*{\si@num@lerr}{% \si@num@cntdigits{\si@tempb}% \ifnum\si@tempcnta=\si@tempcntb\relax\else @@ -1847,6 +1873,14 @@ \def\si@num@movedigit#1#2\@empty{% \protected@edef\si@tempa{\si@tempa#1}% \protected@edef\si@tempb{#2}} +\newcommand*{\si@num@fixlength}{% + \ifsi@fixdp + \expandafter\si@num@fixdp + \else + \ifsi@fixsf + \expandafter\expandafter\expandafter\si@num@fixsf + \fi + \fi} \newcommand*{\si@num@fixdp}{% \si@num@cntdigits{\si@num@postdec}% \ifx\@empty\si@num@postdec\@empty @@ -1865,10 +1899,14 @@ \newcommand*{\si@num@pd}{% \advance\si@tempcnta\@ne\relax \protected@edef\si@num@postdec{\si@num@postdec0}} +\newcount\si@num@rndtarget \newcommand*{\si@num@prernd}{} \newcommand*{\si@num@postrnd}{} \newcommand*{\si@num@round}{% \si@log@debug{Rounding to \the\si@num@dp\space digits}% + \si@num@rndtarget\si@num@dp\relax + \si@num@rndstart} +\newcommand*{\si@num@rndstart}{% \si@num@reverse{\si@num@postdec}% \si@num@reverse{\si@num@predec}% \let\si@num@prernd\si@num@predec @@ -1887,10 +1925,10 @@ \si@num@rev#2\@empty\@empty \fi} \newcommand*{\si@num@rnd}{% - \ifnum\si@tempcnta>\z@\relax - \expandafter\si@num@rndpost - \else + \ifx\@empty\si@num@postrnd\@empty \expandafter\si@num@rndpre + \else + \expandafter\si@num@rndpost \fi} \newcommand*{\si@num@rndpre}{% \expandafter\edef\expandafter\si@tempa\expandafter{% @@ -1924,12 +1962,12 @@ \advance\si@tempcntb\@ne\relax \fi \si@switchfalse - \advance\si@num@dp\@ne\relax - \ifnum\si@tempcnta>\si@num@dp\relax - \advance\si@num@dp\m@ne\relax + \advance\si@num@rndtarget\@ne\relax + \ifnum\si@tempcnta>\si@num@rndtarget\relax + \advance\si@num@rndtarget\m@ne\relax \else - \advance\si@num@dp\m@ne\relax - \ifnum\si@tempcnta>\si@num@dp\relax + \advance\si@num@rndtarget\m@ne\relax + \ifnum\si@tempcnta>\si@num@rndtarget\relax \ifnum\si@tempcntb>4\relax \expandafter\expandafter\expandafter\si@switchtrue \fi @@ -1942,7 +1980,120 @@ \fi \fi \advance\si@tempcnta\m@ne\relax + \ifnum\si@tempcnta=\m@ne\relax + \si@num@throw + \fi \si@num@rnd} +\newcommand*{\si@num@throw}{% + \si@num@reverse{\si@num@postdec}% + \edef\si@num@postdec{\expandafter\@cdr\si@num@postdec\@nil}% + \si@num@reverse{\si@num@postdec}} +\newcommand*{\si@num@fixsf}{% + \si@num@cntdigits{\si@num@predec}% + \ifx\@empty\si@num@predec\@empty + \si@tempcnta\z@\relax + \fi + \ifnum\si@tempcnta=\@ne\relax + \renewcommand*{\si@tempa}{0}% + \ifx\si@num@predec\si@tempa + \ifx\@empty\si@num@postdec\@empty\else + \si@tempcnta\z@\relax + \si@switchfalse + \expandafter\si@num@cntpostsf\si@num@postdec + \@empty\@empty + \ifnum\si@tempcnta>\si@num@sf\relax + \si@log@debug{Rounding to \the\si@num@sf\space + figures}% + \si@num@rndtarget\si@num@sf\relax + \si@num@rndstart + \fi + \fi + \else + \si@num@cntprepost + \fi + \else + \ifnum\si@tempcnta<\si@num@sf\relax + \si@num@cntprepost + \else + \advance\si@tempcnta\m@ne\relax + \si@switchfalse + \ifnum\si@tempcnta>\si@num@sf\relax\else + \ifx\@empty\si@num@postdec\@empty\else + \edef\si@num@postdec{\expandafter\@car + \si@num@postdec\@nil}% + \ifnum\si@num@postdec>4\relax + \expandafter\si@switchtrue + \fi + \fi + \fi + \advance\si@tempcnta\@ne\relax + \renewcommand*{\si@num@postdec}{}% + \si@num@reverse{\si@num@predec}% + \let\si@num@prernd\si@num@predec + \renewcommand*{\si@num@predec}{}% + \si@num@sfpre + \ifsi@switch + \edef\si@num@predec{1\si@num@predec}% + \fi + \fi + \fi} +\def\si@num@cntpostsf#1#2\@empty{% + \ifsi@switch + \advance\si@tempcnta\@ne\relax + \else + \if 0#1\relax\else + \si@tempcnta\@ne\relax + \expandafter\expandafter\expandafter\si@switchtrue + \fi + \fi + \ifx\@empty#2\@empty\else + \si@num@cntpostsf#2\@empty\@empty + \fi} +\newcommand*{\si@num@cntprepost}{% + \si@tempcntb\si@tempcnta\relax + \si@num@cntdigits{\si@num@postdec}% + \advance\si@tempcnta\si@tempcntb\relax + \ifnum\si@tempcnta>\si@num@sf + \si@log@debug{Rounding to \the\si@num@sf\space figures}% + \si@num@rndtarget\si@num@sf\relax + \si@num@rndstart + \ifsi@switch + \si@num@throw + \fi + \fi} +\newcommand*{\si@num@sfpre}{% + \expandafter\edef\expandafter\si@tempa\expandafter{% + \expandafter\@car\si@num@prernd\@nil}% + \expandafter\edef\expandafter\si@num@prernd\expandafter{% + \expandafter\@cdr\si@num@prernd\@nil}% + \si@tempcntb\si@tempa\relax + \ifsi@switch + \advance\si@tempcntb\@ne\relax + \fi + \si@switchfalse + \advance\si@num@sf\@ne\relax + \ifnum\si@tempcnta>\si@num@sf\relax + \advance\si@num@sf\m@ne\relax + \edef\si@num@predec{0\si@num@predec}% + \else + \advance\si@num@sf\m@ne\relax + \ifnum\si@tempcnta>\si@num@sf\relax + \ifnum\si@tempcntb>4\relax + \expandafter\expandafter\expandafter\si@switchtrue + \fi + \edef\si@num@predec{0\si@num@predec}% + \else + \ifnum\si@tempcntb=10\relax + \si@tempcntb\z@\relax + \expandafter\expandafter\expandafter\si@switchtrue + \fi + \edef\si@num@predec{\the\si@tempcntb\si@num@predec}% + \fi + \fi + \advance\si@tempcnta\m@ne\relax + \ifx\@empty\si@num@prernd\@empty\else + \expandafter\si@num@sfpre + \fi} \newcommand*{\si@num@int}[1]{% \renewcommand*{\si@num@predec}{}% \ifsi@sepfour @@ -2488,10 +2639,13 @@ \newcount\si@tempcntb \newcommand*{\si@tab@numout}{% \si@num@intabtrue - \ifsi@tab@fixed - \ifsi@tabautofit - \si@num@dp\si@tab@mantpostcnt\relax - \expandafter\expandafter\expandafter\si@fixdptrue + \ifsi@tabparseonly\else + \ifsi@tab@fixed + \ifsi@tabautofit + \si@num@dp\si@tab@mantpostcnt\relax + \expandafter\expandafter\expandafter\expandafter + \expandafter\expandafter\expandafter\si@fixdptrue + \fi \fi \fi \expandafter\si@num\expandafter{\the\si@tab@toks}% @@ -2501,17 +2655,35 @@ \newbox\si@tab@postbox \newbox\si@tab@expbox \newcommand*{\si@tab@format}{% - \ifsi@tab@fixed - \expandafter\si@tab@fixed + \ifsi@tabparseonly + \expandafter\si@tab@outonly \else - \expandafter\si@tab@unfixed + \ifsi@tab@fixed + \expandafter\expandafter\expandafter\si@tab@fixed + \else + \expandafter\expandafter\expandafter\si@tab@unfixed + \fi \fi \ifsi@colourvalues \si@fam@colourcmd{\si@valuecolour}% \fi - \box\si@tab@prebox\box\si@tab@midbox\box\si@tab@postbox% + \box\si@tab@prebox\box\si@tab@midbox\box\si@tab@postbox \box\si@tab@expbox} -\newcommand*\si@tab@unfixed{% +\newcommand*{\si@tab@outonly}{% + \si@log@debug{Using non-aligned S column}% + \setbox\si@tab@prebox=\hbox{}% + \setbox\si@tab@midbox=\hbox{}% + \setbox\si@tab@postbox=\hbox{}% + \setbox\si@tab@expbox=\hbox{}% + \protected@edef\si@tempa{% + \si@tab@out + \ifx\@empty\si@num@out\@empty\else + \ensuremath{{\si@decimalsymbol}}% + \fi + \si@num@out + \si@tab@expout}% + \expandafter\si@out@num\expandafter{\si@tempa}} +\newcommand*{\si@tab@unfixed}{% \si@log@debug{Using variable width S column}% \ifx\@empty\si@num@out\@empty \setbox\si@tab@midbox=\hbox @@ -2589,8 +2761,7 @@ \setbox\si@tab@prebox=\hbox to\si@tab@predim{\hss\hfill \expandafter\si@out@num\expandafter{\si@tab@out}}% \ifx\@empty\si@num@out\@empty - \setbox\si@tab@postbox=\hbox to\si@tab@postdim - {\expandafter\si@out@num\expandafter{\si@num@out}\hfil}% + \setbox\si@tab@postbox=\hbox to\si@tab@postdim{\hfil}% \else \ifsi@tabalignexp\else \protected@edef\si@num@out{\si@num@out\si@tab@expout}% @@ -2672,6 +2843,19 @@ \si@ifdefinable{#2} {\si@unt@defpower[#1]{#2}{#3}} {}} +\newcommand*{\newqualifier}[2]{% + \si@ifdefinable{#1} + {\si@unt@defqual{#1}{#2}} + {\si@log@err{Qualifier \string#1 already defined!}\@eha}} +\newcommand*{\renewqualifier}[2]{% + \si@ifdefinable{#1} + {\si@log@err{Qualifier \string#1 undefined}\@ehc + \si@unt@defqual{#1}{#2}} + {\si@unt@defqual{#1}{#2}}} +\newcommand*{\providequalifier}[2]{% + \si@ifdefinable{#1} + {\si@unt@defqual{#1}{#2}} + {}} \newif\ifsi@unt@num \newcommand*{\si@unt@unitarg}{} \newcommand*{\si@unt@SIopts}{} @@ -2792,8 +2976,8 @@ \renewcommand*{\si@unt@spstack}{}% \renewcommand*{\si@unt@stacka}{}% \renewcommand*{\si@unt@stackb}{}% - \renewcommand*{\si@unt@holdstacka}{}% - \renewcommand*{\si@unt@holdstackb}{}% + \renewcommand*{\si@unt@spacestacka}{}% + \renewcommand*{\si@unt@spacestackb}{}% \renewcommand*{\si@unt@lastadda}{space}% \renewcommand*{\si@unt@lastaddb}{space}} \newcommand*{\si@unt@final}{% @@ -2873,6 +3057,20 @@ \fi \fi {#2}{#3}}} +\newcommand*{\si@unt@defqual}[2]{% + \si@log@debug{Declaring qualifier \string#1 with\MessageBreak + meaning \string#2}% + \protected\def#1{% + \ifsi@unt@littest + \expandafter\@gobble + \else + \ifsi@unt@litout + \expandafter\expandafter\expandafter\si@unt@litqual + \else + \expandafter\expandafter\expandafter\si@unt@qual + \fi + \fi + {#2}}} \newcommand*{\si@unt@unithook}{} \newcommand*{\si@unt@unit}[3]{% \ifnum\si@unt@depthcnt=\m@ne\relax @@ -3034,19 +3232,50 @@ \expandafter\ifx \csname si@unt@lastadd\si@unt@checkstack\endcsname \si@tempa - \si@log@debug{Adding power - \strip@pt\si@unt@powerdim\space to output stack}% - \si@unt@addtostack{power}{^{\num[fixdp=false]{% - \strip@pt\si@unt@powerdim}}}% + \si@unt@skpwr + \else + \renewcommand*{\si@tempa}{qual}% + \expandafter\ifx + \csname si@unt@lastadd\si@unt@checkstack\endcsname + \si@tempa + \si@unt@skpwrqual + \fi \fi \fi \si@unt@powerdim\z@\relax} +\newcommand*{\si@unt@skpwr}{% + \si@log@debug{Adding power + \strip@pt\si@unt@powerdim\space to output stack}% + \si@unt@addtostack{power}{^{\num[fixdp=false]{% + \strip@pt\si@unt@powerdim}}}} \newcommand*{\si@unt@invpower}{% \si@tempdima\si@unt@powerdim\relax \si@unt@powerdim -\si@tempdima\relax \ifdim\si@unt@powerdim=\p@\relax \si@unt@powerdim\z@\relax \fi} +\newcommand*{\si@unt@litqual}[1]{(#1)} +\newcommand*{\si@unt@qual}[1]{% + \ifsi@unt@first + \si@log@err{Qualifier before units} + {A unit qualifier can only be given after\MessageBreak + one or more units. You tried to open a unit + with\MessageBreak \string#1}% + \fi + \expandafter\let\expandafter\si@unt@spacestack + \csname si@unt@spacestack\si@unt@checkstack\endcsname + \expandafter\let\csname si@unt@spacestack\si@unt@checkstack + \endcsname\@empty + \renewcommand*{\si@tempa}{power}% + \expandafter\ifx + \csname si@unt@lastadd\si@unt@checkstack\endcsname\si@tempa + \let\si@unt@skpwrqual\relax + \else + \let\si@unt@skpwrqual\si@unt@skpwr + \fi + \si@unt@addtostack{qual}{_{#1}}% + \expandafter\let\csname si@unt@spacestack\si@unt@checkstack + \endcsname\si@unt@spacestack} \newif\ifsi@unt@per \newif\ifsi@unt@perseen \si@newrobustcmd*{\si@per}{% @@ -3122,28 +3351,27 @@ \expandafter\advance \csname si@unt@unitcnt\si@unt@checkstack\endcsname \@ne\relax} -\newcommand*{\si@unt@holdstacka}{} -\newcommand*{\si@unt@holdstackb}{} +\newcommand*{\si@unt@spacestack}{} +\newcommand*{\si@unt@spacestacka}{} +\newcommand*{\si@unt@spacestackb}{} \newcommand*{\si@unt@holdspace}[1]{% \renewcommand*{\si@tempa}{b}% \edef\si@tempb{\si@unt@checkstack}% \ifx\si@tempa\si@tempb \ifx\@empty\si@unt@stackb\@empty \else - \expandafter\protected@edef - \csname si@unt@holdstack\si@unt@checkstack\endcsname{#1}% + \protected@edef\si@unt@spacestackb{#1}% \fi \else - \expandafter\protected@edef - \csname si@unt@holdstack\si@unt@checkstack\endcsname{#1}% + \protected@edef\si@unt@spacestacka{#1}% \fi} \newcommand*{\si@unt@addstack}[1]{% \expandafter\protected@edef \csname si@unt@stack\si@unt@checkstack\endcsname {\csname si@unt@stack\si@unt@checkstack\endcsname - \csname si@unt@holdstack\si@unt@checkstack\endcsname#1}% + \csname si@unt@spacestack\si@unt@checkstack\endcsname#1}% \expandafter\renewcommand\expandafter*\expandafter{% - \csname si@unt@holdstack\si@unt@checkstack\endcsname}{}} + \csname si@unt@spacestack\si@unt@checkstack\endcsname}{}} \newcommand*{\si@unt@stackout}{% \si@unt@litouttrue \ifsi@frac @@ -3375,9 +3603,11 @@ \begingroup \catcode`\^=\active \catcode`\-=\active + \catcode`\_=\active \gdef\si@out#1{% \begingroup \catcode`\^=\active + \catcode`\_=\active \makeatletter \endlinechar\m@ne \ifsi@fam@set\else @@ -3396,16 +3626,21 @@ \check@mathfonts} \gdef\si@out@text#1{% \let^\si@out@sp + \let_\si@out@sb \let\textsuperscript\si@out@sp + \let\textsubscript\si@out@sb \catcode`\-=\active\relax \let-\si@out@minus #1} \gdef\si@out@maths#1{% \let^\sp + \let_\sb \let\textsuperscript\sp + \let\textsubscript\sb $\si@fam@maths{#1}$} \endgroup \newcommand*{\si@out@sp}[1]{\ensuremath{^{\text{#1}}}} +\newcommand*{\si@out@sb}[1]{\ensuremath{_{\text{#1}}}} \newcommand*{\si@out@minus}{\ensuremath{-}} \newif\ifsi@out@num \newcommand*{\si@out@num}[1]{% @@ -3510,9 +3745,10 @@ negcolour=red, noload={}, numaddn={},%( - numcloseerr=),% + numcloseerr=), numdecimal={.,}, numdigits=0123456789, + numdiv=/, numexp=eEdD, numgobble={}, numopenerr=(,%) @@ -3543,6 +3779,7 @@ tabautofit=false, tabformat=3.2, tabnumalign=centredecimal, + tabparseonly=false, tabtextalign=centre, tabunitalign=left, textrm=rmfamily, |