diff options
author | Norbert Preining <preining@logic.at> | 2007-11-16 10:54:55 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2007-11-16 10:54:55 +0000 |
commit | 26a5e20d6d379e77f021e478b3934f5bc99a2cdd (patch) | |
tree | 78c04c14d2c88d9eaaf2cc31eaf290ee4d228461 /Master/texmf-dist/tex/latex/coollist | |
parent | 9acb11771e83a042aa9f732555d94343c4759010 (diff) |
update coollist v1.2 from ctan
git-svn-id: svn://tug.org/texlive/trunk@5448 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/coollist')
-rw-r--r-- | Master/texmf-dist/tex/latex/coollist/coollist.sty | 168 |
1 files changed, 131 insertions, 37 deletions
diff --git a/Master/texmf-dist/tex/latex/coollist/coollist.sty b/Master/texmf-dist/tex/latex/coollist/coollist.sty index 05c1c43914a..b5bc871e77f 100644 --- a/Master/texmf-dist/tex/latex/coollist/coollist.sty +++ b/Master/texmf-dist/tex/latex/coollist/coollist.sty @@ -13,10 +13,12 @@ %% \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesPackage{coollist} - [2007/10/06 v1.1 COntent Oriented LaTeX Lists] + [2007/10/06 v1.2 COntent Oriented LaTeX Lists] \RequirePackage{ifthen} \RequirePackage{amsmath} \RequirePackage{amssymb} +\RequirePackage{coolstr} +\RequirePackage{forloop} %% \CharacterTable %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z @@ -32,6 +34,7 @@ %% Right bracket \] Circumflex \^ Underscore \_ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newcounter{COOL@listlen}% \newcommand{\COOL@listEnd}{@@@}% \newcommand{\COOL@listStop}{@@}% @@ -41,48 +44,50 @@ \newboolean{COOL@found}% \def\COOL@listgobble[#1]#2,#3,\COOL@listEnd{% \ifthenelse{\equal{#3}{\COOL@listStop}}% -{% -\ifthenelse{\value{COOL@listpointer}=#1}% -{% -\setboolean{COOL@found}{true}% -#2% -}% -{% -}% -}% -{% -\ifthenelse{\value{COOL@listpointer}=#1}% -{% -\setboolean{COOL@found}{true}% -#2% -}% -{% -}% -\stepcounter{COOL@listpointer}% -\COOL@listgobble[#1]#3,\COOL@listEnd% -}% + {% + \ifthenelse{\value{COOL@listpointer}=#1}% + {% + \setboolean{COOL@found}{true}% + #2% + }% + % Else + {% + }% + }% + {% + \ifthenelse{\value{COOL@listpointer}=#1}% + {% + \setboolean{COOL@found}{true}% + #2% + }% + % Else + {% + }% + \stepcounter{COOL@listpointer}% + \COOL@listgobble[#1]#3,\COOL@listEnd% + }% }% \newcommand{\listval}[2]{% \ifthenelse{\equal{#1}{}}% -{% -\setcounter{COOL@listpointer}{0}% -}% -{% -\setcounter{COOL@listpointer}{1}% -\setboolean{COOL@found}{false}% -\COOL@listgobble[#2]#1,\COOL@listStop,\COOL@listEnd% -}% + {% + \setcounter{COOL@listpointer}{0}% + }% + {% + \setcounter{COOL@listpointer}{1}% + \setboolean{COOL@found}{false}% + \COOL@listgobble[#2]#1,\COOL@listStop,\COOL@listEnd% + }% }% \def\COOL@liststore@gobbler[#1]#2,#3,\COOL@listEnd{% \ifthenelse{\equal{#3}{\COOL@listStop}}% -{% -\expandafter\gdef\csname #1\roman{COOL@listpointer}\endcsname{#2}% -}% -{% -\expandafter\gdef\csname #1\roman{COOL@listpointer}\endcsname{#2}% -\stepcounter{COOL@listpointer}% -\COOL@liststore@gobbler[#1]#3,\COOL@listEnd% -}% + {% + \expandafter\gdef\csname #1\roman{COOL@listpointer}\endcsname{#2}% + }% + {% + \expandafter\gdef\csname #1\roman{COOL@listpointer}\endcsname{#2}% + \stepcounter{COOL@listpointer}% + \COOL@liststore@gobbler[#1]#3,\COOL@listEnd% + }% } \newcommand{\liststore}[2]{% \setcounter{COOL@listpointer}{1}% @@ -96,6 +101,95 @@ \listval{#2}{0}% \setcounter{#1}{\value{COOL@listpointer}} }%listlength +\newcounter{COOL@intsum} +\newcounter{COOL@register@ct} +\newcounter{COOL@register@len} +\newboolean{COOL@listsum@isint} +\newcommand{\listsum}[2]{% +\liststore{#1}{COOL@listtosum@element@}% +\listlenstore{COOL@listlen}{#1}% +\ifthenelse{ \value{COOL@listlen} < 1 }% + {% + \PackageWarning{cool}{List is empty}% + \xdef#2{0}% + }% + {% + \isint{\COOL@listtosum@element@i}{COOL@listsum@isint}% + \ifthenelse{ \boolean{COOL@listsum@isint} }% + {% + \xdef\COOL@listsum@register@integers{\COOL@listtosum@element@i}% + \setcounter{COOL@register@len}{0}% + }% + {% + \gdef\COOL@listsum@register@integers{0}% + \xdef\COOL@listsum@register@i{\COOL@listtosum@element@i}% + \gdef\COOL@listsum@register@coef@i{1}% + \setcounter{COOL@register@len}{1}% + }% + \forloop{COOL@listpointer}{2}{\NOT \value{COOL@listpointer} > \value{COOL@listlen}}% + {% + \xdef\COOL@listsum@element{\csname COOL@listtosum@element@\roman{COOL@listpointer}\endcsname}% + \isint{\COOL@listsum@element}{COOL@listsum@isint}% + \ifthenelse{ \boolean{COOL@listsum@isint} }% + {% + \setcounter{COOL@intsum}{\COOL@listsum@register@integers}% + \addtocounter{COOL@intsum}{\COOL@listsum@element}% + \xdef\COOL@listsum@register@integers{\arabic{COOL@intsum}}% + }% + {% + \setboolean{COOL@found}{false}% + \forloop{COOL@register@ct}{1}{\NOT \value{COOL@register@ct} > \value{COOL@register@len}}% + {% + \xdef\COOL@listsum@known@element{% + \csname COOL@listsum@register@\roman{COOL@register@ct}\endcsname% + }% + \ifthenelse{ \equal{\COOL@listsum@element}{\COOL@listsum@known@element} }% + {% + \xdef\COOL@listsum@known@element@coef{% + \csname COOL@listsum@register@coef@\roman{COOL@register@ct}\endcsname% + }% + \setcounter{COOL@intsum}{\COOL@listsum@known@element@coef}% + \addtocounter{COOL@intsum}{1}% + \expandafter\xdef\csname COOL@listsum@register@coef@\roman{COOL@register@ct}\endcsname{\arabic{COOL@intsum}}% + \setboolean{COOL@found}{true}% + }% + {% + }% + }% + \ifthenelse{ \boolean{COOL@found} }% + {}% + {% + \addtocounter{COOL@register@len}{1}% + \expandafter\xdef\csname COOL@listsum@register@\roman{COOL@register@len}\endcsname{\COOL@listsum@element}% + \expandafter\xdef\csname COOL@listsum@register@coef@\roman{COOL@register@len}\endcsname{1}% + }% + }% + }% + \xdef\COOL@listsum@result{}% + \ifthenelse{ \NOT \COOL@listsum@register@integers = 0 }% + { + \xdef\COOL@listsum@result{\COOL@listsum@result\COOL@listsum@register@integers}% + \ifthenelse{ \NOT \value{COOL@register@len} = 0 }% + {% + \xdef\COOL@listsum@result{\COOL@listsum@result+}% + }{}% + }{}% + \forloop{COOL@register@ct}{1}{ \NOT \value{COOL@register@ct} > \value{COOL@register@len} }% + {% + \edef\COOL@listsum@curcoef{\csname COOL@listsum@register@coef@\roman{COOL@register@ct}\endcsname}% + \ifthenelse{ \NOT \COOL@listsum@curcoef = 1}% + {% + \xdef\COOL@listsum@result{\COOL@listsum@result\COOL@listsum@curcoef}% + }{}% + \xdef\COOL@listsum@result{\COOL@listsum@result\csname COOL@listsum@register@\roman{COOL@register@ct}\endcsname}% + \ifthenelse{ \NOT \value{COOL@register@ct} = \value{COOL@register@len} }% + {% + \xdef\COOL@listsum@result{\COOL@listsum@result+}% + }{}% + }% + \xdef#2{\COOL@listsum@result}% + }% +} \endinput %% %% End of file `coollist.sty'. |