summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/oberdiek/kvoptions.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/oberdiek/kvoptions.dtx')
-rw-r--r--Master/texmf-dist/source/latex/oberdiek/kvoptions.dtx173
1 files changed, 148 insertions, 25 deletions
diff --git a/Master/texmf-dist/source/latex/oberdiek/kvoptions.dtx b/Master/texmf-dist/source/latex/oberdiek/kvoptions.dtx
index c108ce24ecd..958cac61be3 100644
--- a/Master/texmf-dist/source/latex/oberdiek/kvoptions.dtx
+++ b/Master/texmf-dist/source/latex/oberdiek/kvoptions.dtx
@@ -19,7 +19,8 @@
% and the derived files
% kvoptions.sty, kvoptions.pdf, kvoptions.ins, kvoptions.drv,
% kvoptions-patch.sty, example-mycolorsetup.sty,
-% kvoptions-test1.tex, kvoptions-test2.tex.
+% kvoptions-test1.tex, kvoptions-test2.tex,
+% kvoptions-test3.tex.
%
% Distribution:
% CTAN:macros/latex/contrib/oberdiek/kvoptions.dtx
@@ -58,6 +59,7 @@
% TDS:doc/latex/oberdiek/example-mycolorsetup.sty
% TDS:doc/latex/oberdiek/test/kvoptions-test1.tex
% TDS:doc/latex/oberdiek/test/kvoptions-test2.tex
+% TDS:doc/latex/oberdiek/test/kvoptions-test3.tex
% TDS:source/latex/oberdiek/kvoptions.dtx
%
%<*ignore>
@@ -73,7 +75,7 @@
\input docstrip.tex
\Msg{************************************************************************}
\Msg{* Installation}
-\Msg{* Package: kvoptions 2009/08/13 v3.4 Keyval support for LaTeX options (HO)}
+\Msg{* Package: kvoptions 2009/12/08 v3.6 Keyval support for LaTeX options (HO)}
\Msg{************************************************************************}
\keepsilent
@@ -103,7 +105,8 @@ This work consists of the main source file kvoptions.dtx
and the derived files
kvoptions.sty, kvoptions.pdf, kvoptions.ins, kvoptions.drv,
kvoptions-patch.sty, example-mycolorsetup.sty,
- kvoptions-test1.tex, kvoptions-test2.tex.
+ kvoptions-test1.tex, kvoptions-test2.tex,
+ kvoptions-test3.tex.
\endpreamble
\let\MetaPrefix\DoubleperCent
@@ -119,6 +122,7 @@ and the derived files
\usedir{doc/latex/oberdiek/test}%
\file{kvoptions-test1.tex}{\from{kvoptions.dtx}{test1}}%
\file{kvoptions-test2.tex}{\from{kvoptions.dtx}{test2}}%
+ \file{kvoptions-test3.tex}{\from{kvoptions.dtx}{test3}}%
}
\obeyspaces
@@ -148,7 +152,7 @@ and the derived files
%<*driver>
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{kvoptions.drv}%
- [2009/08/13 v3.4 Keyval support for LaTeX options (HO)]%
+ [2009/12/08 v3.6 Keyval support for LaTeX options (HO)]%
\documentclass{ltxdoc}
\usepackage{holtxdoc}[2008/08/11]
\begin{document}
@@ -157,7 +161,7 @@ and the derived files
%</driver>
% \fi
%
-% \CheckSum{2121}
+% \CheckSum{2208}
%
% \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
@@ -178,7 +182,7 @@ and the derived files
% \GetFileInfo{kvoptions.drv}
%
% \title{The \xpackage{kvoptions} package}
-% \date{2009/08/13 v3.4}
+% \date{2009/12/08 v3.6}
% \author{Heiko Oberdiek\\\xemail{oberdiek@uni-freiburg.de}}
%
% \maketitle
@@ -582,10 +586,10 @@ and the derived files
%
% The package/class author can wish the end of the option
% already during the package loading, then he will have
-% static behaviour. In case of dynamic options \cs{DisableKeyvalOptions}
+% static behaviour. In case of dynamic options \cs{DisableKeyvalOption}
% can be executed everywhere, also outside the package. Therefore
% the family name and the package/class name is usually unknown for
-% \cs{DisableKeyvalOptions}. Therefore the argument for the family
+% \cs{DisableKeyvalOption}. Therefore the argument for the family
% name is mandatory and for some actions the package/class name
% must be provided.
%
@@ -621,6 +625,15 @@ and the derived files
%\end{verbatim}
%\end{quote}
%
+% \subsubsection{\cs{AddToKeyvalOption}}
+%
+% \begin{declcs}{AddToKeyvalOption}\,\M{family}\,\M{key}\,\M{code}\\
+% \cs{AddToKeyvalOption} \*\,\M{key}\,\M{code}
+% \end{declcs}
+% The code for an existing key \meta{key} of family \meta{family} is
+% extended by code \meta{code}. In the starred form the current
+% family setting is used, see \cs{ProcessKeyvalOptions*}.
+%
% \subsection{Global vs. local options}
%
% Options that are given for \cs{documentclass} are called
@@ -715,7 +728,7 @@ and the derived files
% Package identification
% -----------------------
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{example-mycolorsetup}[2009/08/13 Managing my colors]
+\ProvidesPackage{example-mycolorsetup}[2009/12/08 Managing my colors]
\RequirePackage{ifpdf}
\RequirePackage{kvoptions}
@@ -1088,7 +1101,7 @@ and the derived files
\fi
\expandafter\x\csname ver@kvoptions.sty\endcsname
\ProvidesPackage{kvoptions}%
- [2009/08/13 v3.4 Keyval support for LaTeX options (HO)]
+ [2009/12/08 v3.6 Keyval support for LaTeX options (HO)]
% \end{macrocode}
%
% \paragraph{Catcodes}
@@ -1189,7 +1202,7 @@ and the derived files
% \begin{macrocode}
\DeclareOption{patch}{%
\AtEndOfPackage{%
- \RequirePackage{kvoptions-patch}[2009/08/13]%
+ \RequirePackage{kvoptions-patch}[2009/12/08]%
}%
}
% \end{macrocode}
@@ -1719,6 +1732,58 @@ and the derived files
}
% \end{macrocode}
%
+% \subsection{Change option code}
+%
+% \subsubsection{\cs{AddToKeyvalOption}}
+%
+% \begin{macro}{\AddToKeyvalOption}
+% \begin{macrocode}
+\newcommand*{\AddToKeyvalOption}{%
+ \@ifstar{%
+ \begingroup
+ \edef\x{\endgroup
+ \noexpand\KVO@AddToKeyvalOption{\KVO@family}%
+ }%
+ \x
+ }%
+ \KVO@AddToKeyvalOption
+}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\KVO@AddToKeyvalOption}
+% \begin{macrocode}
+\def\KVO@AddToKeyvalOption#1#2{%
+ \@ifundefined{KV@#1@#2}{%
+ \PackageWarning{kvoptions}{%
+ Key `#2' of family `#1' does not exist.\MessageBreak
+ Ignoring \string\AddToKeyvalOption
+ }%
+ \@gobble
+ }{%
+ \edef\KVO@next{%
+ \noexpand\KVO@@AddToKeyvalOption
+ \expandafter\noexpand\csname KV@#1@#2\endcsname
+ }%
+ \afterassignment\KVO@next
+ \def\KVO@temp##1%
+ }%
+}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\KVO@@AddToKeyvalOption}
+% \begin{macrocode}
+\def\KVO@@AddToKeyvalOption#1{%
+ \begingroup
+ \toks@\expandafter{#1{##1}}%
+ \toks@\expandafter{\the\expandafter\toks@\KVO@temp{##1}}%
+ \edef\x{\endgroup
+ \noexpand\def\noexpand#1####1{\the\toks@}%
+ }%
+ \x
+}
+% \end{macrocode}
+% \end{macro}
+%
% \subsection{Process options}
%
% \subsubsection{\cs{ProcessKeyvalOptions}}
@@ -1808,21 +1873,28 @@ and the derived files
KV@#1@\expandafter\KVO@getkey\CurrentOption=\@nil
}{%
% \end{macrocode}
-% A class puts not used options in the unused option list.
+% A class puts not used options in the unused option list
+% unless there is a default handler.
% \begin{macrocode}
- \ifx\KVO@Patch Y%
- \@onelevel@sanitize\CurrentOption
- \fi
- \ifx\@unusedoptionlist\@empty
- \global\let\@unusedoptionlist\CurrentOption
- \else
- \expandafter\expandafter\expandafter\gdef
- \expandafter\expandafter\expandafter\@unusedoptionlist
- \expandafter\expandafter\expandafter{%
- \expandafter\@unusedoptionlist
- \expandafter,\CurrentOption
+ \@ifundefined{KVO@default@\@currname.\@currext}{%
+ \ifx\KVO@Patch Y%
+ \@onelevel@sanitize\CurrentOption
+ \fi
+ \ifx\@unusedoptionlist\@empty
+ \global\let\@unusedoptionlist\CurrentOption
+ \else
+ \expandafter\expandafter\expandafter\gdef
+ \expandafter\expandafter\expandafter\@unusedoptionlist
+ \expandafter\expandafter\expandafter{%
+ \expandafter\@unusedoptionlist
+ \expandafter,\CurrentOption
+ }%
+ \fi
+ }{%
+ \toks\tw@\expandafter{%
+ \the\toks\expandafter\tw@\expandafter,\CurrentOption
}%
- \fi
+ }%
}{%
\toks@\expandafter{%
\the\expandafter\toks@\expandafter,\CurrentOption
@@ -2078,7 +2150,7 @@ and the derived files
\noexpand\endinput
}
\ProvidesPackage{kvoptions-patch}%
- [2009/08/13 v3.4 LaTeX patch for keyval options (HO)]%
+ [2009/12/08 v3.6 LaTeX patch for keyval options (HO)]%
% \end{macrocode}
%
% Check for \eTeX.
@@ -2723,6 +2795,47 @@ and the derived files
%</test2>
% \end{macrocode}
%
+% \begin{macrocode}
+%<*test3>
+\NeedsTeXFormat{LaTeX2e}
+\makeatletter
+\RequirePackage{kvoptions}[2009/12/08]
+\def\msg#{\immediate\write16}
+\define@key{testfamily}{testkey}{%
+ \msg{[testfamily/testkey/#1]}%
+}
+\define@key{testfamily}{testdefaultkey}[testdefault]{%
+ \msg{[testfamily/testdefaultkey/#1]}%
+}
+\AddToKeyvalOption{testfamily}{testkey}{%
+ \msg{[addition/#1]}%
+}
+\AddToKeyvalOption{testfamily}{testdefaultkey}{%
+ \msg{[addition/#1]}%
+}
+\setkeys{testfamily}{%
+ testkey=testA,%
+ testdefaultkey=testB,%
+ testdefaultkey,%
+}
+\SetupKeyvalOptions{%
+ family=testfamily%
+}
+\AddToKeyvalOption*{testkey}{%
+ \msg{[star addition/#1]}%
+}
+\AddToKeyvalOption*{testdefaultkey}{%
+ \msg{[star addition/#1]}%
+}
+\setkeys{testfamily}{%
+ testkey=testA,%
+ testdefaultkey=testB,%
+ testdefaultkey,%
+}
+\@@end
+%</test3>
+% \end{macrocode}
+%
% \section{Installation}
%
% \subsection{Download}
@@ -2788,6 +2901,7 @@ and the derived files
% example-mycolorsetup.sty & doc/latex/oberdiek/example-mycolorsetup.sty\\
% test/kvoptions-test1.tex & doc/latex/oberdiek/test/kvoptions-test1.tex\\
% test/kvoptions-test2.tex & doc/latex/oberdiek/test/kvoptions-test2.tex\\
+% test/kvoptions-test3.tex & doc/latex/oberdiek/test/kvoptions-test3.tex\\
% kvoptions.dtx & source/latex/oberdiek/kvoptions.dtx\\
% \end{tabular}^^A
% }^^A
@@ -3044,6 +3158,15 @@ and the derived files
% \item
% Documentation addition: local/global options.
% \end{Version}
+% \begin{Version}{2009/12/04 v3.5}
+% \item
+% \cs{AddToKeyvalOption} added.
+% \end{Version}
+% \begin{Version}{2009/12/08 v3.6}
+% \item
+% Fix: If a default handler is configured, it is now also
+% called for classes.
+% \end{Version}
% \end{History}
%
% \PrintIndex