diff options
author | Norbert Preining <preining@logic.at> | 2007-11-16 10:27:33 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2007-11-16 10:27:33 +0000 |
commit | bc5f7832361ad6f48e2053a7b124ffd3176446cd (patch) | |
tree | 6b7ac2cc2174abc16a503506a44e6a6ef48a3394 /Master/texmf-dist/source/latex | |
parent | 221423156f38c059e608604cb46b0e1608cb166f (diff) |
update coolstr v2.1 from CTAN
git-svn-id: svn://tug.org/texlive/trunk@5435 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex')
-rw-r--r-- | Master/texmf-dist/source/latex/coolstr/coolstr.dtx | 565 |
1 files changed, 284 insertions, 281 deletions
diff --git a/Master/texmf-dist/source/latex/coolstr/coolstr.dtx b/Master/texmf-dist/source/latex/coolstr/coolstr.dtx index 1211a996321..72b335c35fa 100644 --- a/Master/texmf-dist/source/latex/coolstr/coolstr.dtx +++ b/Master/texmf-dist/source/latex/coolstr/coolstr.dtx @@ -12,6 +12,7 @@ \documentclass{ltxdoc} \usepackage{coolstr} \usepackage{url} +\usepackage{pdflscape} \EnableCrossrefs \CodelineIndex \RecordChanges @@ -22,7 +23,7 @@ % \fi % % -% \CheckSum{309} +% \CheckSum{310} % % %% \CharacterTable @@ -94,7 +95,6 @@ % Strings are defined as a sequence of characters (not \TeX{} tokens). The main purpose behind treating strings as % characters rather than tokens is that one can then do some text manipulation on them. % -% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %\section{Descriptions} @@ -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,20 @@ % % % \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} +% |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 +187,18 @@ % % % \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} +% |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 +211,22 @@ % % % \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} \isdecimal{\numberstore}{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} % % @@ -240,6 +240,7 @@ % 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| % % +% \begin{landscape} % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -289,27 +290,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} % @@ -336,14 +337,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} % @@ -359,14 +360,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} % @@ -388,107 +389,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} % @@ -508,27 +509,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} @@ -543,13 +544,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} @@ -569,13 +570,13 @@ \newcommand{\ifstrleneq}[4]{% \strlenstore{#1}{COOL@strlen}% \ifthenelse{ \value{COOL@strlen} = #2 }% - {% - #3% - }% + {% + #3% + }% % Else - {% - #4% - }% + {% + #4% + }% } % \end{macrocode} % \end{macro} @@ -601,45 +602,45 @@ % \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} @@ -656,13 +657,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} @@ -690,38 +691,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} % @@ -735,34 +736,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} @@ -770,26 +771,28 @@ % \begin{macro}{\isint} % \changes{v2.0}{2006/12/29}{added extra mandatory argument for storing return boolean} % \changes{v2.0a}{2006/12/30}{modified internals slightly to work with \textsf{cool} package} +% \changes{v2.1b}{2007/10/10}{added expandafter before COOL@intgobbler to expand macros before evaluating} % |\isint|\marg{string}\marg{boolean} sets the \meta{boolean} to |true| if \meta{string} is an integer or |false| otherwise % % \begin{macrocode} \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}{true}% + }% % Else - {% - \setboolean{#2}{false}% - }% + {% + \setboolean{#2}{false}% + }% } % \end{macrocode} % % \end{macro} % +% \end{landscape} % % % |