diff options
author | Karl Berry <karl@freefriends.org> | 2008-12-24 23:27:00 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2008-12-24 23:27:00 +0000 |
commit | b32f575da15f39882f8c3e83c838ef841cba2304 (patch) | |
tree | bcc66dba59bb83b0586b115e26142664077217d9 /Master/texmf-dist/tex/latex/ionumbers | |
parent | 4d5b0d9afc48f2d8e9ae1e3198a4b9adf142deae (diff) |
ionumbers update (24dec08)
git-svn-id: svn://tug.org/texlive/trunk@11706 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/ionumbers')
-rw-r--r-- | Master/texmf-dist/tex/latex/ionumbers/ionumbers.sty | 195 |
1 files changed, 149 insertions, 46 deletions
diff --git a/Master/texmf-dist/tex/latex/ionumbers/ionumbers.sty b/Master/texmf-dist/tex/latex/ionumbers/ionumbers.sty index 85ede742a19..b1580fdb04f 100644 --- a/Master/texmf-dist/tex/latex/ionumbers/ionumbers.sty +++ b/Master/texmf-dist/tex/latex/ionumbers/ionumbers.sty @@ -39,7 +39,7 @@ %% \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesPackage{ionumbers} - [2008/11/02 v0.2.1-alpha restyle numbers in math mode] + [2008/12/21 v0.2.3-alpha restyle numbers in math mode] \RequirePackage{keyval} \newif\ifion@autothousands \newif\ifion@autothousandths @@ -113,14 +113,26 @@ \newcommand*\renewionumbersexponent{% \@ifstar{\renewionumbersexponent@@}{\renewionumbersexponent@}} \newcommand*\renewionumbersexponent@[2]{\expandafter\renewcommand% - \expandafter*\csname ion@exponent@#1\endcsname{\ionumbersoff{#2}}} + \expandafter*\csname ion@exponent@#1\endcsname{\ionumbersoff{#2}% + \ion@currnum@exponent}} \newcommand*\renewionumbersexponent@@[2]{\expandafter\renewcommand% \expandafter*\csname ion@exponent@#1\endcsname{\ionumbersoff{#2}% - \ion@exponent@superscripttrue}} + \ion@currnum@exponent\ion@exponent@superscripttrue}} \mathchardef\ion@point@original="013A \mathchardef\ion@comma@original="613B \mathchardef\ion@plus@original="202B \mathchardef\ion@minus@original="2200 +\mathchardef\ion@zero@original="7030 +\mathchardef\ion@one@original="7031 +\mathchardef\ion@two@original="7032 +\mathchardef\ion@three@original="7033 +\mathchardef\ion@four@original="7034 +\mathchardef\ion@five@original="7035 +\mathchardef\ion@six@original="7036 +\mathchardef\ion@seven@original="7037 +\mathchardef\ion@eight@original="7038 +\mathchardef\ion@nine@original="7039 +\mathchardef\ion@e@original="7165 \def\ion@comma@ignore{} \def\ion@comma@decimal{\ion@decimal@curr} \def\ion@comma@thousands{\ion@thousands@curr} @@ -161,14 +173,17 @@ \def\ion@thousandths@space{\,} \def\ion@thousandths@default{\ion@thousandths@space} \def\ion@exponent@none{} -\mathchardef\ion@exponent@ite="7165 -\mathchardef\ion@exponent@itE="7145 -\mathchardef\ion@exponent@rme="7065 -\mathchardef\ion@exponent@rmE="7045 -\def\ion@exponent@timestento{\times10\,\ion@exponent@superscripttrue} -\def\ion@exponent@cdottento{\cdot10\,\ion@exponent@superscripttrue} -\def\ion@exponent@wedge{^\wedge} -\def\ion@exponent@default{\ion@exponent@ite} +\def\ion@exponent@original{\ion@e@original} +\def\ion@exponent@ite{\mathchar"7165\ion@currnum@exponenttrue} +\def\ion@exponent@itE{\mathchar"7145\ion@currnum@exponenttrue} +\def\ion@exponent@rme{\mathchar"7065\ion@currnum@exponenttrue} +\def\ion@exponent@rmE{\mathchar"7045\ion@currnum@exponenttrue} +\def\ion@exponent@timestento{\times10\,\ion@currnum@exponenttrue% + \ion@exponent@superscripttrue} +\def\ion@exponent@cdottento{\cdot10\,\ion@currnum@exponenttrue% + \ion@exponent@superscripttrue} +\def\ion@exponent@wedge{^\wedge\ion@currnum@exponenttrue} +\def\ion@exponent@default{\ion@exponent@original} \def\ion@separators@active{\catcode`\,=\active\catcode`\.=\active\relax} \def\ion@signs@active{\catcode`\+=\active\catcode`\-=\active\relax} \def\ion@digits@active{\catcode`\,=\active\catcode`\.=\active% @@ -194,14 +209,14 @@ \AtBeginDocument{\ionumbers} \def\ion@comma{% \ion@ifnextdigit{% - \ion@currnum@pushback*{\ion@comma@curr}\ion@aftercomma@curr% + \ion@currnum@append*{\ion@comma@curr}\ion@aftercomma@curr% }{% \ion@ifnextseparator{% - \ion@currnum@pushback*{\ion@comma@curr}\ion@aftercomma@curr% + \ion@currnum@append*{\ion@comma@curr}\ion@aftercomma@curr% \@warning{Too many separators}% }{% \ion@ifnextchar e{% - \ion@currnum@pushback*{\ion@comma@curr}\ion@aftercomma@curr% + \ion@currnum@append*{\ion@comma@curr}\ion@aftercomma@curr% \ion@currnum@output\ion@exponent@curr\@gobble% }{% \ion@currnum@output\ion@comma@original% @@ -211,14 +226,14 @@ } \def\ion@point{% \ion@ifnextdigit{% - \ion@currnum@pushback*{\ion@point@curr}\ion@afterpoint@curr% + \ion@currnum@append*{\ion@point@curr}\ion@afterpoint@curr% }{% \ion@ifnextseparator{% - \ion@currnum@pushback*{\ion@point@curr}\ion@afterpoint@curr% + \ion@currnum@append*{\ion@point@curr}\ion@afterpoint@curr% \@warning{Too many separators}% }{% \ion@ifnextchar e{% - \ion@currnum@pushback*{\ion@point@curr}\ion@afterpoint@curr% + \ion@currnum@append*{\ion@point@curr}\ion@afterpoint@curr% \ion@currnum@output\ion@exponent@curr\@gobble% }{% \ion@currnum@output\ion@point@original% @@ -227,36 +242,51 @@ }% } \def\ion@plus{% + \ion@iffirstchar{% + \ion@plus@original% + }{% + \ion@currnum@append*{\ion@plus@original}% + }% \ion@ifnextdigit{% - \ion@currnum@pushback*{\ion@plus@original}% + %% nothing }{% \ion@ifnextseparator{% - \ion@currnum@pushback*{\ion@plus@original}% + %% nothing }{% \ion@ifnextsign{% - \ion@currnum@pushback*{\ion@plus@original}\@warning{Too many signs}% + \@warning{Too many signs}% }{% - \ion@currnum@output\ion@plus@original% + \ion@currnum@output% }% }% }% } \def\ion@minus{% + \ion@iffirstchar{% + \ion@minus@original% + }{% + \ion@currnum@append*{\ion@minus@original}% + }% \ion@ifnextdigit{% - \ion@currnum@pushback*{\ion@minus@original}% + %% nothing }{% \ion@ifnextseparator{% - \ion@currnum@pushback*{\ion@minus@original}% + %% nothing }{% \ion@ifnextsign{% - \ion@currnum@pushback*{\ion@minus@original}\@warning{Too many signs}% + \@warning{Too many signs}% }{% - \ion@currnum@output\ion@minus@original% + \ion@currnum@output% }% }% }% } -\def\ion@zero{\ion@currnum@pushback{\mathchar"7030}% +\def\ion@zero{% + \ion@iffirstchar{% + \ion@zero@original\ion@currnum@append{}% + }{% + \ion@currnum@append{\ion@zero@original}% + }% \ion@ifnextdigit{% %% nothing }{% @@ -271,7 +301,12 @@ }% }% } -\def\ion@one{\ion@currnum@pushback{\mathchar"7031}% +\def\ion@one{% + \ion@iffirstchar{% + \ion@one@original\ion@currnum@append{}% + }{% + \ion@currnum@append{\ion@one@original}% + }% \ion@ifnextdigit{% %% nothing }{% @@ -286,7 +321,12 @@ }% }% } -\def\ion@two{\ion@currnum@pushback{\mathchar"7032}% +\def\ion@two{% + \ion@iffirstchar{% + \ion@two@original\ion@currnum@append{}% + }{% + \ion@currnum@append{\ion@two@original}% + }% \ion@ifnextdigit{% %% nothing }{% @@ -301,7 +341,12 @@ }% }% } -\def\ion@three{\ion@currnum@pushback{\mathchar"7033}% +\def\ion@three{% + \ion@iffirstchar{% + \ion@three@original\ion@currnum@append{}% + }{% + \ion@currnum@append{\ion@three@original}% + }% \ion@ifnextdigit{% %% nothing }{% @@ -316,7 +361,12 @@ }% }% } -\def\ion@four{\ion@currnum@pushback{\mathchar"7034}% +\def\ion@four{% + \ion@iffirstchar{% + \ion@four@original\ion@currnum@append{}% + }{% + \ion@currnum@append{\ion@four@original}% + }% \ion@ifnextdigit{% %% nothing }{% @@ -331,7 +381,12 @@ }% }% } -\def\ion@five{\ion@currnum@pushback{\mathchar"7035}% +\def\ion@five{% + \ion@iffirstchar{% + \ion@five@original\ion@currnum@append{}% + }{% + \ion@currnum@append{\ion@five@original}% + }% \ion@ifnextdigit{% %% nothing }{% @@ -346,7 +401,12 @@ }% }% } -\def\ion@six{\ion@currnum@pushback{\mathchar"7036}% +\def\ion@six{% + \ion@iffirstchar{% + \ion@six@original\ion@currnum@append{}% + }{% + \ion@currnum@append{\ion@six@original}% + }% \ion@ifnextdigit{% %% nothing }{% @@ -361,7 +421,12 @@ }% }% } -\def\ion@seven{\ion@currnum@pushback{\mathchar"7037}% +\def\ion@seven{% + \ion@iffirstchar{% + \ion@seven@original\ion@currnum@append{}% + }{% + \ion@currnum@append{\ion@seven@original}% + }% \ion@ifnextdigit{% %% nothing }{% @@ -376,7 +441,12 @@ }% }% } -\def\ion@eight{\ion@currnum@pushback{\mathchar"7038}% +\def\ion@eight{% + \ion@iffirstchar{% + \ion@eight@original\ion@currnum@append{}% + }{% + \ion@currnum@append{\ion@eight@original}% + }% \ion@ifnextdigit{% %% nothing }{% @@ -391,7 +461,12 @@ }% }% } -\def\ion@nine{\ion@currnum@pushback{\mathchar"7039}% +\def\ion@nine{% + \ion@iffirstchar{% + \ion@nine@original\ion@currnum@append{}% + }{% + \ion@currnum@append{\ion@nine@original}% + }% \ion@ifnextdigit{% %% nothing }{% @@ -425,6 +500,18 @@ \global\let9=\ion@nine% } \endgroup +\def\ion@iffirstchar#1#2{% + \ifion@currnum@exponent% + #2% + \else% + \ifion@currnum@firstchar% + #1% + \else + #2% + \fi% + \fi% + \ion@currnum@firstcharfalse% +} \long\def\ion@ifnextdigit#1#2{% \def\reserved@a{#1}% \def\reserved@b{#2}% @@ -492,12 +579,17 @@ Do not load both packages in the same document}{}}{}} \newcommand*{\ion@problem@package}[2]{% \@ifpackageloaded{#1}{\PackageWarning{ionumbers}% - {Loading #1 and ionumbers is\MessageBreak% - problematic!\MessageBreak% + {Loading #1 and ionumbers is problematic!\MessageBreak% #2}{}}} + \AtBeginDocument{% \ion@conflict@package{ziffer}% \ion@problem@package{dcolumn}{Use `tabular's inside \string\ionumbersoff}% + \ion@problem@package{amsmath}{Load ionumbers after amsmath}% + \ion@problem@package{amsmath}{Use \string\operatorname\space inside + \string\ionumbersoff}% + \ion@problem@package{amsopn}{Use \string\operatorname\space inside + \string\ionumbersoff}% } \newcommand*\ion@conflict@definedtest[1]{% \ifx#1\@undefined\else\PackageWarning{ionumbers}% @@ -547,8 +639,10 @@ } \endgroup \AtBeginDocument{\ion@conflict@redefinedtest@macro} +\newif\ifion@currnum@firstchar\ion@currnum@firstchartrue \newif\ifion@beforedecimal\ion@beforedecimaltrue \newif\ifion@noexplicitthousands\ion@noexplicitthousandstrue +\newif\ifion@currnum@exponent\ion@currnum@exponentfalse \newif\ifion@exponent@superscript\ion@exponent@superscriptfalse \newcount\ion@thousands@currpos\ion@thousands@currpos=0 \newcount\ion@thousandths@currpos\ion@thousandths@currpos=0 @@ -557,12 +651,14 @@ \def\ion@thousands@sepb{} \def\ion@thousands@sepc{} \def\ion@thousandths@sep{} -\newcommand{\ion@currnum@pushback}{\@ifstar{\ion@currnum@pushback@@}% - {\ion@currnum@pushback@}} -\newcommand*{\ion@currnum@pushback@@}[1]{% +\newcommand{\ion@currnum@append}{% + \ion@currnum@firstcharfalse% + \@ifstar{\ion@currnum@append@@}{\ion@currnum@append@}% +} +\newcommand*{\ion@currnum@append@@}[1]{% \ion@addto@macro{\ion@currnum}{#1}% } -\newcommand*{\ion@currnum@pushback@}[1]{% +\newcommand*{\ion@currnum@append@}[1]{% \ifion@beforedecimal% %% push back (empty) separator and character \ifcase\ion@thousands@currpos% @@ -614,19 +710,26 @@ \def\ion@thousandths@sep{\ion@thousandths@curr}% \fi% %% output number - \ifion@exponent@superscript% - ^{\ion@currnum}% - \else% + \ifion@currnum@exponent% + \ifion@exponent@superscript% + ^{\ion@currnum}% + \else% + {\ion@currnum}% + \fi% + \else \ion@currnum% - \fi% + \fi \endgroup% %% reset stuff for next number \ion@thousands@currpos=0% \ion@thousandths@currpos=0% \def\ion@currnum{}% + \ion@currnum@firstchartrue% \ion@beforedecimaltrue% \ion@noexplicitthousandstrue% - \ion@exponent@superscriptfalse} + \ion@currnum@exponentfalse% + \ion@exponent@superscriptfalse% +} \newcommand{\ion@addto@macro}[2]{% \begingroup\toks@\expandafter{#1#2}% \edef\@tempa{\endgroup\def\noexpand#1{\the\toks@}}% |