summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/skeyval/skeyval-testpkg.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/latex/skeyval/skeyval-testpkg.sty')
-rw-r--r--Master/texmf-dist/doc/latex/skeyval/skeyval-testpkg.sty140
1 files changed, 71 insertions, 69 deletions
diff --git a/Master/texmf-dist/doc/latex/skeyval/skeyval-testpkg.sty b/Master/texmf-dist/doc/latex/skeyval/skeyval-testpkg.sty
index eae0c324f7d..30de37acd89 100644
--- a/Master/texmf-dist/doc/latex/skeyval/skeyval-testpkg.sty
+++ b/Master/texmf-dist/doc/latex/skeyval/skeyval-testpkg.sty
@@ -1,5 +1,5 @@
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++%
-% This is file 'skeyval-testpkg.sty', version 1.1, 2012/10/15. %
+% This is file 'skeyval-testpkg.sty', version 1.1a, 2012/10/16. %
% %
% This package and accompanying files may be distributed and/or %
% modified under the conditions of the LaTeX Project Public License, %
@@ -27,7 +27,7 @@
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++%
\ProvidesPackage{skeyval-testpkg}
- [2012/10/15 v1.1 skeyval test package 1 (AM)]
+ [2012/10/16 v1.1a skeyval test package 1 (AM)]
\NeedsTeXFormat{LaTeX2e}
\@ifpackageloaded{skeyval}{}{\RequirePackage{skeyval}}
\RequirePackage{graphicx}
@@ -36,30 +36,12 @@
%%++++++++++++++++ Passing options to packages +++++++++++++++++++%%
-\skvdeclarebooloption[SKVT]<passoptions>[skvtp@]{verbose}[true]{}
+\skvdeclarebooloption[SKVT]<testpkg>[skvtp@]{verbose}[true]{}
% Declare options with default values that will be used when the options
-% are called without user values:
-% \DeclarePassedOptions{<option>=<default>,...}
-\skvrobustdef*\skvDeclarePassedOptions#1{%
- \skvkvparse{#1}\skv@tempa{%
- \def\do##1=##2=##3\@nil{%
- \skvdeclareoption{##1}[##2]{%
- \skvifcsdef{ver@##1.sty}{%
- \skv@warn{Package '##1' has been loaded and
- \MessageBreak now you've asked for it to be loaded}%
- }{%
- \skvAfterProcessOptions{%
- \RequirePackage[####1]{##1}%
- }%
- }%
- }%
- }%
- \expandafter\do\skv@tempa==\@nil
- }%
-}
-
-\skvDeclarePassedOptions{%
+% are called without user values.
+%
+\skvDeclarePassedOptionsLoadPackage[SKVT]{testpkg}{%
hyperref={colorlinks,breaklinks},xcolor=svgnames
}
@@ -69,7 +51,7 @@
% 'shadowbox' family below.
\newcommand*\justified{}
\skvordkey[SKVT]{abrtext}{align}[right]{%
- \skvifcase\skvxifstrcmp{#1}
+ \skvifcase\skvxifstrcmpTF{#1}
{left}{\def\mpfalign{flushleft}}
{right}{\def\mpfalign{flushright}}
{center}{\def\mpfalign{center}}
@@ -169,7 +151,7 @@
.cmd/framecolor/black,
.cmd/shadecolor/white,
.cmd/shadowcolor/gray!55,
- .cmd/boxwidth/2cm,
+ .cmd/boxwidth/1.5cm,
.ord/framesize/.5pt/\def\currfboxrule{#1},
.ord/shadowsize/2pt/\shadowspread=\dimexpr#1\relax,
.choice/align/center/{%
@@ -187,28 +169,32 @@
\skvdisablekeys[SKVT]{testfam}{put shadow, shade color}
-% 'Presetting keys' means set the following keys whenever \setkeys is called.
-% These keys should be set BEFORE the keys listed in the current argument of
-% \setkeys are set, provided that these keys aren't listed in the current
-% argument of \setkeys. If these keys appear in the current argument of \setkeys,
-% then obviously the user has new values for them or he wants the keys to be
-% set with their default values.
-
-% 'Postsetting keys' means set the following keys whenever \setkeys is called.
-% These keys should be set AFTER the keys listed in the current argument of
-% \setkeys are set, provided that these keys aren't listed in the current
-% argument of \setkeys.
-
-% The command \presetkeys of the xkeyval package expects both 'head' and 'tail'.
-% The skeyval package splits \presetkeys into two, hopefully less confusing,
-% commands: \skvpresetkeys and \skvpostsetkeys.
-
-% There is also command \skvpreposetkeys, which combines \skvpresetkeys and
-% \skvpostsetkeys. This expects both head and tail and is equivalent to
-% xkeyval's \presetkeys.
+% Presetting and posetting keys.
+%
+% 1. 'Presetting keys' means set the following keys whenever
+% \setkeys is called. These keys should be set BEFORE the keys
+% listed in the current argument of \setkeys are set, provided
+% that these keys aren't listed in the current argument of \setkeys.
+% If these keys appear in the current argument of \setkeys,
+% then obviously the user has new values for them or he wants
+% the keys to be set with their default values.
+%
+% 2. 'Postsetting keys' means set the following keys whenever
+% \setkeys is called. These keys should be set AFTER the keys
+% listed in the current argument of \setkeys are set, provided
+% that these keys aren't listed in the current argument of \setkeys.
+%
+% 3. The command \presetkeys of the xkeyval package expects both
+% 'head' and 'tail'. The skeyval package splits \presetkeys into two,
+% hopefully less confusing, commands: \skvpresetkeys and
+% \skvpostsetkeys.
+%
+% 4. There is also command \skvpreposetkeys, which combines
+% \skvpresetkeys and \skvpostsetkeys. This expects both head and
+% tail and is equivalent to xkeyval's \presetkeys.
\skvpresetkeys[SKVT]{shadowbox}{%
- put frame,framecolor=black,framesize=.8pt,boxwidth=2cm,align=center,
+ put frame,framecolor=black,framesize=.8pt,boxwidth=1.5cm,align=center,
shadecolor=gray!15
}
@@ -240,13 +226,18 @@
% The following are meant to demonstrate the use of the macro \directkeys:
-\newcount\skvsratchcnt
+\ifdefined\skvtestcnt
+ \skvtestcnt\z@
+\else
+ \newcount\skvtestcnt
+\fi
\def\logsetting{%
- \advance\skvsratchcnt\@ne
+ \advance\skvtestcnt\@ne
\typeout{'\skvcurrentkey' set: no.
- \ifnum\skvsratchcnt<10 0\fi\the\skvsratchcnt, %
+ \ifnum\skvtestcnt<10 0\fi\the\skvtestcnt, %
path: \skvcurrentprefix/\skvcurrentfamily}%
}
+
\directkeys{%
% #1 will be the user-value of the handler 'some handler'.
.new handlers = {
@@ -284,29 +275,37 @@
.ignore prefixes = {KVA,KVD},
.ignore families = {fama,famb,famc},
.restore families = {fama,famb},
- .restore roots = {KVA/fama,KVD/famc},
+ .restore paths = {KVA/fama,KVD/famc},
% .ignore keys = {keyb,keyc},
.new keys = {
.ord/keya/keya-default,
.cmd/keyb/keyb-default/\def\x##1{##1#1},
.cmd/keyc/keyc-default,
- .choice/keyd/center/{right,left,center},
+ .choice*/keyd/center
+ /{ right.do=\def\val@r{#1},
+ left.do=\def\val@l{#1},
+ center.do=\def\val@c{#1}
+ }
+ /\def\yes{value accepted}
+ /\def\no{value rejected},
.bool/keye/true/
- \ifskvindef\else
- \logsetting
- \fi
+ \ifskvindef\else\logsetting\fi
\ifmp@keye\def\y##1{##1#1}\fi
,
.bool/keyf/true/,
.bool/keyg/true/
},
+ .push path,
+ .path = KV/fam1,
+ .set keys = {keyd},
+ .pop path,
.ignore keys = {keyb,keyc},
% Stop processing this list:
% .list break,
.restore keys = {keyb,keyc},
.preset keys = {keyb,keyc},
.postset keys = {keyb,keyc},
- % save unknown keys in the default macro \<pref>@<fam>@rmkeys:
+ % Save unknown keys in the default macro \<pref>@<fam>@rmkeys:
.save unknown keys = true,
.save unknown keys in = \macroa,
.set keys = {keya,keyb,keyc,keyd,keye},
@@ -317,11 +316,12 @@
.set rmkeys*,
% Execute arbitrary code:
.exec code=\def\x#1{#1},
- % Nesting of \directkeys is possible. At the end of the nest, prevailing
- % variables of \directkeys revert to their previous (door) values:
+ % Nesting of \directkeys is possible. Pre-entry and post-entry
+ % topologies are independent. At the end of the nest,
+ % prevailing variables of \directkeys revert to their previous
+ % (pre-door) values:
\directkeys{
- .prefixes = {KVA,KVB},
- .family = fam3,
+ .paths = {KVA/fam3,KVB/fam3},
.holder prefix = hp@,
.define keys = {
.cmd/keya/keya-default/\def\x##1{##1#1},
@@ -332,12 +332,14 @@
.exec code = \def\keycval{true},
% Prepend style keye to key1 and key2:
.prepend style={key1/{keye=.expanded{\keycval}},key2/{keye=false}},
- .prepend style={{key3,key4}/{keye=true,keyf=true}, key5/{keye=false}},
+ % Multi-prepend styles:
+ .prepend style={{key3,key4}/{keye=true,keyf=true},key5/{keye=false}},
% Prepend style keyd to key6:
.prepend style={key6/{keyd=right}},
- % Append styles keye and keyf to key7 and key8:
+ % Append styles keye and keyf to key7 and key8.
+ % '.styles' and '.style' are equivalent to '.append styles'
+ % and '.append style'.
.append style={key7/{keye=true},key8/{keyf=false}},
- %
% The next two link keyb and keyc to key9. #1 here refers to the
% current value of key9. The same effect can be achieved directly
% via the '.link' handler:
@@ -347,7 +349,7 @@
% Link keye and keyf to key10 and key11. The values of key10 and
% key11 are used to set keye and keyf. key10 and key11 are hence
% 'parent keys'.
- .link={key10/keye, key11/keyf},
+ .link = {key10/keye, {key11,key12}/{keyf,keyg}},
.set keys = {key10=true},
.ignore key = keyf,
.save unknown keys in = \macrob,
@@ -394,7 +396,7 @@
%%+++++++++++++++++++++ Changing the key parser ++++++++++++++++++++%%
\setupskeyval{key parser={;}}
-\AfterDefineKeys{\setupskeyval{keyparser={,}}}
+\skvafterdefinekeys{\setupskeyval{keyparser={,}}}
\skvdefinekeys*[SKVT]{example}[exm@]{%
.zbool/put frame/true;
.cmd/shadecolor/green;
@@ -406,13 +408,12 @@
justified.do=\let\curralign\@iden
};
}
-%\setupskeyval{keyparser={,}}
%%++++++++++++++++++++++++++ Options section ++++++++++++++++++++++%%
\def\skvtp@unknownoptions{}
-\skvunknownoptionhandler[SKVT]<abrtext,shadowbox,citation,passoptions>{%
+\skvunknownoptionhandler[SKVT]<abrtext,shadowbox,citation,testpkg>{%
\edef\skvtp@unknownoptions{%
\skvtp@unknownoptions\ifx\skvtp@unknownoptions\@empty\else,\fi
#3%
@@ -425,9 +426,10 @@
}%
}
\skvexecuteoptions[SKVT]<abrtext>{align=.expanded{\alignval},
- text style=.expand once{\stextstyle},author,show author}
+ text style=.expand once{\stextstyle},author,show author
+}
-\skvprocessoptions*+[SKVT]<abrtext,shadowbox,citation,passoptions>\relax
-%\skvrestrictedprocessoptions*+[SKVT]<abrtext,shadowbox,citation,passoptions>\relax
+\skvprocessoptions*+[SKVT]<abrtext,shadowbox,citation,testpkg>\relax
+%\skvrestrictedprocessoptions*+[SKVT]<abrtext,shadowbox,citation,testpkg>\relax
\endinput