summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Master/texmf-dist/doc/latex/coolstr/coolstr.pdfbin93108 -> 124324 bytes
-rw-r--r--Master/texmf-dist/source/latex/coolstr/coolstr.dtx451
-rw-r--r--Master/texmf-dist/tex/latex/coolstr/coolstr.sty191
-rw-r--r--Master/texmf-dist/tpm/coolstr.tpm8
4 files changed, 503 insertions, 147 deletions
diff --git a/Master/texmf-dist/doc/latex/coolstr/coolstr.pdf b/Master/texmf-dist/doc/latex/coolstr/coolstr.pdf
index 61b5c5a67d9..b3ad63bc993 100644
--- a/Master/texmf-dist/doc/latex/coolstr/coolstr.pdf
+++ b/Master/texmf-dist/doc/latex/coolstr/coolstr.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/coolstr/coolstr.dtx b/Master/texmf-dist/source/latex/coolstr/coolstr.dtx
index f2aec955401..cb3c9b895a6 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> [2006/09/17 v1.0 COntent Oriented LaTeX Strings]
+%<package> [2006/12/30 v2.0a COntent Oriented LaTeX Strings]
%<package>\RequirePackage{ifthen}
%<package>\RequirePackage{amsmath}
%<package>\RequirePackage{amssymb}
@@ -21,10 +21,9 @@
%</driver>
% \fi
%
-% \iffalse meta-comment
-% remove this comment to get a checksum
-% \CheckSum{0}
-% \fi
+%
+% \CheckSum{218}
+%
%
%% \CharacterTable
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -43,6 +42,7 @@
%% Right brace \} Tilde \~}
%
% \changes{v1.0}{2006/09/17}{Initial Release}
+% \changes{v2.0}{2006/12/29}{Added three new commands: \texttt{ifstrchareq}, \texttt{ifstrleneq}, \texttt{strlen}}
%
% \GetFileInfo{coolstr.sty}
%
@@ -97,6 +97,102 @@
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%\section{Test Cases}
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% \newboolean{t}
+%
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
+%\subsection{\texttt{$\backslash$isdecimal}}
+% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+%
+% \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}
+% \end{tabular}
+%
+%
+%
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
+%\subsection{\texttt{$\backslash$isnumeric}}
+% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+%
+% \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}
+% \end{tabular}
+%
+%
+%
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
+%\subsection{\texttt{$\backslash$isint}}
+% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+%
+% \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}
+% \end{tabular}
+%
+%
+%
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%\section{Acknowledgments}
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% Thanks to J.~J.~Weimer for the comments and aid in coding.
+%
+%
+%
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\section{Implementation}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -116,6 +212,7 @@
% \begin{macrocode}
\newcommand{\COOL@strEnd}{\%\%\%}
\newcommand{\COOL@intEnd}{\%@\%@\%@}
+\let\COOL@strStop=\relax
% \end{macrocode}
%
% and may be changed by the following command (which utilizes the |\renewcommand|):
@@ -141,11 +238,11 @@
%
% \begin{macrocode}
\def\COOL@strgobble[#1]#2#3{%
-\ifthenelse{\equal{#3}{\COOL@strEnd}}
+\ifthenelse{\equal{#3}{\COOL@strEnd}}%
{%
- \ifthenelse{\value{COOL@strpointer}=#1}
+ \ifthenelse{\value{COOL@strpointer}=#1}%
{%
- #2
+ #2%
}%
% Else
{%
@@ -153,15 +250,15 @@
}%
% Else
{%
- \ifthenelse{\value{COOL@strpointer}=#1}
+ \ifthenelse{\value{COOL@strpointer}=#1}%
{%
- #2
+ #2%
}%
% Else
{%
}%
\stepcounter{COOL@strpointer}%
- \COOL@strgobble[#1]#3
+ \COOL@strgobble[#1]#3%
}%
}
% \end{macrocode}
@@ -178,109 +275,263 @@
%
% \end{macro}
%
-% This ``gobbler" is used to determine if the string contains numeric data. As it stands, not all numeric data is
-% recognized
+%
+% \begin{macro}{\strlen}
+% \changes{v2.0}{2006/12/29}{added to package}
+% |\strlen|\marg{string} gives the length of the string. It is better to use |\strlenstore| to record the length
+%
+% |\strlen{abc}| \strlen{abc}
+%
+% \begin{macrocode}
+\newcommand{\strlen}[1]{%
+\strchar{#1}{0}
+\arabic{COOL@strpointer}%
+}
+% \end{macrocode}
+%
+% \end{macro}
+%
+%
+% \begin{macro}{\strlenstore}
+% \changes{v2.0}{2006/12/29}{added to package}
+% |\strlenstore|\marg{string}\marg{counter} stores the length of \meta{string} in \meta{counter}
+%
+% \begin{macrocode}
+\newcommand{\strlenstore}[2]{%
+\strchar{#1}{0}%
+\setcounter{#2}{COOL@strpointer}%
+}
+% \end{macrocode}
+%
+% \end{macro}
+%
+%
+% Define a new boolean for comparing characters
+%
+% \begin{macrocode}
+\newboolean{COOL@charmatch}
+% \end{macrocode}
+%
+% \begin{macro}{\COOL@strcomparegobble}
+% This ``gobbler" does character comparison
+% \changes{v2.0}{2006/12/29}{added to package for single character comparisons}
%
% \begin{macrocode}
-\newboolean{COOL@firstdecimalfound}
-\newboolean{COOL@seconddecimalfound}
-\newboolean{COOL@efound}
-\newboolean{COOL@digitfound}
-
-\def\COOL@numericgobbler#1#2{%
-\ifthenelse{\equal{#2}{\COOL@strEnd}}%
+\def\COOL@strcomparegobble[#1]<#2>#3#4{%
+\ifthenelse{\equal{#4}{\COOL@strEnd}}%
{%
- \ifthenelse{`#1 < `0 \OR `#1 > `9}%
+ \ifthenelse{\value{COOL@strpointer}=#1 \AND \equal{#2}{#3} }%
{%
- Not Numeric%
+ \setboolean{COOL@charmatch}{true}%
}%
% Else
{%
- Is Numeric%
}%
}%
% Else
{%
- \ifthenelse{ `#1 < `0 \OR `#1 > `9 }%
+ \ifthenelse{\value{COOL@strpointer}=#1 \AND \equal{#2}{#3} }%
{%
+ \setboolean{COOL@charmatch}{true}%
+ }%
+ % Else
+ {%
+ }%
+ \stepcounter{COOL@strpointer}%
+ \COOL@strcomparegobble[#1]<#2>#4%
+ }%
+}
% \end{macrocode}
-% at this point it can only be a decimal point or an 'e' if it is to remain numeric
+% \end{macro}
+%
+% \begin{macro}{\ifstrchareq}
+% |\ifstrchareq|\marg{string}\marg{char index}\marg{comparison char}\marg{do if true}\marg{do if false}
+% \changes{v2.0}{2006/12/29}{added to package to do character comparing}
+%
% \begin{macrocode}
- \ifthenelse{ `#1 = `. }%
- {%
- \ifthenelse{ \boolean{COOL@seconddecimalfound} }%
- {%
+\newcommand{\ifstrchareq}[5]{%
+\setboolean{COOL@charmatch}{false}%
+\setcounter{COOL@strpointer}{1}%
+\COOL@strcomparegobble[#2]<#3>#1\COOL@strEnd\relax%
+\ifthenelse{ \boolean{COOL@charmatch} }%
+ {%
+ #4%
+ }%
+% Else
+ {%
+ #5%
+ }%
+}
% \end{macrocode}
-% this is the THIRD decimal
+% \end{macro}
+%
+%
+% \begin{macro}{\ifstrleneq}
+% |\ifstrleneq|\marg{string}\marg{number}\marg{do if true}\marg{do if false}
+%
+% \noindent |\ifstrleneq{abc}{3}{length is $3$}{length is not $3$}| \ifstrleneq{abc}{3}{length is $3$}{length is not $3$}
+%
+% \noindent |\ifstrleneq{abcde}{3}{length is $3$}{length is not $3$}| \ifstrleneq{abcde}{3}{length is $3$}{length is not $3$}
+%
+% \changes{v2.0}{2006/12/29}{added to package to do length comparison}
+%
% \begin{macrocode}
- Not numeric%
- }%
- % else
- {%
- \ifthenelse{ \boolean{COOL@firstdecimalfound} }%
- {%
+\newcommand{\ifstrleneq}[4]{%
+\strchar{#1}{0}%
+\ifthenelse{ \value{COOL@strpointer} = #2 }%
+ {%
+ #3%
+ }%
+% Else
+ {%
+ #4%
+ }%
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\COOL@decimalgobbler}
+%
+% This ``gobbler" is used to determine if the submitted string is a rational number (satisfies $d_n d_{n-1} \cdots d_1 d_0 . d_{-1} d_{-2} \cdots d_{-m}$). The idea behind the macro is that it assumes the string is rational until it encounters a non-numeric object
+% \changes{v2.0}{2006/12/29}{added this ``gobbler'' to complete \texttt{isnumeric}}
+%
+% \begin{macrocode}
+\newboolean{COOL@decimalfound}
+\newboolean{COOL@decimal}
% \end{macrocode}
-% this is the SECOND decimal
+%
+% |COOL@decimalfound| is a boolean indicating if the first decimal point is found
+%
+% |COOL@decimal| is the flag that tells if the string contains numeric data
+%
% \begin{macrocode}
- \ifthenelse{ \boolean{COOL@efound} }%
- {%
- \setboolean{COOL@seconddecimalfound}{true}%
- \COOL@numericgobbler#2%
- }%
- % else
- {%
- Not numeric%
- }%
- }%
- % else
- {%
+\def\COOL@decimalgobbler#1#2\COOL@strEnd{%
+\ifthenelse{\equal{#2}{\COOL@strStop}}%
% \end{macrocode}
-% this is the FIRST decimal
+% 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}
- \setboolean{COOL@firstdecimalfound}{true}%
- \COOL@numericgobbler#2%
- }%
- }%
+ {%
+ \ifthenelse{`#1 < `0 \OR `#1 > `9}%
+ {%
+ \ifthenelse{ `#1 = `. \AND \NOT \value{COOL@strpointer} = 1 \AND \NOT \boolean{COOL@decimalfound} }%
+ {%
}%
- % else
+ % Else
{%
- \ifthenelse{ \(`#1 = `E\) \OR \(`#1 = `e\) }%
- {%
- \ifthenelse{ \boolean{COOL@efound} \OR \NOT \boolean{COOL@digitfound} }%
- {%
- Not numeric%
- }%
- % else
- {%
- \setboolean{COOL@efound}{true}%
- \COOL@numericgobbler#2%
- }%
- }%
- % else
- {%
- Not Numeric
- }%
+ \setboolean{COOL@decimal}{false}%
}%
}%
% Else
{%
- \setboolean{COOL@digitfound}{true}%
- \COOL@numericgobbler#2%
}%
}%
-}
+% Else
+ {%
+ \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%
+ }%
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\isdecimal}
+% |isdecimal|\marg{string}\marg{boolean}
+% \changes{v2.0}{2006/12/29}{added}
+%
+% \begin{macrocode}
+\newcommand{\isdecimal}[2]{%
+\setcounter{COOL@strpointer}{1}%
+\setboolean{COOL@decimalfound}{false}%
+\setboolean{COOL@decimal}{true}%
+\expandafter\COOL@decimalgobbler#1\COOL@strStop\COOL@strEnd%
+\ifthenelse{ \boolean{COOL@decimal} }%
+ {%
+ \setboolean{#2}{true}%
+ }%
+% Else
+ {%
+ \setboolean{#2}{false}%
+ }%
+}%
+% \end{macrocode}
+% \end{macro}
%
% \begin{macro}{\isnumeric}
-% |\isnumeric|\marg{string} returns some text stating whether or not \meta{string} contains numeric data.
+% |\isnumeric|\marg{string}\marg{boolean} stores |true| in \meta{boolean} if \meta{string} is numeric
+% \changes{v2.0}{2006/12/29}{added extra mandatory argument for storing return boolean}
%
% \begin{macrocode}
-\newcommand{\isnumeric}[1]{%
-\setboolean{COOL@firstdecimalfound}{false}%
-\setboolean{COOL@seconddecimalfound}{false}%
-\setboolean{COOL@efound}{false}%
-\setboolean{COOL@digitfound}{false}%
-\COOL@numericgobbler#1\COOL@strEnd%
+\newboolean{COOL@numeric}%
+\def\COOL@eparser#1e#2\COOL@strEnd{%
+\xdef\COOL@num@magnitude{#1}%
+\xdef\COOL@num@exponent{#2}%
+}
+\def\COOL@ecorrector#1e\COOL@strStop{%
+\xdef\COOL@num@exponent{#1}%
+}
+\def\COOL@Eparser#1E#2\COOL@strEnd{%
+\xdef\COOL@num@magnitude{#1}%
+\xdef\COOL@num@exponent{#2}%
+}
+\def\COOL@Ecorrector#1E\COOL@strStop{%
+\xdef\COOL@num@exponent{#1}%
+}
+\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%
+ }%
+ }
+% Else
+ {%
+ \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}%
+ }%
+ }%
+% Else
+ {%
+ \setboolean{#2}{false}%
+ }%
}
% \end{macrocode}
%
@@ -290,10 +541,9 @@
% needed
%
% \begin{macrocode}
-\let\COOL@strStop=\relax
\newboolean{COOL@isint}
\def\COOL@intgobbler#1#2\COOL@strEnd{%
-\ifcat#11
+\ifcat#11%
\ifthenelse{\equal{#2}{\COOL@strStop}}%
{%
\ifthenelse{`#1 < `0 \OR `#1 > `9}%
@@ -302,33 +552,50 @@
}%
% Else
{%
- \setboolean{COOL@isint}{true}%
}%
}%
% Else
{%
\ifthenelse{ `#1 < `0 \OR `#1 > `9 }%
{%
- \setboolean{COOL@isint}{false}%
+ \ifthenelse{ `#1 = `+ \OR `#1 = `- \AND \value{COOL@strpointer} = 1 }%
+ {}%
+ % Else
+ {%
+ \setboolean{COOL@isint}{false}%
+ }%
}%
% Else
{%
- \setboolean{COOL@digitfound}{true}%
- \COOL@intgobbler#2\COOL@strEnd%
}%
+ \stepcounter{COOL@strpointer}%
+ \COOL@intgobbler#2\COOL@strEnd%
}%
-\else
+\else%
\setboolean{COOL@isint}{false}%
-\fi
+\fi%
}
% \end{macrocode}
%
% \begin{macro}{\isint}
-% |\isint|\marg{string} doesn't actually return anything, but sets the boolean |COOL@isint| to true or false
-% depending on whether or not \meta{string} contains an integer
+% \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}
+% |\isint|\marg{string}\marg{boolean} sets the \meta{boolean} to |true| if \meta{string} is an integer or |false| otherwise
%
% \begin{macrocode}
-\newcommand{\isint}[1]{\COOL@intgobbler#1\COOL@strStop\COOL@strEnd}
+\newcommand{\isint}[2]{%
+\setcounter{COOL@strpointer}{1}%
+\setboolean{COOL@isint}{true}%
+\COOL@intgobbler#1\COOL@strStop\COOL@strEnd%
+\ifthenelse{ \boolean{COOL@isint} }%
+ {%
+ \setboolean{#2}{true}%
+ }%
+% Else
+ {%
+ \setboolean{#2}{false}%
+ }%
+}
% \end{macrocode}
%
% \end{macro}
diff --git a/Master/texmf-dist/tex/latex/coolstr/coolstr.sty b/Master/texmf-dist/tex/latex/coolstr/coolstr.sty
index c74aff34b76..3b23fcc86ef 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}
- [2006/09/17 v1.0 COntent Oriented LaTeX Strings]
+ [2006/12/30 v2.0a COntent Oriented LaTeX Strings]
\RequirePackage{ifthen}
\RequirePackage{amsmath}
\RequirePackage{amssymb}
@@ -35,110 +35,185 @@
\newcounter{COOL@strlen}%
\newcommand{\COOL@strEnd}{\%\%\%}
\newcommand{\COOL@intEnd}{\%@\%@\%@}
+\let\COOL@strStop=\relax
\newcommand{\setstrEnd}[1]{\renewcommand{\COOL@strEnd}{#1}}
\newcounter{COOL@strpointer}
\def\COOL@strgobble[#1]#2#3{%
-\ifthenelse{\equal{#3}{\COOL@strEnd}}
+\ifthenelse{\equal{#3}{\COOL@strEnd}}%
{%
-\ifthenelse{\value{COOL@strpointer}=#1}
+\ifthenelse{\value{COOL@strpointer}=#1}%
{%
-#2
+#2%
}%
{%
}%
}%
{%
-\ifthenelse{\value{COOL@strpointer}=#1}
+\ifthenelse{\value{COOL@strpointer}=#1}%
{%
-#2
+#2%
}%
{%
}%
\stepcounter{COOL@strpointer}%
-\COOL@strgobble[#1]#3
+\COOL@strgobble[#1]#3%
}%
}
\newcommand{\strchar}[2]{%
\setcounter{COOL@strpointer}{1}%
\COOL@strgobble[#2]#1\COOL@strEnd%
}
-\newboolean{COOL@firstdecimalfound}
-\newboolean{COOL@seconddecimalfound}
-\newboolean{COOL@efound}
-\newboolean{COOL@digitfound}
-
-\def\COOL@numericgobbler#1#2{%
-\ifthenelse{\equal{#2}{\COOL@strEnd}}%
+\newcommand{\strlen}[1]{%
+\strchar{#1}{0}
+\arabic{COOL@strpointer}%
+}
+\newcommand{\strlenstore}[2]{%
+\strchar{#1}{0}%
+\setcounter{#2}{COOL@strpointer}%
+}
+\newboolean{COOL@charmatch}
+\def\COOL@strcomparegobble[#1]<#2>#3#4{%
+\ifthenelse{\equal{#4}{\COOL@strEnd}}%
{%
-\ifthenelse{`#1 < `0 \OR `#1 > `9}%
+\ifthenelse{\value{COOL@strpointer}=#1 \AND \equal{#2}{#3} }%
{%
-Not Numeric%
+\setboolean{COOL@charmatch}{true}%
}%
{%
-Is Numeric%
}%
}%
{%
-\ifthenelse{ `#1 < `0 \OR `#1 > `9 }%
-{%
-\ifthenelse{ `#1 = `. }%
+\ifthenelse{\value{COOL@strpointer}=#1 \AND \equal{#2}{#3} }%
{%
-\ifthenelse{ \boolean{COOL@seconddecimalfound} }%
+\setboolean{COOL@charmatch}{true}%
+}%
{%
-Not numeric%
}%
+\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} }%
{%
-\ifthenelse{ \boolean{COOL@firstdecimalfound} }%
+#4%
+}%
{%
-\ifthenelse{ \boolean{COOL@efound} }%
+#5%
+}%
+}
+\newcommand{\ifstrleneq}[4]{%
+\strchar{#1}{0}%
+\ifthenelse{ \value{COOL@strpointer} = #2 }%
{%
-\setboolean{COOL@seconddecimalfound}{true}%
-\COOL@numericgobbler#2%
+#3%
}%
{%
-Not numeric%
+#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@firstdecimalfound}{true}%
-\COOL@numericgobbler#2%
+\setboolean{COOL@decimal}{false}%
+}%
}%
+{%
}%
}%
{%
-\ifthenelse{ \(`#1 = `E\) \OR \(`#1 = `e\) }%
+\ifthenelse{ `#1 < `0 \OR `#1 > `9 }%
{%
-\ifthenelse{ \boolean{COOL@efound} \OR \NOT \boolean{COOL@digitfound} }%
+\ifthenelse{ `#1 = `. \AND \NOT \boolean{COOL@decimalfound} }%
{%
-Not numeric%
+\setboolean{COOL@decimalfound}{true}%
}%
+{\ifthenelse{ \(`#1 = `+ \OR `#1 = `-\) \AND \value{COOL@strpointer} = 1 }%
{%
-\setboolean{COOL@efound}{true}%
-\COOL@numericgobbler#2%
}%
+{%
+\setboolean{COOL@decimal}{false}%
+}}%
+}%
+{}%
+\stepcounter{COOL@strpointer}%
+\COOL@decimalgobbler#2\COOL@strEnd%
}%
+}
+\newcommand{\isdecimal}[2]{%
+\setcounter{COOL@strpointer}{1}%
+\setboolean{COOL@decimalfound}{false}%
+\setboolean{COOL@decimal}{true}%
+\expandafter\COOL@decimalgobbler#1\COOL@strStop\COOL@strEnd%
+\ifthenelse{ \boolean{COOL@decimal} }%
{%
-Not Numeric
+\setboolean{#2}{true}%
}%
+{%
+\setboolean{#2}{false}%
}%
}%
+\newboolean{COOL@numeric}%
+\def\COOL@eparser#1e#2\COOL@strEnd{%
+\xdef\COOL@num@magnitude{#1}%
+\xdef\COOL@num@exponent{#2}%
+}
+\def\COOL@ecorrector#1e\COOL@strStop{%
+\xdef\COOL@num@exponent{#1}%
+}
+\def\COOL@Eparser#1E#2\COOL@strEnd{%
+\xdef\COOL@num@magnitude{#1}%
+\xdef\COOL@num@exponent{#2}%
+}
+\def\COOL@Ecorrector#1E\COOL@strStop{%
+\xdef\COOL@num@exponent{#1}%
+}
+\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} }%
{%
-\setboolean{COOL@digitfound}{true}%
-\COOL@numericgobbler#2%
+\gdef\COOL@num@exponent{0}%
}%
+{%
+\expandafter\COOL@Ecorrector\COOL@num@exponent%
}%
}
-\newcommand{\isnumeric}[1]{%
-\setboolean{COOL@firstdecimalfound}{false}%
-\setboolean{COOL@seconddecimalfound}{false}%
-\setboolean{COOL@efound}{false}%
-\setboolean{COOL@digitfound}{false}%
-\COOL@numericgobbler#1\COOL@strEnd%
+{%
+\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}%
+}%
}
-\let\COOL@strStop=\relax
\newboolean{COOL@isint}
\def\COOL@intgobbler#1#2\COOL@strEnd{%
-\ifcat#11
+\ifcat#11%
\ifthenelse{\equal{#2}{\COOL@strStop}}%
{%
\ifthenelse{`#1 < `0 \OR `#1 > `9}%
@@ -146,24 +221,38 @@ Not Numeric
\setboolean{COOL@isint}{false}%
}%
{%
-\setboolean{COOL@isint}{true}%
}%
}%
{%
\ifthenelse{ `#1 < `0 \OR `#1 > `9 }%
{%
+\ifthenelse{ `#1 = `+ \OR `#1 = `- \AND \value{COOL@strpointer} = 1 }%
+{}%
+{%
\setboolean{COOL@isint}{false}%
}%
+}%
{%
-\setboolean{COOL@digitfound}{true}%
-\COOL@intgobbler#2\COOL@strEnd%
}%
+\stepcounter{COOL@strpointer}%
+\COOL@intgobbler#2\COOL@strEnd%
}%
-\else
+\else%
\setboolean{COOL@isint}{false}%
-\fi
+\fi%
+}
+\newcommand{\isint}[2]{%
+\setcounter{COOL@strpointer}{1}%
+\setboolean{COOL@isint}{true}%
+\COOL@intgobbler#1\COOL@strStop\COOL@strEnd%
+\ifthenelse{ \boolean{COOL@isint} }%
+{%
+\setboolean{#2}{true}%
+}%
+{%
+\setboolean{#2}{false}%
+}%
}
-\newcommand{\isint}[1]{\COOL@intgobbler#1\COOL@strStop\COOL@strEnd}
\endinput
%%
%% End of file `coolstr.sty'.
diff --git a/Master/texmf-dist/tpm/coolstr.tpm b/Master/texmf-dist/tpm/coolstr.tpm
index e057d33dbda..8ca9d146fca 100644
--- a/Master/texmf-dist/tpm/coolstr.tpm
+++ b/Master/texmf-dist/tpm/coolstr.tpm
@@ -3,7 +3,7 @@
<rdf:Description about="http://texlive.dante.de/texlive/Package/coolstr.zip">
<TPM:Name>coolstr</TPM:Name>
<TPM:Type>Package</TPM:Type>
- <TPM:Date>2006/09/19 17:45:27</TPM:Date>
+ <TPM:Date>2006/12/30 19:34:00</TPM:Date>
<TPM:Version></TPM:Version>
<TPM:Creator>karl</TPM:Creator>
<TPM:Title>The coolstr package.</TPM:Title>
@@ -12,15 +12,15 @@
<TPM:Size>110287</TPM:Size>
<TPM:License></TPM:License>
<TPM:Build/>
- <TPM:RunFiles size="4779">
+ <TPM:RunFiles size="6671">
texmf-dist/tex/latex/coolstr/coolstr.sty
texmf-dist/tpm/coolstr.tpm
</TPM:RunFiles>
- <TPM:DocFiles size="94222">
+ <TPM:DocFiles size="125438">
texmf-dist/doc/latex/coolstr/README
texmf-dist/doc/latex/coolstr/coolstr.pdf
</TPM:DocFiles>
- <TPM:SourceFiles size="11286">
+ <TPM:SourceFiles size="22378">
texmf-dist/source/latex/coolstr/coolstr.dtx
texmf-dist/source/latex/coolstr/coolstr.ins
</TPM:SourceFiles>