diff options
-rw-r--r-- | Master/texmf-dist/doc/latex/coolstr/coolstr.pdf | bin | 133354 -> 134387 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/coolstr/coolstr.dtx | 565 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/coolstr/coolstr.sty | 441 |
3 files changed, 512 insertions, 494 deletions
diff --git a/Master/texmf-dist/doc/latex/coolstr/coolstr.pdf b/Master/texmf-dist/doc/latex/coolstr/coolstr.pdf Binary files differindex 78e5b0286f8..2cefbdab007 100644 --- a/Master/texmf-dist/doc/latex/coolstr/coolstr.pdf +++ b/Master/texmf-dist/doc/latex/coolstr/coolstr.pdf 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} % % % 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 %% |