summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/siunitx/siunitx.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2008-09-05 18:49:14 +0000
committerKarl Berry <karl@freefriends.org>2008-09-05 18:49:14 +0000
commit4b1c829c2bee6f9a1ea665a342afbc563cb63b61 (patch)
tree11e5a7de4d84535c8641a23297cf63c409417bcc /Master/texmf-dist/tex/latex/siunitx/siunitx.sty
parentae41bbd3003da49008e930d3f24b1908d316e810 (diff)
siunitx 1.0l (3sep08)
git-svn-id: svn://tug.org/texlive/trunk@10435 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/siunitx/siunitx.sty')
-rw-r--r--Master/texmf-dist/tex/latex/siunitx/siunitx.sty81
1 files changed, 59 insertions, 22 deletions
diff --git a/Master/texmf-dist/tex/latex/siunitx/siunitx.sty b/Master/texmf-dist/tex/latex/siunitx/siunitx.sty
index 22ecfac416e..3d5eb1260d7 100644
--- a/Master/texmf-dist/tex/latex/siunitx/siunitx.sty
+++ b/Master/texmf-dist/tex/latex/siunitx/siunitx.sty
@@ -14,13 +14,8 @@
%% ----------------------------------------------------------------
%%
\NeedsTeXFormat{LaTeX2e}
-\newcommand*{\si@svn@ver}{v1.0i}
-\def\si@svn@id$#1: #2.#3 #4 #5-#6-#7 #8 #9${%
- \newcommand*{\si@svn@version}{%
- #5/#6/#7\space\si@svn@ver\space}}
-\si@svn@id $Id: siunitx.dtx 121 2008-08-14 14:06:03Z joseph $
\ProvidesPackage{siunitx}
- [\si@svn@version A comprehensive (SI) units package]
+ [2008/09/03 v1.0l A comprehensive (SI) units package]
\begingroup
\@ifundefined{eTeXversion}
{\PackageError{siunitx}
@@ -2336,6 +2331,7 @@
\si@tab@posttoks{}%
\si@switchfalse
\si@tab@gettok}
+\newcommand*{\si@tab@next}{}
\newcommand*{\si@tab@gettok@S}[1]{%
\ifx\tabularnewline#1\relax
\let\si@tab@next\si@tab@newline@S
@@ -2356,15 +2352,23 @@
\let\si@tab@next\relax
\else
\let\si@tab@next\si@tab@gettok@S
- \si@str@ifchrstr{#1}{\si@numvalid}
- {\si@switchtrue
- \si@log@debug{Found numerical cell
- contents `#1'}%
- \si@tab@toks=\expandafter{%
- \the\si@tab@toks#1}}
- {\si@log@debug{Found other cell contents
- \string#1}%
- \si@tab@othertok{#1}}%
+ \ifx\ignorespaces#1\relax
+ \si@tab@othertok{#1}%
+ \else
+ \ifx\unskip#1\relax
+ \si@tab@othertok{#1}%
+ \else
+ \si@str@ifchrstr{#1}{\si@numvalid}
+ {\si@switchtrue
+ \si@log@debug{Found numerical cell
+ contents `#1'}%
+ \si@tab@toks=\expandafter{%
+ \the\si@tab@toks#1}}
+ {\si@tab@ifonechar{#1}
+ {\futurelet\si@tempa\si@tab@bracetest#1}%
+ {\si@tab@othertok{#1}}}%
+ \fi
+ \fi
\fi
\fi
\fi
@@ -2373,11 +2377,42 @@
\fi
\si@tab@next}
\newcommand*{\si@tab@othertok}[1]{%
+ \si@log@debug{Found other cell contents `\unexpanded{#1}'}%
\ifsi@switch
+ \si@log@debug{Adding to post-numeral part}%
\si@tab@posttoks=\expandafter{\the\si@tab@posttoks#1}%
\else
+ \si@log@debug{Adding to pre-numeral part}%
\si@tab@pretoks=\expandafter{\the\si@tab@pretoks#1}%
\fi}
+\newcommand*{\si@tab@ifonechar}[1]{\si@tab@onechar#1\@empty}
+\def\si@tab@onechar#1#2\@empty{%
+ \ifx\@empty#2\@empty
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi}
+\newcommand*{\si@tab@bracetest}{%
+ \ifx\si@tempa\bgroup
+ \expandafter\si@tab@othertok
+ \else
+ \expandafter\si@tab@exptest
+ \fi}
+\newcommand*{\si@tab@exptest}[1]{%
+ \edef\si@tempa{\si@tab@meaning{#1}}%
+ \ifx\si@tempa\si@tab@macro
+ \si@log@debug{Expanding cell contents `\unexpanded{#1}'}%
+ \the\si@tab@pretoks
+ \si@tab@pretoks{}%
+ \protected@edef\si@tab@next{\noexpand\si@tab@gettok@S#1}%
+ \else
+ \si@tab@othertok{#1}%
+ \fi}
+\newcommand*{\si@tab@meaning}[1]{%
+ \expandafter\si@tab@strip\meaning#1:->:->\@empty}
+\def\si@tab@strip#1:->#2:->#3\@empty{#1}
+\newcommand*{\si@tab@macro}{}
+\edef\si@tab@macro{\si@tab@meaning{\si@tab@macro}}
\newcommand*{\si@tab@gettok@s}[1]{%
\ifx\tabularnewline#1\relax
\let\si@tab@next\si@tab@newline@s
@@ -2422,9 +2457,9 @@
\fi
\si@tab@lfill\relax
\ifsi@switch
- \llap{\the\si@tab@pretoks}%
- \expandafter\si@tab@numout
- \rlap{\the\si@tab@posttoks}%
+ \the\si@tab@pretoks
+ \si@tab@numout
+ \the\si@tab@posttoks
\else
\the\si@tab@pretoks
\fi
@@ -2478,9 +2513,6 @@
\box\si@tab@expbox}
\newcommand*\si@tab@unfixed{%
\si@log@debug{Using variable width S column}%
- \protected@edef\si@num@out{\si@num@out\si@tab@expout}%
- \setbox\si@tab@prebox=\hbox
- {\expandafter\si@out@num\expandafter{\si@tab@out}}%
\ifx\@empty\si@num@out\@empty
\setbox\si@tab@midbox=\hbox
{\phantom{\ensuremath{{\si@decimalsymbol}}}}%
@@ -2488,6 +2520,9 @@
\setbox\si@tab@midbox=\hbox
{\ensuremath{{\si@decimalsymbol}}}%
\fi
+ \protected@edef\si@num@out{\si@num@out\si@tab@expout}%
+ \setbox\si@tab@prebox=\hbox
+ {\expandafter\si@out@num\expandafter{\si@tab@out}}%
\setbox\si@tab@postbox=\hbox
{\expandafter\si@out@num\expandafter{\si@num@out}}%
\ifdim\wd\si@tab@prebox>\wd\si@tab@postbox\relax
@@ -2515,7 +2550,9 @@
\si@tab@sepcorr{mantpre}{pre}%
\si@tab@postdim\si@tab@mantpostcnt\si@tempdima\relax
\setbox\si@tempboxa=\hbox{\ensuremath{{\si@decimalsymbol}}}%
- \advance\si@tab@postdim\wd\si@tempboxa\relax
+ \ifnum\si@tab@mantpostcnt=\z@\relax\else
+ \advance\si@tab@postdim\wd\si@tempboxa\relax
+ \fi
\si@tab@sepcorr{mantpost}{post}%
\setbox\si@tempboxa=\hbox{\si@out@num{^{1}}}%
\si@tempdima\wd\si@tempboxa\relax