summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/catoptions
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-12-21 23:44:26 +0000
committerKarl Berry <karl@freefriends.org>2011-12-21 23:44:26 +0000
commit735d23a7da30c06020104501e6df02d1786133f0 (patch)
tree8ca806310f14c6e0f76d432beed27896bd846885 /Master/texmf-dist/tex/latex/catoptions
parent117036c8b17ada73b5a49c31661201ffdf6a55d8 (diff)
catoptions 0.2.7b (19dec11)
git-svn-id: svn://tug.org/texlive/trunk@24899 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/catoptions')
-rw-r--r--Master/texmf-dist/tex/latex/catoptions/catoptions-guide.cfg5
-rw-r--r--Master/texmf-dist/tex/latex/catoptions/catoptions.sty132
2 files changed, 49 insertions, 88 deletions
diff --git a/Master/texmf-dist/tex/latex/catoptions/catoptions-guide.cfg b/Master/texmf-dist/tex/latex/catoptions/catoptions-guide.cfg
index ab07f1f6b87..538fac72380 100644
--- a/Master/texmf-dist/tex/latex/catoptions/catoptions-guide.cfg
+++ b/Master/texmf-dist/tex/latex/catoptions/catoptions-guide.cfg
@@ -1,7 +1,8 @@
\ProvidesFile{catoptions-guide.cfg}%
- [2011/12/07 v0.2.7a Configuration file for catoptions-guide.tex (AM)]
+ [2011/12/17 v0.2.7b Configuration file for catoptions-guide.tex (AM)]
+
\cptloadpackages{%
- n-xwatermark|printwatermark;
+ xwatermark|printwatermark;
array;
colortbl;
ltablex;
diff --git a/Master/texmf-dist/tex/latex/catoptions/catoptions.sty b/Master/texmf-dist/tex/latex/catoptions/catoptions.sty
index 86d5a87a1dd..1678941a59a 100644
--- a/Master/texmf-dist/tex/latex/catoptions/catoptions.sty
+++ b/Master/texmf-dist/tex/latex/catoptions/catoptions.sty
@@ -1,5 +1,5 @@
%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++%
-% This is 'catoptions' package, version 0.2.7a, 2011/12/07. %
+% This is 'catoptions' package, version 0.2.7b, 2011/12/17. %
% %
% The catoptions package changes LaTeX package loading internals %
% so that all subsequently loaded packages can rely on having %
@@ -86,8 +86,14 @@
\catcode126=13
\AtEndOfPackage{%
\newletcsset{%
+ \dofunclist=\cptdofunclist,
\docommalist=\cptdocommalist,
\newvariables=\cptnewvariables,
+ \stripallouterbraces=\cptstripallouterbraces,
+ \stripouterbraces=\cptstripNouterbraces,
+ \gobble@to@relax=\cptgobbletorelax,
+ \cpt@gobbletorelax=\cptgobbletorelax,
+ \cpt@gobbletorelax@fi@endgroup=\cptbgobbletorelax
}%
}
\edef\cpt@hashchar{\string#}
@@ -101,7 +107,7 @@
\chardef\active=13
\NeedsTeXFormat{LaTeX2e}[2011/06/27]
\ProvidesPackage{catoptions}
- [2011/12/07 v0.2.7a Securing catcodes and parsing options (AM)]
+ [2011/12/17 v0.2.7b Securing catcodes and parsing options (AM)]
\ifcase%
\ifx\eTeXversion\cpt@undefined\z@pt\else
\ifnum\eTeXversion<\tw@\z@pt\else\@ne\fi\fi
@@ -110,7 +116,7 @@
\expandafter\endinput
\fi
% \ifcsdefinable, \cpt@starorlong, \cptcommanormalize, etc,
-% change later:
+% change later on:
\@ifdefinable\ifcsdefinable{\let\ifcsdefinable\@ifdefinable}
\@ifdefinable\ifdefinablelet\relax
\protected\def\ifdefinablelet#1{\ifcsdefinable#1\relax\let#1}
@@ -177,6 +183,9 @@
{\expandafter\newcount\csname#1##1\endcsname}%
}%
}
+\newcommand*\cptnewcounters[2][]{%
+ \cptfor#2\dofor{\newcounter{#1##1}}%
+}
\newcommand*\cptnewdimens[2][]{%
\cptfor#2\dofor{%
\expandafter\ifcsdefinable\csname#1##1\endcsname
@@ -829,7 +838,6 @@
{\detokenize{macro parameter character}}
{\meaning\@let@token}%
}
-
\begingroup
\uccode`\~=`\,%
\uppercase{\endgroup
@@ -960,9 +968,6 @@
\cpt@tempb\cpt@tempa
}
\endgroup
-
-% We need the equivalent of '\protected\let' and we want to be able to
-% do \shelllet\x=\y:
\robust@def*\shelllet#1{\cpt@ifeql{\cpt@shelllet{#1}}{\cpt@shelllet{#1}}}
\robust@def*\cpt@shelllet#1#2{%
\ifblankTF{#2}{%
@@ -989,6 +994,7 @@
\new@def*\ifdocstartedTF{%
\ifdefTF\cpt@docstarted\iofii\iiofii
}
+
\long\def\@gobblethree#1#2#3{}
\long\def\@firstofthree#1#2#3{#1}
\long\def\@secondofthree#1#2#3{#2}
@@ -999,8 +1005,8 @@
\new@def\cpt@car#1#2\car@nil{#1}
\new@def\cpt@cdr#1#2\cdr@nil{#2}
\ifcsdefinable\cpt@relax{\let\cpt@relax\relax}
-\new@def\cpt@gobbletorelax#1\cpt@relax{}
-\new@def\cpt@gobbletorelax@fi@endgroup\fi#1\cpt@relax{\fi\endgroup}
+\new@def\cptgobbletorelax#1\cpt@relax{}
+\new@def\cptbgobbletorelax\fi#1\cpt@relax{\fi\endgroup}
\new@def\cpt@removetonnil#1\cpt@nnil{}
\new@def\cpt@catchtonnil#1\cpt@nnil{#1}
\new@def\cpt@removetodot#1.{}
@@ -1082,7 +1088,7 @@
\expandafter\@secondoftwo\else\expandafter\@firstoftwo\fi
{%
\ifnum\cpt@pdfstrcmp{\expandafter\@car\detokenize{#1}\@nil}%
- \leftbracechar=\z@pt
+ \cpt@leftbracechar=\z@pt
\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi
}{%
\@secondoftwo
@@ -1169,6 +1175,7 @@
\ifdefboolFT{cpt@st}{}{\let#2=\cpt@rsvda}%
}%
}
+% \cptnewvariables{<type>}[<prf>]{<variables>}[<state/value>]
\robust@def*\cptnewvariables#1{\cpt@testopt{\cpt@newvariables{#1}}{}}
\robust@def*\cpt@newvariables#1[#2]#3{%
\edef\reserved@a{\noexpand\cpt@testopt{%
@@ -1182,7 +1189,7 @@
}%
\edef\cpt@tempb{\ifstrcmpTF{#1}{if}{if}{}}%
\cptfor#3\dofor{%
- \ifblankTF{##1}\cpt@gobbletorelax\relax
+ \ifblankTF{##1}\cptgobbletorelax\relax
\ifnamedefTF{\cpt@tempb#2##1}{%
\edef\undefinablecs{\cpt@tempb#2##1}%
\ifstrcmpTF{#1}{tog}{}{\cpt@notdefinable}%
@@ -1319,7 +1326,9 @@
\new@def*\xifdefTF#1{\cptexpandarg\ifdefTF{#1}}
\new@def*\xifdefFT#1{\cptexpandarg\ifdefFT{#1}}
\new@def*\ifcsndefTF#1{%
- \ifblankTF{#1}\@gobble{%
+ \ifblankTF{#1}{%
+ \expandafter\@secondoftwo\@gobble
+ }{%
\ifcsname#1\endcsname
\expandafter\@firstofone
\else
@@ -1361,15 +1370,7 @@
\robust@def*\ltxmsg@info{\@latex@info@no@line}
\robust@def*\ltxmsg@err{\@latex@error}
\robust@redef\cpt@testopt#1#2{\ifnextcharTF[{#1}{#1[{#2}]}}
-% Eg, \def\csa{\cpt@testcharopt\csb<{default}>}
-% \def\csb<#1>{...}
\robust@def*\cpt@testcharopt#1#2#3#4{\ifnextcharTF#2{#1}{#1#2{#3}#4}}
-
-% Expandable \@testopt:
-% Eg, \def\macroa#1{\cpt@xtestopt{#1}\macrob{Mr.}}
-% \def\macrob[#1]#2{#1 #2}
-% \edef\testa{\macroa{John Johnson}}
-% \edef\testb{\macroa[Dr.]{Haiki Heiki}}
\new@def*\cpt@xtestopt#1#2#3{%
\cpt@xifbrack#1\\[\\{#2#1}{#2[{#3}]{#1}}%
}
@@ -1377,10 +1378,6 @@
\ifcat$\detokenize{#1#2}$\expandafter\@firstoftwo
\else\expandafter\@secondoftwo\fi
}
-% Eg, \def\macroa{\cpt@newxtestopt\macrob{Mr.}}
-% \def\macrob[#1]#2{#1 #2}
-% \edef\testa{\expandafter\macroa\activespace{John Johnson}}
-% \edef\testb{\macroa[Dr.]{Haiki Heiki}}
\new@def*\cpt@newxtestopt#1#2#3{%
\ifstrcmpTF{ }{#3}{%
\cpt@newxtestopt#1{#2}%
@@ -1648,7 +1645,7 @@
\gletcs#1\cpt@tempa
\endgroup
}
-\robust@def*\dofunclist{%
+\robust@def*\cptdofunclist{%
\pushnumber\dofunclistdepth
\begingroup
\edef\sav@do{\cptmakecs{sav@do@\cptrm\dofunclistdepth}}%
@@ -1969,8 +1966,6 @@
\expandafter\csv@@loop\reserved@a[#1]{#2}%
\postgroupdef\cptelemnr\endgroup
}
-% Eg, \ifelemcountTF[;](>)[2]{a;b;c}{T}{F};
-% * -> #4 is a macro
\robust@def*\ifelemcountTF{\cpt@teststopt\cpt@ifelemcount@a,}
\robust@def*\cpt@ifelemcount@a[#1]{%
\cpt@testpnopt{\cpt@ifelemcount@b{#1}}=%
@@ -2170,11 +2165,8 @@
\new@def\cpt@iterate\@gobble#1{%
#1\relax\expandafter\cpt@iterate\fi\@gobble{#1}%
}
-\new@def\cptwhilecond#1\fi#2{%
- #1\relax#2\relax\cptswap{\cpt@whilecond{#1\relax#2\relax}\fi}\fi
-}
-\new@def\cpt@whilecond#1\fi{%
- #1\expandafter\cpt@whilecond\else\@gobbletwo\fi{#1}\fi
+\new@def\cptwhileexpr#1\do#2{%
+ #1\cptswap{#2\cptwhileexpr{#1}\do{#2}}\fi
}
\new@def*\cpt@numlt#1<{#1<\numexpr}
\new@def*\cpt@numgt#1>{#1>\numexpr}
@@ -2184,25 +2176,13 @@
\new@def*\cpt@dimeq#1={#1=\dimexpr}
\new@def*\cptwhilenum#1\do#2{%
\ifnum\numexpr\cpt@numlt\cpt@numgt\cpt@numeq#1%
- \cpt@removetonnil<=>\cpt@nnil\relax#2\relax
- \cptswap{\cpt@whilenum{#1}{\relax#2\relax}}\fi
-}
-\new@def*\cpt@whilenum#1#2{%
- \ifnum\numexpr\cpt@numlt\cpt@numgt\cpt@numeq#1%
- \cpt@removetonnil<=>\cpt@nnil#2%
- \expandafter\cpt@whilenum\else
- \expandafter\@gobbletwo\fi{#1}{#2}%
+ \cpt@removetonnil<=>\cpt@nnil\relax
+ \cptswap{#2\cptwhilenum{#1}\do{#2}}\fi
}
\new@def*\cptwhiledim#1\do#2{%
\ifdim\dimexpr\cpt@dimlt\cpt@dimgt\cpt@dimeq#1%
- \cpt@removetonnil<=>\cpt@nnil\relax#2\relax
- \cptswap{\cpt@whiledim{#1}{\relax#2\relax}}\fi
-}
-\new@def*\cpt@whiledim#1#2{%
- \ifdim\dimexpr\cpt@dimlt\cpt@dimgt\cpt@dimeq#1%
- \cpt@removetonnil<=>\cpt@nnil#2%
- \expandafter\cpt@whiledim\else
- \expandafter\@gobbletwo\fi{#1}{#2}%
+ \cpt@removetonnil<=>\cpt@nnil\relax
+ \cptswap{#2\cptwhiledim{#1}\do{#2}}\fi
}
\new@def*\ifnumcmpTF#1#{%
\usename{@\ifnum\numexpr\cpt@numlt\cpt@numgt\cpt@numeq#1%
@@ -2555,7 +2535,7 @@
}{%
\ifsingletokenTF{#1}{%
\xifinsetTF{\detokenize{#1}}\cpt@parserlist{%
- #2% Don't put \relax here!
+ #2%
}{%
\cpt@listparsererr{#1}%
}%
@@ -2662,8 +2642,6 @@
\ifblankTF{#2}{0 #3#1}{\cpt@fullexpand{#2}{#3#1}}%
}
\endgroup
-
-% [<fallback>]{<teststr>}{<{str1}{act1}{str2}{act2}...>}
\new@def*\cptifstreqcase#1{\cpt@xtestopt{#1}\cpt@ifstreqcase{}}
\new@def\cpt@ifstreqcase[#1]#2#3{%
\expandafter\cptswapbracefirst\expandafter{#2}%
@@ -2690,7 +2668,6 @@
}%
}%
}
-% [<default act>]{<teststr>}{<{str1}{act1}{str2}{act2}...>}
\new@def*\cptifstrpresentcase#1{\cpt@xtestopt{#1}\cpt@ifstrincase{}}
\new@def\cpt@ifstrincase[#1]#2#3{%
\expandafter\cptswapbracefirst\expandafter{#2}%
@@ -2706,29 +2683,6 @@
\new@def\all@to@endif#1\endif{#1}
\new@def\first@to@endif#1#2\endif{#1}
\new@def*\ifcassenumcmpTF#1#2#3{\ifdimcmpTF#1pt#2pt{#3}}
-% Eg,
-% \edef\x{%
-% \cptifcasse\ifcassestrcmpTF{teststr}
-% {str1}{case1 callback}
-% {str2}{case2 callback}
-% \elseif
-% no match
-% \endif
-% }
-% \edef\x{%
-% \cptifcasse\ifcassenumcmpTF{testnum}
-% {=2}{equal to 2}
-% {<3}{less than 3}
-% {>4}{greater than 4}
-% \elseif
-% no match
-% \endif
-% }
-% The omparator command is any test command that yields
-% <iofii> or <iiofii> but \ifnumcmpTF can't be used directly.
-% Use \ifcassenumcmpTF instead. The user can also define his own
-% logical test command and pass it to \cptifcasse, eg,
-% \def\test#1#2{\ifinsetTF{#2}{#1}}
\new@def*\cptifcasse#1#2{%
\ifstrcmpTF{#1}\elseif{%
\all@to@endif
@@ -2980,7 +2934,6 @@
\csv@@parse[#1]{#3}%
\postgroupdef#2\endgroup
}
-% \cptreplaceoneelement[<parser>]{<cs>}{<search>}{<replace>}
\robust@def*\cptreplaceoneelement{\cpt@teststopt\cpt@replaceoneelement,}
\robust@def\cpt@replaceoneelement[#1]#2#3#4{%
\begingroup
@@ -3128,7 +3081,7 @@
}{}%
\begingroup
\ifcat$\detokenize\expandafter\expandafter\expandafter
- {\expandafter\@gobble#2.}$\cpt@gobbletorelax@fi@endgroup\fi
+ {\expandafter\@gobble#2.}$\cptbgobbletorelax\fi
\def\reserved@e##1#1{%
\edef\reserved@a{\unexpanded\expandafter{\@gobble##1}}%
\ifx\reserved@a\@empty
@@ -3205,17 +3158,17 @@
{#3}{#1}{#2}%
}
\robust@def\cptstripallouterbraces#1#2{%
- \edef#2{\unexpanded\cptthreexp{\cpt@stripallouterbraces{#1}}}%
+ \edef#2{\unexpanded\cptthreexp{\cpt@stripallouterbraces#1\strip@nil}}%
}
\newletcs\cptstripallbr\cptstripallouterbraces
\robust@def\cptstripallouterbracesincs#1{%
\expandafter\cptstripallouterbraces\expandafter{#1}#1%
}
\newletcs\cptstripallbrincs\cptstripallouterbracesincs
-\robust@def\cpt@stripallouterbraces#1{%
+\robust@def\cpt@stripallouterbraces#1\strip@nil{%
\romannumeral\ifbracedTF{#1}{%
\expandafter\ifnullTF\expandafter{\@gobble#1}{%
- \expandafter\@gobble\cpt@stripallouterbraces#1%
+ \expandafter\@gobble\cpt@stripallouterbraces#1\strip@nil
}{0 #1}%
}{0 #1}%
}
@@ -3347,7 +3300,6 @@
\catcode`\{\@ne
\catcode`\}\tw@
}
-% #1 must be a non-parametered macro:
\robust@def*\cptscantokens#1{%
\begingroup
\edef#1{\long\def\string#1{\cptoxdetok{#1}}}%
@@ -3820,6 +3772,7 @@
\RequirePackage{#1}[#2]%
}%
}
+% If package has been loaded with <options>.
% \ifpackagewithoptionsTF{<package>}{<options>}
\robust@def*\ifpackagewithoptionsTF{\cpt@ifoptions\@pkgextension}
\robust@def*\ifclasswithoptionsTF{\cpt@ifoptions\@clsextension}
@@ -3852,6 +3805,7 @@
\ifboolTF{cpt@choicefd}
{\endgroup\@firstoftwo}{\endgroup\@secondoftwo}%
}
+% If package was later loaded (before begin-document).
% \ifpackageloadedlaterTF{<package>}{<true>}{<false>}
\robust@def*\ifpackageloadedlaterTF{\cpt@ifpkgloadedlater\@pkgextension}
\robust@def*\ifclassloadedlaterTF{\cpt@ifpkgloadedlater\@clsextension}
@@ -4025,13 +3979,16 @@
\cpt@normalizelist{#1}{#2}%
}
\ifcsdefinable\normalized@list\relax
+
+\begingroup
+\catcode`\^=3
\robust@gdef\cpt@normalizelist#1#2{%
\begingroup
\let\if@nmlzst\ifcpt@st
\cpt@stchoose{cpt@st}{#2}\reserved@e\cpt@normalizelist
\ifx\reserved@e\@empty
\def\normalized@list{}%
- \cpt@gobbletorelax@fi@endgroup
+ \cptbgobbletorelax
\fi
\cpt@ch@cklistparser{#1}%
\expandafter\setup@parser@nmlz\string#1%
@@ -4044,10 +4001,10 @@
\nmlz@activeequal
\nmlz@spaceletter=%
\nmlz@letterspace=%
- \toks@\expandafter{\the\toks@^?^}%
+ \toks@\expandafter{\the\toks@^?}%
\nmlz@doubleletter=%
\cpt@commaequalerr
- \def\reserved@a##1^?^##2\cpt@nil{\toks@{##1##2}}%
+ \def\reserved@a##1^?##2\cpt@nil{\toks@{##1##2}}%
\expandafter\reserved@a\the\toks@\cpt@nil
}%
\edef\normalized@list{\the\toks@}%
@@ -4061,6 +4018,8 @@
}%
\cpt@relax
}
+\endgroup
+
\def\setup@parser@nmlz#1{%
\begingroup
\uccode`\~=`#1%
@@ -5312,8 +5271,8 @@
\cptdocommalist{#1}{\cpt@rem@vevalues{##1}}%
}
\robust@def*\cpt@rem@vevalues#1{%
- \ifcseqTF#1\@empty\cpt@gobbletorelax\relax
- \xifinsetTF{=}{\cptoxdetok{#1}}{}\cpt@gobbletorelax
+ \ifcseqTF#1\@empty\cptgobbletorelax\relax
+ \xifinsetTF{=}{\cptoxdetok{#1}}{}\cptgobbletorelax
\begingroup
\def\cpt@resa{}%
\def\cpt@resb##1=##2\cpt@nil{%
@@ -5453,6 +5412,7 @@
}%
\ifdefTF\cpt@documentclass\endgroup\cpt@tempa
}
+
\cptonlypreamble{%
\cptonlypreamble,\cpt@getdocumentclass,\cptloadpackages,
\ifpackagewithoptionsTF,\ifclasswithoptionsTF,\cpt@ifoptions,