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.dtx230
1 files changed, 177 insertions, 53 deletions
diff --git a/Master/texmf-dist/source/latex/oberdiek/kvoptions.dtx b/Master/texmf-dist/source/latex/oberdiek/kvoptions.dtx
index 9148014c921..e7b9e0a0f57 100644
--- a/Master/texmf-dist/source/latex/oberdiek/kvoptions.dtx
+++ b/Master/texmf-dist/source/latex/oberdiek/kvoptions.dtx
@@ -18,7 +18,8 @@
% This work consists of the main source file kvoptions.dtx
% and the derived files
% kvoptions.sty, kvoptions.pdf, kvoptions.ins, kvoptions.drv,
-% example-mycolorsetup.sty, kvoptions-test1.tex.
+% kvoptions-patch.sty, example-mycolorsetup.sty,
+% kvoptions-test1.tex, kvoptions-test2.tex.
%
% Distribution:
% CTAN:macros/latex/contrib/oberdiek/kvoptions.dtx
@@ -52,9 +53,11 @@
%
% Installation:
% TDS:tex/latex/oberdiek/kvoptions.sty
+% TDS:tex/latex/oberdiek/kvoptions-patch.sty
% TDS:doc/latex/oberdiek/kvoptions.pdf
% TDS:doc/latex/oberdiek/example-mycolorsetup.sty
-% TDS:doc/latex/oberdiek/kvoptions-test1.tex
+% TDS:doc/latex/oberdiek/test/kvoptions-test1.tex
+% TDS:doc/latex/oberdiek/test/kvoptions-test2.tex
% TDS:source/latex/oberdiek/kvoptions.dtx
%
%<*ignore>
@@ -70,7 +73,7 @@
\input docstrip.tex
\Msg{************************************************************************}
\Msg{* Installation}
-\Msg{* Package: kvoptions 2007/10/02 v2.8 Connects package keyval with LaTeX options (HO)}
+\Msg{* Package: kvoptions 2007/10/18 v3.0 Keyval support for LaTeX options (HO)}
\Msg{************************************************************************}
\keepsilent
@@ -98,7 +101,8 @@ This Current Maintainer of this work is Heiko Oberdiek.
This work consists of the main source file kvoptions.dtx
and the derived files
kvoptions.sty, kvoptions.pdf, kvoptions.ins, kvoptions.drv,
- example-mycolorsetup.sty, kvoptions-test1.tex.
+ kvoptions-patch.sty, example-mycolorsetup.sty,
+ kvoptions-test1.tex, kvoptions-test2.tex.
\endpreamble
@@ -107,18 +111,21 @@ and the derived files
\file{kvoptions.drv}{\from{kvoptions.dtx}{driver}}%
\usedir{tex/latex/oberdiek}%
\file{kvoptions.sty}{\from{kvoptions.dtx}{package}}%
+ \file{kvoptions-patch.sty}{\from{kvoptions.dtx}{patch}}%
\usedir{doc/latex/oberdiek}%
\file{example-mycolorsetup.sty}{\from{kvoptions.dtx}{example}}%
+ \usedir{doc/latex/oberdiek/test}%
\file{kvoptions-test1.tex}{\from{kvoptions.dtx}{test1}}%
+ \file{kvoptions-test2.tex}{\from{kvoptions.dtx}{test2}}%
}
\obeyspaces
\Msg{************************************************************************}
\Msg{*}
\Msg{* To finish the installation you have to move the following}
-\Msg{* file into a directory searched by TeX:}
+\Msg{* files into a directory searched by TeX:}
\Msg{*}
-\Msg{* kvoptions.sty}
+\Msg{* kvoptions.sty, kvoptions-patch.sty}
\Msg{*}
\Msg{* To produce the documentation run the file `kvoptions.drv'}
\Msg{* through LaTeX.}
@@ -135,16 +142,16 @@ and the derived files
%<*driver>
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{kvoptions.drv}%
- [2007/10/02 v2.8 Connects package keyval with LaTeX options (HO)]%
+ [2007/10/18 v3.0 Keyval support for LaTeX options (HO)]%
\documentclass{ltxdoc}
-\usepackage{holtxdoc}
+\usepackage{holtxdoc}[2007/10/21]
\begin{document}
\DocInput{kvoptions.dtx}%
\end{document}
%</driver>
% \fi
%
-% \CheckSum{1741}
+% \CheckSum{1866}
%
% \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
@@ -165,7 +172,7 @@ and the derived files
% \GetFileInfo{kvoptions.drv}
%
% \title{The \xpackage{kvoptions} package}
-% \date{2007/10/02 v2.8}
+% \date{2007/10/18 v3.0}
% \author{Heiko Oberdiek\\\xemail{oberdiek@uni-freiburg.de}}
%
% \maketitle
@@ -641,7 +648,7 @@ and the derived files
% Package identification
% -----------------------
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{example-mycolorsetup}[2007/10/02 Managing my colors]
+\ProvidesPackage{example-mycolorsetup}[2007/10/18 Managing my colors]
\RequirePackage{ifpdf}
\RequirePackage{kvoptions}
@@ -749,7 +756,9 @@ and the derived files
% Thus package and class authors, stay with |\RequirePackage{kvoptions}|
% without options.
%
-% \subsection{Option \xoption{patch}}
+% Option \xoption{patch} loads package \xpackage{kvoptions-patch}.
+%
+% \subsection{Package \xpackage{kvoptions-patch}}
%
% \LaTeX's system of package/class options has some severe limitations
% that especially affects the value part if options are used as
@@ -852,31 +861,33 @@ and the derived files
% \section{Limitations}
%
% \subsection{Compatibility}
-% \subsubsection{Option \xoption{patch} vs. package \xpackage{xkvltxp}}
+% \subsubsection{Package \xpackage{kvoptions-patch} vs. package \xpackage{xkvltxp}}
%
% Package \xpackage{xkvltxp} from the \xpackage{xkeyval} project
-% has the same goal as \xpackage{kvoptions}'s
-% option \xoption{patch} and patches \LaTeX's kernel commands.
+% has the same goal as package \xpackage{kvoptions-patch}
+% and to patch \LaTeX's kernel commands in order to get better support
+% for key value options.
% Of course they cannot be used both. The user must decide, which
-% method he prefers. Package \xpackage{kvoptions} drops option
-% \xoption{patch} if it detects that \xpackage{xkvltxp} is
+% method he prefers. Package \xpackage{kvoptions-patch} aborts itself,
+% if it detects that \xpackage{xkvltxp} is
% already loaded.
%
-% However both \emph{packages} can be used together, example:
+% However package \xpackage{xkvltxp} and \xpackage{kvoptions}
+% can be used together, example:
% \begin{quote}
% |\usepackage{xkvltxp}|\\
% |\usepackage[...]{foobar} % |\texttt{\itshape foobar using kvoptions}
% \end{quote}
% The other way should work, too.
%
-% Package \xpackage{kvoptions} tries to catch more situations
+% Package \xpackage{kvoptions-patch} tries to catch more situations
% and to be more robust.
% For example, during the comparison of options it normalizes
% them by removing spaces around |=| and the value. Thus the
% following is not reported as option clash:
% \begin{quote}
%\begin{verbatim}
-%\RequirePackage[patch]{kvoptions}
+%\RequirePackage{kvoptions-patch}
%\documentclass{article}
%
%\usepackage[scaled=0.7]{helvet}
@@ -903,9 +914,9 @@ and the derived files
% |\usepackage[0.95]{helvet}|
% \end{quote}
%
-% \subsubsection{Option list parsing with option \xoption{patch}}
+% \subsubsection{Option list parsing with package \xpackage{kvoptions-patch}}
%
-% With option \xoption{patch} the range of possible values
+% With package \xpackage{kvoptions-patch} the range of possible values
% in key value specifications is much large, for example
% the comma can be used, if enclosed in curly braces.
%
@@ -922,7 +933,7 @@ and the derived files
%
% Example:
% \begin{quote}
-% |\RequirePackage[patch]{kvoptions}|\\
+% |\RequirePackage{kvoptions-patch}|\\
% |\documentclass[a={a,b,c},b]{article}|\\
% |\begin{document}|\\
% |\end{document}|
@@ -1002,7 +1013,7 @@ and the derived files
\fi
\expandafter\x\csname ver@kvoptions.sty\endcsname
\ProvidesPackage{kvoptions}%
- [2007/10/02 v2.8 Connects package keyval with LaTeX options (HO)]
+ [2007/10/18 v3.0 Keyval support for LaTeX options (HO)]
% \end{macrocode}
%
% \paragraph{Catcodes}
@@ -1027,6 +1038,7 @@ and the derived files
\TMP@EnsureCode{41}{12}% )
\TMP@EnsureCode{42}{12}% *
\TMP@EnsureCode{44}{12}% ,
+\TMP@EnsureCode{45}{12}% -
\TMP@EnsureCode{46}{12}% .
\TMP@EnsureCode{47}{12}% /
\TMP@EnsureCode{58}{12}% :
@@ -1081,7 +1093,11 @@ and the derived files
% \end{macrocode}
%
% \begin{macrocode}
-\DeclareOption{patch}{\catcode\tw@=9 }
+\DeclareOption{patch}{%
+ \AtEndOfPackage{%
+ \RequirePackage{kvoptions-patch}[2007/10/18]%
+ }%
+}
% \end{macrocode}
%
% Optionen auswerten:
@@ -1630,17 +1646,26 @@ and the derived files
\@ifundefined{KV@#1@\expandafter\KVO@getkey
\KVO@CurrentOption=\@nil}{%
}{%
- \edef\KVO@temp{%
-^^B \etex@unexpanded\expandafter{%
+ \ifx\KVO@Patch Y%
+ \edef\KVO@temp{%
+ \etex@unexpanded\expandafter{%
+ \KVO@temp
+ }%
+ ,%
+ \etex@unexpanded\expandafter{%
+ \KVO@CurrentOption
+ }%
+ ,%
+ }%
+ \@onelevel@sanitize\KVO@CurrentOption
+ \else
+ \edef\KVO@temp{%
\KVO@temp
-^^B }%
- ,%
-^^B \etex@unexpanded\expandafter{%
+ ,%
\KVO@CurrentOption
-^^B }%
- ,%
- }%
-^^B \@onelevel@sanitize\KVO@CurrentOption
+ ,%
+ }%
+ \fi
\@expandtwoargs\@removeelement\KVO@CurrentOption
\@unusedoptionlist\@unusedoptionlist
}%
@@ -1671,7 +1696,9 @@ and the derived files
% \end{macrocode}
% A class puts not used options in the unused option list.
% \begin{macrocode}
-^^B \@onelevel@sanitize\CurrentOption
+ \ifx\KVO@Patch Y%
+ \@onelevel@sanitize\CurrentOption
+ \fi
\ifx\@unusedoptionlist\@empty
\global\let\@unusedoptionlist\CurrentOption
\else
@@ -1794,43 +1821,76 @@ and the derived files
\def\ProcessKeyvalOptions{%
\@ifstar{}\@gobble
}%
- \catcode\tw@=14 %
\fi
% \end{macrocode}
%
-% \subsection{Patch}
-%
-% Caution: docstrip stops at \cs{endinput} if it starts a line.
% \begin{macrocode}
-^^B\@gobbletwo
-\KVO@AtEnd\endinput
+\KVO@AtEnd
+%</package>
% \end{macrocode}
+%
+% \subsection{Package \xpackage{kvoptions-patch}}
+%
% \begin{macrocode}
-\PackageInfo{kvoptions}{Patching LaTeX's option system}
+%<*patch>
+\NeedsTeXFormat{LaTeX2e}
+\expandafter\edef\csname KVO@AtEnd\endcsname{%
+ \catcode64 \the\catcode64\relax
+}
+\catcode64 11 % @
+\def\TMP@EnsureCode#1#2{%
+ \edef\KVO@AtEnd{%
+ \KVO@AtEnd
+ \catcode#1 \the\catcode#1\relax
+ }%
+ \catcode#1 #2\relax
+}
+\TMP@EnsureCode{39}{12}% '
+\TMP@EnsureCode{40}{12}% (
+\TMP@EnsureCode{41}{12}% )
+\TMP@EnsureCode{43}{12}% +
+\TMP@EnsureCode{44}{12}% ,
+\TMP@EnsureCode{45}{12}% -
+\TMP@EnsureCode{46}{12}% .
+\TMP@EnsureCode{47}{12}% /
+\TMP@EnsureCode{58}{12}% :
+\TMP@EnsureCode{60}{12}% <
+\TMP@EnsureCode{61}{12}% =
+\TMP@EnsureCode{62}{12}% >
+\TMP@EnsureCode{91}{12}% [
+\TMP@EnsureCode{93}{12}% ]
+\TMP@EnsureCode{96}{12}% `
+\TMP@EnsureCode{124}{12}% |
+\edef\KVO@AtEnd{%
+ \KVO@AtEnd
+ \noexpand\endinput
+}
+\ProvidesPackage{kvoptions-patch}%
+ [2007/10/18 v3.0 LaTeX patch for keyval options (HO)]%
% \end{macrocode}
%
% Check for \eTeX.
% \begin{macrocode}
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname eTeXversion\endcsname\relax
- \PackageWarningNoLine{kvoptions}{%
- Option `patch' ignored, because e-TeX is missing%
+ \PackageWarningNoLine{kvoptions-patch}{%
+ Package loading is aborted, because e-TeX is missing%
}%
- \expandafter\endinput
+ \expandafter\KVO@AtEnd
\fi
% \end{macrocode}
%
% Package \xpackage{etexcmds} for \cs{etex@unexpanded}.
% \begin{macrocode}
-\RequirePackage{etexcmds}
+\RequirePackage{etexcmds}[2007/09/09]
\ifetex@unexpanded
\else
- \PackageError{kvoptions}{%
+ \PackageError{kvoptions-patch}{%
Could not find eTeX's \string\unexpanded.\MessageBreak
Try adding \string\RequirePackage\string{etexcmds\string} %
before \string\documentclass%
}\@ehd
- \expandafter\endinput
+ \expandafter\KVO@AtEnd
\fi
% \end{macrocode}
%
@@ -1840,9 +1900,9 @@ and the derived files
\PackageWarningNoLine{kvoptions}{%
Option `patch' cannot be used together with\MessageBreak
package `xkvltxp' that is already loaded.\MessageBreak
- Therefore option `patch' will be ignored%
+ Therefore package loading is aborted%
}%
- \endinput
+ \KVO@AtEnd
}{}
% \end{macrocode}
%
@@ -2295,9 +2355,15 @@ and the derived files
\fi
% \end{macrocode}
%
+% \begin{macro}{\KVO@Patch}
% \begin{macrocode}
-KVO@AtEnd
-%</package>
+\let\KVO@Patch=Y
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\KVO@AtEnd
+%</patch>
% \end{macrocode}
%
% \section{Test}
@@ -2362,6 +2428,54 @@ KVO@AtEnd
%</test1>
% \end{macrocode}
%
+% \begin{macrocode}
+%<*test2>
+\NeedsTeXFormat{LaTeX2e}
+\makeatletter
+\catcode`\@=11 %
+\def\RestoreCatcodes{}
+\count@=0 %
+\loop
+ \edef\RestoreCatcodes{%
+ \RestoreCatcodes
+ \catcode\the\count@=\the\catcode\count@\relax
+ }%
+\ifnum\count@<255 %
+ \advance\count@\@ne
+\repeat
+
+\def\RangeCatcodeInvalid#1#2{%
+ \count@=#1\relax
+ \loop
+ \catcode\count@=15 %
+ \ifnum\count@<#2\relax
+ \advance\count@\@ne
+ \repeat
+}
+\def\Test#1{%
+ \RangeCatcodeInvalid{0}{47}%
+ \RangeCatcodeInvalid{58}{64}%
+ \RangeCatcodeInvalid{91}{96}%
+ \RangeCatcodeInvalid{123}{255}%
+ \catcode`\@=12 %
+ \catcode`\\=0 %
+ \catcode`\{=1 %
+ \catcode`\}=2 %
+ \catcode`\#=6 %
+ \catcode`\[=12 %
+ \catcode`\]=12 %
+ \catcode`\%=14 %
+ \catcode`\ =10 %
+ \catcode13=5 %
+ #1\relax
+ \RestoreCatcodes
+}
+\Test{\RequirePackage{kvoptions-patch}}%
+\Test{\RequirePackage{kvoptions}}%
+\csname @@end\endcsname
+%</test2>
+% \end{macrocode}
+%
% \section{Installation}
%
% \subsection{Download}
@@ -2422,9 +2536,11 @@ KVO@AtEnd
% \def\t{^^A
% \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$ }>{\ttfamily}l@{}}
% kvoptions.sty & tex/latex/oberdiek/kvoptions.sty\\
+% kvoptions-patch.sty & tex/latex/oberdiek/kvoptions-patch.sty\\
% kvoptions.pdf & doc/latex/oberdiek/kvoptions.pdf\\
% example-mycolorsetup.sty & doc/latex/oberdiek/example-mycolorsetup.sty\\
-% kvoptions-test1.tex & doc/latex/oberdiek/kvoptions-test1.tex\\
+% test/kvoptions-test1.tex & doc/latex/oberdiek/test/kvoptions-test1.tex\\
+% test/kvoptions-test2.tex & doc/latex/oberdiek/test/kvoptions-test2.tex\\
% kvoptions.dtx & source/latex/oberdiek/kvoptions.dtx\\
% \end{tabular}^^A
% }^^A
@@ -2647,6 +2763,14 @@ KVO@AtEnd
% \item
% Typos in documentation fixed (Axel Sommerfeldt).
% \end{Version}
+% \begin{Version}{2007/10/11 v2.9}
+% \item
+% Bug fix for option \xoption{patch}.
+% \end{Version}
+% \begin{Version}{2007/10/18 v3.0}
+% \item
+% New package \xpackage{kvoptions-patch}.
+% \end{Version}
% \end{History}
%
% \PrintIndex