summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
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
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')
-rw-r--r--Master/texmf-dist/doc/latex/keycommand/keycommand-example.pdfbin147252 -> 165101 bytes
-rw-r--r--Master/texmf-dist/doc/latex/keycommand/keycommand-example.tex5
-rw-r--r--Master/texmf-dist/doc/latex/keycommand/keycommand.pdfbin191903 -> 316176 bytes
-rw-r--r--Master/texmf-dist/source/latex/keycommand/keycommand.drv8
-rw-r--r--Master/texmf-dist/source/latex/keycommand/keycommand.dtx193
-rw-r--r--Master/texmf-dist/source/latex/keycommand/keycommand.ins6
-rw-r--r--Master/texmf-dist/tex/latex/keycommand/keycommand.sty68
7 files changed, 152 insertions, 128 deletions
diff --git a/Master/texmf-dist/doc/latex/keycommand/keycommand-example.pdf b/Master/texmf-dist/doc/latex/keycommand/keycommand-example.pdf
index 894a4b77550..528da813d02 100644
--- a/Master/texmf-dist/doc/latex/keycommand/keycommand-example.pdf
+++ b/Master/texmf-dist/doc/latex/keycommand/keycommand-example.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/keycommand/keycommand-example.tex b/Master/texmf-dist/doc/latex/keycommand/keycommand-example.tex
index 8e07e07c262..14a6a2009fc 100644
--- a/Master/texmf-dist/doc/latex/keycommand/keycommand-example.tex
+++ b/Master/texmf-dist/doc/latex/keycommand/keycommand-example.tex
@@ -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
@@ -57,8 +57,11 @@
\title{This is {\tt keycommand-example.tex}}
\author{Florent Chervet}
\date{July 22, 2009}
+
\maketitle
+{\Large Please refer to {\tt keycommand-example.tex} for definitions.}
+
\section{Example of a keycommand : \texttt{\string\Rule}}
\begin{tabular*}\textwidth{rl}
diff --git a/Master/texmf-dist/doc/latex/keycommand/keycommand.pdf b/Master/texmf-dist/doc/latex/keycommand/keycommand.pdf
index 76eb62bc544..52a99e78580 100644
--- a/Master/texmf-dist/doc/latex/keycommand/keycommand.pdf
+++ b/Master/texmf-dist/doc/latex/keycommand/keycommand.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/keycommand/keycommand.drv b/Master/texmf-dist/source/latex/keycommand/keycommand.drv
index 2ad4f24cd05..3b7caba7799 100644
--- a/Master/texmf-dist/source/latex/keycommand/keycommand.drv
+++ b/Master/texmf-dist/source/latex/keycommand/keycommand.drv
@@ -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
@@ -26,15 +26,15 @@
%%
\edef\thisfile{\jobname}
\def\thisinfo{key-value interface for commands and environments in \LaTeX.}
-\def\thisdate{2010/03/28}
-\def\thisversion{3.0}
+\def\thisdate{2010/04/15}
+\def\thisversion{3.1}
\let\loadclass\LoadClass
\def\LoadClass#1{\loadclass[abstracton]{scrartcl}\let\scrmaketitle\maketitle\AtEndOfClass{\let\maketitle\scrmaketitle}}
\documentclass[a4paper,oneside]{ltxdoc}
\usepackage[latin9]{inputenc}
\usepackage[american]{babel}
\usepackage[T1]{fontenc}
-\usepackage{etex,holtxdoc,geometry,tocloft,graphicx,xspace,fancyhdr,color,bbding,embedfile,framed,multirow,txfonts,makecell,enumitem,arydshln}
+\usepackage{etex,etoolbox,holtxdoc,geometry,tocloft,graphicx,xspace,fancyhdr,color,bbding,embedfile,framed,multirow,txfonts,makecell,enumitem,arydshln,LastPage}
\CodelineNumbered
\usepackage{keyval}\makeatletter\let\keyval@setkeys\setkeys\makeatother
\usepackage{xkeyval}\let\xsetkeys\setkeys
diff --git a/Master/texmf-dist/source/latex/keycommand/keycommand.dtx b/Master/texmf-dist/source/latex/keycommand/keycommand.dtx
index c5459cebc58..eff3c9cc34d 100644
--- a/Master/texmf-dist/source/latex/keycommand/keycommand.dtx
+++ b/Master/texmf-dist/source/latex/keycommand/keycommand.dtx
@@ -1,5 +1,5 @@
% \iffalse meta-comment
-% 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
@@ -37,7 +37,7 @@
\input docstrip.tex
\Msg{************************************************************************}
\Msg{* Installation}
-\Msg{* Package: keycommand 2010/03/28 v3.0 key-value interface for commands and environments in LaTeX}
+\Msg{* Package: keycommand 2010/04/15 v3.1 key-value interface for commands and environments in LaTeX}
\Msg{************************************************************************}
\keepsilent
@@ -48,7 +48,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
@@ -100,15 +100,15 @@ Copyright (C) 2009-2010 by Florent Chervet <florent.chervet@free.fr>
%<*driver>
\edef\thisfile{\jobname}
\def\thisinfo{key-value interface for commands and environments in \LaTeX.}
-\def\thisdate{2010/03/28}
-\def\thisversion{3.0}
+\def\thisdate{2010/04/15}
+\def\thisversion{3.1}
\let\loadclass\LoadClass
\def\LoadClass#1{\loadclass[abstracton]{scrartcl}\let\scrmaketitle\maketitle\AtEndOfClass{\let\maketitle\scrmaketitle}}
\documentclass[a4paper,oneside]{ltxdoc}
\usepackage[latin9]{inputenc}
\usepackage[american]{babel}
\usepackage[T1]{fontenc}
-\usepackage{etex,holtxdoc,geometry,tocloft,graphicx,xspace,fancyhdr,color,bbding,embedfile,framed,multirow,txfonts,makecell,enumitem,arydshln}
+\usepackage{etex,etoolbox,holtxdoc,geometry,tocloft,graphicx,xspace,fancyhdr,color,bbding,embedfile,framed,multirow,txfonts,makecell,enumitem,arydshln,LastPage}
\CodelineNumbered
\usepackage{keyval}\makeatletter\let\keyval@setkeys\setkeys\makeatother
\usepackage{xkeyval}\let\xsetkeys\setkeys
@@ -237,15 +237,15 @@ Copyright (C) 2009-2010 by Florent Chervet <florent.chervet@free.fr>
% \endgroup\makeatother
%
% \deffootnote{1em}{0pt}{\rlap{\thefootnotemark.}\kern1em}
-% \vskip-12pt
-% \begin{abstract}\parindent0pt\noindent\leftskip=1cm\rightskip\leftskip\lastlinefit0%
+% \vskip-48pt
+% \begin{abstract}\parindent0pt\noindent\leftskip1cm\rightskip\leftskip\lastlinefit0%
%
% \thispackage provides an easy way to define commands or environments
% with optional keys. \csbf{newkeycommand} and its relatives
% \cs{renewkeycommand}, \csbf{newkeyenvironment}, \linebreak\cs{renewkeyenvironment}
% and \cs{providekeycommand} are defined in this package.
%
-% Keys are simply defined while defining the command itself in a vary natural way.
+% Keys are simply defined while defining the command itself in a very natural way.
% You can restrict the possible values for the keys by declaring them with a \textbf{type}.
% Available types for keys are : \textit{boolean}, \textit{enum} and \textit{choice}.^^A Make refs please !!!
%
@@ -261,7 +261,7 @@ Copyright (C) 2009-2010 by Florent Chervet <florent.chervet@free.fr>
% It works with an \eTeX{} distribution of \LaTeX.
% \end{abstract}
%
-% \DeleteShortVerb{\+}
+% \DeleteShortVerb{\+}\enlargethispage{2\baselineskip}
% \cftbeforesecskip=4pt plus2pt minus2pt
% \cftbeforesubsecskip=0pt plus2pt minus2pt
% \renewcommand\contentsname{Contents\quad\leaders\vrule height3.4pt depth-3pt\hfill\null\kern0pt\vskip-6pt}
@@ -369,7 +369,7 @@ Copyright (C) 2009-2010 by Florent Chervet <florent.chervet@free.fr>
%
% \cs{ifcommandkey}\{\meta{name}\}\{\meta{true}\}\{\meta{false}\}\quad expands \meta{true} if the commandkey \meta{name} is not blank.
%
-% {\db\cs{Otherkeys}} captures the keys given by the user but not declared: they are simply given back to \cs{includegraphics} here...
+% {\db \meta{Otherkeys}} captures the keys given by the user but not declared: they are simply given back to \cs{includegraphics} here...
%
%
% \subsection{Explanation of the \string+ form}
@@ -385,7 +385,7 @@ Copyright (C) 2009-2010 by Florent Chervet <florent.chervet@free.fr>
% }\keyMacro{#1}}
% \end{Verbatim}
% Therefore, the arguments of \cs{Macro} are ready: there is no more \cs{commandkey} stuff, but instead the values of the keys
-% as you give them to the key-command. \cs{getcommandkey}\{A\} is expanded to \cs{defA}.
+% as you gave them to the key-command. \cs{getcommandkey}\{A\} is expanded to \cs{defA}.
%
% But \cs{defA} is not expanded of course: in the {\bf\dr\string+} form, \cs{commandkey} has the meaning of \cs{getcommandkey}.
%
@@ -495,6 +495,7 @@ Copyright (C) 2009-2010 by Florent Chervet <florent.chervet@free.fr>
% \begin{center}\vskip6pt$\star$\hskip4em\lower12pt\hbox{$\star$}\hskip4em$\star$\vadjust{\vskip12pt}\end{center}
%
% \section{Implementation} \label{Implementation}
+% \csdef{HDorg@PrintMacroName}#1{\hbox to4em{\strut \MacroFont \string #1\ \hss}}
%
% \subsection{Identification}
%
@@ -505,7 +506,7 @@ Copyright (C) 2009-2010 by Florent Chervet <florent.chervet@free.fr>
\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]
% \end{macrocode}
%
% \subsection{Requirements}
@@ -526,7 +527,10 @@ Copyright (C) 2009-2010 by Florent Chervet <florent.chervet@free.fr>
% \begin{macrocode}
\def\kcmd@pkg@name{keycommand}
\RequirePackage{etex,kvsetkeys,xkeyval,etoolbox,etextools}
-% the \setkeys of \xpackage{xkeyval} package :
+% \end{macrocode}
+% the \cs{setkeys} of \xpackage{xkeyval} package (in case it was overwritten by a
+% subsequent load of \xpackage{kvsetkeys} or \xpackage{keyval} for example :
+% \begin{macrocode}
\def\kcmd@Xsetkeys{\XKV@testopta{\XKV@testoptc\XKV@setkeys}}% in case \setkeys was overwritten
\@ifpackagelater{etextools}{2009/08/27}\relax
{\PackageError\kcmd@pkg@name{keycommand requires an implementation of\MessageBreak
@@ -535,7 +539,7 @@ Copyright (C) 2009-2010 by Florent Chervet <florent.chervet@free.fr>
{The keycommand package will not be loaded.}%
\expandafter\endinput}
% \end{macrocode}
-%
+% Some \cs{catcode} assertions internally used by \thispackage:
% \begin{macrocode}
\let\kcmd@AtEnd\@empty
\def\TMP@EnsureCode#1#2{%
@@ -555,38 +559,45 @@ Copyright (C) 2009-2010 by Florent Chervet <florent.chervet@free.fr>
% \end{macrocode}
%
% \subsection{Defining (and undefining) command-keys}
+%\begin{macro}{\kcmd@keyfam}\qquad
+% The macro expands to the family-name, given the keycommand name:
+% \begin{macrocode}
+\def\kcmd@keyfam#1{\detokenize{keycmd->}\expandafter\@gobble\string#1}
+% \end{macrocode}
+% \end{macro}
%
-% This macro assign the values to the keys (expansion of \xpackage{xkeyval} \cs{setkeys}
-% on the result of \xpackage{kvsetkeys}-\cs{kv@normalize}):
-%
-%\begin{macro}{\kcmd@normalize@setkeys}
+% \begin{macro}{\kcmd@normalize@setkeys}~\par
+% This macro assigns the values to the keys (expansion of \xpackage{xkeyval}-\cs{setkeys}
+% on the result of \xpackage{kvsetkeys}-\cs{kv@normalize}). Braces are normalized too so that
+% \verb+key= {{{value}}}+ is the same as \verb+key={{{value}}}+ as explained in section \ref{kvsetkeys-comparisons}:
% \begin{macrocode}
\newrobustcmd\kcmd@normalize@setkeys[4]{%
-% #1=key-command,
+% #1 = key-command,
% #2 = family,
% #3 = other-key,
% #4 = key-values pairs
- \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}}
% \end{macrocode}
-%\end{macro}
-%
-% \begin{macro}{\kcmd@definekey}
-%
+% \end{macro}
+% \tracingnone
+% \begin{macro}{\kcmd@definekey}~\par
% \CS{kcmd@definekey} define the keys declared for the key-command.
% It is used as the \emph{processor} for the \cs{kv@parse} macro of \xpackage{kvsetkeys}.
+% The macro appends the key names to the key list: ``\textit{family}.keylist''.
%
-% The macro puts the keys just defined into the key list: ``\textit{family}.keylist''.
-%
-% The keys are first checked for their type (bool, enum, enum*, choice or choice*) :
+% keys are first checked for their type (bool, enum, enum*, choice or choice*) :
%
% \begin{macrocode}
\def\kcmd@check@typeofkey#1{% expands to
@@ -678,11 +689,10 @@ Copyright (C) 2009-2010 by Florent Chervet <florent.chervet@free.fr>
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\kcmd@undefinekeys}
+% \begin{macro}{\kcmd@undefinekeys}~\par
% Now in case we redefine a key-command, we would like the old keys (\emph{ie} the keys
% associated to the old definition of the command) to be cleared, undefined.
-% That's the job of +\kcmd@undefinekeys+. It uses \cs{csvloop} (in a \cs{edef} in \cmd{kcmd@defcommand}).
-%
+% That's the job of \cs{kcmd@undefinekeys}. It uses \cs{csvloop} (in a \cs{edef} in \cs{kcmd@defcommand}).
% \begin{macrocode}
\def\kcmd@undefinekeys#1#2{% #1 = global, #2 = family
\ifcsundef{#2.keylist}
@@ -697,36 +707,45 @@ Copyright (C) 2009-2010 by Florent Chervet <florent.chervet@free.fr>
% \end{macro}
%
% \begin{macro}{\kcmd@def}
-% \cs{kcmd@def} checks \cs{@ifdefinable} and cancels definition if needed:
+% checks \cs{@ifdefinable} and cancels definition if needed:
% \begin{macrocode}
\protected\long\def\kcmd@def#1#2[#3][#4][#5]#6#7{%
\@ifdefinable#1{\kcmd@defcommand#1[{#3}][{#4}][{#5}]{#6}{#2}{#7}}}
% \end{macrocode}
% \cs{kcmd@defcommand} prepares (expand) the arguments before closing the group opened at the very beginning.
-% Then it proceeds (\cs{kcmd@yargdef} (normal interface) or \cs{kcmd@yargdef} (\string+ modifier))
+% Then it proceeds (\cs{kcmd@yargdef} (normal interface) or \cs{kcmd@yargedef} (when \cs{newkeycommand}\string+ is used))
% \begin{macrocode}
\protected\long\def\kcmd@defcommand#1[#2][#3][#4]#5#6#7{%
\edef\kcmd@fam{\kcmd@keyfam{#1}}\let\commandkey\relax
\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}%
}
@@ -738,7 +757,7 @@ Copyright (C) 2009-2010 by Florent Chervet <florent.chervet@free.fr>
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\kcmd@mount@unexpandchar}
+% \begin{macro}{\kcmd@mount@unexpandchar}~\par
% This macro defines the macro \cs{"\textit{family.unexpandchar}"}. \CS{"\textit{family.unexpandchar}"} activates the
% shortcut character for \cs{unexpanded} and defines its meaning.
% \begin{macrocode}
@@ -755,7 +774,7 @@ Copyright (C) 2009-2010 by Florent Chervet <florent.chervet@free.fr>
% \end{macro}
%
%----------------------------------------------------------------------------
-% \begin{macro}{\kcmd@yargdef}
+% \begin{macro}{\kcmd@yargdef}\qquad\qquad
% This is the {\tt argdef} macro for the normal (non \string+) form:
% \begin{macrocode}
\protected \def \kcmd@yargdef #1#2#3#4#5{\begingroup
@@ -763,7 +782,7 @@ Copyright (C) 2009-2010 by Florent Chervet <florent.chervet@free.fr>
% #2 = long or {}
% #3 = Command
% #4 = nr of args
-% #5 = endenvir
+% #5 = endenvir (or \relax if not an environment)
\def \kcmd@yargd@f ##1#4##2##{\afterassignment#5\endgroup
#1#2\expandafter\def\expandafter#3\@gobble ##1#4%
}\kcmd@yargd@f 0##1##2##3##4##5##6##7##8##9###4%
@@ -771,7 +790,7 @@ Copyright (C) 2009-2010 by Florent Chervet <florent.chervet@free.fr>
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\kcmd@yargedef}
+% \begin{macro}{\kcmd@yargedef}\qquad\qquad
% This is the {\tt argdef} macro for the {\dr\bf\string+} form:
% \begin{macrocode}
\protected\def\kcmd@yargedef#1#2#3#4#5#6{\begingroup
@@ -779,7 +798,7 @@ Copyright (C) 2009-2010 by Florent Chervet <florent.chervet@free.fr>
% #2 = long or {}
% #3 = Command
% #4 = nr of args
-% #5 = endenvir
+% #5 = endenvir (or \relax if not an environment)
% #6 = unexpandchar mounting macro
\letcs\kcmd@nargs{kcmd@#4of9}%
\long\def\kcmd@yarg@edef##1##2{\afterassignment#5\endgroup
@@ -799,7 +818,7 @@ Copyright (C) 2009-2010 by Florent Chervet <florent.chervet@free.fr>
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\kcmd@nargs}
+% \begin{macro}{\kcmd@nargs}\qquad
% Filter macros used by \cs{kcmd@yargedef} to get the correct number of arguments:
% \begin{macrocode}
\def\kcmd@XofNINE#1{%
@@ -815,7 +834,7 @@ Copyright (C) 2009-2010 by Florent Chervet <florent.chervet@free.fr>
%
% \subsection{new key-commands}
%
-% \begin{macro}{\newkeycommand}
+% \begin{macro}{\newkeycommand}\qquad\qquad
% Here are the entry points:
% \begin{macrocode}
\protected\def\newkeycommand{\begingroup
@@ -827,7 +846,7 @@ Copyright (C) 2009-2010 by Florent Chervet <florent.chervet@free.fr>
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\kcmd@modifiers}
+% \begin{macro}{\kcmd@modifiers}~\par
% This macro reads the modifiers for \cs{newkeycommand} (or \cs{newkeyenvironment}) and save them for later use.
% The scanning of modifiers is performed by \xpackage{etextools}-\cs{futuredef}:
% \begin{macrocode}
@@ -841,7 +860,7 @@ Copyright (C) 2009-2010 by Florent Chervet <florent.chervet@free.fr>
% \end{macrocode}
% \end{macro}
%
-%\begin{macro}{\kcmd@unexpandchar}
+%\begin{macro}{\kcmd@unexpandchar}\qquad\qquad\quad
% Reads the possible unexpand-char shortcut:
% \begin{macrocode}
\def\kcmd@unexpandchar#1[#2]{\def\kcmd@unexpandchar{#2}% only once inside group...
@@ -859,36 +878,37 @@ Copyright (C) 2009-2010 by Florent Chervet <florent.chervet@free.fr>
% \end{macrocode}
%\end{macro}
%
-% \begin{macro}{\new@keycommand}
+% \begin{macro}{\new@keycommand}\qquad\qquad
% Reads the key-command name (cs-token):
% \begin{macrocode}
\protected\def\new@keycommand#1{\@testopt{\@newkeycommand#1}{}}
% \end{macrocode}
% \end{macro}
%
-%\begin{macro}{\@newkeycommand}
+%\begin{macro}{\@newkeycommand}\qquad\qquad
% Reads the first optional parameter (keys or number of mandatory args):
% \begin{macrocode}
-\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
% \end{macrocode}
% \end{macro}
%
-%\begin{macro}{\@new@keycommand}
+%\begin{macro}{\@new@keycommand}\qquad\qquad
% Reads the second optional parameter (opt key or number of mandatory args):
% \begin{macrocode}
\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}}
% \end{macrocode}
%\end{macro}
%
-%\begin{macro}{\@new@key@command}
-% Reads the definition of the command (\cs{kcmd@def} handles both the case of commands and environements):
+%\begin{macro}{\@new@key@command}\qquad\qquad
+% Reads the definition of the command (\cs{kcmd@def} handles both cases of commands and environements).
+% The so called "unexpand-char shortcut" has been activated before reading command definition:
% \begin{macrocode}
\protected\long\def\@new@key@command#1[#2][#3][#4]#5{%
\kcmd@def#1\relax[{#2}][{#3}][{#4}]{#5}{}}
@@ -946,7 +966,7 @@ Copyright (C) 2009-2010 by Florent Chervet <florent.chervet@free.fr>
\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}%
}
% \end{macrocode}
@@ -969,15 +989,9 @@ Copyright (C) 2009-2010 by Florent Chervet <florent.chervet@free.fr>
%
% \subsection{Tests on keys}
%
-% First we need some helper macros:
-% \begin{macrocode}
-\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}
-% \end{macrocode}
-%
-%
-% \begin{macro}{\ifcommandkey}
+% \begin{macro}{\ifcommandkey}\qquad
+% \{\meta{key-name}\}\{\meta{true}\}\{\meta{false}\}\quad expands \meta{true} only if the value of the key
+% is not blank:
% \begin{macrocode}
\newcommand*\ifcommandkey[1]{\csname @\expandafter\expandafter\expandafter
\ettl@nbk\commandkey{#1}//{first}{second}//%
@@ -986,7 +1000,7 @@ Copyright (C) 2009-2010 by Florent Chervet <florent.chervet@free.fr>
% \end{macro}
%
%
-% \begin{macro}{\showcommandkeys}
+% \begin{macro}{\showcommandkeys}\qquad\qquad are helper macros essentially for debuging purpose...
% \begin{macrocode}
\newcommand\showcommandkeys[1]{\let\do\showcommandkey\docsvlist{#1}}
\newcommand\showcommandkey[1]{key \string"#1\string" = %
@@ -1039,8 +1053,11 @@ Copyright (C) 2009-2010 by Florent Chervet <florent.chervet@free.fr>
\title{This is {\tt keycommand-example.tex}}
\author{Florent Chervet}
\date{July 22, 2009}
+
\maketitle
+{\Large Please refer to {\tt keycommand-example.tex} for definitions.}
+
\section{Example of a keycommand : \texttt{\string\Rule}}
\begin{tabular*}\textwidth{rl}
@@ -1086,13 +1103,17 @@ Copyright (C) 2009-2010 by Florent Chervet <florent.chervet@free.fr>
test for dblruled key-environment
\end{dblruled}
-
\end{document}
%</example>
% \end{macrocode}
% \DeleteShortVerb{\+}^^A\UndefineShortVerb{\+}
% \begin{History}
%
+% \begin{Version}{2010/04/15 v3.1}
+% \item Correction of bug in the normalization process. \\
+% Correction of a bug in \cs{ifcommandkey} (undesirable space...)
+% \end{Version}
+%
% \begin{Version}{2010/03/28 v3.0}
% \item Complete redesign of the implementation. \\
% \xpackage{keycommand} is now based on some macros of \xpackage{etoolbox}.
@@ -1101,16 +1122,6 @@ Copyright (C) 2009-2010 by Florent Chervet <florent.chervet@free.fr>
%
% \end{Version}
%
-% \begin{Version}{2009/08/04 v2.e-}
-% \item
-% Fix catcode of double quote (") in case user command had a double quote in its name...
-% \item
-% Add History to the documentation file
-% \item
-% Modify the prefixes scanner (it is now the same as the one of \Xpackage{ltxnew}).\\
-% Modify the documentation (\KOMAScript\ classe)
-% \end{Version}
-%
% \begin{Version}{2009/07/22 v1.0}
% \item
% First version.
diff --git a/Master/texmf-dist/source/latex/keycommand/keycommand.ins b/Master/texmf-dist/source/latex/keycommand/keycommand.ins
index d6e7afa4861..1345b89244a 100644
--- a/Master/texmf-dist/source/latex/keycommand/keycommand.ins
+++ b/Master/texmf-dist/source/latex/keycommand/keycommand.ins
@@ -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 @@
\input docstrip.tex
\Msg{************************************************************************}
\Msg{* Installation}
-\Msg{* Package: keycommand 2010/03/28 v3.0 key-value interface for commands and environments in LaTeX}
+\Msg{* Package: keycommand 2010/04/15 v3.1 key-value interface for commands and environments in LaTeX}
\Msg{************************************************************************}
\keepsilent
@@ -38,7 +38,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
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}