%% %% This is file `ionumbers.sty', %% generated with the docstrip utility. %% %% The original source files were: %% %% ionumbers.dtx (with options: `package') %% %% This is a generated file. %% %% Copyright 2007-2008 Christian Schneider %% %% idea and parts of this package based on: ziffer.sty v2.1 %% Copyright Martin Vaeth %% %% ion@addto@macro: identical to l@addto@macro from koma-script %% bundle v2.9t %% Copyright 1994-2004 Markus Kohm and Frank Neukam %% %% Thanks to Martin Vaeth and Markus Kohm for permitting to use their %% code in this package. Please do not bother Martin and Markus with %% questions or bugs concering this package! %% %% This file is part of ionumbers. %% %% ionumbers is free software: you can redistribute it and/or modify %% it under the terms of the GNU General Public License version 3 as %% published by the Free Software Foundation, not any later version. %% %% ionumbers is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied warranty of %% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the %% GNU General Public License for more details. %% %% You should have received a copy of the GNU General Public License %% along with ionumbers. If not, see . %% %% WARNING: THIS IS ALPHA SOFTWARE AND MAY CONTAIN SERIOUS BUGS! %% \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesPackage{ionumbers} [2011/06/15 v0.3.1-alpha restyle numbers in math mode] \RequirePackage{keyval} \newif\ifion@autothousands \newif\ifion@autothousandths \newcount\ion@grplenthousands \newcount\ion@grplenthousandths \newcommand*{\ion@grplencheck}[1]{% \ifnum#1>9% \PackageError{ionumbers}% {Group length argument too large (#1).\MessageBreak% Grouping lengths must be smaller than 10.}{}% \fi% } \newcommand*\ion@defpackopts{\define@key{ion@packopts}} \newcommand*\ion@setpackopts{\setkeys{ion@packopts}} \ion@defpackopts{comma}{% \def\ion@comma@reset{\csname ion@comma@#1\endcsname}% \def\ion@aftercomma@reset{\csname ion@aftercomma@#1\endcsname}} \ion@defpackopts{point}{% \def\ion@point@reset{\csname ion@point@#1\endcsname}% \def\ion@afterpoint@reset{\csname ion@afterpoint@#1\endcsname}} \ion@defpackopts{decimal}{\def\ion@decimal@reset{% \csname ion@decimal@#1\endcsname}} \ion@defpackopts{thousands}{\def\ion@thousands@reset{% \csname ion@thousands@#1\endcsname}} \ion@defpackopts{thousandths}{\def\ion@thousandths@reset{% \csname ion@thousandths@#1\endcsname}} \ion@defpackopts{exponent}{\def\ion@exponent@reset{% \csname ion@exponent@#1\endcsname}} \ion@defpackopts{autothousands}[true]{\def\ion@autothousandsreset{% \csname ion@autothousands#1\endcsname}\ion@autothousandsreset} \ion@defpackopts{autothousandths}[true]{\def\ion@autothousandthsreset{% \csname ion@autothousandths#1\endcsname}\ion@autothousandthsreset} \ion@defpackopts{grplenthousands}{\ion@grplencheck{#1}% \def\ion@grplenthousandsreset{\ion@grplenthousands=#1}% \ion@grplenthousandsreset} \ion@defpackopts{grplenthousandths}{\ion@grplencheck{#1}% \def\ion@grplenthousandthsreset{\ion@grplenthousandths=#1}% \ion@grplenthousandthsreset} \ion@setpackopts{comma=default,point=default,thousands=default,% decimal=default,thousandths=default,exponent=default,autothousands=false,% autothousandths=false,grplenthousands=3,grplenthousandths=3} \DeclareOption*{\expandafter\ion@setpackopts\expandafter{\CurrentOption}} \ProcessOptions\relax \newcommand*\ion@deflocopts{\define@key{ion@locopts}} \newcommand*\ionumbersstyle[1]{\setkeys{ion@locopts}{#1}} \ion@deflocopts{comma}{% \def\ion@comma@curr{\csname ion@comma@#1\endcsname}% \def\ion@aftercomma@curr{\csname ion@aftercomma@#1\endcsname}} \ion@deflocopts{point}{% \def\ion@point@curr{\csname ion@point@#1\endcsname}% \def\ion@afterpoint@curr{\csname ion@afterpoint@#1\endcsname}} \ion@deflocopts{decimal}{\def\ion@decimal@curr{% \csname ion@decimal@#1\endcsname}} \ion@deflocopts{thousands}{\def\ion@thousands@curr{% \csname ion@thousands@#1\endcsname}} \ion@deflocopts{thousandths}{\def\ion@thousandths@curr{% \csname ion@thousandths@#1\endcsname}} \ion@deflocopts{exponent}{\def\ion@exponent@curr{% \csname ion@exponent@#1\endcsname}} \ion@deflocopts{autothousands}[true]{\csname ion@autothousands#1\endcsname} \ion@deflocopts{autothousandths}[true]{\csname ion@autothousandths#1\endcsname} \ion@deflocopts{grplenthousands}{% \def\@tempa{#1}% \def\@tempb{reset}% \ifx\@tempa\@tempb% \ion@grplenthousandsreset% \else% \ion@grplencheck{#1}% \ion@grplenthousands=#1% \fi% } \ion@deflocopts{grplenthousandths}{% \def\@tempa{#1}% \def\@tempb{reset}% \ifx\@tempa\@tempb% \ion@grplenthousandthsreset% \else% \ion@grplencheck{#1}% \ion@grplenthousandths=#1% \fi% } \newcommand*\ionumbersresetstyle{% \ionumbersstyle{comma=reset,point=reset,thousands=reset,% decimal=reset,thousandths=reset,exponent=reset,autothousands=reset,% autothousandths=reset,grplenthousands=reset,grplenthousandths=reset}} \AtEndOfPackage{\ionumbersresetstyle} \newcommand*\newionumbersthousands[2]{\expandafter\newcommand% \expandafter*\csname ion@thousands@#1\endcsname{\ionumbersoff{#2}}} \newcommand*\newionumbersdecimal[2]{\expandafter\newcommand% \expandafter*\csname ion@decimal@#1\endcsname{\ionumbersoff{#2}}} \newcommand*\newionumbersthousandths[2]{\expandafter\newcommand% \expandafter*\csname ion@thousandths@#1\endcsname{\ionumbersoff{#2}}} \newcommand*\newionumbersexponent{% \@ifstar{\newionumbersexponent@@}{\newionumbersexponent@}} \newcommand*\newionumbersexponent@[2]{\expandafter\newcommand% \expandafter*\csname ion@exponent@#1\endcsname{\ionumbersoff{#2}}} \newcommand*\newionumbersexponent@@[2]{\expandafter\newcommand% \expandafter*\csname ion@exponent@#1\endcsname{\ionumbersoff{#2}% \ion@exponent@superscripttrue}} \newcommand*\renewionumbersthousands[2]{\expandafter\renewcommand% \expandafter*\csname ion@thousands@#1\endcsname{\ionumbersoff{#2}}} \newcommand*\renewionumbersdecimal[2]{\expandafter\renewcommand% \expandafter*\csname ion@decimal@#1\endcsname{\ionumbersoff{#2}}} \newcommand*\renewionumbersthousandths[2]{\expandafter\renewcommand% \expandafter*\csname ion@thousandths@#1\endcsname{\ionumbersoff{#2}}} \newcommand*\renewionumbersexponent{% \@ifstar{\renewionumbersexponent@@}{\renewionumbersexponent@}} \newcommand*\renewionumbersexponent@[2]{\expandafter\renewcommand% \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@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} \def\ion@comma@default{\ion@comma@thousands} \def\ion@aftercomma@ignore{} \def\ion@aftercomma@decimal{\ion@beforedecimalfalse} \def\ion@aftercomma@thousands{\ion@noexplicitthousandsfalse} \def\ion@aftercomma@default{\ion@aftercomma@thousands} \def\ion@point@ignore{} \def\ion@point@decimal{\ion@decimal@curr} \def\ion@point@thousands{\ion@thousands@curr} \def\ion@point@default{\ion@point@decimal} \def\ion@afterpoint@ignore{} \def\ion@afterpoint@decimal{\ion@beforedecimalfalse} \def\ion@afterpoint@thousands{\ion@noexplicitthousandsfalse} \def\ion@afterpoint@default{\ion@afterpoint@decimal} \mathchardef\ion@decimal@point="013A \mathchardef\ion@decimal@comma="013B \mathchardef\ion@decimal@punctpoint="613A \mathchardef\ion@decimal@punctcomma="613B \def\ion@decimal@default{\ion@decimal@point} \def\ion@thousands@none{} \mathchardef\ion@thousands@comma="013B \mathchardef\ion@thousands@point="013A \mathchardef\ion@thousands@punctcomma="613B \mathchardef\ion@thousands@punctpoint="613A \def\ion@thousands@apostrophe{^\prime} \def\ion@thousands@phantom{\phantom{\ion@point@original}} \def\ion@thousands@space{\,} \def\ion@thousands@default{\ion@thousands@punctcomma} \def\ion@thousandths@none{} \mathchardef\ion@thousandths@comma="013B \mathchardef\ion@thousandths@point="013A \mathchardef\ion@thousandths@punctcomma="613B \mathchardef\ion@thousandths@punctpoint="613A \def\ion@thousandths@apostrophe{^\prime} \def\ion@thousandths@phantom{\phantom{\ion@point@original}} \def\ion@thousandths@space{\,} \def\ion@thousandths@default{\ion@thousandths@space} \def\ion@exponent@none{} \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% \catcode`\0=\active\catcode`\1=\active\catcode`\2=\active% \catcode`\3=\active\catcode`\4=\active\catcode`\5=\active% \catcode`\6=\active\catcode`\7=\active\catcode`\8=\active% \catcode`\9=\active\relax} \def\ion@separators@math@active{\mathcode`,="8000\mathcode`.="8000\relax} \def\ion@separators@math@inactive{\mathcode`,="613B\mathcode`.="013A\relax} \def\ion@signs@math@active{\mathcode`+="8000\mathcode`-="8000\relax} \def\ion@signs@math@inactive{\mathcode`+="202B\mathcode`-="2200\relax} \def\ion@digits@math@active{\mathcode`0="8000\mathcode`1="8000\mathcode`2="8000% \mathcode`3="8000\mathcode`4="8000\mathcode`5="8000\mathcode`6="8000% \mathcode`7="8000\mathcode`8="8000\mathcode`9="8000\relax} \def\ion@digits@math@inactive{\mathcode`0="7030\mathcode`1="7031% \mathcode`2="7032\mathcode`3="7033\mathcode`4="7034\mathcode`5="7035% \mathcode`6="7036\mathcode`7="7037\mathcode`8="7038\mathcode`9="7039\relax} \def\ionumbers{\ion@separators@math@active\ion@signs@math@active% \ion@digits@math@active} \def\endionumbers{\ion@separators@math@inactive\ion@signs@math@inactive% \ion@digits@math@inactive} \newcommand\ionumbersoff[1]{\begingroup\endionumbers#1\ionumbers\endgroup} \AtBeginDocument{\ionumbers} \def\ion@comma{% \ion@ifnextdigit{% \ion@currnum@append*{\ion@comma@curr}\ion@aftercomma@curr% }{% \ion@ifnextseparator{% \ion@currnum@append*{\ion@comma@curr}\ion@aftercomma@curr% \@warning{Too many separators}% }{% \ion@ifnextchar e{% \ion@currnum@append*{\ion@comma@curr}\ion@aftercomma@curr% \ion@currnum@output\ion@exponent@curr\@gobble% }{% \ion@currnum@output\ion@comma@original% }% }% }% } \def\ion@point{% \ion@ifnextdigit{% \ion@currnum@append*{\ion@point@curr}\ion@afterpoint@curr% }{% \ion@ifnextseparator{% \ion@currnum@append*{\ion@point@curr}\ion@afterpoint@curr% \@warning{Too many separators}% }{% \ion@ifnextchar e{% \ion@currnum@append*{\ion@point@curr}\ion@afterpoint@curr% \ion@currnum@output\ion@exponent@curr\@gobble% }{% \ion@currnum@output\ion@point@original% }% }% }% } \def\ion@plus{% \ion@iffirstchar{% \ion@plus@original% }{% \ion@currnum@append*{\ion@plus@original}% }% \ion@ifnextdigit{% %% nothing }{% \ion@ifnextseparator{% %% nothing }{% \ion@ifnextsign{% \@warning{Too many signs}% }{% \ion@currnum@output% }% }% }% } \def\ion@minus{% \ion@iffirstchar{% \ion@minus@original% }{% \ion@currnum@append*{\ion@minus@original}% }% \ion@ifnextdigit{% %% nothing }{% \ion@ifnextseparator{% %% nothing }{% \ion@ifnextsign{% \@warning{Too many signs}% }{% \ion@currnum@output% }% }% }% } \def\ion@zero{% \ion@iffirstchar{% \ion@zero@original\ion@currnum@append{}% }{% \ion@currnum@append{\ion@zero@original}% }% \ion@ifnextdigit{% %% nothing }{% \ion@ifnextseparator{% %% nothing }{% \ion@ifnextchar e{% \ion@currnum@output\ion@exponent@curr\@gobble% }{% \ion@currnum@output% }% }% }% } \def\ion@one{% \ion@iffirstchar{% \ion@one@original\ion@currnum@append{}% }{% \ion@currnum@append{\ion@one@original}% }% \ion@ifnextdigit{% %% nothing }{% \ion@ifnextseparator{% %% nothing }{% \ion@ifnextchar e{% \ion@currnum@output\ion@exponent@curr\@gobble% }{% \ion@currnum@output% }% }% }% } \def\ion@two{% \ion@iffirstchar{% \ion@two@original\ion@currnum@append{}% }{% \ion@currnum@append{\ion@two@original}% }% \ion@ifnextdigit{% %% nothing }{% \ion@ifnextseparator{% %% nothing }{% \ion@ifnextchar e{% \ion@currnum@output\ion@exponent@curr\@gobble% }{% \ion@currnum@output% }% }% }% } \def\ion@three{% \ion@iffirstchar{% \ion@three@original\ion@currnum@append{}% }{% \ion@currnum@append{\ion@three@original}% }% \ion@ifnextdigit{% %% nothing }{% \ion@ifnextseparator{% %% nothing }{% \ion@ifnextchar e{% \ion@currnum@output\ion@exponent@curr\@gobble% }{% \ion@currnum@output% }% }% }% } \def\ion@four{% \ion@iffirstchar{% \ion@four@original\ion@currnum@append{}% }{% \ion@currnum@append{\ion@four@original}% }% \ion@ifnextdigit{% %% nothing }{% \ion@ifnextseparator{% %% nothing }{% \ion@ifnextchar e{% \ion@currnum@output\ion@exponent@curr\@gobble% }{% \ion@currnum@output% }% }% }% } \def\ion@five{% \ion@iffirstchar{% \ion@five@original\ion@currnum@append{}% }{% \ion@currnum@append{\ion@five@original}% }% \ion@ifnextdigit{% %% nothing }{% \ion@ifnextseparator{% %% nothing }{% \ion@ifnextchar e{% \ion@currnum@output\ion@exponent@curr\@gobble% }{% \ion@currnum@output% }% }% }% } \def\ion@six{% \ion@iffirstchar{% \ion@six@original\ion@currnum@append{}% }{% \ion@currnum@append{\ion@six@original}% }% \ion@ifnextdigit{% %% nothing }{% \ion@ifnextseparator{% %% nothing }{% \ion@ifnextchar e{% \ion@currnum@output\ion@exponent@curr\@gobble% }{% \ion@currnum@output% }% }% }% } \def\ion@seven{% \ion@iffirstchar{% \ion@seven@original\ion@currnum@append{}% }{% \ion@currnum@append{\ion@seven@original}% }% \ion@ifnextdigit{% %% nothing }{% \ion@ifnextseparator{% %% nothing }{% \ion@ifnextchar e{% \ion@currnum@output\ion@exponent@curr\@gobble% }{% \ion@currnum@output% }% }% }% } \def\ion@eight{% \ion@iffirstchar{% \ion@eight@original\ion@currnum@append{}% }{% \ion@currnum@append{\ion@eight@original}% }% \ion@ifnextdigit{% %% nothing }{% \ion@ifnextseparator{% %% nothing }{% \ion@ifnextchar e{% \ion@currnum@output\ion@exponent@curr\@gobble% }{% \ion@currnum@output% }% }% }% } \def\ion@nine{% \ion@iffirstchar{% \ion@nine@original\ion@currnum@append{}% }{% \ion@currnum@append{\ion@nine@original}% }% \ion@ifnextdigit{% %% nothing }{% \ion@ifnextseparator{% %% nothing }{% \ion@ifnextchar e{% \ion@currnum@output\ion@exponent@curr\@gobble% }{% \ion@currnum@output% }% }% }% } \begingroup \ion@separators@active\ion@signs@active\ion@digits@active \gdef\ion@define@charmacros{% \global\let,=\ion@comma% \global\let.=\ion@point% \global\let+=\ion@plus% \global\let-=\ion@minus% \global\let0=\ion@zero% \global\let1=\ion@one% \global\let2=\ion@two% \global\let3=\ion@three% \global\let4=\ion@four% \global\let5=\ion@five% \global\let6=\ion@six% \global\let7=\ion@seven% \global\let8=\ion@eight% \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}% \futurelet\@let@token\ion@ifnextdigit@} \def\ion@ifnextdigit@{% \ifx\@let@token1\let\reserved@c\reserved@a\else% \ifx\@let@token2\let\reserved@c\reserved@a\else% \ifx\@let@token3\let\reserved@c\reserved@a\else% \ifx\@let@token4\let\reserved@c\reserved@a\else% \ifx\@let@token5\let\reserved@c\reserved@a\else% \ifx\@let@token6\let\reserved@c\reserved@a\else% \ifx\@let@token7\let\reserved@c\reserved@a\else% \ifx\@let@token8\let\reserved@c\reserved@a\else% \ifx\@let@token9\let\reserved@c\reserved@a\else% \ifx\@let@token0\let\reserved@c\reserved@a\else% \let\reserved@c\reserved@b% \fi% \fi% \fi% \fi% \fi% \fi% \fi% \fi% \fi% \fi% \reserved@c} \long\def\ion@ifnextseparator#1#2{% \def\reserved@a{#1}% \def\reserved@b{#2}% \futurelet\@let@token\ion@ifnextseparator@} \def\ion@ifnextseparator@{% \ifx\@let@token,\let\reserved@c\reserved@a\else% \ifx\@let@token.\let\reserved@c\reserved@a\else% \let\reserved@c\reserved@b% \fi% \fi% \reserved@c} \long\def\ion@ifnextsign#1#2{% \def\reserved@a{#1}% \def\reserved@b{#2}% \futurelet\@let@token\ion@ifnextsign@} \def\ion@ifnextsign@{% \ifx\@let@token+\let\reserved@c\reserved@a\else% \ifx\@let@token-\let\reserved@c\reserved@a\else% \let\reserved@c\reserved@b% \fi% \fi% \reserved@c} \long\def\ion@ifnextchar#1#2#3{% \let\reserved@d=#1% \def\reserved@a{#2}% \def\reserved@b{#3}% \futurelet\@let@token\ion@ifnextchar@} \def\ion@ifnextchar@{% \ifx\@let@token\reserved@d% \let\reserved@c\reserved@a% \else% \let\reserved@c\reserved@b% \fi% \reserved@c} \newcommand*{\ion@conflict@package}[1]{% \@ifpackageloaded{#1}{% \PackageError{ionumbers}% {Packages #1 and ionumbers conflict!\MessageBreak% Do not load both packages in the same document}{}% }{}% } \newcommand*{\ion@problem@package}[2]{% \@ifpackageloaded{#1}{% \PackageWarning{ionumbers}% {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}% {Potential conflict with other package(s) detected.\MessageBreak% `\string#1' has already been defined. I will redefine it.\MessageBreak% This might break other package(s)!\MessageBreak}\fi} \begingroup \ion@separators@active\ion@signs@active\ion@digits@active \ion@conflict@definedtest{,} \ion@conflict@definedtest{.} \ion@conflict@definedtest{+} \ion@conflict@definedtest{-} \ion@conflict@definedtest{0} \ion@conflict@definedtest{1} \ion@conflict@definedtest{2} \ion@conflict@definedtest{3} \ion@conflict@definedtest{4} \ion@conflict@definedtest{5} \ion@conflict@definedtest{6} \ion@conflict@definedtest{7} \ion@conflict@definedtest{8} \ion@conflict@definedtest{9} \endgroup \ion@define@charmacros \newcommand*{\ion@conflict@redefinedtest}[2]{% \ifx#1#2\else\PackageWarning{ionumbers}% {Potential conflict with other package(s) detected.\MessageBreak% `\string#1' has been redefined. This might break ionumbers!\MessageBreak}% \fi} \begingroup \ion@separators@active\ion@signs@active\ion@digits@active \gdef\ion@conflict@redefinedtest@macro{% \ion@conflict@redefinedtest{,}{\ion@comma}% \ion@conflict@redefinedtest{.}{\ion@point}% \ion@conflict@redefinedtest{+}{\ion@plus}% \ion@conflict@redefinedtest{-}{\ion@minus}% \ion@conflict@redefinedtest{0}{\ion@zero}% \ion@conflict@redefinedtest{1}{\ion@one}% \ion@conflict@redefinedtest{2}{\ion@two}% \ion@conflict@redefinedtest{3}{\ion@three}% \ion@conflict@redefinedtest{4}{\ion@four}% \ion@conflict@redefinedtest{5}{\ion@five}% \ion@conflict@redefinedtest{6}{\ion@six}% \ion@conflict@redefinedtest{7}{\ion@seven}% \ion@conflict@redefinedtest{8}{\ion@eight}% \ion@conflict@redefinedtest{9}{\ion@nine}% } \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 \def\ion@currnum{} \def\ion@thousands@sepa{} \def\ion@thousands@sepb{} \def\ion@thousands@sepc{} \def\ion@thousands@sepd{} \def\ion@thousands@sepe{} \def\ion@thousands@sepf{} \def\ion@thousands@sepg{} \def\ion@thousands@seph{} \def\ion@thousands@sepi{} \def\ion@thousandths@sep{} \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@append@}[1]{% \ifion@beforedecimal% %% push back (empty) separator and character \ifcase\ion@thousands@currpos% \ion@addto@macro{\ion@currnum}{#1}% \or% \ion@addto@macro{\ion@currnum}{\ion@thousands@sepa#1}% \or% \ion@addto@macro{\ion@currnum}{\ion@thousands@sepb#1}% \or% \ion@addto@macro{\ion@currnum}{\ion@thousands@sepc#1}% \or% \ion@addto@macro{\ion@currnum}{\ion@thousands@sepd#1}% \or% \ion@addto@macro{\ion@currnum}{\ion@thousands@sepe#1}% \or% \ion@addto@macro{\ion@currnum}{\ion@thousands@sepf#1}% \or% \ion@addto@macro{\ion@currnum}{\ion@thousands@sepg#1}% \or% \ion@addto@macro{\ion@currnum}{\ion@thousands@seph#1}% \or% \ion@addto@macro{\ion@currnum}{\ion@thousands@sepi#1}% \fi% %% advance thousands counter \advance\ion@thousands@currpos by1\relax% \ifnum\ion@thousands@currpos>\ion@grplenthousands% \ion@thousands@currpos=1% \fi% \else% %% push back (empty) separator and character \ifnum\ion@thousandths@currpos=\ion@grplenthousandths% \ion@addto@macro{\ion@currnum}{\ion@thousandths@sep#1}% \else% \ion@addto@macro{\ion@currnum}{#1}% \fi% %% advance thousandths counter \advance\ion@thousandths@currpos by1\relax% \ifnum\ion@thousandths@currpos>\ion@grplenthousandths% \ion@thousandths@currpos=1% \fi% \fi% } \newcommand*{\ion@currnum@output}{% \begingroup% %% set automatic thousands separator \ifion@autothousands% \ifion@noexplicitthousands% \ifcase\ion@thousands@currpos% %% do nothing \or% \def\ion@thousands@sepa{\ion@thousands@curr}% \or% \def\ion@thousands@sepb{\ion@thousands@curr}% \or% \def\ion@thousands@sepc{\ion@thousands@curr}% \or% \def\ion@thousands@sepd{\ion@thousands@curr}% \or% \def\ion@thousands@sepe{\ion@thousands@curr}% \or% \def\ion@thousands@sepf{\ion@thousands@curr}% \or% \def\ion@thousands@sepg{\ion@thousands@curr}% \or% \def\ion@thousands@seph{\ion@thousands@curr}% \or% \def\ion@thousands@sepi{\ion@thousands@curr}% \fi% \fi% \fi% %% set automatic thousandths separator \ifion@autothousandths% \def\ion@thousandths@sep{\ion@thousandths@curr}% \fi% %% output number \ifion@currnum@exponent% \ifion@exponent@superscript% ^{\ion@currnum}% \else% {\ion@currnum}% \fi% \else \ion@currnum% \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@currnum@exponentfalse% \ion@exponent@superscriptfalse% } \newcommand{\ion@addto@macro}[2]{% \begingroup\toks@\expandafter{#1#2}% \edef\@tempa{\endgroup\def\noexpand#1{\the\toks@}}% \@tempa} \endinput %% %% End of file `ionumbers.sty'.