summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/stringstrings
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2009-11-23 18:04:51 +0000
committerKarl Berry <karl@freefriends.org>2009-11-23 18:04:51 +0000
commit011a86d8d8e37bf87d987880ac4ee50de04c6718 (patch)
tree43526c26e3832a0f5774c7b378bb6354b1b23ad0 /Master/texmf-dist/tex/latex/stringstrings
parentce23501cc3677b075ea61b6793acfc67386e5d99 (diff)
stringstrings update (3nov09)
git-svn-id: svn://tug.org/texlive/trunk@16143 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/stringstrings')
-rw-r--r--Master/texmf-dist/tex/latex/stringstrings/stringstrings.sty118
1 files changed, 77 insertions, 41 deletions
diff --git a/Master/texmf-dist/tex/latex/stringstrings/stringstrings.sty b/Master/texmf-dist/tex/latex/stringstrings/stringstrings.sty
index c4c4980880e..e41ca502baf 100644
--- a/Master/texmf-dist/tex/latex/stringstrings/stringstrings.sty
+++ b/Master/texmf-dist/tex/latex/stringstrings/stringstrings.sty
@@ -21,7 +21,7 @@
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
\ProvidesPackage{stringstrings}
-[2009/10/01 v1.04
+[2009/11/02 v1.10
Extensive array of string manipulation routines for
cosmetic and programming application]
\NeedsTeXFormat{LaTeX2e}
@@ -265,6 +265,7 @@
\newcounter{@maxrotation}
\newcounter{@stringsize}
\newcounter{@@stringsize}
+\newcounter{@@@stringsize}
\newcounter{@revisedstringsize}
\newcounter{@gobbleindex}
\newcounter{@charsfound}
@@ -280,6 +281,7 @@
\newcounter{@matchsize}
\newcounter{@matchmax}
\newcounter{@skipped}
+\newcounter{@lcwords}
%%%%% CONFIGURATION COMMANDS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand\defaultTreatments{%
@@ -557,6 +559,79 @@
\fi
}
+\newcounter{@@matchloc}
+\newcommand\convertword[4][v]{%
+ \+\edef\@@teststring{#2}%
+ \edef\@fromstring{#3}%
+ \edef\@tostring{#4}\?%
+ \edef\@@@teststring{\@@teststring}%
+ \def\@buildfront{}%
+ \edef\@buildstring{\@@teststring}%
+ \setcounter{@charsfound}{0}%
+ \whiledo{\the@charsfound > -1}{%
+ \whereisword[q]{\@@teststring}{\@fromstring}%
+ \setcounter{@matchloc}{\theresult}%
+ \ifthenelse{\the@matchloc = 0}%
+ {%
+ \setcounter{@charsfound}{-1}%
+ }%
+ {%
+ \addtocounter{@charsfound}{1}%
+ \addtocounter{@matchloc}{-1}%
+ \substring[e]{\@@@teststring}{1}{\the@matchloc}%
+ \edef\@buildfront{\@buildfront\thestring}%
+ \addtocounter{@matchloc}{1}%
+ \addtocounter{@matchloc}{\the@matchsize}%
+ \ifthenelse{\the@matchloc > \the@@@stringsize}%
+ {%
+ \setcounter{@charsfound}{-1}%
+ \edef\@buildstring{\@buildfront\@tostring}%
+ }%
+ {%
+ \substring[e]{\@@@teststring}{\the@matchloc}{\@MAXSTRINGSIZE}%
+ \edef\@@teststring{\thestring}%
+ \edef\@@@teststring{\@@teststring}%
+ \edef\@buildstring{\@buildfront\@tostring\@@@teststring}%
+ \edef\@buildfront{\@buildfront\@tostring}%
+ }%
+ }%
+ }%
+ \substring[#1]{\@buildstring}{1}{\@MAXSTRINGSIZE}%
+}
+
+\setcounter{@lcwords}{0}
+\newcommand\resetlcwords[0]{%
+ \setcounter{@lcwords}{0}%
+}
+
+\newcommand\addlcwords[1]{%
+ \getargs{#1}%
+ \setcounter{@wordindex}{0}%
+ \whiledo{\value{@wordindex} < \narg}{%
+ \addtocounter{@wordindex}{1}%
+ \addlcword{\csname arg\roman{@wordindex}\endcsname}%
+ }
+}
+
+\newcommand\addlcword[1]{%
+ \addtocounter{@lcwords}{1}%
+ \expandafter\edef\csname lcword\roman{@lcwords}\endcsname{#1}
+}
+
+\newcommand\capitalizetitle[2][v]{%
+ \capitalizewords[e]{#2}%
+ \setcounter{@wordindex}{0}%
+ \whiledo{\value{@wordindex} < \value{@lcwords}}{%
+ \addtocounter{@wordindex}{1}%
+ \edef\mystring{\thestring}%
+ \edef\lcword{\csname lcword\roman{@wordindex}\endcsname}%
+ \capitalize[e]{\lcword}%
+ \edef\ucword{\thestring}%
+ \convertword[e]{\mystring}{\ucword~}{\lcword~}%
+ }
+ \capitalize[#1]{\thestring}%
+}
+
\newcommand\rotateword[2][v]{%
\+\edef\thestring{#2}\?%
\@treatleadingspaces[e]{\thestring}{}%
@@ -681,6 +756,7 @@
\edef\@@@@teststring{#2}%
\edef\@matchstring{#3}%
\@getstringlength{#2}{@@stringsize}%
+ \setcounter{@@@stringsize}{\value{@@stringsize}}
\@getstringlength{#3}{@matchsize}%
\setcounter{@matchmax}{\the@@stringsize}%
\addtocounter{@matchmax}{-\the@matchsize}%
@@ -754,46 +830,6 @@
\if q#1\else\theresult\fi%
}
-\newcounter{@@matchloc}
-\newcommand\convertword[4][v]{%
- \+\edef\@@teststring{#2}%
- \edef\@fromstring{#3}%
- \edef\@tostring{#4}\?%
- \edef\@@@teststring{\@@teststring}%
- \def\@buildfront{}%
- \edef\@buildstring{\@@teststring}%
- \setcounter{@charsfound}{0}%
- \whiledo{\the@charsfound > -1}{%
-\whereisword[q]{\@@teststring}{\@fromstring}%
- \setcounter{@matchloc}{\theresult}%
- \ifthenelse{\the@matchloc = 0}%
- {%
- \setcounter{@charsfound}{-1}%
- }%
- {%
- \addtocounter{@charsfound}{1}%
- \addtocounter{@matchloc}{-1}%
- \substring[e]{\@@@teststring}{1}{\the@matchloc}%
- \edef\@buildfront{\@buildfront\thestring}%
- \addtocounter{@matchloc}{1}%
- \addtocounter{@matchloc}{\the@matchsize}%
- \ifthenelse{\the@matchloc > \the@@stringsize}%
- {%
- \setcounter{@charsfound}{-1}%
- \edef\@buildstring{\@buildfront\@tostring}%
- }%
- {%
- \substring[e]{\@@@teststring}{\the@matchloc}{\@MAXSTRINGSIZE}%
- \edef\@@teststring{\thestring}%
- \edef\@@@teststring{\@@teststring}%
- \edef\@buildstring{\@buildfront\@tostring\@@@teststring}%
- \edef\@buildfront{\@buildfront\@tostring}%
- }%
- }%
- }%
- \substring[#1]{\@buildstring}{1}{\@MAXSTRINGSIZE}%
-}
-
\newcommand\wordcount[2][v]{\+%
\edef\@argv{#2}
\@getstringlength{\@argv}{@stringsize}