summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/keycommand
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-04-14 00:25:48 +0000
committerKarl Berry <karl@freefriends.org>2010-04-14 00:25:48 +0000
commit724018f893698d0a71294ce43f49ce39184056bf (patch)
tree7f229089f752620c446c5be9bd58c9ff0a9abdd1 /Master/texmf-dist/tex/latex/keycommand
parent80e6a095ae76c52f406ac9331721cb5426f4a3f4 (diff)
keycommand update (12apr10)
git-svn-id: svn://tug.org/texlive/trunk@17850 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/keycommand')
-rw-r--r--Master/texmf-dist/tex/latex/keycommand/keycommand.sty68
1 files changed, 39 insertions, 29 deletions
diff --git a/Master/texmf-dist/tex/latex/keycommand/keycommand.sty b/Master/texmf-dist/tex/latex/keycommand/keycommand.sty
index fbb8b0f007d..8683f1fd7c2 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.0 2010/03/28]
+%% keycommand : key-value interface for commands and environments in LaTeX [v3.1 2010/04/15]
%%
%% 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/03/29 v3.0 - key-value interface for commands and environments in LaTeX]
+ [2010/04/15 v3.1 - key-value interface for commands and environments in LaTeX]
\def\kcmd@pkg@name{keycommand}
\RequirePackage{etex,kvsetkeys,xkeyval,etoolbox,etextools}
\def\kcmd@Xsetkeys{\XKV@testopta{\XKV@testoptc\XKV@setkeys}}% in case \setkeys was overwritten
@@ -52,17 +52,21 @@
\TMP@EnsureCode{46}{12}% . dot
\TMP@EnsureCode{47}{8}% / slash (etextools)
\AtEndOfPackage{\kcmd@AtEnd\undef\kcmd@AtEnd}
+\def\kcmd@keyfam#1{\detokenize{keycmd->}\expandafter\@gobble\string#1}
\newrobustcmd\kcmd@normalize@setkeys[4]{%
- \kv@normalize{#4}\edef\kv@list{\csvloop[\kcmd@normalize@braces]\kv@list}%
- \expandafter\@swaparg\expandafter{\kv@list}{\kcmd@Xsetkeys*{#2}}%
- \ettl@nbk#3//{\csedef{#2@#3}{\expandonce{\XKV@rm}}}%
- {\expandafter\ettl@nbk\XKV@rm//%
+ \kv@normalize{#4}\expandafter\let\expandafter\kv@list\expandafter\@empty
+ \expandafter\kv@parse@normalized\expandafter{\kv@list}{\kcmd@normalize@braces{#2}}%
+ \expandafter\@swaparg\expandafter{\kv@list,}{\kcmd@Xsetkeys*{#2}}%
+ \ettl@nbk#3//% undeclared keys are assigned to "OtherKeys"
+ {\csedef{#2@#3}{\expandonce{\XKV@rm}}}% (if specified, ie not empty)
+ {\expandafter\ettl@nbk\XKV@rm//% (otherwise a recoverable error is thown)
{\PackageError\kcmd@pkg@name{The key-value pairs :\MessageBreak
\XKV@rm\MessageBreak
cannot be processed for key-command \string#1\MessageBreak
See the definition of the key-command!}{}}{}//}//}
-\long\def\kcmd@normalize@braces#1{\kcmd@normalize@br@ces#1==\@nil}
-\long\def\kcmd@normalize@br@ces#1=#2=#3\@nil{\unexpanded{#1={{{#2}}},}}
+\long\def\kcmd@normalize@braces#1#2#3{% This is kvsetkeys processor for normalizing braces
+ \edef\kv@list{\expandonce\kv@list,%
+ #2\if @\detokenize{#3}@\else ={{{\unexpanded{#3}}}}\fi}}
\def\kcmd@check@typeofkey#1{% expands to
\kcmd@check@typeofkey@bool#1bool //%
{\kcmd@check@typeofkey@enumst#1enum* //%
@@ -145,23 +149,32 @@
\edef\kcmd@defcommand{\endgroup
\kcmd@undefinekeys{\kcmd@gbl}{\kcmd@fam}% undefines all keys for this keycommand family
\kcmd@mount@unexpandchar{\kcmd@fam}{\expandonce\kcmd@unexpandchar}%
- \unexpanded{\kv@parse{#2,#3}}{\kcmd@definekey\noexpand#1{\kcmd@gbl}{\kcmd@fam}}% defines the keys for this keycommand
+ \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{\unexpanded\expandafter\expandafter\expandafter}{%
- \noexpand\csname\kcmd@fam @####1\endcsname}}%
- \let\commandkey\expandafter\noexpand\csname\kcmd@fam.\kcmd@plus get\fi commandkey\endcsname
- \kcmd@plus % %% ENDENVIR ??
- \csdef{\kcmd@fam}{\kcmd@yargedef{\kcmd@gbl}{\kcmd@long}{\noexpandcs\kcmd@fam}{\number#4}{#6}{\csname\kcmd@fam.unexpandchar\endcsname}}%
- \unless\ifx#6\relax\def#6{\kcmd@yargedef{\kcmd@gbl}{\kcmd@long}{#6}0{\relax}{\csname\kcmd@fam.unexpandchar\endcsname}}\fi
- \else
- \csdef{\kcmd@fam}{\kcmd@yargdef{\kcmd@gbl}{\kcmd@long}{\noexpandcs\kcmd@fam}{\number#4}{#6}}%
- \unless\ifx#6\relax\def#6{\kcmd@yargdef{\kcmd@gbl}{\kcmd@long}{#6}0{\relax}}\fi
+ \csdef{\kcmd@fam.getcommandkey}####1{%
+ \unexpanded{\unexpanded\expandafter\expandafter\expandafter}{%
+ \noexpand\csname\kcmd@fam @####1\endcsname}}%
+ \let\commandkey\noexpandcs{\kcmd@fam.\kcmd@plus get\fi commandkey}%
+ \kcmd@plus% \newkeycommand+
+ \csdef{\kcmd@fam}{\kcmd@yargedef{\kcmd@gbl}{\kcmd@long}{\noexpandcs\kcmd@fam}
+ {\number#4}{#6}{\csname\kcmd@fam.unexpandchar\endcsname}}%
+ \unless\ifx#6\relax% that means we have to define a key-environment
+ \def#6{\kcmd@yargedef{\kcmd@gbl}{\kcmd@long}{#6}%
+ 0\relax{\csname\kcmd@fam.unexpandchar\endcsname}}%
+ \fi
+ \else% \newkeycommand
+ \csdef{\kcmd@fam}{\kcmd@yargdef{\kcmd@gbl}{\kcmd@long}{\noexpandcs\kcmd@fam}
+ {\number#4}{#6}}%
+ \unless\ifx#6\relax% that means we have to define a key-environment
+ \def#6{\kcmd@yargdef{\kcmd@gbl}{\kcmd@long}{#6}0\relax}%
+ \fi
\fi
- \kcmd@gbl\protected\edef#1{% entry point %%(?? cas où il n'y a pas de clé => pas besoin de \@testopt\kcmd@init etc ... at run time)
- \let\noexpand\noexpand\commandkey\noexpand\noexpand\noexpandcs{\kcmd@fam.\kcmd@plus get\fi commandkey}%
- \noexpand\csvloop[\noexpand\kcmd@resetdefault{\kcmd@fam}]{\noexpandcs{\kcmd@fam.keylist}}%
- \noexpand\noexpand\noexpand\@testopt{%
- \kcmd@setkeys\noexpand\noexpand#1{\kcmd@fam}{\kcmd@otherkeys{#3}}}{}}%
+ \kcmd@gbl\protected\edef#1{% entry point
+ \let\noexpand\noexpand\commandkey\noexpand\noexpand\noexpandcs{%
+ \kcmd@fam.\kcmd@plus get\fi commandkey}%
+ \noexpand\csvloop[\noexpand\kcmd@resetdefault{\kcmd@fam}]{\noexpandcs{\kcmd@fam.keylist}}%
+ \noexpand\noexpand\noexpand\@testopt{%
+ \kcmd@setkeys\noexpand\noexpand#1{\kcmd@fam}{\kcmd@otherkeys{#3}}}{}}%
\noexpandcs\kcmd@fam%
}\kcmd@defcommand{#5}{#7}%
}
@@ -234,12 +247,12 @@
{}//%
\fi#1}
\protected\def\new@keycommand#1{\@testopt{\@newkeycommand#1}{}}
-\protected\def\@newkeycommand#1[#2]{% #2 = key=values or N=mandatory args (also expanded by @newkeyenv)
+\protected\def\@newkeycommand#1[#2]{% #2 = key=values or N=mandatory args
+ \kcmd@plus \kcmd@unexpandchar@activate \fi% activates unexpand-char before reading definition
\ifstrnum{#2}%
{\@new@key@command#1[][][{#2}]}% no kv, no optkey, number of args
{\@testopt{\@new@keycommand#1[{#2}]}0}}% kv, check for optkey/nr of args
\protected\def\@new@keycommand#1[#2][#3]{%
- \kcmd@plus \kcmd@unexpandchar@activate \fi% activate unexpand-char before reading definition
\ifstrnum{#3}%
{\@new@key@command#1[{#2}][][{#3}]}% no optkey
{\@testopt{\@new@key@command#1[{#2}][{#3}]}0}}
@@ -277,7 +290,7 @@
\kcmd@keyenvir@def{#1}{#2}%
}
\long\def\kcmd@keyenvir@def#1#2#3#4{%
- \cslet{end#1}\protected% %%?? et si end#1 est déjà défini et pas #1 (\@ifdefinable ne teste que #1) ??
+ \cslet{end#1}\protected
\expandafter\kcmd@def\csname #1\expandafter\endcsname\csname end#1\endcsname#2{#3}{#4}%
}
\def\renew@keyenvironment#1{%
@@ -288,9 +301,6 @@
\new@keyenvironment{#1}}
-\def\kcmd@afterelse#1\else#2\fi{\fi#1}
-\def\kcmd@afterfi#1\fi{\fi#1}
-\def\kcmd@keyfam#1{\detokenize{keycmd->}\expandafter\@gobble\string#1}
\newcommand*\ifcommandkey[1]{\csname @\expandafter\expandafter\expandafter
\ettl@nbk\commandkey{#1}//{first}{second}//%
oftwo\endcsname}