diff options
author | Karl Berry <karl@freefriends.org> | 2010-04-29 13:41:50 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-04-29 13:41:50 +0000 |
commit | f7ccaa5d547012cb2beaaa0d0c1540d18eca1124 (patch) | |
tree | b300a6fca2f8665034403f4067c805d21971fa05 /Master | |
parent | 3793428328652bd18a288a1ab5bd9f5aac85d765 (diff) |
keycommand 3.1415 (27apr10)
git-svn-id: svn://tug.org/texlive/trunk@18042 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/keycommand/keycommand-example.pdf | bin | 166465 -> 166465 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/keycommand/keycommand-example.tex | 2 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/keycommand/keycommand.pdf | bin | 329653 -> 335420 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/keycommand/keycommand.drv | 10 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/keycommand/keycommand.dtx | 211 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/keycommand/keycommand.ins | 6 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/keycommand/keycommand.sty | 154 |
7 files changed, 241 insertions, 142 deletions
diff --git a/Master/texmf-dist/doc/latex/keycommand/keycommand-example.pdf b/Master/texmf-dist/doc/latex/keycommand/keycommand-example.pdf Binary files differindex a042b865da4..a0f02a3476b 100644 --- a/Master/texmf-dist/doc/latex/keycommand/keycommand-example.pdf +++ b/Master/texmf-dist/doc/latex/keycommand/keycommand-example.pdf diff --git a/Master/texmf-dist/doc/latex/keycommand/keycommand-example.tex b/Master/texmf-dist/doc/latex/keycommand/keycommand-example.tex index 66f9ced4e2d..dec4d37c6e7 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.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 diff --git a/Master/texmf-dist/doc/latex/keycommand/keycommand.pdf b/Master/texmf-dist/doc/latex/keycommand/keycommand.pdf Binary files differindex 3ccfeddde2c..1a0b6dfe6b3 100644 --- a/Master/texmf-dist/doc/latex/keycommand/keycommand.pdf +++ b/Master/texmf-dist/doc/latex/keycommand/keycommand.pdf diff --git a/Master/texmf-dist/source/latex/keycommand/keycommand.drv b/Master/texmf-dist/source/latex/keycommand/keycommand.drv index dfced5eebb2..ec9308583e8 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.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 @@ -26,15 +26,15 @@ %% \edef\thisfile{\jobname} \def\thisinfo{key-value interface for commands and environments in \LaTeX.} -\def\thisdate{2010/04/25} -\def\thisversion{3.141} +\def\thisdate{2010/04/27} +\def\thisversion{3.1415} \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,etoolbox,holtxdoc,geometry,tocloft,graphicx,xspace,fancyhdr,color,bbding,embedfile,framed,multirow,txfonts,makecell,enumitem,arydshln,LastPage} +\usepackage{etex,etoolbox,holtxdoc,geometry,tocloft,graphicx,xspace,fancyhdr,color,bbding,embedfile,framed,multirow,txfonts,makecell,enumitem,arydshln} \CodelineNumbered \usepackage{keyval}\makeatletter\let\keyval@setkeys\setkeys\makeatother \usepackage{xkeyval}\let\xsetkeys\setkeys @@ -49,7 +49,7 @@ colorlinks,linkcolor=reflink, pdfstartview={FitH}, pdfkeywords={tex, e-tex, latex, package, keys, keycommand, newcommand, keyval, kvsetkeys, programming}, - bookmarksopen=true,bookmarksopenlevel=2} + bookmarksopen=true,bookmarksopenlevel=3} \embedfile{\thisfile.dtx} \begin{document} \DocInput{\thisfile.dtx} diff --git a/Master/texmf-dist/source/latex/keycommand/keycommand.dtx b/Master/texmf-dist/source/latex/keycommand/keycommand.dtx index b2007ceb043..5f5ac85f3a3 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.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 @@ -37,7 +37,7 @@ \input docstrip.tex \Msg{************************************************************************} \Msg{* Installation} -\Msg{* Package: keycommand 2010/04/25 v3.141 key-value interface for commands and environments in LaTeX} +\Msg{* Package: keycommand 2010/04/27 v3.1415 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.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 @@ -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/04/25} -\def\thisversion{3.141} +\def\thisdate{2010/04/27} +\def\thisversion{3.1415} \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,etoolbox,holtxdoc,geometry,tocloft,graphicx,xspace,fancyhdr,color,bbding,embedfile,framed,multirow,txfonts,makecell,enumitem,arydshln,LastPage} +\usepackage{etex,etoolbox,holtxdoc,geometry,tocloft,graphicx,xspace,fancyhdr,color,bbding,embedfile,framed,multirow,txfonts,makecell,enumitem,arydshln} \CodelineNumbered \usepackage{keyval}\makeatletter\let\keyval@setkeys\setkeys\makeatother \usepackage{xkeyval}\let\xsetkeys\setkeys @@ -123,7 +123,7 @@ Copyright (C) 2009-2010 by Florent Chervet <florent.chervet@free.fr> colorlinks,linkcolor=reflink, pdfstartview={FitH}, pdfkeywords={tex, e-tex, latex, package, keys, keycommand, newcommand, keyval, kvsetkeys, programming}, - bookmarksopen=true,bookmarksopenlevel=2} + bookmarksopen=true,bookmarksopenlevel=3} \embedfile{\thisfile.dtx} \begin{document} \DocInput{\thisfile.dtx} @@ -131,7 +131,7 @@ Copyright (C) 2009-2010 by Florent Chervet <florent.chervet@free.fr> %</driver> % \fi % -% \CheckSum{1053} +% \CheckSum{1111} % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -231,7 +231,7 @@ Copyright (C) 2009-2010 by Florent Chervet <florent.chervet@free.fr> % \subject{\vskip-2cm\relax The \textit{free} and \textit{open source}} % % \maketitle -% +% % \makeatletter\begingroup\let\@thefnmark\@empty\let\@makefntext\@firstofone % \footnotetext{\noindent % This documentation is produced with the +DocStrip+ utility. @@ -242,9 +242,10 @@ Copyright (C) 2009-2010 by Florent Chervet <florent.chervet@free.fr> % \end{tabbing}§ % The \xext{dtx} file is embedded into this pdf file thank to \xpackage{embedfile} by H. Oberdiek.} % \endgroup\makeatother -% +% +% \hypersetup{bookmarksopenlevel=3} % \deffootnote{1em}{0pt}{\rlap{\thefootnotemark.}\kern1em} -% \vskip-48pt +% \vspace*{-18pt} % \begin{abstract}\parindent0pt\noindent\leftskip1cm\rightskip\leftskip\lastlinefit0% % % \thispackage provides an easy way to define commands or environments @@ -355,7 +356,7 @@ Copyright (C) 2009-2010 by Florent Chervet <florent.chervet@free.fr> % % \clearpage % -% \subsection{Second example : the {\rred\bf\string+} form} +% \subsection[Second example : the \string+ form]{Second example : the {\rred\bf\string+} form} % \label{sec:example:plus} % % \DeleteShortVerb{\+} @@ -383,7 +384,7 @@ Copyright (C) 2009-2010 by Florent Chervet <florent.chervet@free.fr> % {\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 {\rred\bf\string+} form} +% \subsection[Explanation of the \string+ form]{Explanation of the {\rred\bf\string+} form} % \DeleteShortVerb{\+} % The |\commankey{|\meta{name}|}| stuff is expanded at run time using the following scheme:§§ % \begin{Verbatim}[gobble=1,commandchars=!(),frame=lines] @@ -427,7 +428,32 @@ Copyright (C) 2009-2010 by Florent Chervet <florent.chervet@free.fr> % Key-environments may be defined with the \stform+ form in the same way as \cs{newkeycommand} is used. % Be aware that each part of the environment: \meta{begin} and \meta{end} are expanded at run time then, % and the optional {\rred\bf+[\|]+} argument protects from expansion in each of those parts. +% +% \subsection[Example of a \string+ key-environment]{Example of a {\rred\bf\string+} key-environment} +% +% \DeleteShortVerb{\+} +% \begin{Verbatim}[gobble=1,commandchars=$(),frame=lines] +% ($bf\newkeyenvironment)($rred$bf+[\|])({$copper myfigure)}[ +% caption, +% enum placement={H,h,b,t,p}, +% width=.5\linewidth, +% label +% ][($db OtherKeys)][1]% +% {% ($nbf$dg begin part) +% ($rred|)($bf\begin){figure}($rred|)[($red\commandkey){placement}] +% ($rred|)($bf\includegraphics)($rred|)[($red\commandkey){($db OtherKeys)},width=($red\commandkey){width}]{$#1}% +% } +% {% ($nbf$dg end part) +% ($dg\ifcommandkey){caption}{($rred|)\caption($rred|){($red\commandkey){caption} image file = $#1}}{}% +% ($dg\ifcommandkey){label}{($rred|)\label($rred|){($red\commandkey){label}}}{}% +% ($rred|)($bf\end){figure}($rred|)% +% } +% \end{Verbatim} +% \MakeShortVerb{\+} % +% As you can see, \cs{commandkey} and mandatory arguments (\#1 here) are available both in the \meta{begin} +% and in the \meta{end} parts of the key-environment. +% % % \DefineShortVerb{\+} % @@ -523,7 +549,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/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] % \end{macrocode} % % \subsection{Requirements} @@ -767,7 +793,7 @@ Copyright (C) 2009-2010 by Florent Chervet <florent.chervet@free.fr> \ifcsundef{#1.keylist}{} {\expandafter\expandafter\expandafter\docsvlist \expandafter\expandafter\expandafter{% - \csname #1.keylist\endcsname}}% + \csname#1.keylist\endcsname}}% } % \end{macrocode} %\end{macro} @@ -778,8 +804,14 @@ Copyright (C) 2009-2010 by Florent Chervet <florent.chervet@free.fr> % checks \cs{@ifdefinable} and cancels definition if needed: % \begin{macrocode} \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 } % \end{macrocode} @@ -788,54 +820,60 @@ Copyright (C) 2009-2010 by Florent Chervet <florent.chervet@free.fr> % \begin{macro}{\kcmd@defcommand}\qquad\qquad prepares (expands) the arguments before closing the group opened at the very beginning. % Then it proceeds (\cs{kcmd@yargdef} (normal interface) or \cs{kcmd@yargedef} (when \cs{newkeycommand}\stform+ 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\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% - \endcsname}% - \kcmd@gbl\protected\edef#1{% entry point - \let\getcommandkey\unexpanded{\expandafter\noexpand\csname}\kcmd@fam.getcommandkey% - \endcsname + \def\noexpand\do####1{\unexpanded{\expandafter\noexpand\csname}KV@#1@####1@default% + \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} % \end{macrocode} @@ -886,20 +924,38 @@ Copyright (C) 2009-2010 by Florent Chervet <florent.chervet@free.fr> % #4 = nr of args % #5 = endenvir (or \@gobble if not an environment, or \relax if #3 is endenvir) % #6 = unexpandchar mounting macro - \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@envir##1{% + \edef\next{\kcmd@yarg@edef{\def\noexpand#5{\expandonce{#5##1}}\expandonce{#3##1}}}\next }% - \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% + \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% } % \end{macrocode} % \end{macro} @@ -907,14 +963,18 @@ Copyright (C) 2009-2010 by Florent Chervet <florent.chervet@free.fr> % \begin{macro}{\kcmd@nargs}\qquad % Filter macros used by \cs{kcmd@yargedef} to get the correct number of arguments: % \begin{macrocode} -\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{}% -} -\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}% +}% % \end{macrocode} % \end{macro} % @@ -1209,6 +1269,11 @@ even if a pagebreak occurs inside the environment: % \DeleteShortVerb{\+}^^A\UndefineShortVerb{\+} % \begin{History} % +% \begin{Version}{2010/04/27 v3.1415} +% \item Key-environment can now be nested ! (it's not too late... I hope so) +% \item Keys and mandatory arguments as well can be used in both \texttt{begin} end \texttt{end} part of the environment. +% \end{Version} +% % \begin{Version}{2010/04/25 v3.141} % \item No new feature but a real improvement in optimization. \\ % In particular, \thispackage does not load \xpackage{etextools} anymore. \\ diff --git a/Master/texmf-dist/source/latex/keycommand/keycommand.ins b/Master/texmf-dist/source/latex/keycommand/keycommand.ins index 7d63becf333..107da0a5e4e 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.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 @@ \input docstrip.tex \Msg{************************************************************************} \Msg{* Installation} -\Msg{* Package: keycommand 2010/04/25 v3.141 key-value interface for commands and environments in LaTeX} +\Msg{* Package: keycommand 2010/04/27 v3.1415 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.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 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 |