summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/coolstr/coolstr.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2009-09-09 23:56:06 +0000
committerKarl Berry <karl@freefriends.org>2009-09-09 23:56:06 +0000
commitfefc491847fa3f36a998b5ce431c863560d4a0a6 (patch)
tree9b4fd278017def01e69e5c4193031dea35f691b5 /Master/texmf-dist/tex/latex/coolstr/coolstr.sty
parent9dbc25b4e44ce350c7bc495e01ef15fdc48d513a (diff)
coolstr update (9sep09)
git-svn-id: svn://tug.org/texlive/trunk@15195 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/coolstr/coolstr.sty')
-rw-r--r--Master/texmf-dist/tex/latex/coolstr/coolstr.sty462
1 files changed, 233 insertions, 229 deletions
diff --git a/Master/texmf-dist/tex/latex/coolstr/coolstr.sty b/Master/texmf-dist/tex/latex/coolstr/coolstr.sty
index da616cb64ed..88f5a297219 100644
--- a/Master/texmf-dist/tex/latex/coolstr/coolstr.sty
+++ b/Master/texmf-dist/tex/latex/coolstr/coolstr.sty
@@ -13,7 +13,7 @@
%%
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{coolstr}
- [2007/01/08 v2.1 COntent Oriented LaTeX Strings]
+ [2009/09/09 v2.2 COntent Oriented LaTeX Strings]
\RequirePackage{ifthen}
\RequirePackage{amsmath}
\RequirePackage{amssymb}
@@ -40,26 +40,26 @@
\newcounter{COOL@strpointer}
\def\COOL@strgobble[#1]#2#3{%
\ifthenelse{\equal{#3}{\COOL@strEnd}}%
- {%
- \ifthenelse{\value{COOL@strpointer}=#1}%
- {%
- #2%
- }%
- % Else
- {%
- }%
- }%
- {%
- \ifthenelse{\value{COOL@strpointer}=#1}%
- {%
- #2%
- }%
- % Else
- {%
- }%
- \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}%
@@ -67,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}
@@ -91,161 +91,165 @@
\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} }%
- {}%
- % 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%
- }%
+ {%
+ \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}%
- }%
- % Else
- {%
- }%
- }%
- {%
- \ifthenelse{\value{COOL@strpointer}=#1 \AND \equal{#2}{#3} }%
- {%
- \setboolean{COOL@charmatch}{true}%
- }%
- % Else
- {%
- }%
- \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} }%
- {%
- }%
- % 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%
- }%
+\ifthenelse{\equal{#1}{\COOL@strStop}}%
+ {%
+ \setboolean{COOL@decimal}{false}%
+ }%
+{\ifthenelse{\equal{#2}{\COOL@strStop}}%
+ {%
+ \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}%
@@ -253,12 +257,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{%
@@ -278,68 +282,68 @@
\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}%
- }%
- % Else
- {%
- \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}%
- }%
- % Else
- {%
- \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}%
- }%
- % 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%
- }%
+ {%
+ \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]{%
@@ -347,12 +351,12 @@
\setboolean{COOL@isint}{true}%
\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
%%