You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
836 lines
22 KiB
836 lines
22 KiB
%%
|
|
%% This is file `kvoptions.sty',
|
|
%% generated with the docstrip utility.
|
|
%%
|
|
%% The original source files were:
|
|
%%
|
|
%% kvoptions.dtx (with options: `package')
|
|
%%
|
|
%% This is a generated file.
|
|
%%
|
|
%% Project: kvoptions
|
|
%% Version: 2019/11/29 v3.13
|
|
%%
|
|
%% Copyright (C)
|
|
%% 2004, 2006, 2007, 2009-2011 Heiko Oberdiek
|
|
%% 2016-2019 Oberdiek Package Support Group
|
|
%%
|
|
%% This work may be distributed and/or modified under the
|
|
%% conditions of the LaTeX Project Public License, either
|
|
%% version 1.3c of this license or (at your option) any later
|
|
%% version. This version of this license is in
|
|
%% https://www.latex-project.org/lppl/lppl-1-3c.txt
|
|
%% and the latest version of this license is in
|
|
%% https://www.latex-project.org/lppl.txt
|
|
%% and version 1.3 or later is part of all distributions of
|
|
%% LaTeX version 2005/12/01 or later.
|
|
%%
|
|
%% This work has the LPPL maintenance status "maintained".
|
|
%%
|
|
%% The Current Maintainers of this work are
|
|
%% Heiko Oberdiek and the Oberdiek Package Support Group
|
|
%% https://github.com/ho-tex/kvoptions/issues
|
|
%%
|
|
%%
|
|
%% 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-test3.tex, kvoptions-test4.tex,
|
|
%% kvoptions-test4.sty.
|
|
%%
|
|
%% No we don't need the option 'color'.
|
|
%% With color support option 'emphcolor' will dynamically
|
|
%% change the color of \emph statements.
|
|
\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@kvoptions.sty\endcsname
|
|
\ifx\x\relax % plain-TeX, first loading
|
|
\else
|
|
\def\empty{}%
|
|
\ifx\x\empty % LaTeX, first loading,
|
|
% variable is initialized, but \ProvidesPackage not yet seen
|
|
\else
|
|
\expandafter\ifx\csname PackageInfo\endcsname\relax
|
|
\def\x#1#2{%
|
|
\immediate\write-1{Package #1 Info: #2.}%
|
|
}%
|
|
\else
|
|
\def\x#1#2{\PackageInfo{#1}{#2, stopped}}%
|
|
\fi
|
|
\x{kvoptions}{The package is already loaded}%
|
|
\aftergroup\endinput
|
|
\fi
|
|
\fi
|
|
\endgroup%
|
|
\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}%
|
|
\xdef#1{#4}%
|
|
}%
|
|
\else
|
|
\def\x#1#2[#3]{\endgroup
|
|
#2[{#3}]%
|
|
\ifx#1\@undefined
|
|
\xdef#1{#3}%
|
|
\fi
|
|
\ifx#1\relax
|
|
\xdef#1{#3}%
|
|
\fi
|
|
}%
|
|
\fi
|
|
\expandafter\x\csname ver@kvoptions.sty\endcsname
|
|
\ProvidesPackage{kvoptions}%
|
|
[2019/11/29 v3.13 Key value format for package options (HO)]%
|
|
\begingroup\catcode61\catcode48\catcode32=10\relax%
|
|
\catcode13=5 % ^^M
|
|
\endlinechar=13 %
|
|
\catcode123=1 % {
|
|
\catcode125=2 % }
|
|
\catcode64=11 % @
|
|
\def\x{\endgroup
|
|
\expandafter\edef\csname KVO@AtEnd\endcsname{%
|
|
\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\catcode61\catcode48\catcode32=10\relax%
|
|
\catcode13=5 % ^^M
|
|
\endlinechar=13 %
|
|
\catcode35=6 % #
|
|
\catcode64=11 % @
|
|
\catcode123=1 % {
|
|
\catcode125=2 % }
|
|
\def\TMP@EnsureCode#1#2{%
|
|
\edef\KVO@AtEnd{%
|
|
\KVO@AtEnd
|
|
\catcode#1=\the\catcode#1\relax
|
|
}%
|
|
\catcode#1=#2\relax
|
|
}
|
|
\TMP@EnsureCode{1}{14}% ^^A (comment)
|
|
\TMP@EnsureCode{2}{14}% ^^A (comment)
|
|
\TMP@EnsureCode{33}{12}% !
|
|
\TMP@EnsureCode{39}{12}% '
|
|
\TMP@EnsureCode{40}{12}% (
|
|
\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}% :
|
|
\TMP@EnsureCode{62}{12}% >
|
|
\TMP@EnsureCode{91}{12}% [
|
|
\TMP@EnsureCode{93}{12}% ]
|
|
\TMP@EnsureCode{94}{7}% ^ (superscript)
|
|
\TMP@EnsureCode{96}{12}% `
|
|
\edef\KVO@AtEnd{\KVO@AtEnd\noexpand\endinput}
|
|
\@ifundefined{define@key}{%
|
|
\RequirePackage{keyval}\relax
|
|
}{}
|
|
\RequirePackage{ltxcmds}[2010/12/02]
|
|
\RequirePackage{kvsetkeys}[2007/09/29]
|
|
\@ifundefined{@x@protect}{%
|
|
\def\@x@protect#1\fi#2#3{%
|
|
\fi\protect#1%
|
|
}%
|
|
\let\@typeset@protect\relax
|
|
}{}
|
|
\@ifundefined{@currname}{%
|
|
\def\@currname{}%
|
|
}{}
|
|
\@ifundefined{@currext}{%
|
|
\def\@currext{}%
|
|
}{}
|
|
\DeclareOption{debugshow}{\catcode\@ne=9 }
|
|
\DeclareOption{patch}{%
|
|
\AtEndOfPackage{%
|
|
\RequirePackage{kvoptions-patch}[2019/11/29]%
|
|
}%
|
|
}
|
|
\ProcessOptions\relax
|
|
\define@key{KVO}{family}{%
|
|
\expandafter\edef\csname KVO@family@%
|
|
\@currname.\@currext\endcsname{#1}%
|
|
}
|
|
\def\KVO@family{%
|
|
\@ifundefined{KVO@family@\@currname.\@currext}{%
|
|
\@currname
|
|
}{%
|
|
\csname KVO@family@\@currname.\@currext\endcsname
|
|
}%
|
|
}
|
|
\define@key{KVO}{prefix}{%
|
|
\expandafter\edef\csname KVO@prefix@%
|
|
\@currname.\@currext\endcsname{#1}%
|
|
}
|
|
\def\KVO@prefix{%
|
|
\ltx@ifundefined{KVO@prefix@\@currname.\@currext}{%
|
|
\@currname @%
|
|
}{%
|
|
\csname KVO@prefix@\@currname.\@currext\endcsname
|
|
}%
|
|
}
|
|
\define@key{KVO}{setkeys}{%
|
|
\expandafter\def\csname KVO@setkeys@%
|
|
\@currname.\@currext\endcsname{#1}%
|
|
}
|
|
\def\KVO@setkeys{%
|
|
\ltx@IfUndefined{KVO@setkeys@\@currname.\@currext}{%
|
|
\setkeys
|
|
}{%
|
|
\csname KVO@setkeys@\@currname.\@currext\endcsname
|
|
}%
|
|
}
|
|
\newcommand*{\SetupKeyvalOptions}{%
|
|
\kvsetkeys{KVO}%
|
|
}
|
|
\newcommand*{\DeclareBoolOption}[2][false]{%
|
|
\KVO@ifdefinable{if\KVO@prefix#2}{%
|
|
\KVO@ifdefinable{\KVO@prefix#2true}{%
|
|
\KVO@ifdefinable{\KVO@prefix#2false}{%
|
|
\csname newif\expandafter\endcsname
|
|
\csname if\KVO@prefix#2\endcsname
|
|
\@ifundefined{\KVO@prefix#2#1}{%
|
|
\PackageWarning{kvoptions}{%
|
|
Initialization of option `#2' failed,\MessageBreak
|
|
cannot set boolean option to `#1',\MessageBreak
|
|
use `true' or `false', now using `false'%
|
|
}%
|
|
}{%
|
|
\csname\KVO@prefix#2#1\endcsname
|
|
}%
|
|
\begingroup
|
|
\edef\x{\endgroup
|
|
\noexpand\define@key{\KVO@family}{#2}[true]{%
|
|
\noexpand\KVO@boolkey{\@currname}%
|
|
\ifx\@currext\@clsextension
|
|
\noexpand\@clsextension
|
|
\else
|
|
\noexpand\@pkgextension
|
|
\fi
|
|
{\KVO@prefix}{#2}{####1}%
|
|
}%
|
|
}%
|
|
\x
|
|
}%
|
|
}%
|
|
}%
|
|
}
|
|
\newcommand*{\DeclareComplementaryOption}[2]{%
|
|
\@ifundefined{if\KVO@prefix#2}{%
|
|
\PackageError{kvoptions}{%
|
|
Cannot generate option code for `#1',\MessageBreak
|
|
parent switch `#2' does not exist%
|
|
}{%
|
|
You are inside %
|
|
\ifx\@currext\@clsextension class\else package\fi\space
|
|
`\@currname.\@currext'.\MessageBreak
|
|
`\KVO@family' is used as familiy %
|
|
for the keyval options.\MessageBreak
|
|
`\KVO@prefix' serves as prefix %
|
|
for internal switch macros.\MessageBreak
|
|
\MessageBreak
|
|
\@ehc
|
|
}%
|
|
}{%
|
|
\KVO@ifdefinable{\KVO@prefix#1true}{%
|
|
\KVO@ifdefinable{\KVO@prefix#1false}{%
|
|
\expandafter\let\csname\KVO@prefix#1false\expandafter\endcsname
|
|
\csname\KVO@prefix#2true\endcsname
|
|
\expandafter\let\csname\KVO@prefix#1true\expandafter\endcsname
|
|
\csname\KVO@prefix#2false\endcsname
|
|
\begingroup
|
|
\edef\x{\endgroup
|
|
\noexpand\define@key{\KVO@family}{#1}[true]{%
|
|
\noexpand\KVO@boolkey{\@currname}%
|
|
\ifx\@currext\@clsextension
|
|
\noexpand\@clsextension
|
|
\else
|
|
\noexpand\@pkgextension
|
|
\fi
|
|
{\KVO@prefix}{#1}{####1}%
|
|
}%
|
|
}%
|
|
\x
|
|
}%
|
|
}%
|
|
}%
|
|
}
|
|
\def\KVO@ifdefinable#1{%
|
|
\expandafter\@ifdefinable\csname #1\endcsname
|
|
}
|
|
\def\KVO@boolkey#1#2#3#4#5{%
|
|
\edef\KVO@param{#5}%
|
|
\ltx@onelevel@sanitize\KVO@param
|
|
\ifx\KVO@param\KVO@true
|
|
\expandafter\@firstofone
|
|
\else
|
|
\ifx\KVO@param\KVO@false
|
|
\expandafter\expandafter\expandafter\@firstofone
|
|
\else
|
|
\ifx#2\@clsextension
|
|
\expandafter\ClassWarning
|
|
\else
|
|
\expandafter\PackageWarning
|
|
\fi
|
|
{#1}{%
|
|
Value `\KVO@param' is not supported by\MessageBreak
|
|
option `#4'%
|
|
}%
|
|
\expandafter\expandafter\expandafter\@gobble
|
|
\fi
|
|
\fi
|
|
{%
|
|
^^A\ifx#2\@clsextension
|
|
^^A \expandafter\ClassInfo
|
|
^^A\else
|
|
^^A \expandafter\PackageInfo
|
|
^^A\fi
|
|
^^A{#1}{[option] #4=\KVO@param}%
|
|
\csname#3#4\KVO@param\endcsname
|
|
}%
|
|
}
|
|
\def\KVO@true{true}
|
|
\def\KVO@false{false}
|
|
\ltx@onelevel@sanitize\KVO@true
|
|
\ltx@onelevel@sanitize\KVO@false
|
|
\newcommand*{\DeclareStringOption}[2][]{%
|
|
\@ifnextchar[{%
|
|
\KVO@DeclareStringOption{#1}{#2}@%
|
|
}{%
|
|
\KVO@DeclareStringOption{#1}{#2}{}[]%
|
|
}%
|
|
}
|
|
\def\KVO@DeclareStringOption#1#2#3[#4]{%
|
|
\KVO@ifdefinable{\KVO@prefix#2}{%
|
|
\@namedef{\KVO@prefix#2}{#1}%
|
|
\begingroup
|
|
\ifx\\#3\\%
|
|
\toks@{}%
|
|
\else
|
|
\toks@{[{#4}]}%
|
|
\fi
|
|
\edef\x{\endgroup
|
|
\noexpand\define@key{\KVO@family}{#2}\the\toks@{%
|
|
^^A\begingroup
|
|
^^A \toks@{####1}%
|
|
^^A \ifx\@currext\@clsextension
|
|
^^A \noexpand\ClassInfo
|
|
^^A \else
|
|
^^A \noexpand\PackageInfo
|
|
^^A \fi
|
|
^^A {\@currname}{%
|
|
^^A [option] #2={\noexpand\the\toks@}%
|
|
^^A }%
|
|
^^A\endgroup
|
|
\noexpand\def
|
|
\expandafter\noexpand\csname\KVO@prefix#2\endcsname{####1}%
|
|
}%
|
|
}%
|
|
\x
|
|
}%
|
|
}
|
|
\newcommand*{\DeclareVoidOption}[2]{%
|
|
\begingroup
|
|
\let\next\@gobbletwo
|
|
\KVO@ifdefinable{\KVO@prefix#1}{%
|
|
\let\next\@firstofone
|
|
}%
|
|
\expandafter\endgroup
|
|
\next{%
|
|
\begingroup
|
|
\edef\x{\endgroup
|
|
\noexpand\define@key{\KVO@family}{#1}[\KVO@VOID@]{%
|
|
\noexpand\KVO@voidkey{\@currname}%
|
|
\ifx\@currext\@clsextension
|
|
\noexpand\@clsextension
|
|
\else
|
|
\noexpand\@pkgextension
|
|
\fi
|
|
{#1}%
|
|
{####1}%
|
|
\expandafter\noexpand\csname\KVO@prefix#1\endcsname
|
|
}%
|
|
}%
|
|
\x
|
|
\begingroup
|
|
\toks@{#2}%
|
|
\expandafter\endgroup
|
|
\expandafter\def
|
|
\csname\KVO@prefix#1\expandafter\endcsname
|
|
\expandafter{\the\toks@}%
|
|
}%
|
|
}
|
|
\def\KVO@VOID@{@VOID@}
|
|
\def\KVO@voidkey#1#2#3#4{%
|
|
\def\CurrentOption{#3}%
|
|
\begingroup
|
|
\def\x{#4}%
|
|
\expandafter\endgroup
|
|
\ifx\x\KVO@VOID@
|
|
\else
|
|
\ifx#2\@clsextension
|
|
\expandafter\ClassWarning
|
|
\else
|
|
\expandafter\PackageWarning
|
|
\fi
|
|
{#1}{%
|
|
Unexpected value for option `#3'\MessageBreak
|
|
is ignored%
|
|
}%
|
|
\fi
|
|
^^A\ifx#2\@clsextension
|
|
^^A \expandafter\ClassInfo
|
|
^^A\else
|
|
^^A \expandafter\PackageInfo
|
|
^^A\fi
|
|
^^A{#1}{[option] #3}%
|
|
}
|
|
\newcommand*{\DeclareDefaultOption}{%
|
|
\@namedef{KVO@default@\@currname.\@currext}%
|
|
}
|
|
\newcommand*{\DeclareLocalOptions}[1]{%
|
|
\comma@parse{#1}\KVO@DeclareLocalOption
|
|
}
|
|
\def\KVO@DeclareLocalOption#1{%
|
|
\expandafter\def\csname KVO@local@\KVO@family @#1\endcsname{}%
|
|
}
|
|
\SetupKeyvalOptions{%
|
|
family=KVOdyn,%
|
|
prefix=KVOdyn@%
|
|
}
|
|
\DeclareBoolOption[true]{global}
|
|
\DeclareComplementaryOption{local}{global}
|
|
\DeclareStringOption[undef]{action}
|
|
\let\KVOdyn@name\relax
|
|
\let\KVOdyn@ext\@empty
|
|
\define@key{KVOdyn}{class}{%
|
|
\def\KVOdyn@name{#1}%
|
|
\let\KVOdyn@ext\@clsextension
|
|
}
|
|
\define@key{KVOdyn}{package}{%
|
|
\def\KVOdyn@name{#1}%
|
|
\let\KVOdyn@ext\@pkgextension
|
|
}
|
|
\newcommand*{\DisableKeyvalOption}[3][]{%
|
|
\begingroup
|
|
\kvsetkeys{KVOdyn}{#1}%
|
|
\def\x{\endgroup}%
|
|
\@ifundefined{KVO@action@\KVOdyn@action}{%
|
|
\PackageError{kvoptions}{%
|
|
Unknown disable action %
|
|
`\expandafter\strip@prefix\meaning\KVOdyn@action'\MessageBreak
|
|
for option `#3' in keyval family '#2'%
|
|
}\@ehc
|
|
}{%
|
|
\csname KVO@action@\KVOdyn@action\endcsname{#2}{#3}%
|
|
}%
|
|
\x
|
|
}
|
|
\def\KVO@action@undef#1#2{%
|
|
\edef\x{\endgroup
|
|
\ifKVOdyn@global\global\fi
|
|
\let
|
|
\expandafter\noexpand\csname KV@#1@#2\endcsname
|
|
\relax
|
|
\ifKVOdyn@global\global\fi
|
|
\let
|
|
\expandafter\noexpand\csname KV@#1@#2@default\endcsname
|
|
\relax
|
|
}%
|
|
^^A\PackageInfo{kvoptions}{%
|
|
^^A [option] key `#2' of family `#1'\MessageBreak
|
|
^^A is disabled (undef, \ifKVOdyn@global global\else local\fi)%
|
|
^^A}%
|
|
}
|
|
\def\KVO@action@ignore#1#2{%
|
|
\edef\x{\endgroup
|
|
\ifKVOdyn@global\global\fi
|
|
\let
|
|
\expandafter\noexpand\csname KV@#1@#2\endcsname
|
|
\noexpand\@gobble
|
|
\ifKVOdyn@global\global\fi
|
|
\let
|
|
\expandafter\noexpand\csname KV@#1@#2@default\endcsname
|
|
\noexpand\@empty
|
|
}%
|
|
^^A\PackageInfo{kvoptions}{%
|
|
^^A [option] key `#2' of family `#1'\MessageBreak
|
|
^^A is disabled (ignore, \ifKVOdyn@global global\else local\fi)%
|
|
^^A}%
|
|
}
|
|
\def\KVO@action@error{%
|
|
\KVO@do@action{error}%
|
|
}
|
|
\def\KVO@action@warning{%
|
|
\KVO@do@action{warning}%
|
|
}
|
|
\def\KVO@do@action#1#2#3{%
|
|
\ifx\KVOdyn@name\relax
|
|
\PackageError{kvoptions}{%
|
|
Action type `#1' needs package/class name\MessageBreak
|
|
for key `#3' in family `#2'%
|
|
}\@ehc
|
|
\else
|
|
\edef\x{\endgroup
|
|
\noexpand\define@key{#2}{#3}[]{%
|
|
\expandafter\noexpand\csname KVO@disable@#1\endcsname
|
|
{\KVOdyn@name}\noexpand\KVOdyn@ext{#3}%
|
|
}%
|
|
\ifKVOdyn@global
|
|
\global\let
|
|
\expandafter\noexpand\csname KV@#2@#3\endcsname
|
|
\expandafter\noexpand\csname KV@#2@#3\endcsname
|
|
\global\let
|
|
\expandafter\noexpand\csname KV@#2@#3@default\endcsname
|
|
\expandafter\noexpand\csname KV@#2@#3@default\endcsname
|
|
\fi
|
|
}%
|
|
^^A\ifx\KVOdyn@ext\@clsextension
|
|
^^A \expandafter\ClassInfo
|
|
^^A\else
|
|
^^A \expandafter\PackageInfo
|
|
^^A\fi
|
|
^^A{\KVOdyn@name}{%
|
|
^^A [option] key `#3' of family `#2'\MessageBreak
|
|
^^A is disabled (#1, \ifKVOdyn@global global\else local\fi)%
|
|
^^A}%
|
|
\fi
|
|
}
|
|
\def\KVO@disable@error#1#2#3{%
|
|
\ifx#2\@clsextension
|
|
\expandafter\ClassError
|
|
\else
|
|
\expandafter\PackageError
|
|
\fi
|
|
{#1}{%
|
|
Option `#3' is given too late,\MessageBreak
|
|
now the option is ignored%
|
|
}\@ehc
|
|
}
|
|
\def\KVO@disable@warning#1#2#3{%
|
|
\ifx#2\@clsextension
|
|
\expandafter\ClassWarning
|
|
\else
|
|
\expandafter\PackageWarning
|
|
\fi
|
|
{#1}{%
|
|
Option `#3' is already consumed\MessageBreak
|
|
and has no effect%
|
|
}%
|
|
}
|
|
\newcommand*{\AddToKeyvalOption}{%
|
|
\@ifstar{%
|
|
\begingroup
|
|
\edef\x{\endgroup
|
|
\noexpand\KVO@AddToKeyvalOption{\KVO@family}%
|
|
}%
|
|
\x
|
|
}%
|
|
\KVO@AddToKeyvalOption
|
|
}
|
|
\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%
|
|
}%
|
|
}
|
|
\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
|
|
}
|
|
\def\KVO@IfDefThen#1#2{%
|
|
\ifx#1\ltx@undefined
|
|
\else
|
|
\ifx#1\relax
|
|
\else
|
|
#2%
|
|
\fi
|
|
\fi
|
|
}%
|
|
\def\KVO@GetClassOptionsList{%
|
|
\let\KVO@classoptionslist\@classoptionslist
|
|
\KVO@IfDefThen\@classoptionslist{%
|
|
\KVO@IfDefThen\XKV@documentclass{%
|
|
\ifx\XKV@documentclass\ltx@empty
|
|
\else
|
|
\KVO@IfDefThen\XKV@classoptionslist{%
|
|
\ifx\XKV@classoptionslist\ltx@empty
|
|
\else
|
|
\let\KVO@classoptionslist\XKV@classoptionslist
|
|
\fi
|
|
}%
|
|
\fi
|
|
}%
|
|
}%
|
|
}%
|
|
\newcommand*{\ProcessKeyvalOptions}{%
|
|
\@ifstar{%
|
|
\begingroup
|
|
\edef\x{\endgroup
|
|
\noexpand\KVO@ProcessKeyvalOptions{\KVO@family}%
|
|
}%
|
|
\x
|
|
}%
|
|
\KVO@ProcessKeyvalOptions
|
|
}
|
|
\def\KVO@ProcessKeyvalOptions#1{%
|
|
\let\@tempc\relax
|
|
\let\KVO@temp\@empty
|
|
\ifx\@currext\@clsextension
|
|
\else
|
|
\KVO@GetClassOptionsList
|
|
\ifx\KVO@classoptionslist\relax
|
|
\else
|
|
\@for\KVO@CurrentOption:=\KVO@classoptionslist\do{%
|
|
\@ifundefined{KV@#1@\expandafter\KVO@getkey
|
|
\KVO@CurrentOption=\@nil}{%
|
|
}{%
|
|
\@ifundefined{KVO@local@#1@\expandafter\KVO@getkey
|
|
\KVO@CurrentOption=\@nil}{%
|
|
\ifx\KVO@Patch Y%
|
|
\edef\KVO@temp{%
|
|
\etex@unexpanded\expandafter{%
|
|
\KVO@temp
|
|
}%
|
|
,%
|
|
\etex@unexpanded\expandafter{%
|
|
\KVO@CurrentOption
|
|
}%
|
|
,%
|
|
}%
|
|
\ltx@onelevel@sanitize\KVO@CurrentOption
|
|
\else
|
|
\edef\KVO@temp{%
|
|
\KVO@temp
|
|
,%
|
|
\KVO@CurrentOption
|
|
,%
|
|
}%
|
|
\fi
|
|
\@expandtwoargs\@removeelement\KVO@CurrentOption
|
|
\@unusedoptionlist\@unusedoptionlist
|
|
}{}%
|
|
}%
|
|
}%
|
|
\fi
|
|
\fi
|
|
\begingroup
|
|
\toks\tw@{}%
|
|
\@ifundefined{opt@\@currname.\@currext}{%
|
|
\toks@\expandafter{\KVO@temp}%
|
|
}{%
|
|
\toks@\expandafter\expandafter\expandafter{%
|
|
\csname opt@\@currname.\@currext\endcsname
|
|
}%
|
|
\ifx\@currext\@clsextension
|
|
\edef\CurrentOption{\the\toks@}%
|
|
\toks@\expandafter{\KVO@temp}%
|
|
\@for\CurrentOption:=\CurrentOption\do{%
|
|
\@ifundefined{%
|
|
KV@#1@\expandafter\KVO@getkey\CurrentOption=\@nil
|
|
}{%
|
|
\@ifundefined{KVO@default@\@currname.\@currext}{%
|
|
\ifx\KVO@Patch Y%
|
|
\ltx@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
|
|
}%
|
|
}%
|
|
}{%
|
|
\toks@\expandafter{%
|
|
\the\expandafter\toks@\expandafter,\CurrentOption
|
|
}%
|
|
}%
|
|
}%
|
|
\else
|
|
\@ifundefined{KVO@default@\@currname.\@currext}{%
|
|
\toks@\expandafter\expandafter\expandafter{%
|
|
\expandafter\KVO@temp\the\toks@
|
|
}%
|
|
}{%
|
|
\edef\CurrentOption{\the\toks@}%
|
|
\toks@\expandafter{\KVO@temp}%
|
|
\@for\CurrentOption:=\CurrentOption\do{%
|
|
\@ifundefined{%
|
|
KV@#1@\expandafter\KVO@getkey\CurrentOption=\@nil
|
|
}{%
|
|
\toks\tw@\expandafter{%
|
|
\the\toks\expandafter\tw@\expandafter,\CurrentOption
|
|
}%
|
|
}{%
|
|
\toks@\expandafter{%
|
|
\the\expandafter\toks@\expandafter,\CurrentOption
|
|
}%
|
|
}%
|
|
}%
|
|
}%
|
|
\fi
|
|
}%
|
|
\edef\KVO@temp{\endgroup
|
|
\noexpand\KVO@calldefault{\the\toks\tw@}%
|
|
\noexpand\KVO@setkeys{#1}{\the\toks@}%
|
|
}%
|
|
\KVO@temp
|
|
\let\CurrentOption\@empty
|
|
\AtEndOfPackage{\let\@unprocessedoptions\relax}%
|
|
}
|
|
\newcommand*{\ProcessLocalKeyvalOptions}{%
|
|
\@ifstar{%
|
|
\begingroup
|
|
\edef\x{\endgroup
|
|
\noexpand\KVO@ProcessLocalKeyvalOptions{\KVO@family}%
|
|
}%
|
|
\x
|
|
}%
|
|
\KVO@ProcessLocalKeyvalOptions
|
|
}
|
|
\def\KVO@ProcessLocalKeyvalOptions#1{%
|
|
\let\@tempc\relax
|
|
\let\KVO@temp\@empty
|
|
\ifx\@currext\@pkgextension
|
|
\else
|
|
\PackageError{kvoptions}{%
|
|
\string\ProcessLocalKeyvalOptions\space is intended for packages only%
|
|
}\@ehc
|
|
\fi
|
|
\begingroup
|
|
\toks\tw@{}%
|
|
\@ifundefined{opt@\@currname.\@currext}{%
|
|
\toks@\expandafter{\KVO@temp}%
|
|
}{%
|
|
\toks@\expandafter\expandafter\expandafter{%
|
|
\csname opt@\@currname.\@currext\endcsname
|
|
}%
|
|
\@ifundefined{KVO@default@\@currname.\@currext}{%
|
|
\toks@\expandafter\expandafter\expandafter{%
|
|
\expandafter\KVO@temp\the\toks@
|
|
}%
|
|
}{%
|
|
\edef\CurrentOption{\the\toks@}%
|
|
\toks@\expandafter{\KVO@temp}%
|
|
\@for\CurrentOption:=\CurrentOption\do{%
|
|
\@ifundefined{%
|
|
KV@#1@\expandafter\KVO@getkey\CurrentOption=\@nil
|
|
}{%
|
|
\toks\tw@\expandafter{%
|
|
\the\toks\expandafter\tw@\expandafter,\CurrentOption
|
|
}%
|
|
}{%
|
|
\toks@\expandafter{%
|
|
\the\expandafter\toks@\expandafter,\CurrentOption
|
|
}%
|
|
}%
|
|
}%
|
|
}%
|
|
}%
|
|
\edef\KVO@temp{\endgroup
|
|
\noexpand\KVO@calldefault{\the\toks\tw@}%
|
|
\noexpand\KVO@setkeys{#1}{\the\toks@}%
|
|
}%
|
|
\KVO@temp
|
|
\let\CurrentOption\@empty
|
|
\AtEndOfPackage{\let\@unprocessedoptions\relax}%
|
|
}
|
|
\def\KVO@getkey#1=#2\@nil{#1}
|
|
\def\KVO@calldefault#1{%
|
|
\begingroup
|
|
\def\x{#1}%
|
|
\expandafter\endgroup
|
|
\ifx\x\@empty
|
|
\else
|
|
\@for\CurrentOption:=#1\do{%
|
|
\ifx\CurrentOption\@empty
|
|
\else
|
|
\expandafter\KVO@setcurrents\CurrentOption=\@nil
|
|
\@nameuse{KVO@default@\@currname.\@currext}%
|
|
\fi
|
|
}%
|
|
\fi
|
|
}
|
|
\def\KVO@setcurrents#1=#2\@nil{%
|
|
\def\CurrentOptionValue{#2}%
|
|
\ifx\CurrentOptionValue\@empty
|
|
\let\CurrentOptionKey\CurrentOption
|
|
\let\CurrentOptionValue\relax
|
|
\else
|
|
\edef\CurrentOptionKey{\zap@space#1 \@empty}%
|
|
\expandafter\KVO@setcurrentvalue\CurrentOption\@nil
|
|
\fi
|
|
}
|
|
\def\KVO@setcurrentvalue#1=#2\@nil{%
|
|
\KV@@sp@def\CurrentOptionValue{#2}%
|
|
}
|
|
\begingroup\expandafter\expandafter\expandafter\endgroup
|
|
\expandafter\ifx\csname documentclass\endcsname\relax
|
|
\def\ProcessKeyvalOptions{%
|
|
\@ifstar{}\@gobble
|
|
}%
|
|
\fi
|
|
\KVO@AtEnd%
|
|
\endinput
|
|
%%
|
|
%% End of file `kvoptions.sty'.
|
|
|