summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/coolstr
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-09-19 17:45:27 +0000
committerKarl Berry <karl@freefriends.org>2006-09-19 17:45:27 +0000
commitff0751c47677d74e738b6009c1401b5b9a88d937 (patch)
tree6cfe46758edd2ece4e34e0c1b52febf047eb705b /Master/texmf-dist/source/latex/coolstr
parentb29717c1df1269ae871047d6ccab7b69f95b7fd1 (diff)
new package coolstr (18sep06)
git-svn-id: svn://tug.org/texlive/trunk@2160 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/coolstr')
-rw-r--r--Master/texmf-dist/source/latex/coolstr/coolstr.dtx340
-rw-r--r--Master/texmf-dist/source/latex/coolstr/coolstr.ins40
2 files changed, 380 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/coolstr/coolstr.dtx b/Master/texmf-dist/source/latex/coolstr/coolstr.dtx
new file mode 100644
index 00000000000..f2aec955401
--- /dev/null
+++ b/Master/texmf-dist/source/latex/coolstr/coolstr.dtx
@@ -0,0 +1,340 @@
+% \iffalse
+%
+%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
+%<package>\ProvidesPackage{coolstr}
+%<package> [2006/09/17 v1.0 COntent Oriented LaTeX Strings]
+%<package>\RequirePackage{ifthen}
+%<package>\RequirePackage{amsmath}
+%<package>\RequirePackage{amssymb}
+%
+%
+%<*driver>
+\documentclass{ltxdoc}
+\usepackage{coolstr}
+\usepackage{url}
+\EnableCrossrefs
+\CodelineIndex
+\RecordChanges
+\begin{document}
+\DocInput{coolstr.dtx}
+\end{document}
+%</driver>
+% \fi
+%
+% \iffalse meta-comment
+% remove this comment to get a checksum
+% \CheckSum{0}
+% \fi
+%
+%% \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
+%% Lower-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
+%% Digits \0\1\2\3\4\5\6\7\8\9
+%% Exclamation \! Double quote \" Hash (number) \#
+%% Dollar \$ Percent \% Ampersand \&
+%% Acute accent \' Left paren \( Right paren \)
+%% Asterisk \* Plus \+ Comma \,
+%% Minus \- Point \. Solidus \/
+%% Colon \: Semicolon \; Less than \<
+%% Equals \= Greater than \> Question mark \?
+%% Commercial at \@ Left bracket \[ Backslash \\
+%% Right bracket \] Circumflex \^ Underscore \_
+%% Grave accent \` Left brace \{ Vertical bar \|
+%% Right brace \} Tilde \~}
+%
+% \changes{v1.0}{2006/09/17}{Initial Release}
+%
+% \GetFileInfo{coolstr.sty}
+%
+% \DoNotIndex{\#,\$,\%,\&,\@,\\,\{,\},\^,\_,\~,\ ,\!,\(,\),\,}
+% \DoNotIndex{\@ne,\expandafter}
+% \DoNotIndex{\advance,\begingroup,\catcode,\closein}
+% \DoNotIndex{\newcommand,\renewcommand,\providecommand}
+% \DoNotIndex{\closeout,\day,\def,\edef,\gdef,\let,\empty,\endgroup}
+% \DoNotIndex{\newcounter,\providecounter,\addtocounter,\setcounter,\stepcounter,\value,\arabic}
+% \DoNotIndex{\if,\fi,\ifthenelse,\else,\setboolean,\boolean,\newboolean,\provideboolean,\equal,\AND,\OR,\NOT,\whiledo}
+% \DoNotIndex{\ifcase,\ifcat,\or,\else}
+% \DoNotIndex{\par,\parbox,\mbox,\hbox,\begin,\end,\nabla,\partial}
+% \DoNotIndex{\overline,\bar,\small,\tiny,\mathchoice,\scriptsize,\textrm,\texttt}
+% \DoNotIndex{\alpha,\beta,\gamma,\epsilon,\varepsilon,\delta,\zeta,\eta,\theta,\vartheta,\iota,\kappa,\lambda,\mu,\nu}
+% \DoNotIndex{\xi,\omicron,\pi,\varpi,\rho,\varrho,\sigma,\tau,\upsilon,\phi,\varphi,\chi,\psi,\omega}
+% \DoNotIndex{\Delta,\Gamma,\Theta,\Lambda,\Xi,\Pi,\Sigma,\Phi,\Psi,\Omega}
+% \DoNotIndex{\digamma,\lceil,\rceil,\lfloor,\rfloor,\left,\right,\inp,\inb,\inbr,\inap,\nop}
+% \DoNotIndex{\sum,\prod,\int,\log,\ln,\exp,\sin,\cos,\tan,\csc,\sec,\cot,\arcsin,\arccos,\arctan,\det}
+% \DoNotIndex{\sinh,\cosh,\tanh,\csch,\sech,\coth,\arcsinh,\arccosh,\arctanh}
+% \DoNotIndex{\mod,\max,\min,\gcd,\lcm,\wp,\arg,\dots,\infty,}
+% \DoNotIndex{\frac,\binom,\braket,\@@atop}
+% \DoNotIndex{\cdot,\ldots,\tilde,\times,\dagger,\relax}
+% \DoNotIndex{\mathbb,\roman,\bf,\mathord,\cal,\DeclareMathOperator,\PackageError,\PackageWarning}
+% \DoNotIndex{\csname,\endcsname,\ifx,\ifnum}
+% \DoNotIndex{\COOL@Hypergeometric@pq,\COOL@Hypergeometric@pq@ab@value,\hideOnSF,\COOL@decide@paren}
+% \DoNotIndex{\COOL@decide@indicies}
+% \DoNotIndex{\mod,\bmod,\pmod,\pod,\operatorname}
+%
+% \title{The \textsf{coolstr} package\thanks{This document
+% corresponds to \textsf{cool}~\fileversion,
+% dated~\filedate.}}
+% \author{nsetzer}
+%
+% \maketitle
+%
+% \setcounter{IndexColumns}{2}
+% \StopEventually{\PrintChanges\PrintIndex}
+%
+% The \textsf{coolstr} package is a ``sub" package of the \textsf{cool} package that seemed appropriate to publish
+% independently since it may occur that one wishes to include the ability to check strings without having to accept
+% all the overhead of the \textsf{cool} package itself.
+%
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%\section{Basics}
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% 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{Implementation}
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This is just an internal counter for dealing with the strings; most often used for the length
+%
+% \begin{macrocode}
+\newcounter{COOL@strlen}%
+% \end{macrocode}
+%
+% \begin{macro}{\setstrEnd}
+%
+% |\setstrEnd{|\meta{string}|}| allows the user to set the end of a string `character'
+% in the rare event that the default value actually appears in the string.
+% The default value is
+%
+% \begin{macrocode}
+\newcommand{\COOL@strEnd}{\%\%\%}
+\newcommand{\COOL@intEnd}{\%@\%@\%@}
+% \end{macrocode}
+%
+% and may be changed by the following command (which utilizes the |\renewcommand|):
+%
+% \begin{macrocode}
+\newcommand{\setstrEnd}[1]{\renewcommand{\COOL@strEnd}{#1}}
+% \end{macrocode}
+%
+% \end{macro}
+%
+%
+% This area defines the core technology behind the \textsf{coolstr} package: the string ``gobbler".
+%
+% \begin{macrocode}
+\newcounter{COOL@strpointer}
+% \end{macrocode}
+%
+% Now we come to ``the gobbler"---a recursive function that eats up a string.
+% It must be written in \TeX{} primatives.
+%
+% The idea behind this is that ``the gobbler" eats up everything before the desired character and everything
+% after the desired character.
+%
+% \begin{macrocode}
+\def\COOL@strgobble[#1]#2#3{%
+\ifthenelse{\equal{#3}{\COOL@strEnd}}
+ {%
+ \ifthenelse{\value{COOL@strpointer}=#1}
+ {%
+ #2
+ }%
+ % Else
+ {%
+ }%
+ }%
+% Else
+ {%
+ \ifthenelse{\value{COOL@strpointer}=#1}
+ {%
+ #2
+ }%
+ % Else
+ {%
+ }%
+ \stepcounter{COOL@strpointer}%
+ \COOL@strgobble[#1]#3
+ }%
+}
+% \end{macrocode}
+%
+% \begin{macro}{\strchar}
+% |\strchar|\marg{index} gives the \meta{index} character of the string. Strings start indexing at $1$.
+%
+% \begin{macrocode}
+\newcommand{\strchar}[2]{%
+\setcounter{COOL@strpointer}{1}%
+\COOL@strgobble[#2]#1\COOL@strEnd%
+}
+% \end{macrocode}
+%
+% \end{macro}
+%
+% This ``gobbler" is used to determine if the string contains numeric data. As it stands, not all numeric data is
+% recognized
+%
+% \begin{macrocode}
+\newboolean{COOL@firstdecimalfound}
+\newboolean{COOL@seconddecimalfound}
+\newboolean{COOL@efound}
+\newboolean{COOL@digitfound}
+
+\def\COOL@numericgobbler#1#2{%
+\ifthenelse{\equal{#2}{\COOL@strEnd}}%
+ {%
+ \ifthenelse{`#1 < `0 \OR `#1 > `9}%
+ {%
+ Not Numeric%
+ }%
+ % Else
+ {%
+ Is Numeric%
+ }%
+ }%
+% Else
+ {%
+ \ifthenelse{ `#1 < `0 \OR `#1 > `9 }%
+ {%
+% \end{macrocode}
+% at this point it can only be a decimal point or an 'e' if it is to remain numeric
+% \begin{macrocode}
+ \ifthenelse{ `#1 = `. }%
+ {%
+ \ifthenelse{ \boolean{COOL@seconddecimalfound} }%
+ {%
+% \end{macrocode}
+% this is the THIRD decimal
+% \begin{macrocode}
+ Not numeric%
+ }%
+ % else
+ {%
+ \ifthenelse{ \boolean{COOL@firstdecimalfound} }%
+ {%
+% \end{macrocode}
+% this is the SECOND decimal
+% \begin{macrocode}
+ \ifthenelse{ \boolean{COOL@efound} }%
+ {%
+ \setboolean{COOL@seconddecimalfound}{true}%
+ \COOL@numericgobbler#2%
+ }%
+ % else
+ {%
+ Not numeric%
+ }%
+ }%
+ % else
+ {%
+% \end{macrocode}
+% this is the FIRST decimal
+% \begin{macrocode}
+ \setboolean{COOL@firstdecimalfound}{true}%
+ \COOL@numericgobbler#2%
+ }%
+ }%
+ }%
+ % 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
+ }%
+ }%
+ }%
+ % Else
+ {%
+ \setboolean{COOL@digitfound}{true}%
+ \COOL@numericgobbler#2%
+ }%
+ }%
+}
+% \end{macrocode}
+%
+% \begin{macro}{\isnumeric}
+% |\isnumeric|\marg{string} returns some text stating whether or not \meta{string} contains numeric data.
+%
+% \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%
+}
+% \end{macrocode}
+%
+% \end{macro}
+%
+% In addition to identifying numeric data, it is useful to know if integers are present, thus another ``gobbler" is
+% needed
+%
+% \begin{macrocode}
+\let\COOL@strStop=\relax
+\newboolean{COOL@isint}
+\def\COOL@intgobbler#1#2\COOL@strEnd{%
+\ifcat#11
+\ifthenelse{\equal{#2}{\COOL@strStop}}%
+ {%
+ \ifthenelse{`#1 < `0 \OR `#1 > `9}%
+ {%
+ \setboolean{COOL@isint}{false}%
+ }%
+ % Else
+ {%
+ \setboolean{COOL@isint}{true}%
+ }%
+ }%
+% Else
+ {%
+ \ifthenelse{ `#1 < `0 \OR `#1 > `9 }%
+ {%
+ \setboolean{COOL@isint}{false}%
+ }%
+ % Else
+ {%
+ \setboolean{COOL@digitfound}{true}%
+ \COOL@intgobbler#2\COOL@strEnd%
+ }%
+ }%
+\else
+ \setboolean{COOL@isint}{false}%
+\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
+%
+% \begin{macrocode}
+\newcommand{\isint}[1]{\COOL@intgobbler#1\COOL@strStop\COOL@strEnd}
+% \end{macrocode}
+%
+% \end{macro}
+%
+%
+%
+%
+% \Finale
+\endinput \ No newline at end of file
diff --git a/Master/texmf-dist/source/latex/coolstr/coolstr.ins b/Master/texmf-dist/source/latex/coolstr/coolstr.ins
new file mode 100644
index 00000000000..11e7781626e
--- /dev/null
+++ b/Master/texmf-dist/source/latex/coolstr/coolstr.ins
@@ -0,0 +1,40 @@
+%%
+%% Copyright (C) 2005 by nsetzer
+%%
+%% This file may be distributed and/or modified under the
+%% conditions of the Limited General Product License
+%%
+
+\input docstrip.tex
+
+\keepsilent
+
+\usedir{tex/latex/coolstr}
+
+\preamble
+
+This is a generated file
+
+This file may be distributed and/or modified under the
+conditions of the Limited General Product License
+
+\endpreamble
+
+
+\generate{\file{coolstr.sty}{\from{coolstr.dtx}{package}}}
+
+\obeyspaces
+\Msg{****************************************************}
+\Msg{* *}
+\Msg{* To finish the installation you have to move the *}
+\Msg{* following file into a directory searched by TeX: *}
+\Msg{* *}
+\Msg{* coolstr.sty *}
+\Msg{* *}
+\Msg{* To produce the documentation run the file *}
+\Msg{* coolstr.dtx through LaTeX. *}
+\Msg{* *}
+\Msg{* *}
+\Msg{****************************************************}
+
+\endbatchfile \ No newline at end of file