From bc5f7832361ad6f48e2053a7b124ffd3176446cd Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Fri, 16 Nov 2007 10:27:33 +0000 Subject: update coolstr v2.1 from CTAN git-svn-id: svn://tug.org/texlive/trunk@5435 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/coolstr/coolstr.sty | 441 ++++++++++++------------ 1 file changed, 228 insertions(+), 213 deletions(-) (limited to 'Master/texmf-dist/tex/latex/coolstr/coolstr.sty') diff --git a/Master/texmf-dist/tex/latex/coolstr/coolstr.sty b/Master/texmf-dist/tex/latex/coolstr/coolstr.sty index 6035e3567d1..da616cb64ed 100644 --- a/Master/texmf-dist/tex/latex/coolstr/coolstr.sty +++ b/Master/texmf-dist/tex/latex/coolstr/coolstr.sty @@ -40,24 +40,26 @@ \newcounter{COOL@strpointer} \def\COOL@strgobble[#1]#2#3{% \ifthenelse{\equal{#3}{\COOL@strEnd}}% -{% -\ifthenelse{\value{COOL@strpointer}=#1}% -{% -#2% -}% -{% -}% -}% -{% -\ifthenelse{\value{COOL@strpointer}=#1}% -{% -#2% -}% -{% -}% -\stepcounter{COOL@strpointer}% -\COOL@strgobble[#1]#3% -}% + {% + \ifthenelse{\value{COOL@strpointer}=#1}% + {% + #2% + }% + % Else + {% + }% + }% + {% + \ifthenelse{\value{COOL@strpointer}=#1}% + {% + #2% + }% + % Else + {% + }% + \stepcounter{COOL@strpointer}% + \COOL@strgobble[#1]#3% + }% } \newcommand{\strchar}[2]{% \setcounter{COOL@strpointer}{1}% @@ -65,23 +67,23 @@ } \newcommand{\strlen}[1]{% \ifthenelse{\equal{#1}{}}% -{% -0% -}% -{% -\strchar{#1}{0}% -\arabic{COOL@strpointer}% -}% + {% + 0% + }% + {% + \strchar{#1}{0}% + \arabic{COOL@strpointer}% + }% } \newcommand{\strlenstore}[2]{% \ifthenelse{\equal{#1}{}}% -{% -\setcounter{#2}{0}% -}% -{% -\strchar{#1}{0}% -\setcounter{#2}{\value{COOL@strpointer}}% -}% + {% + \setcounter{#2}{0}% + }% + {% + \strchar{#1}{0}% + \setcounter{#2}{\value{COOL@strpointer}}% + }% } \newcounter{COOL@str@index} \newcounter{COOL@str@start} @@ -89,153 +91,161 @@ \newcommand{\substr}[3]{% \strlenstore{#1}{COOL@strlen}% \ifthenelse{#2 < 0 \AND \NOT #2 < -\value{COOL@strlen}}% -{% -\setcounter{COOL@str@index}{\value{COOL@strlen}}% -\addtocounter{COOL@str@index}{#2}% -\addtocounter{COOL@str@index}{1}% -}% + {% + \setcounter{COOL@str@index}{\value{COOL@strlen}}% + \addtocounter{COOL@str@index}{#2}% + \addtocounter{COOL@str@index}{1}% + }% {\ifthenelse{#2 > 0 \AND \NOT #2 > \value{COOL@strlen}}% -{% -\setcounter{COOL@str@index}{#2}% -}% -{% -\setcounter{COOL@str@index}{0}% -}}% + {% + \setcounter{COOL@str@index}{#2}% + }% + {% + \setcounter{COOL@str@index}{0}% + }}% \ifthenelse{\equal{#3}{beg}}% -{% -\setcounter{COOL@str@start}{1}% -\setcounter{COOL@str@end}{\value{COOL@str@index}}% -}% + {% + \setcounter{COOL@str@start}{1}% + \setcounter{COOL@str@end}{\value{COOL@str@index}}% + }% {\ifthenelse{\equal{#3}{end}}% -{% -\setcounter{COOL@str@start}{\value{COOL@str@index}}% -\setcounter{COOL@str@end}{\value{COOL@strlen}}% -}% + {% + \setcounter{COOL@str@start}{\value{COOL@str@index}}% + \setcounter{COOL@str@end}{\value{COOL@strlen}}% + }% {\ifthenelse{#3 < 0}% -{% -\setcounter{COOL@str@start}{\value{COOL@str@index}}% -\addtocounter{COOL@str@start}{#3}% -\addtocounter{COOL@str@start}{1}% -\ifthenelse{\NOT \value{COOL@str@start} > 0}{\setcounter{COOL@str@start}{1}}{}% -\setcounter{COOL@str@end}{\value{COOL@str@index}}% -}% + {% + \setcounter{COOL@str@start}{\value{COOL@str@index}}% + \addtocounter{COOL@str@start}{#3}% + \addtocounter{COOL@str@start}{1}% + \ifthenelse{\NOT \value{COOL@str@start} > 0}{\setcounter{COOL@str@start}{1}}{}% + \setcounter{COOL@str@end}{\value{COOL@str@index}}% + }% {\ifthenelse{#3 > 0}% -{% -\setcounter{COOL@str@start}{\value{COOL@str@index}}% -\setcounter{COOL@str@end}{\value{COOL@str@index}}% -\addtocounter{COOL@str@end}{#3}% -\addtocounter{COOL@str@end}{-1}% -\ifthenelse{\value{COOL@str@end} > \value{COOL@strlen}}{\setcounter{COOL@str@end}{\value{COOL@strlen}}}{}% -}% -{% -\setcounter{COOL@str@index}{0}% -}}}}% + {% + \setcounter{COOL@str@start}{\value{COOL@str@index}}% + \setcounter{COOL@str@end}{\value{COOL@str@index}}% + \addtocounter{COOL@str@end}{#3}% + \addtocounter{COOL@str@end}{-1}% + \ifthenelse{\value{COOL@str@end} > \value{COOL@strlen}}{\setcounter{COOL@str@end}{\value{COOL@strlen}}}{}% + }% + {% + \setcounter{COOL@str@index}{0}% + }}}}% \ifthenelse{ \value{COOL@str@index} = 0 }% -{% -}% -{% -\setcounter{COOL@strpointer}{1}% -\COOL@substrgobbler#1\COOL@strStop\COOL@strEnd% -}% + {% + }% + {% + \setcounter{COOL@strpointer}{1}% + \COOL@substrgobbler#1\COOL@strStop\COOL@strEnd% + }% } \def\COOL@substrgobbler#1#2\COOL@strEnd{% \ifthenelse{\equal{#2}{\COOL@strStop}}% -{% -\ifthenelse{ \value{COOL@strpointer} < \value{COOL@str@start} \OR \value{COOL@strpointer} > \value{COOL@str@end} }% -{}% -{% -#1% -}% -}% -{% -\ifthenelse{ \value{COOL@strpointer} < \value{COOL@str@start} \OR \value{COOL@strpointer} > \value{COOL@str@end} }% -{}% -{% -#1% -}% -\stepcounter{COOL@strpointer}% -\COOL@substrgobbler#2\COOL@strEnd% -}% + {% + \ifthenelse{ \value{COOL@strpointer} < \value{COOL@str@start} \OR \value{COOL@strpointer} > \value{COOL@str@end} }% + {}% + % Else + {% + #1% + }% + }% + {% + \ifthenelse{ \value{COOL@strpointer} < \value{COOL@str@start} \OR \value{COOL@strpointer} > \value{COOL@str@end} }% + {}% + % Else + {% + #1% + }% + \stepcounter{COOL@strpointer}% + \COOL@substrgobbler#2\COOL@strEnd% + }% } \newboolean{COOL@charmatch} \def\COOL@strcomparegobble[#1]<#2>#3#4{% \ifthenelse{\equal{#4}{\COOL@strEnd}}% -{% -\ifthenelse{\value{COOL@strpointer}=#1 \AND \equal{#2}{#3} }% -{% -\setboolean{COOL@charmatch}{true}% -}% -{% -}% -}% -{% -\ifthenelse{\value{COOL@strpointer}=#1 \AND \equal{#2}{#3} }% -{% -\setboolean{COOL@charmatch}{true}% -}% -{% -}% -\stepcounter{COOL@strpointer}% -\COOL@strcomparegobble[#1]<#2>#4% -}% + {% + \ifthenelse{\value{COOL@strpointer}=#1 \AND \equal{#2}{#3} }% + {% + \setboolean{COOL@charmatch}{true}% + }% + % Else + {% + }% + }% + {% + \ifthenelse{\value{COOL@strpointer}=#1 \AND \equal{#2}{#3} }% + {% + \setboolean{COOL@charmatch}{true}% + }% + % Else + {% + }% + \stepcounter{COOL@strpointer}% + \COOL@strcomparegobble[#1]<#2>#4% + }% } \newcommand{\ifstrchareq}[5]{% \setboolean{COOL@charmatch}{false}% \setcounter{COOL@strpointer}{1}% \COOL@strcomparegobble[#2]<#3>#1\COOL@strEnd\relax% \ifthenelse{ \boolean{COOL@charmatch} }% -{% -#4% -}% -{% -#5% -}% + {% + #4% + }% + {% + #5% + }% } \newcommand{\ifstrleneq}[4]{% \strlenstore{#1}{COOL@strlen}% \ifthenelse{ \value{COOL@strlen} = #2 }% -{% -#3% -}% -{% -#4% -}% + {% + #3% + }% + {% + #4% + }% } \newboolean{COOL@decimalfound} \newboolean{COOL@decimal} \def\COOL@decimalgobbler#1#2\COOL@strEnd{% \ifthenelse{\equal{#2}{\COOL@strStop}}% -{% -\ifthenelse{`#1 < `0 \OR `#1 > `9}% -{% -\ifthenelse{ `#1 = `. \AND \NOT \value{COOL@strpointer} = 1 \AND \NOT \boolean{COOL@decimalfound} }% -{% -}% -{% -\setboolean{COOL@decimal}{false}% -}% -}% -{% -}% -}% -{% -\ifthenelse{ `#1 < `0 \OR `#1 > `9 }% -{% -\ifthenelse{ `#1 = `. \AND \NOT \boolean{COOL@decimalfound} }% -{% -\setboolean{COOL@decimalfound}{true}% -}% -{\ifthenelse{ \(`#1 = `+ \OR `#1 = `-\) \AND \value{COOL@strpointer} = 1 }% -{% -}% -{% -\setboolean{COOL@decimal}{false}% -}}% -}% -{}% -\stepcounter{COOL@strpointer}% -\COOL@decimalgobbler#2\COOL@strEnd% -}% + {% + \ifthenelse{`#1 < `0 \OR `#1 > `9}% + {% + \ifthenelse{ `#1 = `. \AND \NOT \value{COOL@strpointer} = 1 \AND \NOT \boolean{COOL@decimalfound} }% + {% + }% + % Else + {% + \setboolean{COOL@decimal}{false}% + }% + }% + % Else + {% + }% + }% + {% + \ifthenelse{ `#1 < `0 \OR `#1 > `9 }% + {% + \ifthenelse{ `#1 = `. \AND \NOT \boolean{COOL@decimalfound} }% + {% + \setboolean{COOL@decimalfound}{true}% + }% + {\ifthenelse{ \(`#1 = `+ \OR `#1 = `-\) \AND \value{COOL@strpointer} = 1 }% + {% + }% + % Else + {% + \setboolean{COOL@decimal}{false}% + }}% + }% + % Else + {}% + \stepcounter{COOL@strpointer}% + \COOL@decimalgobbler#2\COOL@strEnd% + }% } \newcommand{\isdecimal}[2]{% \setcounter{COOL@strpointer}{1}% @@ -243,12 +253,12 @@ \setboolean{COOL@decimal}{true}% \expandafter\COOL@decimalgobbler#1\COOL@strStop\COOL@strEnd% \ifthenelse{ \boolean{COOL@decimal} }% -{% -\setboolean{#2}{true}% -}% -{% -\setboolean{#2}{false}% -}% + {% + \setboolean{#2}{true}% + }% + {% + \setboolean{#2}{false}% + }% }% \newboolean{COOL@numeric}% \def\COOL@eparser#1e#2\COOL@strEnd{% @@ -268,76 +278,81 @@ \newcommand{\isnumeric}[2]{% \COOL@eparser#1e\COOL@strStop\COOL@strEnd% \ifthenelse{ \equal{\COOL@num@exponent}{\COOL@strStop} }% -{% -\COOL@Eparser#1E\COOL@strStop\COOL@strEnd% -\ifthenelse{ \equal{\COOL@num@exponent}{\COOL@strStop} }% -{% -\gdef\COOL@num@exponent{0}% -}% -{% -\expandafter\COOL@Ecorrector\COOL@num@exponent% -}% -} -{% -\expandafter\COOL@ecorrector\COOL@num@exponent% -}% + {% + \COOL@Eparser#1E\COOL@strStop\COOL@strEnd% + \ifthenelse{ \equal{\COOL@num@exponent}{\COOL@strStop} }% + {% + \gdef\COOL@num@exponent{0}% + }% + % Else + {% + \expandafter\COOL@Ecorrector\COOL@num@exponent% + }% + } + {% + \expandafter\COOL@ecorrector\COOL@num@exponent% + }% \isdecimal{\COOL@num@magnitude}{COOL@numeric}% \ifthenelse{ \boolean{COOL@numeric} }% -{% -\isdecimal{\COOL@num@exponent}{COOL@numeric}% -\ifthenelse{ \boolean{COOL@numeric} }% -{% -\setboolean{#2}{true}% -}% -{% -\setboolean{#2}{false}% -}% -}% -{% -\setboolean{#2}{false}% -}% + {% + \isdecimal{\COOL@num@exponent}{COOL@numeric}% + \ifthenelse{ \boolean{COOL@numeric} }% + {% + \setboolean{#2}{true}% + }% + % Else + {% + \setboolean{#2}{false}% + }% + }% + {% + \setboolean{#2}{false}% + }% } \newboolean{COOL@isint} \def\COOL@intgobbler#1#2\COOL@strEnd{% \ifcat#11% \ifthenelse{\equal{#2}{\COOL@strStop}}% -{% -\ifthenelse{`#1 < `0 \OR `#1 > `9}% -{% -\setboolean{COOL@isint}{false}% -}% -{% -}% -}% -{% -\ifthenelse{ `#1 < `0 \OR `#1 > `9 }% -{% -\ifthenelse{ `#1 = `+ \OR `#1 = `- \AND \value{COOL@strpointer} = 1 }% -{}% -{% -\setboolean{COOL@isint}{false}% -}% -}% -{% -}% -\stepcounter{COOL@strpointer}% -\COOL@intgobbler#2\COOL@strEnd% -}% + {% + \ifthenelse{`#1 < `0 \OR `#1 > `9}% + {% + \setboolean{COOL@isint}{false}% + }% + % Else + {% + }% + }% + {% + \ifthenelse{ `#1 < `0 \OR `#1 > `9 }% + {% + \ifthenelse{ `#1 = `+ \OR `#1 = `- \AND \value{COOL@strpointer} = 1 }% + {}% + % Else + {% + \setboolean{COOL@isint}{false}% + }% + }% + % Else + {% + }% + \stepcounter{COOL@strpointer}% + \COOL@intgobbler#2\COOL@strEnd% + }% \else% -\setboolean{COOL@isint}{false}% + \setboolean{COOL@isint}{false}% \fi% } \newcommand{\isint}[2]{% \setcounter{COOL@strpointer}{1}% \setboolean{COOL@isint}{true}% -\COOL@intgobbler#1\COOL@strStop\COOL@strEnd% +\expandafter\COOL@intgobbler#1\COOL@strStop\COOL@strEnd% \ifthenelse{ \boolean{COOL@isint} }% -{% -\setboolean{#2}{true}% -}% -{% -\setboolean{#2}{false}% -}% + {% + \setboolean{#2}{true}% + }% + {% + \setboolean{#2}{false}% + }% } \endinput %% -- cgit v1.2.3