summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-01-13 00:09:36 +0000
committerKarl Berry <karl@freefriends.org>2006-01-13 00:09:36 +0000
commita685525d941d96390acfd6fb1f0da1c66d54d123 (patch)
tree71673a79393da4b638531411800647e5384f8fbd /Master/texmf-dist
parentd825f096ae7e035c0a76fc6487a63402a3630563 (diff)
toolbox
git-svn-id: svn://tug.org/texlive/trunk@1401 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/tex/latex/toolbox/toolbox.sty329
1 files changed, 329 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/toolbox/toolbox.sty b/Master/texmf-dist/tex/latex/toolbox/toolbox.sty
new file mode 100644
index 00000000000..3a9f96115a9
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/toolbox/toolbox.sty
@@ -0,0 +1,329 @@
+%%
+%% This file was generated by the docstrip utility from toolbox.dtx.
+%% You may distribute this file only together with the source toolbox.dtx
+%% (and if possible with toolbox.ins) and only if these files are unmodified.
+%%
+%% Author:
+%%
+%% M. V\"ath vaeth@mathematik.uni-wuerzburg.de
+%%
+
+\ifx\typeout\undefined
+ \def\tbx@tmp{\immediate\write17}\expandafter\tbx@tmp
+\else
+ \expandafter\typeout
+\fi{toolbox.sty by M. Vaeth: The TeX Programmer's Toolbox 5.1}
+
+%% First, some LaTeX support:
+%% We inform LaTeX that this is a package, and we test whether we would
+%% override some existing commands.
+
+\ifx\ProvidesPackage\undefined\else
+ \ProvidesPackage{toolbox}[2004/04/29 v5.1]
+\fi
+
+\ifx\newcommand\undefined\else
+ \newcommand{\toolboxMakeDef}{}
+ \newcommand{\toolboxFreeDef}{}
+ \newcommand{\toolboxFuturelet}{}
+ \newcommand{\toolboxGobbleNext}{}
+ \newcommand{\toolboxIfNextToken}{}
+ \newcommand{\toolboxIfNextGobbling}{}
+ \newcommand{\toolboxIfEmpty}{}
+ \newcommand{\toolboxIfx}{}
+ \newcommand{\toolboxIfX}{}
+ \newcommand{\toolboxIfElse}{}
+ \newcommand{\toolboxLoop}{}
+ \newcommand{\toolboxLoopName}{}
+ \newcommand{\toolboxToken}{}
+ \newcommand{\toolboxTokenName}{}
+ \newcommand{\toolboxTokDef}{}
+ \newcommand{\toolboxDef}{}
+ \newcommand{\toolboxAppend}{}
+ \newcommand{\toolboxSplitAt}{}
+ \newcommand{\toolboxMakeSplit}{}
+ \newcommand{\toolboxFreeSplit}{}
+ \newcommand{\toolboxReplace}{}
+ \newcommand{\toolboxReplaceSplit}{}
+ \newcommand{\toolboxMakeHarmless}{}
+ \newcommand{\toolboxDropBrace}{}
+ \newcommand{\toolboxIf}{}
+ \newcommand{\toolboxNewiftrue}{}
+ \newcommand{\toolboxNewiffalse}{}
+ \newcommand{\toolboxLet}{}
+ \newcommand{\toolboxWithNr}{}
+ \newcommand{\toolboxEmpty}{}
+ \newcommand{\toolboxSpace}{}
+ \newcommand{\toolboxSpaceToken}{}
+ \newcommand{\toolboxFirstOfTwo}{}
+ \newcommand{\toolboxSecondOfTwo}{}
+ \newcommand{\toolboxGobbleArg}{}
+\fi
+
+\def\toolboxEmpty{}
+\def\toolboxSpace{ }
+\expandafter
+ \futurelet\expandafter\toolboxSpaceToken\expandafter
+ \if\toolboxSpace\toolboxEmpty\toolboxEmpty\fi
+
+\long\def\toolboxFirstOfTwo#1#2{#1}
+\long\def\toolboxSecondOfTwo#1#2{#2}
+\long\def\toolboxGobbleArg#1{}
+
+\toksdef\tbx@toks=0
+
+\def\toolboxMakeDef{\tbx@MakeNames\tbx@MakeDef}
+\def\tbx@MakeDef#1#2#3#4#5#6#7#8#9{%
+ \tbx@def#1{\toolboxIfNextGobbling*%
+ {\tbx@MakeNew\let{#8}{#9}}{\tbx@MakeNew\def{#8}{#9}}}%
+ \tbx@def#2{\toolboxIfNextGobbling*%
+ {\tbx@MakeRenew\let{#8}{#9}}{\tbx@MakeRenew\def{#8}{#9}}}%
+ \tbx@def#3{\toolboxIfNextGobbling*%
+ {\tbx@MakeProvide\let{#8}{#9}}{\tbx@MakeProvide\def{#8}{#9}}}%
+ \tbx@def#4{\toolboxIfNextGobbling*%
+ {\tbx@MakeForce\let{#8}{#9}}{\tbx@MakeForce\def{#8}{#9}}}%
+ \tbx@def#5##1##2{\expandafter
+ \tbx@MakeLet\csname tbx@l@#8@#9@##2\endcsname##1}%
+ \tbx@def#6{\toolboxIfNextGobbling*%
+ {\tbx@MakeUse\tbx@itemEnd{#8}{#9}}{\tbx@MakeUse\relax{#8}{#9}}}%
+ \long\def#7##1}
+
+\def\tbx@MakeNew#1#2#3#4{\expandafter
+ \ifx\csname tbx@l@#2@#3@#4\endcsname\relax\else
+ \errmessage{#2New#3: entry #4 already exists}%
+ \fi
+ \tbx@MakeForce{#1}{#2}{#3}{#4}}
+
+\def\tbx@MakeRenew#1#2#3#4{\expandafter
+ \ifx\csname tbx@l@#2@#3@#4\endcsname\relax
+ \errmessage{#2Renew#3: entry #4 was not defined before}%
+ \fi
+ \tbx@MakeForce{#1}{#2}{#3}{#4}}
+
+\def\tbx@MakeProvide#1#2#3#4#5{\expandafter
+ \ifx\csname tbx@l@#2@#3@#4\endcsname\relax
+ \tbx@MakeForce{#1}{#2}{#3}{#4}{#5}%
+ \fi}
+
+\long\def\tbx@MakeForce#1#2#3#4#5{%
+ \ifx#1\let
+ \expandafter
+ \let\csname tbx@l@#2@#3@#4\endcsname#5%
+ \else
+ \expandafter
+ \tbx@MakeDoDef\csname tbx@l@#2@#3@#4\expandafter\endcsname
+ \csname tbx@e@#2@#3\endcsname{#5}%
+ \fi}
+\long\def\tbx@MakeDoDef#1#2#3{\tbx@toks\expandafter{#2{#3}}%
+ \edef#1{\the\tbx@toks}}
+
+\def\tbx@MakeLet#1#2{%
+ \ifx#1\relax
+ \let#2\undefined
+ \else
+ \let#2#1%
+ \fi}
+
+\def\tbx@MakeUse#1#2#3#4{%
+ \expandafter
+ \ifx\csname tbx@l@#2@#3@#4\endcsname#1%
+ \errmessage{Entry #4 was not defined with
+ #2New#3, #2Provide#3, or #2Def#3}%
+ \fi
+ \csname tbx@l@#2@#3@#4\endcsname}
+
+\def\tbx@def#1{%
+ \ifx#1\relax\else
+ \errmessage{\string#1 is already defined}%
+ \fi
+ \def#1}
+
+\def\toolboxFreeDef{\toolboxIfNextGobbling*%
+ {\tbx@MakeNames{\tbx@FreeDef\relax}}{\tbx@MakeNames{\tbx@FreeDef\undefined}}}
+\def\tbx@FreeDef#1#2#3#4#5#6#7#8#9{%
+ \let#2\undefined\let#3\undefined\let#4\undefined\let#5\undefined
+ \let#8\undefined
+ \ifx#1\undefined
+ \let#6\undefined\let#7\undefined
+ \fi\toolboxGobbleArg}
+
+\def\tbx@MakeNames#1{\toolboxIfNextToken[%]
+ {\tbx@MakingNames{#1}}{\tbx@MakingNames{#1}[]}}
+\def\tbx@MakingNames#1[#2]#3{\expandafter
+ \tbx@ListSwap\expandafter{%
+ \csname#2New#3\expandafter\endcsname
+ \csname#2Renew#3\expandafter\endcsname
+ \csname#2Provide#3\expandafter\endcsname
+ \csname#2Def#3\expandafter\endcsname
+ \csname#2Let#3\expandafter\endcsname
+ \csname#2#3\expandafter\endcsname
+ \csname tbx@e@#2@#3\endcsname{#2}{#3}}{#1}}
+\def\tbx@ListSwap#1#2{#2#1}
+
+\long\def\toolboxFuturelet#1#2{\toolboxTokDef{#2}\tbx@tmp\futurelet#1\tbx@tmp}
+
+\long\def\toolboxGobbleNext#1{\toolboxTokDef{#1}\tbx@tmp
+ \afterassignment\tbx@tmp
+ \let\toolboxToken= }% The space here is important to read spaces properly
+
+\long\def\toolboxIfNextToken#1#2#3{%
+ \toolboxFuturelet\toolboxToken{%
+ \ifx#1\toolboxToken
+ \expandafter\toolboxFirstOfTwo
+ \else
+ \expandafter\toolboxSecondOfTwo
+ \fi{#2}{#3}}}
+
+\long\def\toolboxIfNextGobbling#1#2#3{%
+ \toolboxIfNextToken{#1}{\toolboxGobbleNext{#2}}{#3}}
+
+\long\def\toolboxLoop#1#2{\tbx@item\tbx@i\tbx@I{#1}{#2}}
+\long\def\toolboxLoopName#1#2#3{\tbx@LoopName{#1}iI\tbx@item{#2}{#3}}
+\def\tbx@LoopName#1#2#3#4{%
+ \expandafter#4\csname tbx@#2@#1\expandafter\endcsname
+ \csname tbx@#3@#1\endcsname}
+\long\def\tbx@item#1#2#3#4{%
+ \long\def#1##1{%
+ \toolboxTokDef{##1}\toolboxToken
+ \ifx\toolboxToken\tbx@itemEnd
+ \def#2{\let#1\undefined\let#2\undefined}%
+ \else
+ #4{##1}%
+ \fi
+ #2}%
+ \let#2#1%
+ #1#3\tbx@itemEnd}
+\def\tbx@itemEnd{\tbx@itemEnd}
+
+\long\def\toolboxTokenLoop#1#2{\tbx@token\tbx@t\tbx@T{#1}{#2}}
+\long\def\toolboxTokenLoopName#1#2#3{\tbx@LoopName{#1}tT\tbx@token{#2}{#3}}
+\long\def\tbx@token#1#2#3#4{%
+ \def#1{%
+ \ifx\toolboxToken\tbx@tokenEnd
+ \def#2{\let#1\undefined\let#2\undefined}%
+ \else
+ #4\toolboxToken
+ \fi
+ #2}%
+ \def#2{\afterassignment#1\let\toolboxToken= }%
+ #2#3\tbx@tokenEnd}
+\def\tbx@tokenEnd{\tbx@tokenEnd}
+
+\long\def\toolboxIfEmpty#1{\toolboxIfx{#1}\toolboxEmpty}
+\long\def\toolboxIfX#1#2{\toolboxTokDef{#1}\tbx@ifx\toolboxIfx{#2}\tbx@ifx}
+\long\def\toolboxIfx#1#2{\toolboxTokDef{#1}\tbx@tmp
+ \toolboxIfElse{\ifx\tbx@tmp#2}}
+\long\def\toolboxIfElse#1{#1\expandafter
+ \toolboxFirstOfTwo\else\expandafter\toolboxSecondOfTwo\fi}
+
+\long\def\toolboxTokDef#1#2{\tbx@toks{#1}\edef#2{\the\tbx@toks}}
+
+\def\toolboxDef#1#2{%
+ \tbx@item\tbx@odefa\tbx@odefb{#2}\tbx@odef
+ \let#1\tbx@odeftmp\let\tbx@odeftmp\toolboxEmpty}
+\let\tbx@odeftmp\toolboxEmpty
+\long\def\tbx@odef#1{\expandafter\tbx@odefapp\expandafter{#1}}
+\long\def\tbx@odefapp#1{\tbx@toks\expandafter{\tbx@odeftmp#1}%
+ \edef\tbx@odeftmp{\the\tbx@toks}}
+
+\def\toolboxAppend#1#2{\toolboxDef#1{#1#2}}
+
+\long\def\toolboxSurround#1#2#3{\tbx@toks{#1}%
+ \tbx@toks\expandafter{\the\expandafter\tbx@toks#3#2}%
+ \edef#3{\the\tbx@toks}}
+
+\def\toolboxMakeSplit{%
+ \toolboxIfNextGobbling*\tbx@MakeLong\tbx@MakeShort}
+\long\def\tbx@MakeLong#1#2{%
+ \tbx@SplitNames{#2}%
+ \expandafter
+ \tbx@DoSplitInstance\tbx@splt{#1}\long}
+\def\tbx@MakeShort#1#2{%
+ \tbx@SplitNames{#2}%
+ \expandafter
+ \tbx@DoSplitInstance\tbx@splt{#1}{}}
+\def\tbx@SplitNames#1{%
+ \expandafter
+ \def\expandafter\tbx@splt\expandafter{\csname#1\expandafter\endcsname
+ \csname tbx@#1@spt\expandafter\endcsname
+ \csname tbx@#1@rst\endcsname}}
+\long\def\tbx@DoSplitInstance#1#2#3#4#5{%
+ #5\def#1##1##2##3{%
+ #2##2##3\toolboxEmpty##1#4#4@tbx@spt%
+ \ifx##3\toolboxEmpty
+ \let##3\undefined
+ \else
+ #3##3##1a@tbx@rst%
+ \fi
+ }%
+ #5\def#2##1##2##3#4##4#4##5@tbx@spt{\expandafter
+ \toolboxTokDef\expandafter{##3}##1\toolboxTokDef{##5}##2}%
+ #5\def#3##1##2#4##3@tbx@rst{\tbx@rememberlasta##3@tbx@dropa%
+ \tbx@defwithoutlasta##1##3@tbx@dropa}}
+\long\def\tbx@rememberlasta#1a@tbx@dropa{\toolboxTokDef{#1}\tbx@droplasta
+ \toolboxTokDef{#1a}\tbx@rebuilda}
+\long\def\tbx@defwithoutlasta#1#2@tbx@dropa{\toolboxTokDef{#2}\tbx@originala
+ \ifx\tbx@originala\tbx@rebuilda
+ \let#1\tbx@droplasta
+ \else
+ \expandafter\toolboxTokDef\expandafter{\expandafter{\tbx@droplasta}}#1%
+ \fi}
+
+\def\toolboxFreeSplit#1{%
+ \tbx@SplitNames{#1}%
+ \expandafter
+ \toolboxLoop\expandafter{\tbx@splt}\tbx@freeSplit}
+\def\tbx@freeSplit#1{\let#1\undefined}
+
+\def\toolboxSplitAt{\toolboxIfNextGobbling*\tbx@SplitLong\tbx@SplitShort}
+\long\def\tbx@SplitLong#1#2#3#4{%
+ \tbx@DoSplitInstance\tbx@splt\tbx@splta\tbx@spltb{#2}\long
+ \tbx@splt{#1}{#3}{#4}}
+\def\tbx@SplitShort#1#2#3#4{%
+ \tbx@DoSplitInstance\tbx@splt\tbx@splta\tbx@spltb{#2}{}%
+ \tbx@splt{#1}{#3}{#4}}
+
+\long\def\toolboxReplaceSplit#1#2#3{%
+ \toolboxTokDef{#1}\tbx@reptext
+ \expandafter
+ \tbx@replace\expandafter{#3}{\let#3\toolboxEmpty}#3#2\tbx@reptext}
+\long\def\tbx@replace#1#2#3#4#5{#2%
+ #4{#1}\tbx@repla\tbx@replb
+ \toolboxIfElse{\ifx\tbx@replb\undefined}%
+ {\toolboxDef#3{#3\tbx@repla}}%
+ {\toolboxDef#3{#3\tbx@repla#5}%
+ \expandafter\tbx@replace\expandafter{\tbx@replb}{}#3#4#5}}
+\long\def\toolboxReplace#1#2{%
+ \tbx@DoSplitInstance\tbx@splt\tbx@splta\tbx@spltb{#1}\long
+ \toolboxReplaceSplit{#2}\tbx@splt}
+\def\toolboxMakeHarmless#1{\edef#1{\tbx@Nearverbatim#1}}
+\def\tbx@Nearverbatim{\expandafter\tbx@Meaning\meaning}
+\long\def\tbx@Meaning#1>{}
+
+\def\toolboxDropBrace#1{\expandafter\tbx@ForgetBrace#1@tbx@dropbrace#1}
+\long\def\tbx@ForgetBrace#1@tbx@dropbrace#2{\toolboxTokDef{#1}#2}
+
+\long\def\toolboxIf#1#2#3{%
+ \ifx#1#3\def\tbx@tmp{#2#3}\else\def\tbx@tmp{#2\tbx@tmp}\fi\tbx@tmp}
+
+\def\toolboxNewiftrue#1{\tbx@newifexec{#1}{\csname#1true\endcsname}}
+\def\toolboxNewiffalse#1{\tbx@newifexec{#1}{\csname#1false\endcsname}}
+\def\toolboxNewifTrue#1{\tbx@newifexec{#1}{}\csname#1true\endcsname}
+\def\toolboxNewifFalse#1{\tbx@newifexec{#1}{}\csname#1false\endcsname}
+\def\tbx@newifexec#1#2{\expandafter
+ \ifx\csname if#1\endcsname\relax
+ \expandafter\tbx@newif\csname if#1\endcsname{#1}%
+ #2%
+ \fi}
+\def\tbx@newif#1#2{%
+ \expandafter
+ \def\csname#2true\endcsname{\let#1\iftrue}%
+ \expandafter
+ \def\csname#2false\endcsname{\let#1\iffalse}}
+
+\def\toolboxWithNr#1#2#3{\expandafter#2\csname #3#1\endcsname}
+\def\toolboxLet#1#2{\expandafter\let\expandafter#1\csname #2\endcsname}
+
+\endinput
+%%
+%% End of file `toolbox.sty'.