summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/keycommand
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-04-29 13:41:50 +0000
committerKarl Berry <karl@freefriends.org>2010-04-29 13:41:50 +0000
commitf7ccaa5d547012cb2beaaa0d0c1540d18eca1124 (patch)
treeb300a6fca2f8665034403f4067c805d21971fa05 /Master/texmf-dist/tex/latex/keycommand
parent3793428328652bd18a288a1ab5bd9f5aac85d765 (diff)
keycommand 3.1415 (27apr10)
git-svn-id: svn://tug.org/texlive/trunk@18042 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/keycommand')
-rw-r--r--Master/texmf-dist/tex/latex/keycommand/keycommand.sty154
1 files changed, 94 insertions, 60 deletions
diff --git a/Master/texmf-dist/tex/latex/keycommand/keycommand.sty b/Master/texmf-dist/tex/latex/keycommand/keycommand.sty
index 3bf7e801bd1..ecf16bc2f64 100644
--- a/Master/texmf-dist/tex/latex/keycommand/keycommand.sty
+++ b/Master/texmf-dist/tex/latex/keycommand/keycommand.sty
@@ -8,7 +8,7 @@
%%
%% This is a generated file.
%%
-%% keycommand : key-value interface for commands and environments in LaTeX [v3.141 2010/04/25]
+%% keycommand : key-value interface for commands and environments in LaTeX [v3.1415 2010/04/27]
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
@@ -27,7 +27,7 @@
\NeedsTeXFormat{LaTeX2e}% LaTeX 2.09 can't be used (nor non-LaTeX)
[2005/12/01]% LaTeX must be 2005/12/01 or younger (see kvsetkeys.dtx).
\ProvidesPackage{keycommand}
- [2010/04/18 v3.14 - key-value interface for commands and environments in LaTeX]
+ [2010/04/27 v3.1415 - key-value interface for commands and environments in LaTeX]
\def\kcmd@pkg@name{keycommand}
\RequirePackage{etex,kvsetkeys,xkeyval,etoolbox}
\protected\def\kcmd@Xsetkeys{\XKV@sttrue\XKV@plfalse\XKV@testoptc\XKV@setkeys}% in case \setkeys
@@ -167,61 +167,73 @@
\ifcsundef{#1.keylist}{}
{\expandafter\expandafter\expandafter\docsvlist
\expandafter\expandafter\expandafter{%
- \csname #1.keylist\endcsname}}%
+ \csname#1.keylist\endcsname}}%
}
\protected\long\def\kcmd@def#1#2[#3][#4][#5]#6#7{%
- \ifx#1\kcmd@donot@provide\else
- \@ifdefinable#1{\kcmd@defcommand#1[{#3}][{#4}][{#5}]{#6}{#2}{#7}}%
+ \ifx#1\kcmd@donot@provide \endgroup
+ \else
+ \@tempswafalse\@ifdefinable#1{\@tempswatrue}%
+ \if@tempswa
+ \edef\kcmd@fam{\kcmd@keyfam{#1}}%
+ \expandafter\kcmd@defcommand\expandafter{\kcmd@fam}#1[{#3}][{#4}][{#5}]{#6}{#2}{#7}%
+ \else\endgroup
+ \fi
\fi
}
-\protected\long\def\kcmd@defcommand#1[#2][#3][#4]#5#6#7{%
- \edef\kcmd@fam{\kcmd@keyfam{#1}}\let\commandkey\relax\let\getcommandkey\relax
- \let#1\relax \cslet\kcmd@fam\relax
- \def\do{\kcmd@undefinekey{\kcmd@gbl}{\kcmd@fam}}%
+\protected\long\def\kcmd@defcommand#1#2[#3][#4][#5]#6#7#8{%
+ \let\commandkey\relax \let\getcommandkey\relax \let#2\relax
+ \cslet{#1}\relax \cslet{#1.commankey}\relax \cslet{#1.getcommandkey}\relax
+ \def\do{\kcmd@undefinekey{\kcmd@gbl}{#1}}%
\edef\kcmd@defcommand{\endgroup
- \kcmd@undefinekeys{\kcmd@gbl}{\kcmd@fam}% undefines all keys for this keycommand family
+ \kcmd@undefinekeys{\kcmd@gbl}{#1}% undefines all keys for this keycommand family
\ifx\kcmd@unexpandchar\@empty\else
- \kcmd@mount@unexpandchar{\kcmd@fam}{\unexpanded\expandafter{\kcmd@unexpandchar}}%
+ \kcmd@mount@unexpandchar{#1}{\unexpanded\expandafter{\kcmd@unexpandchar}}%
\fi
- \unexpanded{\kv@parse{#2,#3}}{\kcmd@definekey\noexpand#1{\kcmd@gbl}{\kcmd@fam}}% defines keys
- \csdef{\kcmd@fam.commandkey}####1{\noexpand\csname\kcmd@fam @####1\endcsname}%
- \csdef{\kcmd@fam.getcommandkey}####1{%
+ \unexpanded{\kv@parse{#3,#4}}{\kcmd@definekey\noexpand#2{\kcmd@gbl}{#1}}% defines keys
+ \csdef{#1.commandkey}####1{\noexpand\csname#1@####1\endcsname}%
+ \csdef{#1.getcommandkey}####1{%
\unexpanded{\unexpanded\expandafter\expandafter\expandafter}{%
- \noexpand\csname\kcmd@fam @####1\endcsname}}%
+ \noexpand\csname#1@####1\endcsname}}%
\kcmd@ifplus% \newkeycommand+ / \newkeyenvironment+
- \csdef{\kcmd@fam}{%
- \kcmd@yargedef{\kcmd@gbl}{\kcmd@long}\csname\kcmd@fam\endcsname
- {\number#4}{\noexpand#6}{\csname\kcmd@fam.unexpandchar\endcsname}}%
- \ifx#6\@gobble\else \def#6{% that means we have to define a key-environment
- \kcmd@yargedef{\kcmd@gbl}{\kcmd@long}{#6}%
- 0\relax{\csname\kcmd@fam.unexpandchar\endcsname}}%
+ \protected\csdef{#1}{%
+ \kcmd@yargedef{\kcmd@gbl}{\kcmd@long}\csname#1\endcsname
+ {\number#5}{\noexpand#7}{\csname#1.unexpandchar\endcsname}}%
+ \ifx#7\@gobble\else
+ \protected\def#7{\kcmd@yargedef#7}%
\fi
\else% \newkeycommand / \newkeyenvironment
- \csdef{\kcmd@fam}{%
- \kcmd@yargdef{\kcmd@gbl}{\kcmd@long}\csname\kcmd@fam\endcsname
- {\number#4}{\noexpand#6}}%
- \ifx#6\@gobble\else \def#6{% that means we have to define a key-environment
- \kcmd@yargdef{\kcmd@gbl}{\kcmd@long}{#6}0\relax}%
+ \csdef{#1}{%
+ \kcmd@yargdef{\kcmd@gbl}{\kcmd@long}\csname#1\endcsname
+ {\number#5}{\noexpand#7}}%
+ \ifx#7\@gobble\else \def#7####1{% that means we have to define a key-environment
+ \def#7{%
+ \let\getcommandkey\csname#1.getcommandkey\endcsname
+ \let\commandkey\csname#1.commandkey\endcsname
+ ####1}%
+ }%
\fi
\fi
- \let\commandkey\relax\let\getcommandkey\relax\let#1\relax
- \def\noexpand\do####1{\unexpanded{\expandafter\noexpand\csname}KV@\kcmd@fam @####1@default%
+ \def\noexpand\do####1{\unexpanded{\expandafter\noexpand\csname}KV@#1@####1@default%
\endcsname}%
- \kcmd@gbl\protected\edef#1{% entry point
- \let\getcommandkey\unexpanded{\expandafter\noexpand\csname}\kcmd@fam.getcommandkey%
- \endcsname
+ \let\commandkey\relax \let\getcommandkey\relax \let#2\relax
+ \kcmd@gbl\protected\edef#2{% entry point
+ \let\getcommandkey\noexpand\noexpand\csname#1.getcommandkey\endcsname
\kcmd@ifplus \let\commandkey\getcommandkey
- \else \letcs\commandkey{\kcmd@fam.commandkey}%
+ \else \let\commandkey\noexpand\noexpand\csname#1.commandkey\endcsname
+ \fi
+ \noexpand\kcmd@setdefaults{#1}%
+ \ifx#7\@gobble \noexpand\noexpand\noexpand\@testopt
+ {\kcmd@setkeys#2{#1}{\kcmd@otherkey{#4}}}{}%
+ \else \noexpand\noexpand\noexpand\@testopt
+ {\kcmd@setkeys#2{#1}{\kcmd@otherkey{#4}}}{}%
\fi
- \noexpand\kcmd@setdefaults{\kcmd@fam}%
- \noexpand\noexpand\noexpand\@testopt{%
- \kcmd@setkeys#1{\kcmd@fam}{\kcmd@otherkey{#3}}}{}
}%
- \csname\kcmd@fam\endcsname% expand \kcmd@yargedef or \kcmd@yargdef
- }\kcmd@defcommand{#5}{#7}% #5 = definition, #7 = definition end-envir
+ \csname#1\endcsname% expand \kcmd@yargedef or \kcmd@yargdef
+ }\kcmd@defcommand{#6}{#8}% #6 = definition, #8 = definition end-envir
+}
+\protected\long\def\kcmd@setkeys#1#2#3[#4]{% #1=key-command, #2=family, #3=otherkey, #4=key=value pairs
+ \kcmd@normalize@setkeys{#1}{#2}{#3}{#4}\csname#2\endcsname
}
-\protected\long\def\kcmd@setkeys#1#2#3[#4]{%
- \kcmd@normalize@setkeys{#1}{#2}{#3}{#4}\csname#2\endcsname}
\long\def\kcmd@otherkey#1{\kcmd@nbk#1//{\kcmd@otherkey@name#1=\kcmd@nil}{}//}
\long\def\kcmd@otherkey@name#1=#2\kcmd@nil{#1}
\protected \def \kcmd@mount@unexpandchar#1#2{%
@@ -240,29 +252,51 @@
}\kcmd@yargd@f 0##1##2##3##4##5##6##7##8##9###4%
}
\protected \def \kcmd@yargedef#1#2#3#4#5#6{\begingroup
- \expandafter\let\expandafter\kcmd@nargs\csname kcmd@#4of9\endcsname
- \long\def\kcmd@yarg@edef##1##2{\afterassignment#5\endgroup
- #1\edef#3{\begingroup #6%
- #2\edef\unexpanded{#3##2}{\endgroup\unexpanded{##1}%
- }\noexpand#3}%
+ \kcmd@nargs{#4}%
+ \protected\long\def\kcmd@yarg@edef##1##2{\endgroup
+ #1\edef#3{\begingroup #6%
+ #2\edef#3\unexpanded{##2}{\endgroup\unexpanded{##1}%
+ }#3}%
}%
- \protected\def\kcmd@yarg@body{\edef\body{\unexpanded\expandafter\expandafter\expandafter{%
- \expandafter#3\kcmd@nargs{{####1}}{{####2}}{{####3}}{{####4}}{{####5}}{{####6}}{{####7}}{{####8}}{{####9}}}%
- }\expandafter\kcmd@yarg@edef\expandafter{\body}}%
- \def\kcmd@yarged@f##1#4##2##{%
- \edef\kcmd@yargedef@next{\kcmd@yarg@body{\expandonce{\@gobble ##1#4}}}%
- \afterassignment\kcmd@yargedef@next
- \expandafter\def\expandafter#3\@gobble ##1#4%
- }\kcmd@yarged@f 0##1##2##3##4##5##6##7##8##9###4%
-}
-\def\do#1{%
- \def\kcmd@XofNine##1#1##2##{%
- \expandafter\csedef{kcmd@#1of9}####1####2####3####4####5####6####7####8####9{%
- \@gobble ##1#1}%
- }\kcmd@XofNine 0##1##2##3##4##5##6##7##8##9###1{}%
+ \protected\def\kcmd@envir##1{%
+ \edef\next{\kcmd@yarg@edef{\def\noexpand#5{\expandonce{#5##1}}\expandonce{#3##1}}}\next
+ }%
+ \protected\def\kcmd@command##1{%
+ \edef\next{\kcmd@yarg@edef{\expandonce{#3##1}}}\next
+ }%
+ \protected\def\kcmd@yargedef##1{%
+ \kcmd@yargedef@##1 0####1####2####3####4####5####6####7####8####9#####4%
+ }%
+ \ifx#5\@gobble % keycommand
+ \def\next{\kcmd@command}%
+ \else % key-environmment
+ \def\next{\kcmd@envir}%
+ \fi
+ \let\@next\relax
+ \def\kcmd@yargedef@##1##2#4##3##{%
+ \ifx\@next\relax
+ \edef\@next{\next{\expandonce{\kcmd@nargs}}{\expandonce{\@gobble##2#4}}}%
+ \ifx#5\@gobble \edef\@next{\expandonce\@next\noexpand#5}%
+ \else \edef\@next{\edef\noexpand\@next{\noexpand\unexpanded{\expandonce\@next}}#5}%
+ \fi
+ \fi
+ \afterassignment\@next
+ \expandafter\def\expandafter##1\@gobble##2#4%
+ }%
+ \kcmd@yargedef#3%
}
-\docsvlist{1,2,3,4,5,6,7,8,9,0}
-\undef\kcmd@XofNine
+\def\kcmd@nargs#1{\edef\kcmd@nargs%##1##2##3##4##5##6##7##8##9%
+ {\ifnum#1>0{####1%
+ \ifnum#1>1}{####2%
+ \ifnum#1>2}{####3%
+ \ifnum#1>3}{####4%
+ \ifnum#1>4}{####5%
+ \ifnum#1>5}{####6%
+ \ifnum#1>6}{####7%
+ \ifnum#1>7}{####8%
+ \ifnum#1>8}{####9%
+ \fi\fi\fi\fi\fi\fi\fi\fi}\fi}%
+}%
\newrobustcmd*\newkeycommand{\begingroup
\let\kcmd@gbl\@empty\kcmd@star@or@long\new@keycommand}
\newrobustcmd*\renewkeycommand{\begingroup