diff options
author | Karl Berry <karl@freefriends.org> | 2008-11-03 19:31:51 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2008-11-03 19:31:51 +0000 |
commit | 6353d202605e9d14b274ec399dc15bb7de330328 (patch) | |
tree | 72563c0c9f28aeb28941acc7173c4ea548003294 /Master/texmf-dist/tex/latex/ionumbers | |
parent | ab017d77dda45d76965159f5d01b8afef6a509c0 (diff) |
new latex package ionumbers (2nov08)
git-svn-id: svn://tug.org/texlive/trunk@11165 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 | 636 |
1 files changed, 636 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/ionumbers/ionumbers.sty b/Master/texmf-dist/tex/latex/ionumbers/ionumbers.sty new file mode 100644 index 00000000000..85ede742a19 --- /dev/null +++ b/Master/texmf-dist/tex/latex/ionumbers/ionumbers.sty @@ -0,0 +1,636 @@ +%% +%% 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 <software(at)chschneider(dot)eu> +%% +%% idea and parts of this package based on: ziffer.sty v2.1 +%% Copyright Martin Vaeth <vaeth@mathematik.uni-wuerzburg.de> +%% +%% 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 <http://www.gnu.org/licenses/>. +%% +%% WARNING: THIS IS ALPHA SOFTWARE AND MAY CONTAIN SERIOUS BUGS! +%% +\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\ProvidesPackage{ionumbers} + [2008/11/02 v0.2.1-alpha restyle numbers in math mode] +\RequirePackage{keyval} +\newif\ifion@autothousands +\newif\ifion@autothousandths +\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@setpackopts{comma=default,point=default,thousands=default,% + decimal=default,thousandths=default,exponent=default,autothousands=false,% + autothousandths=false} +\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} +\newcommand*\ionumbersresetstyle{% + \ionumbersstyle{comma=reset,point=reset,thousands=reset,% + decimal=reset,thousandths=reset,exponent=reset,autothousands=reset,% + autothousandths=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}}} +\newcommand*\renewionumbersexponent@@[2]{\expandafter\renewcommand% + \expandafter*\csname ion@exponent@#1\endcsname{\ionumbersoff{#2}% + \ion@exponent@superscripttrue}} +\mathchardef\ion@point@original="013A +\mathchardef\ion@comma@original="613B +\mathchardef\ion@plus@original="202B +\mathchardef\ion@minus@original="2200 +\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{} +\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@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@pushback*{\ion@comma@curr}\ion@aftercomma@curr% + }{% + \ion@ifnextseparator{% + \ion@currnum@pushback*{\ion@comma@curr}\ion@aftercomma@curr% + \@warning{Too many separators}% + }{% + \ion@ifnextchar e{% + \ion@currnum@pushback*{\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@pushback*{\ion@point@curr}\ion@afterpoint@curr% + }{% + \ion@ifnextseparator{% + \ion@currnum@pushback*{\ion@point@curr}\ion@afterpoint@curr% + \@warning{Too many separators}% + }{% + \ion@ifnextchar e{% + \ion@currnum@pushback*{\ion@point@curr}\ion@afterpoint@curr% + \ion@currnum@output\ion@exponent@curr\@gobble% + }{% + \ion@currnum@output\ion@point@original% + }% + }% + }% +} +\def\ion@plus{% + \ion@ifnextdigit{% + \ion@currnum@pushback*{\ion@plus@original}% + }{% + \ion@ifnextseparator{% + \ion@currnum@pushback*{\ion@plus@original}% + }{% + \ion@ifnextsign{% + \ion@currnum@pushback*{\ion@plus@original}\@warning{Too many signs}% + }{% + \ion@currnum@output\ion@plus@original% + }% + }% + }% +} +\def\ion@minus{% + \ion@ifnextdigit{% + \ion@currnum@pushback*{\ion@minus@original}% + }{% + \ion@ifnextseparator{% + \ion@currnum@pushback*{\ion@minus@original}% + }{% + \ion@ifnextsign{% + \ion@currnum@pushback*{\ion@minus@original}\@warning{Too many signs}% + }{% + \ion@currnum@output\ion@minus@original% + }% + }% + }% +} +\def\ion@zero{\ion@currnum@pushback{\mathchar"7030}% + \ion@ifnextdigit{% + %% nothing + }{% + \ion@ifnextseparator{% + %% nothing + }{% + \ion@ifnextchar e{% + \ion@currnum@output\ion@exponent@curr\@gobble% + }{% + \ion@currnum@output% + }% + }% + }% +} +\def\ion@one{\ion@currnum@pushback{\mathchar"7031}% + \ion@ifnextdigit{% + %% nothing + }{% + \ion@ifnextseparator{% + %% nothing + }{% + \ion@ifnextchar e{% + \ion@currnum@output\ion@exponent@curr\@gobble% + }{% + \ion@currnum@output% + }% + }% + }% +} +\def\ion@two{\ion@currnum@pushback{\mathchar"7032}% + \ion@ifnextdigit{% + %% nothing + }{% + \ion@ifnextseparator{% + %% nothing + }{% + \ion@ifnextchar e{% + \ion@currnum@output\ion@exponent@curr\@gobble% + }{% + \ion@currnum@output% + }% + }% + }% +} +\def\ion@three{\ion@currnum@pushback{\mathchar"7033}% + \ion@ifnextdigit{% + %% nothing + }{% + \ion@ifnextseparator{% + %% nothing + }{% + \ion@ifnextchar e{% + \ion@currnum@output\ion@exponent@curr\@gobble% + }{% + \ion@currnum@output% + }% + }% + }% +} +\def\ion@four{\ion@currnum@pushback{\mathchar"7034}% + \ion@ifnextdigit{% + %% nothing + }{% + \ion@ifnextseparator{% + %% nothing + }{% + \ion@ifnextchar e{% + \ion@currnum@output\ion@exponent@curr\@gobble% + }{% + \ion@currnum@output% + }% + }% + }% +} +\def\ion@five{\ion@currnum@pushback{\mathchar"7035}% + \ion@ifnextdigit{% + %% nothing + }{% + \ion@ifnextseparator{% + %% nothing + }{% + \ion@ifnextchar e{% + \ion@currnum@output\ion@exponent@curr\@gobble% + }{% + \ion@currnum@output% + }% + }% + }% +} +\def\ion@six{\ion@currnum@pushback{\mathchar"7036}% + \ion@ifnextdigit{% + %% nothing + }{% + \ion@ifnextseparator{% + %% nothing + }{% + \ion@ifnextchar e{% + \ion@currnum@output\ion@exponent@curr\@gobble% + }{% + \ion@currnum@output% + }% + }% + }% +} +\def\ion@seven{\ion@currnum@pushback{\mathchar"7037}% + \ion@ifnextdigit{% + %% nothing + }{% + \ion@ifnextseparator{% + %% nothing + }{% + \ion@ifnextchar e{% + \ion@currnum@output\ion@exponent@curr\@gobble% + }{% + \ion@currnum@output% + }% + }% + }% +} +\def\ion@eight{\ion@currnum@pushback{\mathchar"7038}% + \ion@ifnextdigit{% + %% nothing + }{% + \ion@ifnextseparator{% + %% nothing + }{% + \ion@ifnextchar e{% + \ion@currnum@output\ion@exponent@curr\@gobble% + }{% + \ion@currnum@output% + }% + }% + }% +} +\def\ion@nine{\ion@currnum@pushback{\mathchar"7039}% + \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 +\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\MessageBreak% + problematic!\MessageBreak% + #2}{}}} +\AtBeginDocument{% + \ion@conflict@package{ziffer}% + \ion@problem@package{dcolumn}{Use `tabular's 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@beforedecimal\ion@beforedecimaltrue +\newif\ifion@noexplicitthousands\ion@noexplicitthousandstrue +\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@thousandths@sep{} +\newcommand{\ion@currnum@pushback}{\@ifstar{\ion@currnum@pushback@@}% + {\ion@currnum@pushback@}} +\newcommand*{\ion@currnum@pushback@@}[1]{% + \ion@addto@macro{\ion@currnum}{#1}% +} +\newcommand*{\ion@currnum@pushback@}[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}% + \fi% + %% advance thousands counter + \advance\ion@thousands@currpos by1\relax% + \ifnum\ion@thousands@currpos>3% + \ion@thousands@currpos=1% + \fi% + \else% + %% push back (empty) separator and character + \ifnum\ion@thousandths@currpos=3% + \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>3% + \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}% + \fi% + \fi% + \fi% + %% set automatic thousandths separator + \ifion@autothousandths% + \def\ion@thousandths@sep{\ion@thousandths@curr}% + \fi% + %% output number + \ifion@exponent@superscript% + ^{\ion@currnum}% + \else% + \ion@currnum% + \fi% + \endgroup% + %% reset stuff for next number + \ion@thousands@currpos=0% + \ion@thousandths@currpos=0% + \def\ion@currnum{}% + \ion@beforedecimaltrue% + \ion@noexplicitthousandstrue% + \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'. |