summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/oberdiek/kvdefinekeys.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/oberdiek/kvdefinekeys.dtx')
-rw-r--r--Master/texmf-dist/source/latex/oberdiek/kvdefinekeys.dtx202
1 files changed, 146 insertions, 56 deletions
diff --git a/Master/texmf-dist/source/latex/oberdiek/kvdefinekeys.dtx b/Master/texmf-dist/source/latex/oberdiek/kvdefinekeys.dtx
index c63ca028a9d..53a9e5a7aac 100644
--- a/Master/texmf-dist/source/latex/oberdiek/kvdefinekeys.dtx
+++ b/Master/texmf-dist/source/latex/oberdiek/kvdefinekeys.dtx
@@ -76,7 +76,7 @@
\input docstrip.tex
\Msg{************************************************************************}
\Msg{* Installation}
-\Msg{* Package: kvdefinekeys 2010/03/01 v1.0 Defining keys (HO)}
+\Msg{* Package: kvdefinekeys 2011/04/07 v1.3 Defining keys (HO)}
\Msg{************************************************************************}
\keepsilent
@@ -152,7 +152,7 @@ and the derived files
%<*driver>
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{kvdefinekeys.drv}%
- [2010/03/01 v1.0 Defining keys (HO)]%
+ [2011/04/07 v1.3 Defining keys (HO)]%
\documentclass{ltxdoc}
\usepackage{holtxdoc}[2008/08/11]
\begin{document}
@@ -161,7 +161,7 @@ and the derived files
%</driver>
% \fi
%
-% \CheckSum{314}
+% \CheckSum{426}
%
% \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
@@ -182,7 +182,7 @@ and the derived files
% \GetFileInfo{kvdefinekeys.drv}
%
% \title{The \xpackage{kvdefinekeys} package}
-% \date{2010/03/01 v1.0}
+% \date{2011/04/07 v1.3}
% \author{Heiko Oberdiek\\\xemail{heiko.oberdiek at googlemail.com}}
%
% \maketitle
@@ -205,11 +205,19 @@ and the derived files
% \cs{setkeys}. This package adds macros to define keys, closing
% the gap \cs{kvsetkeys} leaves.
%
-% \begin{declcs}{kv@define@key}\,\M{family}\,\M{key},[\meta{default}]
+% \begin{declcs}{kv@define@key}\,\M{family}\,\M{key}\,[\meta{default}]\,^^A
+% \M{definition}
% \end{declcs}
% Macro \cs{kv@define@key} reimplements \xpackage{keyval}'s
-% \cs{define@key}. As difference to the original the defined keys
-% also allow \cs{par} inside values.
+% \cs{define@key}. Differences to the original:
+% \begin{itemize}
+% \item The defined keys also allow \cs{par} inside values.
+% \item Shorthands of package \xpackage{babel} are supported in
+% family and key names.
+% \item Macro \cs{kv@define@key} is made robust if
+% \hologo{eTeX}'s \cs{protected} or \hologo{LaTeX}'s
+% \cs{DeclareRobustCommand} are found.
+% \end{itemize}
%
% \StopEventually{
% }
@@ -223,14 +231,18 @@ and the derived files
% \end{macrocode}
% Reload check, especially if the package is not used with \LaTeX.
% \begin{macrocode}
-\begingroup
- \catcode44 12 % ,
- \catcode45 12 % -
- \catcode46 12 % .
- \catcode58 12 % :
- \catcode64 11 % @
- \catcode123 1 % {
- \catcode125 2 % }
+\begingroup\catcode61\catcode48\catcode32=10\relax%
+ \catcode13=5 % ^^M
+ \endlinechar=13 %
+ \catcode35=6 % #
+ \catcode39=12 % '
+ \catcode44=12 % ,
+ \catcode45=12 % -
+ \catcode46=12 % .
+ \catcode58=12 % :
+ \catcode64=11 % @
+ \catcode123=1 % {
+ \catcode125=2 % }
\expandafter\let\expandafter\x\csname ver@kvdefinekeys.sty\endcsname
\ifx\x\relax % plain-TeX, first loading
\else
@@ -238,7 +250,6 @@ and the derived files
\ifx\x\empty % LaTeX, first loading,
% variable is initialized, but \ProvidesPackage not yet seen
\else
- \catcode35 6 % #
\expandafter\ifx\csname PackageInfo\endcsname\relax
\def\x#1#2{%
\immediate\write-1{Package #1 Info: #2.}%
@@ -250,24 +261,27 @@ and the derived files
\aftergroup\endinput
\fi
\fi
-\endgroup
+\endgroup%
% \end{macrocode}
% Package identification:
% \begin{macrocode}
-\begingroup
- \catcode35 6 % #
- \catcode40 12 % (
- \catcode41 12 % )
- \catcode44 12 % ,
- \catcode45 12 % -
- \catcode46 12 % .
- \catcode47 12 % /
- \catcode58 12 % :
- \catcode64 11 % @
- \catcode91 12 % [
- \catcode93 12 % ]
- \catcode123 1 % {
- \catcode125 2 % }
+\begingroup\catcode61\catcode48\catcode32=10\relax%
+ \catcode13=5 % ^^M
+ \endlinechar=13 %
+ \catcode35=6 % #
+ \catcode39=12 % '
+ \catcode40=12 % (
+ \catcode41=12 % )
+ \catcode44=12 % ,
+ \catcode45=12 % -
+ \catcode46=12 % .
+ \catcode47=12 % /
+ \catcode58=12 % :
+ \catcode64=11 % @
+ \catcode91=12 % [
+ \catcode93=12 % ]
+ \catcode123=1 % {
+ \catcode125=2 % }
\expandafter\ifx\csname ProvidesPackage\endcsname\relax
\def\x#1#2#3[#4]{\endgroup
\immediate\write-1{Package: #3 #4}%
@@ -286,35 +300,48 @@ and the derived files
\fi
\expandafter\x\csname ver@kvdefinekeys.sty\endcsname
\ProvidesPackage{kvdefinekeys}%
- [2010/03/01 v1.0 Defining keys (HO)]
+ [2011/04/07 v1.3 Defining keys (HO)]%
% \end{macrocode}
%
% \begin{macrocode}
-\begingroup
- \catcode123 1 % {
- \catcode125 2 % }
+\begingroup\catcode61\catcode48\catcode32=10\relax%
+ \catcode13=5 % ^^M
+ \endlinechar=13 %
+ \catcode123=1 % {
+ \catcode125=2 % }
+ \catcode64=11 % @
\def\x{\endgroup
\expandafter\edef\csname KVD@AtEnd\endcsname{%
- \catcode35 \the\catcode35\relax
- \catcode64 \the\catcode64\relax
- \catcode123 \the\catcode123\relax
- \catcode125 \the\catcode125\relax
+ \endlinechar=\the\endlinechar\relax
+ \catcode13=\the\catcode13\relax
+ \catcode32=\the\catcode32\relax
+ \catcode35=\the\catcode35\relax
+ \catcode61=\the\catcode61\relax
+ \catcode64=\the\catcode64\relax
+ \catcode123=\the\catcode123\relax
+ \catcode125=\the\catcode125\relax
}%
}%
-\x
-\catcode35 6 % #
-\catcode64 11 % @
-\catcode123 1 % {
-\catcode125 2 % }
+\x\catcode61\catcode48\catcode32=10\relax%
+\catcode13=5 % ^^M
+\endlinechar=13 %
+\catcode35=6 % #
+\catcode64=11 % @
+\catcode123=1 % {
+\catcode125=2 % }
\def\TMP@EnsureCode#1#2{%
\edef\KVD@AtEnd{%
\KVD@AtEnd
- \catcode#1 \the\catcode#1\relax
+ \catcode#1=\the\catcode#1\relax
}%
- \catcode#1 #2\relax
+ \catcode#1=#2\relax
}
+\TMP@EnsureCode{42}{12}% *
\TMP@EnsureCode{46}{12}% .
\TMP@EnsureCode{47}{12}% /
+\TMP@EnsureCode{91}{12}% [
+\TMP@EnsureCode{93}{12}% ]
+\edef\KVD@AtEnd{\KVD@AtEnd\noexpand\endinput}
% \end{macrocode}
%
% \subsection{Package loading}
@@ -322,7 +349,13 @@ and the derived files
% \begin{macrocode}
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname RequirePackage\endcsname\relax
- \input ltxcmds.sty\relax
+ \def\TMP@RequirePackage#1[#2]{%
+ \begingroup\expandafter\expandafter\expandafter\endgroup
+ \expandafter\ifx\csname ver@#1.sty\endcsname\relax
+ \input #1.sty\relax
+ \fi
+ }%
+ \TMP@RequirePackage{ltxcmds}[2010/03/01]%
\else
\RequirePackage{ltxcmds}[2010/03/01]%
\fi
@@ -333,7 +366,29 @@ and the derived files
%
% \begin{macro}{\kv@define@key}
% \begin{macrocode}
-\def\kv@define@key#1#2{%
+\ltx@IfUndefined{protected}{%
+ \ltx@IfUndefined{DeclareRobustCommand}{%
+ \def\kv@define@key#1#2%
+ }{%
+ \DeclareRobustCommand*{\kv@define@key}[2]%
+ }%
+}{%
+ \protected\def\kv@define@key#1#2%
+}%
+{%
+ \begingroup
+ \csname @safe@activestrue\endcsname
+ \let\ifincsname\iftrue
+ \edef\KVD@temp{\endgroup
+ \noexpand\KVD@DefineKey{#1}{#2}%
+ }%
+ \KVD@temp
+}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\KVD@DefineKey}
+% \begin{macrocode}
+\def\KVD@DefineKey#1#2{%
\ltx@ifnextchar[{%
\KVD@DefineKeyWithDefault{#1}{#2}%
}{%
@@ -355,7 +410,7 @@ and the derived files
% \end{macro}
%
% \begin{macrocode}
-\KVD@AtEnd
+\KVD@AtEnd%
%</package>
% \end{macrocode}
%
@@ -419,6 +474,22 @@ and the derived files
\advance\count@ 1 %
\repeat
}
+\def\RangeCatcodeCheck#1#2#3{%
+ \count@=#1\relax
+ \loop
+ \ifnum#3=\catcode\count@
+ \else
+ \errmessage{%
+ Character \the\count@\space
+ with wrong catcode \the\catcode\count@\space
+ instead of \number#3%
+ }%
+ \fi
+ \ifnum\count@<#2\relax
+ \advance\count@ 1 %
+ \repeat
+}
+\def\space{ }
\expandafter\ifx\csname LoadCommand\endcsname\relax
\def\LoadCommand{\input kvdefinekeys.sty\relax}%
\fi
@@ -429,15 +500,20 @@ and the derived files
\RangeCatcodeInvalid{123}{255}%
\catcode`\@=12 %
\catcode`\\=0 %
- \catcode`\{=1 %
- \catcode`\}=2 %
- \catcode`\#=6 %
- \catcode`\[=12 %
- \catcode`\]=12 %
\catcode`\%=14 %
- \catcode`\ =10 %
- \catcode13=5 %
\LoadCommand
+ \RangeCatcodeCheck{0}{36}{15}%
+ \RangeCatcodeCheck{37}{37}{14}%
+ \RangeCatcodeCheck{38}{47}{15}%
+ \RangeCatcodeCheck{48}{57}{12}%
+ \RangeCatcodeCheck{58}{63}{15}%
+ \RangeCatcodeCheck{64}{64}{12}%
+ \RangeCatcodeCheck{65}{90}{11}%
+ \RangeCatcodeCheck{91}{91}{15}%
+ \RangeCatcodeCheck{92}{92}{0}%
+ \RangeCatcodeCheck{93}{96}{15}%
+ \RangeCatcodeCheck{97}{122}{11}%
+ \RangeCatcodeCheck{123}{255}{15}%
\RestoreCatcodes
}
\Test
@@ -644,6 +720,20 @@ and the derived files
% \item
% First version.
% \end{Version}
+% \begin{Version}{2010/08/19 v1.1}
+% \item
+% Documentation fix, no code change.
+% \end{Version}
+% \begin{Version}{2011/01/30 v1.2}
+% \item
+% Already loaded package files are not input in \hologo{plainTeX}.
+% \end{Version}
+% \begin{Version}{2011/04/07 v1.3}
+% \item
+% Support for package \xpackage{babel}'s shorthands added.
+% \item
+% \cs{kv@define@key} is made robust if available.
+% \end{Version}
% \end{History}
%
% \PrintIndex