summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/coolstr
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/source/latex/coolstr
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/source/latex/coolstr')
-rw-r--r--Master/texmf-dist/source/latex/coolstr/coolstr.dtx590
1 files changed, 308 insertions, 282 deletions
diff --git a/Master/texmf-dist/source/latex/coolstr/coolstr.dtx b/Master/texmf-dist/source/latex/coolstr/coolstr.dtx
index 72b335c35fa..7014f0d7f52 100644
--- a/Master/texmf-dist/source/latex/coolstr/coolstr.dtx
+++ b/Master/texmf-dist/source/latex/coolstr/coolstr.dtx
@@ -2,7 +2,7 @@
%
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<package>\ProvidesPackage{coolstr}
-%<package> [2007/01/08 v2.1 COntent Oriented LaTeX Strings]
+%<package> [2009/09/09 v2.2 COntent Oriented LaTeX Strings]
%<package>\RequirePackage{ifthen}
%<package>\RequirePackage{amsmath}
%<package>\RequirePackage{amssymb}
@@ -23,7 +23,7 @@
% \fi
%
%
-% \CheckSum{310}
+% \CheckSum{314}
%
%
%% \CharacterTable
@@ -138,15 +138,15 @@
%
% \begin{tabular}{ll}
% \hline
-% |\substr{12345}{1}{2}| & \substr{12345}{1}{2} \\
-% |\substr{12345}{3}{5}| & \substr{12345}{3}{5} \\
-% |\substr{12345}{3}{end}| & \substr{12345}{3}{end} \\
-% |\substr{12345}{3}{beg}| & \substr{12345}{3}{beg} \\
-% |\substr{12345}{-2}{1}| & \substr{12345}{-2}{1} \\
-% |\substr{12345}{3}{-2}| & \substr{12345}{3}{-2} \\
-% |\substr{12345}{-2}{-2}| & \substr{12345}{-2}{-2} \\
-% |\substr{12345}{0}{5}| & \substr{12345}{0}{5} (the null string) \\
-% |\substr{12345}{2}{0}| & \substr{12345}{2}{0} (the null string) \\
+% |\substr{12345}{1}{2}| & \substr{12345}{1}{2} \\
+% |\substr{12345}{3}{5}| & \substr{12345}{3}{5} \\
+% |\substr{12345}{3}{end}| & \substr{12345}{3}{end} \\
+% |\substr{12345}{3}{beg}| & \substr{12345}{3}{beg} \\
+% |\substr{12345}{-2}{1}| & \substr{12345}{-2}{1} \\
+% |\substr{12345}{3}{-2}| & \substr{12345}{3}{-2} \\
+% |\substr{12345}{-2}{-2}| & \substr{12345}{-2}{-2} \\
+% |\substr{12345}{0}{5}| & \substr{12345}{0}{5} (the null string) \\
+% |\substr{12345}{2}{0}| & \substr{12345}{2}{0} (the null string) \\
% \hline
% \end{tabular}
%
@@ -161,20 +161,24 @@
%
%
% \begin{tabular}{ll}
-% |2.345| & \isdecimal{2.345}{t} \ifthenelse{ \boolean{t} }{is decimal}{not a decimal} \\
-% |2.4.5| & \isdecimal{2.4.5}{t} \ifthenelse{ \boolean{t} }{is decimal}{not a decimal} \\
-% |+-2.45| & \isdecimal{+-2.45}{t} \ifthenelse{ \boolean{t} }{is decimal}{not a decimal} \\
-% |+2.345| & \isdecimal{+2.345}{t} \ifthenelse{ \boolean{t} }{is decimal}{not a decimal} \\
-% |-2.345| & \isdecimal{-2.345}{t} \ifthenelse{ \boolean{t} }{is decimal}{not a decimal} \\
-% |2.345-| & \isdecimal{2.345-}{t} \ifthenelse{ \boolean{t} }{is decimal}{not a decimal} \\
-% |2.4+4.| & \isdecimal{2.4+4.5}{t} \ifthenelse{ \boolean{t} }{is decimal}{not a decimal} \\
-% |+4.| & \isdecimal{+4.}{t} \ifthenelse{ \boolean{t} }{is decimal}{not a decimal} \\
-% |4.| & \isdecimal{4.}{t} \ifthenelse{ \boolean{t} }{is decimal}{not a decimal} \\
-% |+.7| & \isdecimal{+.7}{t} \ifthenelse{ \boolean{t} }{is decimal}{not a decimal} \\
-% |.3| & \isdecimal{.3}{t} \ifthenelse{ \boolean{t} }{is decimal}{not a decimal} \\
-% |4| & \isdecimal{4}{t} \ifthenelse{ \boolean{t} }{is decimal}{not a decimal} \\
-% & |\newcommand{\numberstore}{4.5}| \\
-% |\numberstore| & \newcommand{\numberstore}{4.5} \isdecimal{\numberstore}{t} \ifthenelse{ \boolean{t} }{is decimal}{not a decimal}
+% (null str) & \isdecimal{}{t} \ifthenelse{ \boolean{t} }{is decimal}{not a decimal} \\
+% \textvisiblespace & \isdecimal{ }{t} \ifthenelse{ \boolean{t} }{is decimal}{not a decimal} \\
+% \textvisiblespace\textvisiblespace
+% & \isdecimal{ }{t} \ifthenelse{ \boolean{t} }{is decimal}{not a decimal} \\
+% |2.345| & \isdecimal{2.345}{t} \ifthenelse{ \boolean{t} }{is decimal}{not a decimal} \\
+% |2.4.5| & \isdecimal{2.4.5}{t} \ifthenelse{ \boolean{t} }{is decimal}{not a decimal} \\
+% |+-2.45| & \isdecimal{+-2.45}{t} \ifthenelse{ \boolean{t} }{is decimal}{not a decimal} \\
+% |+2.345| & \isdecimal{+2.345}{t} \ifthenelse{ \boolean{t} }{is decimal}{not a decimal} \\
+% |-2.345| & \isdecimal{-2.345}{t} \ifthenelse{ \boolean{t} }{is decimal}{not a decimal} \\
+% |2.345-| & \isdecimal{2.345-}{t} \ifthenelse{ \boolean{t} }{is decimal}{not a decimal} \\
+% |2.4+4.| & \isdecimal{2.4+4.5}{t} \ifthenelse{ \boolean{t} }{is decimal}{not a decimal} \\
+% |+4.| & \isdecimal{+4.}{t} \ifthenelse{ \boolean{t} }{is decimal}{not a decimal} \\
+% |4.| & \isdecimal{4.}{t} \ifthenelse{ \boolean{t} }{is decimal}{not a decimal} \\
+% |+.7| & \isdecimal{+.7}{t} \ifthenelse{ \boolean{t} }{is decimal}{not a decimal} \\
+% |.3| & \isdecimal{.3}{t} \ifthenelse{ \boolean{t} }{is decimal}{not a decimal} \\
+% |4| & \isdecimal{4}{t} \ifthenelse{ \boolean{t} }{is decimal}{not a decimal} \\
+% & |\newcommand{\numberstore}{4.5}| \\
+% |\numberstore| & \newcommand{\numberstore}{4.5} \isdecimal{\numberstore}{t} \ifthenelse{ \boolean{t} }{is decimal}{not a decimal}
% \end{tabular}
%
%
@@ -187,18 +191,22 @@
%
%
% \begin{tabular}{ll}
-% |4.5| & \isnumeric{4.5}{t} \ifthenelse{ \boolean{t} }{is numeric}{not numeric} \\
-% |4.5e5| & \isnumeric{4.5e5}{t} \ifthenelse{ \boolean{t} }{is numeric}{not numeric} \\
-% |+4.5e5| & \isnumeric{+4.5e5}{t} \ifthenelse{ \boolean{t} }{is numeric}{not numeric} \\
-% |4.5e+5| & \isnumeric{4.5e+5}{t} \ifthenelse{ \boolean{t} }{is numeric}{not numeric} \\
-% |+4.5e+5| & \isnumeric{+4.5e+5}{t} \ifthenelse{ \boolean{t} }{is numeric}{not numeric} \\
-% |4.5E5| & \isnumeric{4.5E5}{t} \ifthenelse{ \boolean{t} }{is numeric}{not numeric} \\
-% |-4.5E5| & \isnumeric{-4.5E5}{t} \ifthenelse{ \boolean{t} }{is numeric}{not numeric} \\
-% |4.5E-5| & \isnumeric{4.5E-5}{t} \ifthenelse{ \boolean{t} }{is numeric}{not numeric} \\
-% |-4.5E-5| & \isnumeric{-4.5E-5}{t} \ifthenelse{ \boolean{t} }{is numeric}{not numeric} \\
-% |4.5.E-5| & \isnumeric{4.5.E-5}{t} \ifthenelse{ \boolean{t} }{is numeric}{not numeric} \\
-% |abcdefg| & \isnumeric{abcdefg}{t} \ifthenelse{ \boolean{t} }{is numeric}{not numeric} \\
-% |abcE-5| & \isnumeric{abcE-5}{t} \ifthenelse{ \boolean{t} }{is numeric}{not numeric}
+% (null str) & \isnumeric{}{t} \ifthenelse{ \boolean{t} }{is numeric}{not numeric} \\
+% \textvisiblespace & \isnumeric{ }{t} \ifthenelse{ \boolean{t} }{is numeric}{not numeric} \\
+% \textvisiblespace\textvisiblespace
+% & \isnumeric{ }{t} \ifthenelse{ \boolean{t} }{is numeric}{not numeric} \\
+% |4.5| & \isnumeric{4.5}{t} \ifthenelse{ \boolean{t} }{is numeric}{not numeric} \\
+% |4.5e5| & \isnumeric{4.5e5}{t} \ifthenelse{ \boolean{t} }{is numeric}{not numeric} \\
+% |+4.5e5| & \isnumeric{+4.5e5}{t} \ifthenelse{ \boolean{t} }{is numeric}{not numeric} \\
+% |4.5e+5| & \isnumeric{4.5e+5}{t} \ifthenelse{ \boolean{t} }{is numeric}{not numeric} \\
+% |+4.5e+5| & \isnumeric{+4.5e+5}{t} \ifthenelse{ \boolean{t} }{is numeric}{not numeric} \\
+% |4.5E5| & \isnumeric{4.5E5}{t} \ifthenelse{ \boolean{t} }{is numeric}{not numeric} \\
+% |-4.5E5| & \isnumeric{-4.5E5}{t} \ifthenelse{ \boolean{t} }{is numeric}{not numeric} \\
+% |4.5E-5| & \isnumeric{4.5E-5}{t} \ifthenelse{ \boolean{t} }{is numeric}{not numeric} \\
+% |-4.5E-5| & \isnumeric{-4.5E-5}{t} \ifthenelse{ \boolean{t} }{is numeric}{not numeric} \\
+% |4.5.E-5| & \isnumeric{4.5.E-5}{t} \ifthenelse{ \boolean{t} }{is numeric}{not numeric} \\
+% |abcdefg| & \isnumeric{abcdefg}{t} \ifthenelse{ \boolean{t} }{is numeric}{not numeric} \\
+% |abcE-5| & \isnumeric{abcE-5}{t} \ifthenelse{ \boolean{t} }{is numeric}{not numeric}
% \end{tabular}
%
%
@@ -211,22 +219,26 @@
%
%
% \begin{tabular}{ll}
-% |4| & \isint{4}{t} \ifthenelse{ \boolean{t} }{is integer}{not integer} \\
-% |+4| & \isint{+4}{t} \ifthenelse{ \boolean{t} }{is integer}{not integer} \\
-% |4.5| & \isint{4.5}{t} \ifthenelse{ \boolean{t} }{is integer}{not integer} \\
-% |4.5e5| & \isint{4.5e5}{t} \ifthenelse{ \boolean{t} }{is integer}{not integer} \\
-% |+4.5e5| & \isint{+4.5e5}{t} \ifthenelse{ \boolean{t} }{is integer}{not integer} \\
-% |4.5e+5| & \isint{4.5e+5}{t} \ifthenelse{ \boolean{t} }{is integer}{not integer} \\
-% |+4.5e+5| & \isint{+4.5e+5}{t} \ifthenelse{ \boolean{t} }{is integer}{not integer} \\
-% |4.5E5| & \isint{4.5E5}{t} \ifthenelse{ \boolean{t} }{is integer}{not integer} \\
-% |-4.5E5| & \isint{-4.5E5}{t} \ifthenelse{ \boolean{t} }{is integer}{not integer} \\
-% |4.5E-5| & \isint{4.5E-5}{t} \ifthenelse{ \boolean{t} }{is integer}{not integer} \\
-% |-4.5E-5| & \isint{-4.5E-5}{t} \ifthenelse{ \boolean{t} }{is integer}{not integer} \\
-% |4.5.E-5| & \isint{4.5.E-5}{t} \ifthenelse{ \boolean{t} }{is integer}{not integer} \\
-% |abcdefg| & \isint{abcdefg}{t} \ifthenelse{ \boolean{t} }{is integer}{not integer} \\
-% |abcE-5| & \isint{abcE-5}{t} \ifthenelse{ \boolean{t} }{is integer}{not integer} \\
-% & |\renewcommand{\numberstore}{4}| \\
-% |\numberstore| & \newcommand{\numberstore}{4} \isint{\numberstore}{t} \ifthenelse{ \boolean{t} }{is integer}{not integer}
+% (null str) & \isint{}{t} \ifthenelse{ \boolean{t} }{is integer}{not integer} \\
+% \textvisiblespace & \isint{ }{t} \ifthenelse{ \boolean{t} }{is integer}{not integer} \\
+% \textvisiblespace\textvisiblespace
+% & \isint{ }{t} \ifthenelse{ \boolean{t} }{is integer}{not integer} \\
+% |4| & \isint{4}{t} \ifthenelse{ \boolean{t} }{is integer}{not integer} \\
+% |+4| & \isint{+4}{t} \ifthenelse{ \boolean{t} }{is integer}{not integer} \\
+% |4.5| & \isint{4.5}{t} \ifthenelse{ \boolean{t} }{is integer}{not integer} \\
+% |4.5e5| & \isint{4.5e5}{t} \ifthenelse{ \boolean{t} }{is integer}{not integer} \\
+% |+4.5e5| & \isint{+4.5e5}{t} \ifthenelse{ \boolean{t} }{is integer}{not integer} \\
+% |4.5e+5| & \isint{4.5e+5}{t} \ifthenelse{ \boolean{t} }{is integer}{not integer} \\
+% |+4.5e+5| & \isint{+4.5e+5}{t} \ifthenelse{ \boolean{t} }{is integer}{not integer} \\
+% |4.5E5| & \isint{4.5E5}{t} \ifthenelse{ \boolean{t} }{is integer}{not integer} \\
+% |-4.5E5| & \isint{-4.5E5}{t} \ifthenelse{ \boolean{t} }{is integer}{not integer} \\
+% |4.5E-5| & \isint{4.5E-5}{t} \ifthenelse{ \boolean{t} }{is integer}{not integer} \\
+% |-4.5E-5| & \isint{-4.5E-5}{t} \ifthenelse{ \boolean{t} }{is integer}{not integer} \\
+% |4.5.E-5| & \isint{4.5.E-5}{t} \ifthenelse{ \boolean{t} }{is integer}{not integer} \\
+% |abcdefg| & \isint{abcdefg}{t} \ifthenelse{ \boolean{t} }{is integer}{not integer} \\
+% |abcE-5| & \isint{abcE-5}{t} \ifthenelse{ \boolean{t} }{is integer}{not integer} \\
+% & |\renewcommand{\numberstore}{4}| \\
+% |\numberstore| & \newcommand{\numberstore}{4} \isint{\numberstore}{t} \ifthenelse{ \boolean{t} }{is integer}{not integer}
% \end{tabular}
%
%
@@ -237,7 +249,11 @@
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% Thanks to J.~J.~Weimer for the comments and aid in coding. Also thanks goes to Abraham Weishaus for pointing out a bug in |\strlenstore|
+% Thanks to J.~J.~Weimer for the comments and aid in coding.
+%
+% \noindent Thanks goes to Abraham Weishaus for pointing out a bug in |\strlenstore|
+%
+% \noindent Thanks to Daniel Kucerovsky for pointing the `blank-space' bug of |\isnumeric| (and consequently |\isdecimal|).
%
%
% \begin{landscape}
@@ -290,27 +306,27 @@
% \begin{macrocode}
\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
+ {%
+ }%
+ }%
% Else
- {%
- \ifthenelse{\value{COOL@strpointer}=#1}%
- {%
- #2%
- }%
- % Else
- {%
- }%
- \stepcounter{COOL@strpointer}%
- \COOL@strgobble[#1]#3%
- }%
+ {%
+ \ifthenelse{\value{COOL@strpointer}=#1}%
+ {%
+ #2%
+ }%
+ % Else
+ {%
+ }%
+ \stepcounter{COOL@strpointer}%
+ \COOL@strgobble[#1]#3%
+ }%
}
% \end{macrocode}
%
@@ -337,14 +353,14 @@
% \begin{macrocode}
\newcommand{\strlen}[1]{%
\ifthenelse{\equal{#1}{}}%
- {%
- 0%
- }%
+ {%
+ 0%
+ }%
% Else
- {%
- \strchar{#1}{0}%
- \arabic{COOL@strpointer}%
- }%
+ {%
+ \strchar{#1}{0}%
+ \arabic{COOL@strpointer}%
+ }%
}
% \end{macrocode}
%
@@ -360,14 +376,14 @@
% \begin{macrocode}
\newcommand{\strlenstore}[2]{%
\ifthenelse{\equal{#1}{}}%
- {%
- \setcounter{#2}{0}%
- }%
+ {%
+ \setcounter{#2}{0}%
+ }%
% Else
- {%
- \strchar{#1}{0}%
- \setcounter{#2}{\value{COOL@strpointer}}%
- }%
+ {%
+ \strchar{#1}{0}%
+ \setcounter{#2}{\value{COOL@strpointer}}%
+ }%
}
% \end{macrocode}
%
@@ -389,107 +405,107 @@
\newcommand{\substr}[3]{%
\strlenstore{#1}{COOL@strlen}%
\ifthenelse{#2 < 0 \AND \NOT #2 < -\value{COOL@strlen}}%
- {%
+ {%
% \end{macrocode}
% The starting index is less than zero, so start that many characters back from the end. This means mapping the index to \meta{index}${} + {}$\meta{string length}${} + 1$
% \begin{macrocode}
- \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}%
+ }%
% ElseIf
{\ifthenelse{#2 > 0 \AND \NOT #2 > \value{COOL@strlen}}%
- {%
+ {%
% \end{macrocode}
% The starting index is greater than zero, and within the appropriate range; record it
% \begin{macrocode}
- \setcounter{COOL@str@index}{#2}%
- }%
+ \setcounter{COOL@str@index}{#2}%
+ }%
% Else
- {%
+ {%
% \end{macroccode}
% The \meta{index} value is invalid. Set it to zero for returning the null string
% \begin{macrocode}
- \setcounter{COOL@str@index}{0}%
- }}%
+ \setcounter{COOL@str@index}{0}%
+ }}%
% \end{macrocode}
% Now deal with the \meta{numchar} (which can also be negative)
% \begin{macrocode}
\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}}%
+ }%
% ElseIf
{\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}}%
+ }%
% ElseIf
{\ifthenelse{#3 < 0}%
- {%
+ {%
% \end{macrocode}
% This means to take that many characters to the \emph{left} of the starting index.
% \begin{macrocode}
- \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}}%
+ }%
% ElseIf
{\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@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}}}{}%
+ }%
% Else
- {%
+ {%
% \end{macrocode}
% nonsense submitted, so return the null string
% \begin{macrocode}
- \setcounter{COOL@str@index}{0}%
- }}}}%
+ \setcounter{COOL@str@index}{0}%
+ }}}}%
% \end{macrocode}
% Now send back the appropriate thing
% \begin{macrocode}
\ifthenelse{ \value{COOL@str@index} = 0 }%
- {%
- }%
+ {%
+ }%
% Else
- {%
- \setcounter{COOL@strpointer}{1}%
- \COOL@substrgobbler#1\COOL@strStop\COOL@strEnd%
- }%
+ {%
+ \setcounter{COOL@strpointer}{1}%
+ \COOL@substrgobbler#1\COOL@strStop\COOL@strEnd%
+ }%
}
% \end{macrocode}
% Now define the ``gobbler"
% \begin{macrocode}
\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%
+ }%
+ }%
% Else
- {%
- \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%
+ }%
+ \stepcounter{COOL@strpointer}%
+ \COOL@substrgobbler#2\COOL@strEnd%
+ }%
}
% \end{macrocode}
%
@@ -509,27 +525,27 @@
% \begin{macrocode}
\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
+ {%
+ }%
+ }%
% 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
+ {%
+ }%
+ \stepcounter{COOL@strpointer}%
+ \COOL@strcomparegobble[#1]<#2>#4%
+ }%
}
% \end{macrocode}
% \end{macro}
@@ -544,13 +560,13 @@
\setcounter{COOL@strpointer}{1}%
\COOL@strcomparegobble[#2]<#3>#1\COOL@strEnd\relax%
\ifthenelse{ \boolean{COOL@charmatch} }%
- {%
- #4%
- }%
+ {%
+ #4%
+ }%
% Else
- {%
- #5%
- }%
+ {%
+ #5%
+ }%
}
% \end{macrocode}
% \end{macro}
@@ -570,13 +586,13 @@
\newcommand{\ifstrleneq}[4]{%
\strlenstore{#1}{COOL@strlen}%
\ifthenelse{ \value{COOL@strlen} = #2 }%
- {%
- #3%
- }%
+ {%
+ #3%
+ }%
% Else
- {%
- #4%
- }%
+ {%
+ #4%
+ }%
}
% \end{macrocode}
% \end{macro}
@@ -598,49 +614,59 @@
%
% \begin{macrocode}
\def\COOL@decimalgobbler#1#2\COOL@strEnd{%
-\ifthenelse{\equal{#2}{\COOL@strStop}}%
+% \end{macrocode}
+% \changes{v2.2}{2009/09/09}{fixed blank space bug (blank space causes code to `crash')}
+% \begin{macrocode}
+\ifthenelse{\equal{#1}{\COOL@strStop}}%
+ {%
+% \end{macrocode}
+% user submitted a null string, which can not be numeric
+% \begin{macrocode}
+ \setboolean{COOL@decimal}{false}%
+ }%
+{\ifthenelse{\equal{#2}{\COOL@strStop}}%
% \end{macrocode}
% this indicates we are at the end of the string. We only need to perform the check to see if the digit is a number or the first decimal point
% \begin{macrocode}
- {%
- \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 \value{COOL@strpointer} = 1 \AND \NOT \boolean{COOL@decimalfound} }%
+ {%
+ }%
+ % Else
+ {%
+ \setboolean{COOL@decimal}{false}%
+ }%
+ }%
+ % Else
+ {%
+ }%
+ }%
% Else
- {%
- \ifthenelse{ `#1 < `0 \OR `#1 > `9 }%
- {%
+ {%
+ \ifthenelse{ `#1 < `0 \OR `#1 > `9 }%
+ {%
% \end{macrocode}
% not at the end of a string, and have encountered a non-digit. If it is a number, then this non digit must be the first decimal point or it may be the first character and a $+$ or $-$ sign
% \begin{macrocode}
- \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{ `#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%
+ }}%
}
% \end{macrocode}
% \end{macro}
@@ -657,13 +683,13 @@
\setboolean{COOL@decimal}{true}%
\expandafter\COOL@decimalgobbler#1\COOL@strStop\COOL@strEnd%
\ifthenelse{ \boolean{COOL@decimal} }%
- {%
- \setboolean{#2}{true}%
- }%
+ {%
+ \setboolean{#2}{true}%
+ }%
% Else
- {%
- \setboolean{#2}{false}%
- }%
+ {%
+ \setboolean{#2}{false}%
+ }%
}%
% \end{macrocode}
% \end{macro}
@@ -691,38 +717,38 @@
\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%
- }%
- }
+ {%
+ \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%
+ }%
+ }
% 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}%
- }%
- }%
+ {%
+ \isdecimal{\COOL@num@exponent}{COOL@numeric}%
+ \ifthenelse{ \boolean{COOL@numeric} }%
+ {%
+ \setboolean{#2}{true}%
+ }%
+ % Else
+ {%
+ \setboolean{#2}{false}%
+ }%
+ }%
% Else
- {%
- \setboolean{#2}{false}%
- }%
+ {%
+ \setboolean{#2}{false}%
+ }%
}
% \end{macrocode}
%
@@ -736,34 +762,34 @@
\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}%
+ {%
+ \setboolean{COOL@isint}{false}%
+ }%
+ % Else
+ {%
+ }%
+ }%
% 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 }%
+ {%
+ \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%
}
% \end{macrocode}
@@ -780,13 +806,13 @@
\setboolean{COOL@isint}{true}%
\expandafter\COOL@intgobbler#1\COOL@strStop\COOL@strEnd%
\ifthenelse{ \boolean{COOL@isint} }%
- {%
- \setboolean{#2}{true}%
- }%
+ {%
+ \setboolean{#2}{true}%
+ }%
% Else
- {%
- \setboolean{#2}{false}%
- }%
+ {%
+ \setboolean{#2}{false}%
+ }%
}
% \end{macrocode}
%