summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/latex')
-rw-r--r--Master/texmf-dist/doc/latex/ltxkeys/README5
-rw-r--r--Master/texmf-dist/doc/latex/ltxkeys/ltxkeys-guide-table1.tex7
-rw-r--r--Master/texmf-dist/doc/latex/ltxkeys/ltxkeys-guide.cfg2
-rw-r--r--Master/texmf-dist/doc/latex/ltxkeys/ltxkeys-guide.tex832
-rw-r--r--Master/texmf-dist/doc/latex/ltxkeys/ltxkeys-test-20121122.tex61
5 files changed, 513 insertions, 394 deletions
diff --git a/Master/texmf-dist/doc/latex/ltxkeys/README b/Master/texmf-dist/doc/latex/ltxkeys/README
index d3609376c67..bea50783284 100644
--- a/Master/texmf-dist/doc/latex/ltxkeys/README
+++ b/Master/texmf-dist/doc/latex/ltxkeys/README
@@ -2,7 +2,7 @@ This is the README file for the ltxkeys package.
VERSION
-Version 0.0.3b, October 14, 2012
+Version 0.0.3c, 2012/11/17
LOCATION ON CTAN
@@ -21,8 +21,7 @@ package is faster than the xkeyval package because, among other
features, it avoids character-wise parsing of key values (which
is called selective sanitization by the xkeyval package).
-It also provides many new functions for defining and
-managing keys, including the separate pathkeys package.
+It also provides many new functions for defining and managing keys.
LICENSE
diff --git a/Master/texmf-dist/doc/latex/ltxkeys/ltxkeys-guide-table1.tex b/Master/texmf-dist/doc/latex/ltxkeys/ltxkeys-guide-table1.tex
index 7a5a614c4cf..0e5797602ee 100644
--- a/Master/texmf-dist/doc/latex/ltxkeys/ltxkeys-guide-table1.tex
+++ b/Master/texmf-dist/doc/latex/ltxkeys/ltxkeys-guide-table1.tex
@@ -30,8 +30,12 @@
\colthree=\dimexpr\textwidth-(\colone+\coltwo+1.5cm)\relax
\coltotal=\dimexpr\colone+\coltwo+\colthree\relax
+
+%\starttracingall
+%\trace
\begingroup\small
\begin{tabularx}{\linewidth}{|m{3cm}|m{2cm}|X|}
+%\begin{longtable}[c]{|>{\hspace{0pt}\raggedright}m{\colone}|m{\coltwo}|m{\colthree}|}
\caption{Package options\xwmlabel{tab:pkgoptions}}\\\hline
\rowcolor{pink}
\bfseries Option&\bfseries Default&\bfseries Meaning\\\hline
@@ -49,7 +53,10 @@
\fx{keydepthlimit} & \hx{4} & This is used to guard against erroneous infinite re-entrance of the package's key-setting commands. The default value of~4 means that neither of these commands can ordinarily be nested beyond level~4.\useltablenote[tab:pkgoptions:note3]{ltxkeys-3}\\\hline
\fx{reservenopath} & \hx{false} & The \quoted{path} (or roots or bases) of a key is the combination of key prefix, key family and macro prefix, but when dealing with \quoted{path keys} (see \sref{sec:pathkeys}) the term excludes the macro prefix. These can be reserved and unreserved by any user by the tools of \sref{sec:reservedpath}. Subsequent users can, at their own risk, override all previously reserved paths by enabling the package's boolean option \fx{reservenopath}.\\\hline
\fx{allowemptypath} & \hx{false} & Allow the use of empty key prefix and family. This isn't advisable but some pre-existing packages might have used empty key prefixes and families. \useltablenote[tab:pkgoptions:note4]{4}
+%\end{longtable}
\end{tabularx}
\endgroup
+%\endtrace
+
\end{document} \ No newline at end of file
diff --git a/Master/texmf-dist/doc/latex/ltxkeys/ltxkeys-guide.cfg b/Master/texmf-dist/doc/latex/ltxkeys/ltxkeys-guide.cfg
index bde62498dc1..73fc463bfec 100644
--- a/Master/texmf-dist/doc/latex/ltxkeys/ltxkeys-guide.cfg
+++ b/Master/texmf-dist/doc/latex/ltxkeys/ltxkeys-guide.cfg
@@ -1,5 +1,5 @@
\ProvidesFile{ltxkeys-guide.cfg}%
- [2012/10/14 v0.0.3b Configuration file for ltxkeys-guide.tex (AM)]
+ [2012/11/17 v0.0.3c Configuration file for ltxkeys-guide.tex (AM)]
\hfuzz1pt\vfuzz2pt
\makeindex
diff --git a/Master/texmf-dist/doc/latex/ltxkeys/ltxkeys-guide.tex b/Master/texmf-dist/doc/latex/ltxkeys/ltxkeys-guide.tex
index 6e8b021c26c..dbc9151418a 100644
--- a/Master/texmf-dist/doc/latex/ltxkeys/ltxkeys-guide.tex
+++ b/Master/texmf-dist/doc/latex/ltxkeys/ltxkeys-guide.tex
@@ -14,32 +14,21 @@
\makeatletter
-\ltsbegincomment
+\ltscomment
% Include the use of the following commands in this manual:
-% \ltxkeysifoneincsvlistTF
-% \ltxkeysifincsvlistTF
-% \ltxkeysifoneintokenlistTF
-% \ltxkeysifintsvlistTF
-% \ifltxkeysnovalue
-
-% \ltxkeysgetrmkeys
-% \ltxkeysggetrmkeys
-
-% \ltxkeyspresetkeys
-% \ltxkeysgpresetkeys
-% \ltxkeyspostsetkeys
-% \ltxkeysgpostsetkeys
-
-% \ltxkeysinitializermkeys
-% \ltxkeysginitializermkeys
+% \ifltxkeys@novalue
+% \ltxkeys@presetkeys
+% \ltxkeys@gpresetkeys
+% \ltxkeys@postsetkeys
+% \ltxkeys@gpostsetkeys
+% \ltxkeys@preposetkeys
+% \ltxkeys@gpreposetkeys
\ltxkeysifinlistTF, \ltxkeysnormalizeset, \ltxkeysnormalizecsset
-\ltxkeysuseandrelaxcsn
-\ltxkeysifeltcountTF, \ltxkeyssetinitialkeyvalues, \ltxkeysinitializeafterdeclare
\carmustykeys
-\ltsendcomment
+\ltscommentend
\begin{document}
@@ -47,7 +36,7 @@
\title{The \texttt{\color{blue}ltxkeys} Package\titleref{t1,t2}}
\titlenotes[t1,t2]{%
The package is available at \url{\titleurltext}.\sep
- This user manual corresponds to version~0.0.3b of the package.
+ This user manual corresponds to version~0.0.3 of the package.
}
\subtitle{A robust key parser for \latex}
\titleurl{http://mirror.ctan.org/macros/latex/contrib/ltxkeys/}
@@ -67,7 +56,7 @@
\hrule
\ltsnewfootnote{1}{%
- Because of the multitude of functions provided by the \pkg'{ltxkeys}, it may actually slow down when executing some tasks, depending on the task at hand. The package option \fx{tracingkeys}, for example, does slow down processing. And automatically initiating keys after definition, as done by the command \ffx'{\ltxkeysdeclarekeys}, also affects processing speed; so does \quoted{launching keys}, which first presets absent keys with their default values before setting the current keys (\ie, keys whose values are provided by the user at the moment of setting keys that belong to a family). Then, as in the \pkg'{xkeyval}, there are the commands for presetting and post-setting keys.
+ Because of the multitude of functions provided by the \pkg'{ltxkeys}, it may actually slow down when executing some tasks, depending on the task at hand. The package option \fx{tracingkeys}, for example, does slow down processing. And automatically initiating keys after definition, as done by the commands \ffx'{\ltxkeysdefinekeys, \ltxkeysdeclarekeys}, also affects processing speed; so does \quoted{launching keys}, which first presets absent keys with their default values before setting the current keys (\ie, keys whose values are provided by the user at the moment of setting keys that belong to a family). Then, as in the \pkg'{xkeyval}, there are the commands for presetting and post-setting keys.
}
\ltsnewfootnote{2}{%
Options are also keys, but (from the user's viewpoint) there might be a need to treat options separately when dealing with unknown keys.
@@ -76,10 +65,7 @@
\docsection(sec:intro){Introduction}
-%\lletter{T}{he \pkg'{ltxkeys}}
-
-\yinipar{\color{red}T}he \pkg'{ltxkeys}
-provides facilities for creating and managing keys in the manner of the \pkg'{keyval, xkeyval}, but it is intended to be more robust, faster, and provide more functionality than these earlier packages. Its robustness emanates from, inter alia, its ability to preserve braces in key values throughout parsing. The need to preserve braces in key values without expecting the user to double braces emerges often in parsing keys. This is the case in, \eg, the \pkg'{xwatermark}, but consider also the possibility of passing all the following options to a package at once, where \quotedtt{layout} is a package or class option or key\footnote{It should be noted that if a value of the demonstrative option \fx{layout} is expandable, then the option can't be passed by \hx{\documentclass} without preloading a robust options parser like \pkg{kvoptions-patch, xkvltxp, ltxtools}, or \pkg{ltxkeys} package. In fact, \latex's native options processor can't handle options with values. The \pkg'{ltxkeys}, unlike the \pkg'{xkeyval}, can be loaded before \hx{\documentclass}.}:
+\lletter{T}{he \pkg'{ltxkeys}} provides facilities for creating and managing keys in the manner of the \pkg'{keyval, xkeyval}, but it is intended to be more robust, faster, and provide more functionality than these earlier packages. Its robustness emanates from, inter alia, its ability to preserve braces in key values throughout parsing. The need to preserve braces in key values without expecting the user to double braces emerges often in parsing keys. This is the case in, \eg, the \pkg'{xwatermark}, but consider also the possibility of passing all the following options to a package at once, where \quotedtt{layout} is a package or class option or key\footnote{It should be noted that if a value of the demonstrative option \fx{layout} is expandable, then the option can't be passed by \hx{\documentclass} without preloading a robust options parser like \pkg{kvoptions-patch, xkvltxp, ltxtools}, or \pkg{ltxkeys} package. In fact, \latex's native options processor can't handle options with values. The \pkg'{ltxkeys}, unlike the \pkg'{xkeyval}, can be loaded before \hx{\documentclass}.}:
%[Braced option values]
\start'{example}
@@ -137,15 +123,15 @@ The package options are listed in \sref{tab:pkgoptions}. The package options can
\usepackage[tracingkeys,keyparser={|nv}]{ltxkeys}
\finish{example}
-They can also be passed locally via the command \fx{\ltxkeysoptions}:
+They can also be passed locally via the command \fx{\setltxkeysoptions}:
-\start{newmacro}[\ltxkeysoptions]
-\ltxkeysoptions{tracingkeys=false,keyparser={;}}
+\start{newmacro}[\setltxkeysoptions]
+\setltxkeysoptions{tracingkeys=false,keyparser={;}}
\finish{newmacro}
-\fxim*{\ltxkeysoptions}
+\fxim*{\setltxkeysoptions}
\newltablenote{ltxkeys-1}{%
- The speed of compilation may be affected by this option, but it is recommended at the pre-production stages of developing keys. The option provide some trace functionality and enables the user to, among other things, follow the progress of the \latex run and to see if a key has been defined and/or set/executed more than once in the current run. The \stform+ of the command \ffx'{\ltxkeysdeclarekeys} will always flag an error if a key is being defined twice, irrespective of the state of the package option \fx{tracingkeys}. The \textkey variants (unlike the \textnewkey variants) of key-defining commands don't have this facility, and it may be desirable to know if and when an existing key is being redefined.
+ The speed of compilation may be affected by this option, but it is recommended at the pre-production stages of developing keys. The option provide some trace functionality and enables the user to, among other things, follow the progress of the \latex run and to see if a key has been defined and/or set/executed more than once in the current run. The \stform+ of the commands \ffx'{\ltxkeysdefinekeys, \ltxkeysdeclarekeys} will always flag an error if a key is being defined twice, irrespective of the state of the package option \fx{tracingkeys}. The \textltxkey variants (unlike the \textnewkey variants) of key-defining commands don't have this facility, and it may be desirable to know if and when an existing key is being redefined.
}
\newltablenote{ltxkeys-2}{%
Wherever the \qsemicolon is indicated as a list parser in this guide, it can be replaced by any user-specified one character parser via the package option \fx{keyparser}. To avoid confusing the user-supplied parser with internal parsers, it is advisable to enclose the chosen character in curly braces when submitting it as a package option. The braces will be stripped off internally. Please note that some of the characters that may be passed as a list parser may indeed be active; be careful to make them innocent before using them as a list/key parser. My advice is that the user sticks with the \qsemicolon as the key parser: the chances of it being made active by any package is minimal. If you have the chosen parser as literals in the callbacks of your keys, they have to be enclosed in curly braces.
@@ -161,7 +147,7 @@ They can also be passed locally via the command \fx{\ltxkeysoptions}:
\small
%\trace*
\begin{tabularx}{\linewidth}{|p{3cm}|p{2cm}|X|}
-\caption{Package options. All the package options can also be changed globally via \headhx{\documentclass} and locally through the control sequence \headfx{\ltxkeysoptions}.} \xwmlabel{tab:pkgoptions}
+\caption{Package options. All the package options can also be changed globally via \headhx{\documentclass} and locally through the control sequence \headfx{\setltxkeysoptions}.} \xwmlabel{tab:pkgoptions}
\\\hline
\rowcolor{pink}
\bfseries Option&\bfseries Default&\bfseries Meaning\\\hline
@@ -175,7 +161,7 @@ They can also be passed locally via the command \fx{\ltxkeysoptions}:
\hline
\endlastfoot
\fx{tracingkeys} & \hx{false} & The global boolean switch that determines if information should be logged in the transcript file for some tasks in the package. \useltablenote[tab:pkgoptions:note1]{ltxkeys-1}\\\hline
-\fx{keyparser} & \texttt{;} & The most user-relevant of the list parsers (\ie, item separators) used by internal loops in defining keys---mainly in the macro \ffx'{\ltxkeysdeclarekeys}. \useltablenote[tab:pkgoptions:note2]{ltxkeys-2}\\\hline
+\fx{keyparser} & \texttt{;} & The most user-relevant of the list parsers (\ie, item separators) used by internal loops in defining keys---mainly in the macros \ffx'{\ltxkeysdefinekeys, \ltxkeysdeclarekeys}. \useltablenote[tab:pkgoptions:note2]{ltxkeys-2}\\\hline
\fx{keydepthlimit} & \hx{4} & This is used to guard against erroneous infinite re-entrance of the package's key-setting commands. The default value of~4 means that neither of these commands can ordinarily be nested beyond level~4.\useltablenote[tab:pkgoptions:note3]{ltxkeys-3}\\\hline
\fx{reservenopath} & \hx{false} & The \quoted{path} (or roots or bases) of a key is the combination of key prefix, key family and macro prefix. These can be reserved and unreserved by any user by the tools of \sref{sec:reservedpath}. Subsequent users can, at their own risk, override all previously reserved paths by enabling the package's boolean option \fx{reservenopath}.\\\hline
\fx{allowemptypath} & \hx{false} & Allow the use of empty key prefix and family. This isn't advisable but some pre-existing packages might have used empty key prefixes and families. \useltablenote[tab:pkgoptions:note4]{ltxkeys-4}\\\hline
@@ -189,7 +175,7 @@ They can also be passed locally via the command \fx{\ltxkeysoptions}:
\docsubsection(sec:definablekeys){Defining only definable keys}
-If the package option \fx{tracingkeys} is enabled (\ie, turned true), the user can see in the transcript file the existing keys that he has redefined with the \textkey variants of the key-defining commands, which redefine existing keys without any default warning or error. The log file messages being referred to here will be highlighted with the warning sign (\makered{!!}). This is always desirable in the preproduction stages of your project. However, instead of looking for these warning messages in the log file, the user can use the \textnewkey variants of the key-defining commands to bar himself from redefining existing keys.
+If the package option \fx{tracingkeys} is enabled (\ie, turned true), the user can see in the transcript file the existing keys that he has redefined with the \textltxkey variants of the key-defining commands, which redefine existing keys without any default warning or error. The log file messages being referred to here will be highlighted with the warning sign (\makered{!!}). This is always desirable in the preproduction stages of your project. However, instead of looking for these warning messages in the log file, the user can use the \textnewkey variants of the key-defining commands to bar himself from redefining existing keys.
Subsequently we will mention the \textnewkey variants of key-defining commands without necessarily explaining what they mean, since their meaning is henceforth clear.
@@ -205,7 +191,7 @@ In the following, syntactic quantities in square brackets (\eg, \fx{[yyy]}) and
\finish{newmacro}
\fxim*{\ltxkeysordkey,\ltxkeysnewordkey}
-These define a macro of the form \preffamkey of one parameter that holds the key function/callback \ang{cbk}. The default value for the \quoted{key prefix} \ang{pref} is always \fx{KV}, as in the \pkg'{xkeyval}. When \ang{key} is used in a \fx{\ltxkeysetkeys} command (see \sref{sec:settingkeys}) containing \keyval, the macro \preffamkey takes the value as its argument and is then executed. The given argument or key value can be accessed in the key's callback \ang{cbk} by using \fx{#1} inside the function. The optional default value \ang{dft}, if available, will be used by \preffamkey when the user hasn't provided a value for the key at \fx{\ltxkeyssetkeys}. If \ang{dft} was absent at key definition and the key user hasn't provided a value for the key, an error message is flagged\footnote{The commands \ffx'{\ltxkeyskey, \ltxkeysnewkey} aren't user commands.}.
+These define a macro of the form \preffamkey of one parameter that holds the key function/callback \ang{cbk}. The default value for the \quoted{key prefix} \ang{pref} is always \fx{KV}, as in the \pkg'{xkeyval}. When \ang{key} is used in a \fx{\ltxkeyssetkeys} command (see \sref{sec:settingkeys}) containing \keyval, the macro \preffamkey takes the value as its argument and is then executed. The given argument or key value can be accessed in the key's callback \ang{cbk} by using \fx{#1} inside the function. The optional default value \ang{dft}, if available, will be used by \preffamkey when the user hasn't provided a value for the key at \fx{\ltxkeyssetkeys}. If \ang{dft} was absent at key definition and the key user hasn't provided a value for the key, an error message is flagged\footnote{The commands \ffx'{\ltxkeys@key, \ltxkeys@newkey} aren't user commands.}.
Run the following example and do \fx{\show\cmdb} and \fx{\show\cmdd}:
@@ -227,7 +213,7 @@ The commands \ffx'{\ltxkeysordkey,\ltxkeysnewordkey} can be used to introduce or
\fxim*{\ltxkeysordkeys,\ltxkeysnewordkeys}
-\docsubsection(sec:lispkeys)<lispkeys>{List keys (lispkeys)}
+\docsubsection(sec:lispkeys)<lispkeys>{List processor keys (lispkeys)}
\start+{newmacro}[\ltxkeyslispkey,\ltxkeysnewlispkey, etc.]
\ltxkeyslispkey[|A(pref)]{|A(fam)}{|A(key)}[|A(dft)]{|A(cbk)}
@@ -239,30 +225,71 @@ The commands \ffx'{\ltxkeysordkey,\ltxkeysnewordkey} can be used to introduce or
List processor keys (or lisp keys) are ordinary keys that accept a parser-separated list as a user input and process each element of the list. The key's callback \ang{cbk} is then a list processor, but the key author doesn't have to design and suggest his own looping system. All he has to do is to pass the parameter \fx{#1}, representing the individual items of the list, to the key's callback. The key will internally do the loop and process the list (\ie, the user input).
-Each item will be processed by the key's callback. A lisp key does accept any arbitrary list separator. When the list separator differs from \qcomma, it has to be provided in the key's callback as the argument of the undefined command \fx{\listsep}. And at key-setting time, user inputs that are comma-separated should be enclosed in curly braces, otherwise they won't be parsed properly and errors will arise. An example follows. When setting the key, the user must then use the same list separator. \fx{\ltxkeyslispnr} gives the numerical order of each item in the list. The default value and user input of a lisp key should take cognizance of the list separator. Both the default value and the user input of a lisp key can be just one item, rather than a list; in which case the current input is assumed to have just one item. Spurious leading and trailing spaces (\ie, unprotected spaces) in the list are trimmed before the list is parsed by the key's callback. Reminder: \fx{#1} in the key's callback refers to the individual item of the list, and not the entire list itself.
+\Note In the lisp key's callback, the parameter character \fx{#1} represents not the entire user input (which is assumed to be a list) but the individual items of the list. Each item of the list will be processed by the key's callback.
+
+A lisp key does accept any arbitrary list separator. When the list separator differs from \qcomma, it has to be provided in the key's callback as the argument of the undefined command \fx{\listsep}. And at key-setting time, user inputs that are comma-separated should be enclosed in curly braces, otherwise they won't be parsed properly and errors will arise. An example follows. When setting the key, the user must then use the same list separator. \fx{\ltxkeyslispcount} gives the numerical order of each item in the list. The default value and user input of a lisp key should take cognizance of the list separator. Both the default value and the user input of a lisp key can be just one item, rather than a list; in which case the current input is assumed to have just one item. Spurious leading and trailing spaces (\ie, unprotected spaces) in the list are trimmed before the list is parsed by the key's callback. Reminder: \fx{#1} in the key's callback refers to the individual item of the list, and not the entire list itself.
It is possible to call the command \fx{\ltxkeysbreakloop} in the key's callback \ang{cbk} to break out of the list processing prematurely. The unprocessed items will be handled by the command \fx{\ltxkeysdoremainder}, which can be redefined by the user. By default, it has the same meaning as the \latex kernel's \hx{\@gobble}, meaning that it simply throws away the list remainder.
\start+{example}[\ltxkeyslispkey]
\ltxkeyslispkey[KV]{fam}{keya}[aaa, bbb]{%
|com(`#1' here refers to the current item of the list:)
- \csndef{ww@\romannumeral\ltxkeyslispnr}{#1}%
+ \ltscsdef{ww@\romannumeral\ltxkeyslispcount}{#1}%
}
|com(User inputs that are comma-separated should be wrapped in braces:)
\ltxkeyssetkeys[KV]{fam}{keya={val1, val2, val3}}
\ltxkeyslispkey[KV]{fam}{keyb}[aaa; bbb]{%
|R(\listsep){;}%
- \ifnum\ltxkeyslispnr>2\relax
+ \ifnum\ltxkeyslispcount>2\relax
\ltxkeysbreakloop
\else
- \csn@def{ww@\romannumeral\ltxkeyslispnr}{#1}%
+ \ltscsdef{ww@\romannumeral\ltxkeyslispcount}{#1}%
\fi
}
\ltxkeyssetkeys[KV]{fam}{keyb=val1; val2; val3; val4}
\ltxkeyssetkeys[KV]{fam}{keyb=val5}
\finish{example}
+\start+{example}[\ltxkeyslispkey]
+\ltxkeyslispkey[KV]{fam}{keya,keyb}[default1,default2]{%
+ \begingroup
+ \color{blue}
+ \ifltxkeysnoval
+ \ifnum\ltxkeyslispcount=\@ne
+ \endgraf
+ Using default value of `\ltxkeystkey':
+ \fi
+ \else
+ \ifnum\ltxkeyslispcount=\@ne
+ \endgraf
+ Using user value of `\ltxkeystkey':
+ \fi
+ \fi
+ \endgroup
+ \endgraf
+ Doing item no. \ltxkeyslispcount: #1%
+}
+%\show\KV@fam@keya
+%\endtrace
+\let\ltxsetkeys\ltxkeyssetkeys
+\makeatother
+
+\begin{document}
+\parindent0pt
+%\trace*
+\ltxsetkeys[KV]{fam}{keya,keyb}
+%\endtrace
+
+\par\bigskip
+\ltxsetkeys[KV]{fam}{%
+ keya={item1A,item1B,item1C,item1D},
+ keyb={item2A,item2B,item2C,item2D}
+}
+%\endtrace
+\end{document}
+\finish{example}
+
\docsubsection(sec:cmdkeys)<command keys (cmd)>{Command keys}
@@ -290,7 +317,7 @@ The commands \ffx'{\ltxkeyscmdkey,\ltxkeysnewcmdkey} can be used to introduce co
\docsubsection(sec:stylekeys){Style keys}
\aidx*{style keys (sty)}
-Style keys are keys with dependants (\ie, keys that are processed when the master is set). They have the following syntaxes:
+Style keys are keys with observers (\ie, keys that are processed when the subject/master key is set). They have the following syntaxes:
\start+{newmacro}[\ltxkeysstylekey,\ltxkeysnewstylekey]
\ltxkeysstylekey[|A(pref)]{|A(fam)}[|A(mp)]{|A(key)}[|A(dft)]|(|A(deps)|){|A(cbk)}
@@ -300,47 +327,39 @@ Style keys are keys with dependants (\ie, keys that are processed when the maste
\finish{newmacro}
\fxim*{\ltxkeysstylekey,\ltxkeysnewstylekey}
-The dependants \ang{deps} have the syntax:
+The observers \ang{deps} have the syntax:
-\start'{macro}[Dependant keys syntax]
+\start'{macro}[Observer keys syntax]
|(
- |A(keytype)/|A(keyname)/|A(dft)/|A(cbk);
- another set of dependant; etc.
+ |A(key1)=|A(value1),...,|A(key1)=|A(value1)
|)
\finish{macro}
-\aidxs*{dependant keys}{style keys}
+\aidxs*{observer keys}{style keys}
The default value \ang{dft} and the callback \ang{cbk} can be absent in the syntax of style keys. \ang{keytype} can be \quoted{ord} (ordinary key), \quoted{cmd} (command key), \quoted{bool} (boolean key), or \quoted{choice} (choice key).
-Dependant keys always share the same key prefix \ang{pref}, family \ang{fam}, and macro prefix \ang{mp} with the parent key.
+Observer keys always share the same key prefix \ang{pref}, family \ang{fam}, and macro prefix \ang{mp} with the parent key.
If \ang{mp} is given, the command \mpkey will hold the current user input for the parent key; otherwise the user input will be available in \ipreffamkey{style}. The macro \preffamkey will always hold the callback \ang{cbk}.
-If the \stform is used, all undefined dependants will be defined and set on the fly as the parent is being set. If the \stform isn't used and undefined dependants occur, then an error message will be flagged at the time the parent is being set.
+If the \stform is used, all undefined observers will be defined and set on the fly as the parent is being set. If the \stform isn't used and undefined observers occur, then an error message will be flagged at the time the parent is being set.
-Most of the time it is possible to access the parent key's current value with \fx{\parentval}. Within \ang{dft} and \ang{cbk} of \ang{deps}, it is possible to refer to the parent key's callback with its full macro name (\ie, \preffamkey). \fx{\parentval} is always available for use as the default value of dependant keys, but it may be lost in the callbacks of dependant keys, because a dependant key, once defined, may be set independent of, and long after, the parent key has been executed. It is, therefore, more reliable to refer to the macro \jpreffamkey{value}, which is recorded for only the parent key of style keys and which holds the current user input for the parent key. The macro \jpreffamkey{value} is recorded only if it appears at least once in the attributes or callbacks of dependant keys. The macro \jpreffamkey{value} has a more unique name than \mpkey but they always contain the same value of a style key. As mentioned above, if \ang{mp} is not given, the user input for a style key will be available in the macro \ipreffamkey{style}, instead of \mpkey.
+Most of the time it is possible to access the parent key's current value with \fx{\parentval}. Within \ang{dft} and \ang{cbk} of \ang{deps}, it is possible to refer to the parent key's callback with its full macro name (\ie, \preffamkey). \fx{\parentval} is always available for use as the default value of observer keys, but it may be lost in the callbacks of observer keys, because a observer key, once defined, may be set independent of, and long after, the parent key has been executed. It is, therefore, more reliable to refer to the macro \jpreffamkey{value}, which is recorded for only the parent key of style keys and which holds the current user input for the parent key. The macro \jpreffamkey{value} is recorded only if it appears at least once in the attributes or callbacks of observer keys. The macro \jpreffamkey{value} has a more unique name than \mpkey but they always contain the same value of a style key. As mentioned above, if \ang{mp} is not given, the user input for a style key will be available in the macro \ipreffamkey{style}, instead of \mpkey.
\ltsnote
-The parameter \quotedfx{#1} in the callback of parent key refers to the current value of the parent key, while \quotedfx{#1} in the callback of any dependant key refers to the current value of that dependant key. Here is an example that defines and sets all undefined dependants on the fly:
+The parameter \quotedfx{#1} in the callback of parent key refers to the current value of the parent key, while \quotedfx{#1} in the callback of any observer key refers to the current value of that observer key. Here is an example that defines and sets all undefined observers on the fly:
\start+{example}[\ltxkeysstylekey]
\ltxkeysstylekey|*[KV]{fam}[mp@]{keya}[{left}]|(%
- |com(`#1' here refers to the value of the DEPENDANT key)
- |com(at the time it is being set. Use \parentkey and \parentval)
- |com(here to access the parent key name and its current value:)
- ord/keyb/{right}/\def\y##1{#1##1};
- |com( The default of `keyc' is the current value of parent `keya':)
- cmd/keyc/\parentval;
- |com(Because \KV@fam@keya@value appears below, it will be saved)
- |com(when the parent key `keya' is being set, otherwise it would be)
- |com(unavailable:)
- bool/keyd/true/\ifmp@keyd\edef\x##1{##1\KV@fam@keya@value}\fi
+ |com(`#1' here refers to the value of the PARENT key at the time)
+ |com(it is being set:)
+ keyb=valueb,keyc=#1,keyd=2*#1
|){%
|com(`#1' here refers to the value of the PARENT key at the time)
|com(it is being set:)
\def\x##1{##1xx#1xx}%
|com(Check the value of parent key:)
- \ltxkeyscheckchoice[,]|(\userinput\order|){#1}{left,right,center}{}{%
+ \ltxkeyscheckchoice+[,]|(\userinput\order|){#1}{left,right,center}{}{%
\@latex@error{Invalid input `#1'}\@ehd
}%
}
@@ -558,7 +577,7 @@ If the parser is \qsemicolon, then we would have
This means that if you have \quotedfx{/.do} or \quotedfx{/} in any of the callbacks, it has to be enclosed in curly braces! Please recall that the default value of \ang{keyparser} is \qsemicolon. \fx{keyparser} is a package option. This syntax also implies that if you have the \ang{keyparser} in \ang{defn}, it has to be wrapped in curly braces.
\ltsnote
-The \ang{keyparser} in these syntaxes of \quoted{nominations} for choice keys could also be \qcomma, without the need to declare the package option \fx{keyparser} as \qcomma. Here is the rule for parsing the \ang{alt} list. First the package checks if the declared key parser (\ie, \ang{keyparser}) is in the \ang{alt} list. If the parser exists in \ang{alt}, then the list is parsed using this parser. Otherwise the list is parsed using \qcomma as the parser. Moreover, the package checks if \quotedfx{/.do} separates \ang{choice} from the callback \ang{cbk}. If no \quotedfx{/.do} is found, then \quotedfx{/} is assumed to be the separator. But note that when there is no \ang{cbk} for a nomination, then neither \quotedfx{/.do} nor \quotedfx{/} is necessary.
+The \ang{keyparser} in these syntaxes of \quoted{nominations} for choice keys could also be \qcomma, without the need to declare the package option \fx{keyparser} as \qcomma. Here is the rule for parsing the \ang{alt} list. First the package checks if the declared key parser (\ie, \ang{keyparser}) is in the \ang{alt} list. If the parser exists in \ang{alt}, then the list is parsed using this parser. Otherwise the list is parsed using \qcomma as the parser. Moreover, the package checks if \quotedfx{.do} separates \ang{choice} from the callback \ang{cbk}. If no \quotedfx{.do} is found, then \quotedfx{/} is assumed to be the separator. But note that when there is no \ang{cbk} for a nomination, then neither \quotedfx{.do} nor \quotedfx{/} is necessary.
It is possible to refer to the current value of \ang{key} as \fx{#1} in \ang{alt}.
@@ -617,7 +636,7 @@ The \stform of \fx{\ltxkeyschoicekey} will convert the user input to lowercase b
\ltxkeyssetkeys[KV]{fam}{keyb=center,keyd}
\finish{example}
-The representations \ffx'{\savevalue,\usevalue,\needvalue} are pointers (see \sref{sec:keypointers}).
+The representations \ffx{\savevalue,\usevalue,\needvalue}, \etc are pointers (see \sref{sec:keypointers}).
\docsubsubsection(sec:choicekeys-sameattributes)
@@ -643,10 +662,9 @@ The commands \ffx'{\ltxkeyschoicekey,\ltxkeysnewchoicekey} can be used to introd
\docsection{Default values of keys}
+The code after \fx{.do=} will be executed whenever the default value of the key is used.
-The code after \fx{/.do=} will be executed whenever the default value of the key is used.
-
-% \ltxkeysordkey[KV]{fam}{keya}[\def\y#1{#1}/.do=\def\x#1{#1}]{%
+% \ltxkeysordkey[KV]{fam}{keya}[\def\y#1{#1}.do=\def\x#1{#1}]{%
% \def\cmda##1{##1*#1*##1}
% }
@@ -673,68 +691,6 @@ The following example defines key-default handler for two key prefixes and two f
\docsubsection(sec:declarekeys){Defining all types of key with one command}
\aidx*{defining multiple keys}
-%% Read this section again.
-
-\begin{noteenv}*
-\label{nte:definekeys-1}
-Keys defined by \fx{\ltxkeysdeclarekeys} are automatically set/initialized instantly, to provide default values for immediate use. Boolean keys are preset with value \quoted{false}, so that they aren't turned \quoted{true} prematurely. There is a potential problem with this manner of presetting keys. Consider the following example, in which \ttx{keya} builds a list:
-
-\start{example}[\ltxkeysdeclarekeys]
-\def\alist{}
-\ltxkeysdeclarekeys[pref]{fam}[mp]{%
- cmd/keya/defaulta/\edef\alist{\ifx\alist\@empty\else\alist,\fi#1};
- cmd/keyb/defaultb/\def\callback##1{##1*#1}%
-}
-\finish{example}
-
-If, as is done by the command \fx{\ltxkeysdeclarekeys}, \ttx{keya} is automatically preset at definition, the building of the list \fx{\alist} would then have started soon after the definition of the key, which is most likely not what the user of the key requires. The \pkg'{ltxkeys} therefore provides an internal boolean \fx{\ifltxkeysdec} that is set true within the commands \ffx'{\ltxkeysdeclarekeys, \ltxkeysdeclarekeys} and toggled false outside these commands. The boolean has other uses within these commands. It can be used as follows:
-
-\start{example}[\ltxkeysdeclarekeys]
-\def\alist{}
-\ltxkeysdeclarekeys[pref]{fam}[mp]{%
- keya/defaulta/
- \ifltxkeysdec\else
- |com(Don't execute this when defining the key:)
- \edef\alist{\ifx\alist\@empty\else\alist,\fi#1}%
- \fi;
- keyb/defaultb/\def\callback##1{##1*#1}%
-}
-\finish{example}
-
-So here the building of the list by \ttx{keya} wouldn't start until the key has been defined (\ie, outside \fx{\ltxkeysdeclarekeys}).
-\end{noteenv}
-
-\ltsnote
-In \ffx'{\ltxkeysdeclarekeys}, if \fx{endcallbackline} is true, every line is assumed to end with a comment sign. This is to be specially noted if a space is desired at the end of line. You can insert such a space with a comment sign, or, if appropriate, use \hx{\space}.
-
-\start+{example}[\ltxkeysdeclarekeys]
-|com(The |stform defines new keys:)
-\ltxkeysdeclarekeys|*[KV]{fam}[mp@]{%
- |com(Command key with callback:)
- cmd/keya/{keepbraced}/\def\x##1{##1*#1*##1};
- |com(Boolean key:)
- bool/keyb/true/\def\y##1{##1yyy#1};
- |com(Command key with no callback:)
- cmd/keyc/xxx;
- |com(Choice-like command key:)
- cmd/keyd/center/\ltxkeyscheckuserinput{#1}{left,right,center}
- \ifltxkeysinputvalid |label(mac:ifltxkeysinputvalid)
- \edef\myval{\expandcsonce\userinput}
- \edef\numberinlist{\number\order}
- \edef\mychoices{\expandcsonce\nominations}
- \else
- \@latex@error{Input `#1' not valid}\@ehd
- \fi;
- |com(Boolean key with no callback:)
- bool/keye/false;
-}
-\finish{example}
-\fxim*{\ifltxkeysinputvalid,\ltxkeyscheckuserinput,\nominations,\userinput}
-\aiidxm*[\bs,choice keys]{nominations,ifltxkeysinputvalid}
-
-In this example, \fx{\userinput} corresponds to \fx{#1}; \fx{\order} is the numerical order of the user input in \fx{\nominations}; the list of valid values suggested at key definition time (\fnz*{left,right,center} in this example). The boolean \fx{ltxkeysinputvalid} is associated with the command \fx{\ltxkeyscheckuserinput} and is available to the user. It is set \hx{true} when the user input is valid, and \hx{false} otherwise. The command \fx{\ltxkeyscheckuserinput} expects two arguments: the user input and the list of nominations. It doesn't expect two branches (see \sref{sec:checkchoice}).
-
-
\start{newmacro}[\ltxkeysdeclarekeys]
\ltxkeysdeclarekeys[|A(pref)]{|A(fam)}[|A(mp)]{%|label(mac:declarekeys)
|A(keytype)/|A(keyname)/|A(dft)/|A(cbk);
@@ -750,7 +706,7 @@ In this example, \fx{\userinput} corresponds to \fx{#1}; \fx{\order} is the nume
\fxim*{\ltxkeysdeclarekeys}
\aidx*{style keys (sty*)}
-Here, the default value \ang{dft} and the callback \ang{cbk} can be absent in all cases. \ang{keytype} must be any one of \fnz{ord,cmd,sty,sty*,bool,choice,switch}. The star (\redstar) in \quoted{sty\Redstar} has the same meaning as in \fx{\ltxkeysstylekey} above, namely, undefined dependants will be defined on the fly when the parent key is set. The optional quantity \ang{mp} is the macro prefix, as in, \eg, \sref{sec:cmdkeys,sec:definekeys}.
+Here, the default value \ang{dft} and the callback \ang{cbk} can be absent in all cases. \ang{keytype} must be any one of \fnz{ord,cmd,sty,sty*,bool,choice,switch}. The star (\redstar) in \quoted{sty\Redstar} has the same meaning as in \fx{\ltxkeysstylekey} above, namely, undefined observers will be defined on the fly when the parent key is set. The optional quantity \ang{mp} is the macro prefix, as in, \eg, \sref{sec:cmdkeys,sec:definekeys}.
Choice keys must have their names associated with their admissible \ang{alt} values in the format \keydotchoice{keyname}{alt} (see example below).
@@ -763,18 +719,19 @@ Keys defined by \fx{\ltxkeysdeclarekeys} are automatically set instantly with th
\ltxkeysdeclarekeys|*[KV]{fam}[mp@]{%
|com(Ordinary key with callback:)
ord/keya/.1\paperwidth/\leftmargin=#1\relax;
- |com(Command key with callback:)
- cmd/keyb/10mm/\rightmargin=#1\def\x##1{##1*#1*##1};
+ |com(Command key with callback. `.do=' is allowed before callback:)
+ cmd/keyb/10mm/.do=\rightmargin=#1\def\x##1{##1*#1*##1};
|com(Boolean key without callback:)
bool/keyc/true;
|com(Boolean key with callback:)
bool/keyd/true/\ifmp@keyd\@tempswatrue\else\@tempswafalse\fi;
- |com(Style key with callback but no dependants:)
- sty/keye/aaa/\def\y##1{##1yyy#1};
- |com(Style key with callback and dependants `keyg' and `keyh':)
- sty|*/keyf/blue/\def\y##1{##1#1}/
- cmd|R(>)keyg|R(>)\parentval|R(>)\def\z####1{####1+##1+####1}|R(,)
- ord|R(>)keyh|R(>)\KV@fam@keyf@value;
+ |com(Style key with callback but no observers:)
+ style/keye/aaa/\def\y##1{##1yyy#1};
+ |com(Style key with callback and observers `keyg' and `keyh':)
+ style/keyf|R(.){
+ keyg=valueg,keyh=valueh
+ }
+ /blue/\def\y##1{##1#1};
|com(Choice key with simple nominations and callback. The function)
|com(\order is generated internally:)
choice/keyi|R(.){left,right,center}/center/
@@ -783,19 +740,23 @@ Keys defined by \fx{\ltxkeysdeclarekeys} are automatically set instantly with th
choice/keyj|R(.){
center/.do=\def\mp@textalign{center},
left/.do=\def\mp@textalign{flushleft},
- |com(`.do=' can be omitted:)
- right/\def\mp@textalign{flushright},
- justified/\let\mp@textalign\relax
+ right/.do=\def\mp@textalign{flushright},
+ justified/.do=\let\mp@textalign\relax
}
/center/\def\yy##1{##1yy#1};
ord/keyk/\letcstocsn\func{as-defined-by-user};
switch/keyl/true/\if\mp@keyl\def\y##1{##1+#1+##1}\fi;
+ |com(#1 here means the value of the subject key:)
+ style/key1|R(.){
+ key1a=value1a,key1b=#1
+ }
+ /dft1/\def\y##1{##1*#1};
}
\finish{example}
-\aidx*{style keys (sty*)}
+\aidx*{style keys}
\aidx*{/.do}
-Notice the notation \fx{>...>} used for the attributes of the dependant keys \ttx{keyg,keyh} of style key \quoted{keyf}. Dependent keys are the last attributes of a style key, and they (dependant keys) are separated by \qcomma. The default value of the dependant key \quoted{keyg} will in this example be whatever is submitted for \quoted{keyf}. As indicated in \sref{sec:stylekeys}, the function \fx{\KV@fam@keyf@value} has a longer lifespan than \fx{\parentval}. Notice also the syntax \keydotchoice{keyi}{left,right,center} for the choice keys \ttx{keyi,keyj}. It says that the alternate admissible values for \quoted{keyi} are \quotedlist'{left,right,center,justified}; similarly for key \quoted{keyj}.
+Notice the syntax \keydotchoice{keyi}{left,right,center} for the choice keys \ttx{keyi,keyj}. It says that the alternate admissible values for \quoted{keyi} are \quotedlist'{left,right, center, justified}; similarly for key \quoted{keyj}. For style keys, \keydotchoice{keyf}{keyg=valueg, keyh=valueh} means that \ttx{keyg,keyh} are observer keys of the subject \ttx{keyf}.
\docsubsubsection(sec:sametypekeys)[Defining keys of common type]
@@ -823,12 +784,109 @@ If you have to define keys of the same type with the command \fx{\ltxkeysdeclare
}
\ltxkeysdeclarekeys|*|(sty|*|)[KV]{fam}[mp@]{%
keyd/xxx/\def\y##1{##1yyy#1};
- |com(keyf is a dependant of keye:)
+ |com(keyf is a observer of keye:)
keye/blue/\def\y##1{##1#1}/cmd>keyf>\parentval>\def\z####1{####1+##1+####1}
}
\finish{example}
+\docsubsection(sec:definekeys){Defining keys with one command}
+\aidx*{defining multiple keys}
+
+In my personal experience, boolean and command keys have been the most widely used types of key in the context of \pkg'{xkeyval}. More than one boolean and command keys can be defined simultaneously by the following command:
+
+\start{newmacro}[\ltxkeysdefinekeys]
+\ltxkeysdefinekeys[|A(pref)]{|A(fam)}[|A(mp)]{%
+ |A(key)|R(=)|A(dft)/|A(cbk);
+ another set of key attributes; etc.
+}
+\ltxkeysdefinekeys|*[|A(pref)]{|A(fam)}[|A(mp)]{%
+ |A(key)|R(=)|A(dft)/|A(cbk);
+ another set of key attributes; etc.
+}
+\finish{newmacro}
+\fxim*{\ltxkeysdefinekeys}
+
+The default value \ang{dft} can be absent in the case of command keys, and the callback \ang{cbk} can be absent for the two types of key. Boolean keys must, however, have default values \fnz*{true,false}, to be distinguishable from command keys. The \eqsign that separates the key name from the default value can be replaced with forward slash (/). That is, the following syntax is also permitted:
+
+\start{newmacro}[\ltxkeysdefinekeys]
+\ltxkeysdefinekeys[|A(pref)]{|A(fam)}[|A(mp)]{%
+ |A(key)|R(/)|A(dft)/|A(cbk);
+ another set of key attributes; etc.
+}
+\ltxkeysdefinekeys|*[|A(pref)]{|A(fam)}[|A(mp)]{%
+ |A(key)|R(/)|A(dft)/|A(cbk);
+ another set of key attributes; etc.
+}
+\finish{newmacro}
+\fxim*{\ltxkeysdefinekeys}
+
+You can use the command \fx{\ltxkeyscheckuserinput} in \ang{cbk} to indirectly introduce choice keys as command keys (see example below).
+
+Ordinary keys and conventional choice keys can't be introduced directly by this command (use the command \fx{\ltxkeysdeclarekeys} instead).
+
+The \stform of \fx{\ltxkeysdefinekeys} can be used to define non-existing boolean and command keys in the sense of \hx{\newcommand}.
+
+\begin{noteenv}*
+\label{nte:definekeys-1}
+Keys defined by \fx{\ltxkeysdefinekeys} are automatically set/initialized instantly, to provide default values for immediate use. Boolean keys are preset with value \quoted{false}, so that they aren't turned \quoted{true} prematurely. There is a potential problem with this manner of presetting keys. Consider the following example, in which \ttx{keya} builds a list:
+
+\start{example}[\ltxkeysdefinekeys]
+\def\alist{}
+\ltxkeysdefinekeys[pref]{fam}[mp]{%
+ keya/defaulta/\edef\alist{\ifx\alist\@empty\else\alist,\fi#1};
+ keyb/defaultb/\def\callback##1{##1*#1}%
+}
+\finish{example}
+
+If, as is done by the command \fx{\ltxkeysdefinekeys}, \ttx{keya} is automatically preset at definition, the building of the list \fx{\alist} would then have started, which is most likely not what the user of the key requires. The \pkg'{ltxkeys} therefore provides an internal boolean \fx{\ifltxkeysdec} that is set true within the commands \ffx'{\ltxkeysdefinekeys, \ltxkeysdeclarekeys} and toggled false outside these commands. The boolean has other uses within these commands. It can be used as follows:
+
+\start{example}[\ltxkeysdefinekeys]
+\def\alist{}
+\ltxkeysdefinekeys[pref]{fam}[mp]{%
+ keya/defaulta/
+ \ifltxkeysdec\else
+ |com(Don't execute this when defining the key:)
+ \edef\alist{\ifx\alist\@empty\else\alist,\fi#1}%
+ \fi;
+ keyb/defaultb/\def\callback##1{##1*#1}%
+}
+\finish{example}
+
+So here the building of the list by \ttx{keya} wouldn't start until the key has been defined (\ie, outside \fx{\ltxkeysdefinekeys}).
+\end{noteenv}
+
+\ltsnote
+In \ffx'{\ltxkeysdefinekeys, \ltxkeysdeclarekeys}, if \fx{endcallbackline} is true, every line is assumed to end with a comment sign. This is to be specially noted if a space is desired at the end of line. You can insert such a space with a comment sign, or, if appropriate, use \hx{\space}.
+
+\start+{example}[\ltxkeysdefinekeys]
+|com(The |stform defines new keys:)
+\ltxkeysdefinekeys|*[KV]{fam}[mp@]{%
+ |com(Command key with callback:)
+ keya={keepbraced}/\def\x##1{##1*#1*##1};
+ |com(Boolean key:)
+ keyb=true/\def\y##1{##1yyy#1};
+ |com(Command key with no callback:)
+ keyc=xxx;
+ |com(Choice-like command key:)
+ keyd=center/\ltxkeyscheckuserinput{#1}{left,right,center}
+ \ifltxkeysinputvalid |label(mac:ifltxkeysinputvalid)
+ \edef\myval{\expandcsonce\userinput}
+ \edef\numberinlist{\number\order}
+ \edef\mychoices{\expandcsonce\nominations}
+ \else
+ \@latex@error{Input `#1' not valid}\@ehd
+ \fi;
+ |com(Boolean key with no callback:)
+ keye=false;
+}
+\finish{example}
+\fxim*{\ifltxkeysinputvalid,\ltxkeyscheckuserinput,\nominations,\userinput}
+\aiidxm*[\bs,choice keys]{nominations,ifltxkeysinputvalid}
+
+In this example, \fx{\userinput} corresponds to \fx{#1}; \fx{\order} is the numerical order of the user input in \fx{\nominations}; the list of valid values suggested at key definition time (\fnz*{left,right,center} in this example). The boolean \fx{ltxkeysinputvalid} is associated with the command \fx{\ltxkeyscheckuserinput} and is available to the user. It is set \hx{true} when the user input is valid, and \hx{false} otherwise. The command \fx{\ltxkeyscheckuserinput} expects two arguments: the user input and the list of nominations. It doesn't expect two branches (see \sref{sec:checkchoice}).
+
+
\docsubsection(sec:needvalue)<need-value keys>{Need-value keys}
Sometimes you may want to create keys for which the user must always supply his/her own values, even if the keys originally have default values. The default values of keys may not always be suitable. Take, for example, the height and width of a graphics image. For functions that are meant to handle generic images, it would certainly be inappropriate to relieve the user of the need to call picture height and width without corresponding values.
@@ -851,7 +909,7 @@ See more about key pointers in \sref{sec:keypointers}.
There are times when it is required to use the same, or nearly the same, set of keys for different functions and purposes, and thus for different key families and prefixes. We call such keys \quoted{cross-family keys} or \quoted{xfamily keys}. Such keys bear the same names across key families and key prefixes. For example, the \pkg'{xwatermark} defines three functions (\ffx'{\xwmminipage,\xwmboxedminipage,\xwmcolorbox}) using nearly the same set of keys. In each of the three families, the keys bear the same or similar names and they have similar callbacks. The management of cross-family keys can be simplified by using the tools of this section. Even if not all the cross-family keys are needed in all the families to which they may belong, there are still advantages in using this type of keys when some of the keys cut across families.
-Cross-family keys are automatically initialized after being defined---as we saw in the case of the commands \ffx'{\ltxkeysdeclarekeys,\ltxkeysdeclarekeys}.
+Cross-family keys are automatically initialized after being defined---as we saw in the case of the commands \ffx'{\ltxkeysdefinekeys,\ltxkeysdeclarekeys}.
\start+{newmacro}[\ltxkeyssavexfamilykeys,\ltxkeysdefinexfamilykeys]
\ltxkeyssavexfamilykeys<|A(id)>{|A(keylist)}
@@ -865,9 +923,9 @@ Cross-family keys are automatically initialized after being defined---as we saw
\finish{newmacro}
\fxim*{\ltxkeyssavexfamilykeys,\ltxkeysdefinexfamilykeys}
-Here, \ang{id} is the mandatory identifier of the key list \ang{keylist}, \ang{pref} is the key prefix, \ang{fam} the key family, \ang{mp} is the macro prefix, and \ang{na} is the list of keys belonging to \ang{keylist} that shouldn't be presently defined and initialized. The \ang{na} can be empty, but it must always be there as a mandatory argument. \emph{So, where you put the key list in the commands \emfx{\ltxkeysdeclarekeys} and \emfx{\ltxkeysdeclarekeys} is where you now have to locate \ang{na}}. For any use of the command \fx{\ltxkeysdefinexfamilykeys} we expect the \ang{na} to be far less than the remaining keys. The \stform of \fx{\ltxkeyssavexfamilykeys} will expand \ang{keylistcmd} once before saving the xfamily keys. The \stform of \fx{\ltxkeysdefinexfamilykeys} will define only definable keys, in the sense of \hx{\newcommand}.
+Here, \ang{id} is the mandatory identifier of the key list \ang{keylist}, \ang{pref} is the key prefix, \ang{fam} the key family, \ang{mp} is the macro prefix, and \ang{na} is the list of keys belonging to \ang{keylist} that shouldn't be presently defined and initialized. The \ang{na} can be empty, but it must always be there as a mandatory argument. \emph{So, where you put the key list in the commands \emfx{\ltxkeysdefinekeys} and \emfx{\ltxkeysdeclarekeys} is where you now have to locate \ang{na}}. For any use of the command \fx{\ltxkeysdefinexfamilykeys} we expect the \ang{na} to be far less than the remaining keys. The \stform of \fx{\ltxkeyssavexfamilykeys} will expand \ang{keylistcmd} once before saving the xfamily keys. The \stform of \fx{\ltxkeysdefinexfamilykeys} will define only definable keys, in the sense of \hx{\newcommand}.
-\ang{keylist} and \ang{keylistcmd} have the same syntax as the last arguments of \ffx'{\ltxkeysdeclarekeys,\ltxkeysdeclarekeys}:
+\ang{keylist} and \ang{keylistcmd} have the same syntax as the last arguments of \ffx'{\ltxkeysdefinekeys,\ltxkeysdeclarekeys}:
\start'{newmacro}[Syntax of keylist]
|A(keytype)/|A(keyname)/|A(dft)/|A(cbk);
@@ -875,7 +933,7 @@ another set of key attributes;
etc.
\finish{newmacro}
-Here too \ang{keytype} must be a member of the set \fnz{ord,cmd,sty,sty*,bool,choice}, \ang{keyname} is obviously the name of the key, \ang{dft} is the default value of the key, and \ang{cbk} is the callback of the key. If the key is a style key, you can add the attributes of the dependants after \ang{cbk} (see the syntaxes of the commands \ffx'{\ltxkeysdeclarekeys, \ltxkeysdeclarekeys}).
+Here too \ang{keytype} must be a member of the set \fnz{ord,cmd,sty,sty*,bool,choice}, \ang{keyname} is obviously the name of the key, \ang{dft} is the default value of the key, and \ang{cbk} is the callback of the key. If the key is a style key, you can add the attributes of the observers after \ang{cbk} (see the syntaxes of the commands \ffx'{\ltxkeysdefinekeys, \ltxkeysdeclarekeys}).
The mandatory identifier \ang{id} for each list must be unique, not withstanding the fact that the identifiers have their separate namespace.
@@ -914,15 +972,15 @@ If the xfamily keys are all of the same type (\ie, only one of the types \fnz{or
\fxi*{\ltxkeyssavexfamilykeys,\ltxkeysdefinexfamilykeys}
\start+{example}[xfamily keys]
-|com(`keya' and `keyd' are starred style keys but `keyd' has no dependants:)
+|com(`keya' and `keyd' are starred style keys but `keyd' has no observers:)
\ltxkeyssavexfamilykeys<a1>|(sty|*|){%
- keya/center/\def\xx##1{##1xx#1}/
+ keya/center/.do=\def\xx##1{##1xx#1}/
ord>\needvalue{keyb}>\parentval>\edef\yy##1{##1yy\unexpanded{#1}},
|com(The braces around `center' |(the default value of `keyc'|))
|com(will be preserved in parsing:)
cmd>keyc>{center};
|com(The braces around the callback of `keyd' will be preserved:)
- keyd/red/\def\x{\color{#1}print aaa};
+ keyd/red/.do={\def\x{\color{#1}print aaa}};
}
|com(Ignore `keyd' in defining keys saved in `a1':)
\ltxkeysdefinexfamilykeys*<a1>[KV]{fam}[mp@]{keyd}
@@ -1063,13 +1121,13 @@ Aliased keys differ from style keys of \sref{sec:stylekeys}. Two keys may be ali
Here, \ang{value} is optional; if it is not given, \ang{key} will be set with the current value of its alias.
\start+{example}[\ltxkeyssetaliaskey]
-\ltxkeysdeclarekeys|*[KV]{fam}[mp@]{%
+\ltxkeysdefinekeys|*[KV]{fam}[mp@]{%
printsign=true;
printmark=true/\ltxkeyssetaliaskey{printsign}[false];
keya=$+++$;
keyb=star/\ltxkeyssetaliaskey{keya}[$***$]
}
-\ltxkeysdeclarekeys|*[KV]{fam}[mp@]{%
+\ltxkeysdefinekeys|*[KV]{fam}[mp@]{%
keya=sun/\ltxkeyscheckuserinput{#1}{star,sun,moon}
\ifltxkeysinputvalid
\edef\givenval{\userinput}
@@ -1111,7 +1169,7 @@ Here is an interesting example and proof of concept of pointers:
\ltxkeysstylekeys|*[KV]{fam}{%
\needvalue{keya},\savevalue\needvalue{keyb},\gneedvalue\gsavevalue{keyc}
}[{left}]|(%
- |com(`#1' here refers to the value of the dependant key at the)
+ |com(`#1' here refers to the value of the observer key at the)
|com(time it is being set.)
ord/\savevalue{keyb}/\parentval/\edef\y##1{##1xx\unexpanded{#1}};
cmd/keyc/{center}
@@ -1131,70 +1189,69 @@ Here is an interesting example and proof of concept of pointers:
If you have to save the values of many keys, then the above scheme of placing \fx{\savevalue} or \fx{\gsavevalue} on keys at key setting time can be avoided by using the following commands:
-\start+{newmacro}[\ltxkeyssavevaluekeys,\ltxkeysaddsavevaluekeys, etc.]
-\ltxkeyssavevaluekeys[|A(pref)]{|A(fam)}{|A(list)}
-\ltxkeysaddsavevaluekeys[|A(pref)]{|A(fam)}{|A(list)}
-\ltxkeysremovesavevaluekeys[|A(pref)]{|A(fam)}{|A(list)}
-\ltxkeysundefsavevaluekeys[|A(pref)]{|A(fam)}
-\ltxkeysundefsavevaluekeys|![|A(pref)]{|A(fam)}
-\ltxkeysemptifysavevaluekeys[|A(pref)]{|A(fam)}
-\ltxkeysemptifysavevaluekeys|![|A(pref)]{|A(fam)}
+\start+{newmacro}[\ltxkeys@savevaluekeys,\ltxkeys@addsavevaluekeys, etc.]
+\ltxkeys@savevaluekeys[|A(pref)]{|A(fam)}{|A(list)}
+\ltxkeysgsavevaluekeys[|A(pref)]{|A(fam)}{|A(list)}
+\ltxkeys@addsavevaluekeys[|A(pref)]{|A(fam)}{|A(list)}
+\ltxkeysgaddsavevaluekeys[|A(pref)]{|A(fam)}{|A(list)}
+\ltxkeys@removesavevaluekeys[|A(pref)]{|A(fam)}{|A(list)}
+\ltxkeysgremovesavevaluekeys[|A(pref)]{|A(fam)}{|A(list)}
+\ltxkeys@undefsavevaluekeys[|A(pref)]{|A(fam)}
+\ltxkeysgundefsavevaluekeys|![|A(pref)]{|A(fam)}
\finish{newmacro}
-\fxim*{\ltxkeyssavevaluekeys,\ltxkeysaddsavevaluekeys,
- \ltxkeysremovesavevaluekeys,\ltxkeysundefsavevaluekeys,
- \ltxkeysemptifysavevaluekeys}
+\fxim*{\ltxkeys@savevaluekeys,\ltxkeys@addsavevaluekeys,
+ \ltxkeys@removesavevaluekeys,\ltxkeys@undefsavevaluekeys}
-The command \fx{\ltxkeyssavevaluekeys} will create, for the given key family and prefix, a list of keys whose values should be saved at key-setting time, if those keys don't already exist in the list. The command \fx{\ltxkeysaddsavevaluekeys} will add to the list those keys that don't already exist in the list; \fx{\ltxkeysremovesavevaluekeys} remove those save-keys that it can find in the list; while the command \fx{\ltxkeysundefsavevaluekeys} will undefine the entire list of save-keys of the given key family and prefix. The command \fx{\ltxkeysemptifysavevaluekeys} will simplify emptify the content of the save-key list. The \clform of the commands
+The command \fx{\ltxkeys@savevaluekeys} will create, for the given key family and prefix, a list of keys whose values should be saved at key-setting time, if those keys don't already exist in the list. The command \fx{\ltxkeys@addsavevaluekeys} will add to the list those keys that don't already exist in the list; \fx{\ltxkeys@removesavevaluekeys} remove those save-keys that it can find in the list; while the command \fx{\ltxkeys@undefsavevaluekeys} will undefine the entire list of save-keys of the given key family and prefix.
-\start+{macro}
-\ltxkeysundefsavevaluekeys
-\ltxkeysemptifysavevaluekeys
-\finish{macro}
-
-will undefine or emptify the existing save-key list globally.
-
-\start+{example}[\ltxkeyssavevaluekeys]
-\ltxkeysdeclarekeys[KV]{fam}[mp@]{%
+\start+{example}[\ltxkeys@savevaluekeys]
+\ltxkeysdefinekeys[KV]{fam}[mp@]{%
ord/keya/2cm/\def\x##1{#1xx##1};
cmd/keyb/John;
bool/keyc/true/\ifmp@keyc\def\y##1{##1yy#1}\fi;
choice/keyd.{left,right,center}/
- \ifcase\order\def\shoot{0}\or\def\shoot{1}\or\def\shoot{2}\fi
+ \ifcase\order
+ \def\shoot{0}%
+ \or
+ \def\shoot{1}%
+ \or
+ \def\shoot{2}%
+ \fi
}
-\ltxkeyssavevaluekeys[KV]{fam}{keya,keyb,keyc}
-\ltxkeysaddsavevaluekeys[KV]{fam}{keyd}
-\ltxkeysremovesavevaluekeys[KV]{fam}{keya,keyb}
-\ltxkeysundefsavevaluekeys[KV]{fam}
+\ltxkeys@savevaluekeys[KV]{fam}{keya,keyb,keyc}
+\ltxkeys@addsavevaluekeys[KV]{fam}{keyd}
+\ltxkeys@removesavevaluekeys[KV]{fam}{keya,keyb}
+\ltxkeys@undefsavevaluekeys[KV]{fam}
\ltxkeyssetkeys[KV]{fam}{keya=\usevalue{keyc},keyb=\usevalue{keya}}
\finish{example}
The following commands are also available:
-\start+{newmacro}[\ltxkeysneedvaluekeys,\ltxkeysaddneedvaluekeys, etc.]
-\ltxkeysneedvaluekeys[|A(pref)]{|A(fam)}{|A(list)}
-\ltxkeysaddneedvaluekeys[|A(pref)]{|A(fam)}{|A(list)}
-\ltxkeysremoveneedvaluekeys[|A(pref)]{|A(fam)}{|A(list)}
-\ltxkeysundefneedvaluekeys[|A(pref)]{|A(fam)}
-\ltxkeysundefneedvaluekeys|![|A(pref)]{|A(fam)}
-\ltxkeysemptifyneedvaluekeys[|A(pref)]{|A(fam)}
-\ltxkeysemptifyneedvaluekeys|![|A(pref)]{|A(fam)}
+\start+{newmacro}[\ltxkeys@needvaluekeys,\ltxkeys@addneedvaluekeys, etc.]
+\ltxkeys@needvaluekeys[|A(pref)]{|A(fam)}{|A(list)}
+\ltxkeysgneedvaluekeys[|A(pref)]{|A(fam)}{|A(list)}
+\ltxkeys@addneedvaluekeys[|A(pref)]{|A(fam)}{|A(list)}
+\ltxkeysgaddneedvaluekeys[|A(pref)]{|A(fam)}{|A(list)}
+\ltxkeys@removeneedvaluekeys[|A(pref)]{|A(fam)}{|A(list)}
+\ltxkeysgremoveneedvaluekeys[|A(pref)]{|A(fam)}{|A(list)}
+\ltxkeys@undefneedvaluekeys[|A(pref)]{|A(fam)}
+\ltxkeysgundefneedvaluekeys|![|A(pref)]{|A(fam)}
-\ltxkeysforbidvaluekeys[|A(pref)]{|A(fam)}{|A(list)}
-\ltxkeysaddforbidvaluekeys[|A(pref)]{|A(fam)}{|A(list)}
-\ltxkeysremoveforbidvaluekeys[|A(pref)]{|A(fam)}{|A(list)}
-\ltxkeysundefforbidvaluekeys[|A(pref)]{|A(fam)}
-\ltxkeysundefforbidvaluekeys|![|A(pref)]{|A(fam)}
-\ltxkeysemptifyforbidvaluekeys[|A(pref)]{|A(fam)}
-\ltxkeysemptifyforbidvaluekeys|![|A(pref)]{|A(fam)}
+\ltxkeys@forbidvaluekeys[|A(pref)]{|A(fam)}{|A(list)}
+\ltxkeysgforbidvaluekeys[|A(pref)]{|A(fam)}{|A(list)}
+\ltxkeys@addforbidvaluekeys[|A(pref)]{|A(fam)}{|A(list)}
+\ltxkeysgaddforbidvaluekeys[|A(pref)]{|A(fam)}{|A(list)}
+\ltxkeys@removeforbidvaluekeys[|A(pref)]{|A(fam)}{|A(list)}
+\ltxkeysgremoveforbidvaluekeys[|A(pref)]{|A(fam)}{|A(list)}
+\ltxkeys@undefforbidvaluekeys[|A(pref)]{|A(fam)}
+\ltxkeysgundefforbidvaluekeys|![|A(pref)]{|A(fam)}
\finish{newmacro}
-\fxim*{\ltxkeysneedvaluekeys,\ltxkeysaddneedvaluekeys,
- \ltxkeysremoveneedvaluekeys,\ltxkeysundefneedvaluekeys,
- \ltxkeysemptifyneedvaluekeys,
- \ltxkeysforbidvaluekeys,\ltxkeysaddforbidvaluekeys,
- \ltxkeysremoveforbidvaluekeys,\ltxkeysundefforbidvaluekeys,
- \ltxkeysemptifyforbidvaluekeys
+\fxim*{\ltxkeys@needvaluekeys,\ltxkeys@addneedvaluekeys,
+ \ltxkeys@removeneedvaluekeys,\ltxkeys@undefneedvaluekeys,
+ \ltxkeys@forbidvaluekeys,\ltxkeys@addforbidvaluekeys,
+ \ltxkeys@removeforbidvaluekeys,\ltxkeys@undefforbidvaluekeys,
}
@@ -1244,30 +1301,14 @@ Here, \ang{cs} is the macro (defined or undefined) that will receive the saved v
\ltxkeysremovepostsetkeys|![|A(pref)]{|A(fam)}{|A(keyvals)}
\ltxkeysundefpostsetkeys[|A(pref)]{|A(fam)}
\ltxkeysundefpostsetkeys|![|A(pref)]{|A(fam)}
-
-\ltxkeyspreposetkeys[|A(pref)]{|A(fam)}{|A(head-keyvals)}{|A(tail-keyvals)}
-\ltxkeyspreposetkeys|![|A(pref)]{|A(fam)}{|A(head-keyvals)}{|A(tail-keyvals)}
-\ltxkeysaddpreposetkeys[|A(pref)]{|A(fam)}{|A(head-keyvals)}{|A(tail-keyvals)}
-\ltxkeysaddpreposetkeys|![|A(pref)]{|A(fam)}{|A(head-keyvals)}{|A(tail-keyvals)}
-\ltxkeysremovepreposetkeys[|A(pref)]{|A(fam)}{|A(head-keyvals)}{|A(tail-keyvals)}
-\ltxkeysremovepreposetkeys|![|A(pref)]{|A(fam)}{|A(head-keyvals)}{|A(tail-keyvals)}
-\ltxkeysundefpreposetkeys[|A(pref)]{|A(fam)}
-\ltxkeysundefpreposetkeys|![|A(pref)]{|A(fam)}
\finish{newmacro}
\fxim*{\ltxkeyspresetkeys,\ltxkeysaddpresetkeys,\ltxkeysremovepresetkeys,
\ltxkeysundefpresetkeys,\ltxkeyspostsetkeys,\ltxkeysaddpostsetkeys,
- \ltxkeysremovepostsetkeys,\ltxkeysundefpostsetkeys,
- \ltxkeyspreposetkeys,\ltxkeysaddpreposetkeys,\ltxkeysremovepreposetkeys,
- \ltxkeysundefpreposetkeys
-}
+ \ltxkeysremovepostsetkeys,\ltxkeysundefpostsetkeys}
-Here, \ang{keyvals} is a comma-separated list of \keyval pairs to be preset or postset in the given families. The optional exclamation mark \redclam here, as in many (but not all) instances in the \pkg'{ltxkeys}, means that the assignments would be done and the lists built globally rather than locally. \quoted{Presetting keys} means \quoted{these keys should be set before setting other keys in the user input in every run of the command \fx{\ltxkeyssetkeys} for the given key prefix and family}. Keys contained in the current user input to \fx{\ltxkeyssetkeys} will not be preset or postset, \ie, the current user key-value pairs will always take priority over preset and postset values. The command \fx{\ltxkeysaddpresetkeys} is an alias for \fx{\ltxkeyspresetkeys}, and this helps explain that \fx{\ltxkeyspresetkeys} is indeed a list merger. Neither the command \fx{\ltxkeyspresetkeys} nor \fx{\ltxkeyspostsetkeys} set keys itself, contrary to what the names might suggest.
+Here, \ang{keyvals} is a comma-separated list of \keyval pairs to be preset or postset in the given families. The optional exclamation mark \redclam here, as in many (but not all) instances in the \pkg'{ltxkeys}, means that the assignments would be done and the lists built globally rather than locally. \quoted{Presetting keys} means \quoted{these keys should be set before setting other keys in every run of the command \fx{\ltxkeyssetkeys} for the given key prefix and family}\footnote{Keys contained in the current user input to \fx{\ltxkeyssetkeys} will not be preset or postset, \ie, the current user values of keys will always take priority over preset and postset values.}. The command \fx{\ltxkeysaddpresetkeys} is an alias for \fx{\ltxkeyspresetkeys}, and this helps explain that \fx{\ltxkeyspresetkeys} is indeed a list merger. Neither the command \fx{\ltxkeyspresetkeys} nor \fx{\ltxkeyspostsetkeys} set keys itself, contrary to what the names might suggest.
-\quoted{Post-setting keys} means \quoted{these keys are to be set after setting other keys in the user input in every run of the command \fx{\ltxkeyssetkeys} for the given key prefix and family}. \fx{\ltxkeysaddpostsetkeys} is an alias for \fx{\ltxkeyspostsetkeys}. Keys contained in the current user input to \fx{\ltxkeyssetkeys} will not be postset.
-
-\quoted{Prepo-setting keys} means \quoted{these leading (head) keys are to be set before, and the trailing (tail) keys are to be set after, setting other keys in the user input in every run of the command \fx{\ltxkeyssetkeys} for the given key prefix and family}. Keys contained in the current user input to \fx{\ltxkeyssetkeys} will not be preposet. \fx{\ltxkeysaddpreposetkeys} is an alias for \fx{\ltxkeyspreposetkeys}.
-
-The commands
+\quoted{Post-setting keys} means \quoted{these keys are to be set after setting other keys in every run of the command \fx{\ltxkeyssetkeys} for the given key prefix and family}. \fx{\ltxkeysaddpostsetkeys} is an alias for \fx{\ltxkeyspostsetkeys}. The commands
\start+{macro}
\ltxkeysremovepresetkeys|![|A(pref)]{|A(fam)}{|A(keys)}
@@ -1286,7 +1327,7 @@ respectively, undefine all preset and post-set keys in the given family.
Logically, you can't enter the same key twice in either preset or post-set list in the same family and prefix.
\start+{example}[\ltxkeyspresetkeys, \ltxkeyspostsetkeys, etc.]
-\ltxkeysdeclarekeys|*[KV1]{fam1}[mp@]{%
+\ltxkeysdefinekeys|*[KV1]{fam1}[mp@]{%
keya/left/\def\x##1{#1x##1};
\needvalue{keyb}/right;
keyc/center;
@@ -1305,16 +1346,17 @@ Logically, you can't enter the same key twice in either preset or post-set list
\finish{example}
-\docsubsection(sec:initializekeys)<initializing keys>{Initializing keys}
+\docsubsection(sec:initializekeys)
+ <initializing keys>{Initializing keys}
\start{newmacro}[\ltxkeysinitializekeys]
\ltxkeysinitializekeys[|A(prefs)]{|A(fams)}[|A(na)]
\finish{newmacro}
\fxim*{\ltxkeysinitializekeys}
-This presets all the keys previously defined in families \ang{fams} with their default values; it ignores keys listed in \ang{na}. If \ang{na} is a list of \keyval pairs, the key names are extracted from the list before the family keys are initialized. Any \keyval pairs in \ang{na} are not set at all. All keys defined by \ffx'{\ltxkeysdeclarekeys, \ltxkeysdeclarekeys} are automatically instantly initialized, except slave/alias and dependant keys. Alias and dependant keys aren't initialized in this case in order to avoid cyclic re-entrance of \fx{\ltxkeyssetkeys}.
+This presets all the keys previously defined in families \ang{fams} with their default values; it ignores keys listed in \ang{na}. If \ang{na} is a list of \keyval pairs, the key names are extracted from the list before the family keys are initialized. Any \keyval pairs in \ang{na} are not set at all. All keys defined by \ffx'{\ltxkeysdefinekeys, \ltxkeysdeclarekeys} are automatically instantly initialized, except slave/alias and observer keys. Alias and observer keys aren't initialized in this case in order to avoid cyclic re-entrance of \fx{\ltxkeyssetkeys}.
-The command \fx{\ltxkeysinitializekeys} can be used in place of \fx{\ltxkeysexecuteoptions}, since \fx{\ltxkeysexecuteoptions} (similar to \latex kernel's \hx{\ExecuteOptions}) fulfils the sole purpose of setting up default values of options. Keys defined via \ffx'{\ltxkeysdeclarekeys, \ltxkeysdeclarekeys} don't have to be initialized, since they're automatically initialized at definition time. But if you have used the scheme of \sref{nte:definekeys-1}, then it might still be necessary to initialize keys outside \ffx'{\ltxkeysdeclarekeys, \ltxkeysdeclarekeys}.
+The command \fx{\ltxkeysinitializekeys} can be used in place of \fx{\ltxkeysexecuteoptions}, since \fx{\ltxkeysexecuteoptions} (similar to \latex kernel's \hx{\ExecuteOptions}) fulfils the sole purpose of setting up default values of options. Keys defined via \ffx'{\ltxkeysdefinekeys, \ltxkeysdeclarekeys} don't have to be initialized, since they're automatically initialized at definition time. But if you have used the scheme of \sref{nte:definekeys-1}, then it might still be necessary to initialize keys outside \ffx'{\ltxkeysdefinekeys, \ltxkeysdeclarekeys}.
\begin{noteenv}
\label{nte:initializekeys}
@@ -1377,7 +1419,7 @@ The following example provides unknown option and key handlers. The unknown key
\ltxkeysunknownkeyhandler[KVA,KVB]{fam1,fam2}{%
\@expandtwoargs\in@{,#3,}{,\myspecialkeys,}%
- \ifdefboolTF{in@}{%
+ \ltsifboolTF{in@}{%
|com(The reader may want to investigate what the parameter texts)
|com(##1 and ####1 below stand for |(see |sref(nte:unknownkey) below|):)
\ltxkeysordkey[#1]{#2}{#3}[#4]{\def\x####1{####1xx##1}}%
@@ -1402,7 +1444,7 @@ To see what the parameter texts \fx{##1} and \fx{####1} above stand for, run the
\ifin@
\ltxkeysordkey[#1]{#2}{#3}[#4]{\def\x####1{####1xx##1}}%
\else
- \@warning{Unknown key `#3' with value `\ltxkeysinnocentvalue'
+ \ltxmsg@warn{Unknown key `#3' with value `\ltxkeysinnocentvalue'
in family `#2' ignored}\@ehd
\fi
}
@@ -1441,19 +1483,25 @@ Here, \ang{prefs} and \ang{fams} are comma-separated lists of prefixes and famil
The plain forms of \ffx'{\ltxkeysdisablefamilies,\ltxkeysgdisablefamilies} disable the given families instantly, while the \stform+ disable the families at \hx{\AtBeginDocument}. Authors can use these commands to bar users of their keys from calling those families after a certain point. Individual keys in a family can be disabled using the commands \ffx'{\ltxkeysdisablekeys, \ltxkeysgdisablekeys}.
\start{example}[\ltxkeysdisablefamilies]
-\ltxkeysdeclarekeys*[KV1]{fam1}[mp@]{%
- bool/key1/true/\def\xx##1{##1\\#1\\##1};
- bool/key2/true/\def\yy##1{##1*#1*##1};
- cmd/key3/aaa/;
- cmd/key4/bbb/
-}
-\ltxkeysdeclarekeys*[KV2]{fam2}[mp@]{%
- bool/key1/true;
- bool/key2/true;
- cmd/key3/yyy/;
- cmd/key4/zzz/
-}
-\ltxkeysdisablefamilies[KV1,KV2]{fam1,fam2}[key3,key4]
+\ltxkeys{%
+ |com(The commands \declare@keys, \set@keys and \set@rmkeys are available)
+ |com(only within \ltxkeys.)
+ \declare@keys*[KV1]{fam1}[mp@]{%
+ bool/key1/true/\def\xx##1{##1\\#1\\##1};
+ bool/key2/true/\def\yy##1{##1*#1*##1};
+ cmd/key3/aaa/;
+ cmd/key4/bbb/
+ }%
+ \\
+ \declare@keys*[KV2]{fam2}[mp@]{%
+ bool/key1/true;
+ bool/key2/true;
+ cmd/key3/yyy/;
+ cmd/key4/zzz/
+ }%
+ \\
+ \ltxkeysdisablefamilies[KV1,KV2]{fam1,fam2}[key3,key4]
+}
\showcsn{KV1@fam2@disabledkeys}
\finish{example}
@@ -1507,7 +1555,7 @@ The command \fx{\ltxkeysmakeoptionkeys} makes all the keys with prefix \ang{pref
\docsection(sec:handledkeys)<handled keys>{Handled keys}
-As mentioned in \sref{sec:unknownkeyhandler}, handled keys are keys defined in a macro that is key-prefix and key-family dependent. They are defined as a list in a macro so that they can be used for future applications, such as deciding if a dependant key of a style key should be defined or redefined on the fly. Handled keys should be defined, or added to, using key prefix, family and key names. You can define or add to handled keys by the following command:
+As mentioned in \sref{sec:unknownkeyhandler}, handled keys are keys defined in a macro that is key-prefix and key-family dependent. They are defined as a list in a macro so that they can be used for future applications, such as deciding if a observer key of a style key should be defined or redefined on the fly. Handled keys should be defined, or added to, using key prefix, family and key names. You can define or add to handled keys by the following command:
\start{newmacro}[\ltxkeyshandledkeys]
\ltxkeyshandledkeys[|A(pref)]{|A(fam)}{|A(list)}
@@ -1553,7 +1601,7 @@ Rather than remove individual handled keys from a list, you might prefer or need
\docsection(sec:reservedpath){Reserving and unreserving key path or bases}
\aidxm*{reserving key prefix, reserving key family}
-By \quoted{key path} we mean the key prefix (default is \fx{KV}), key family (generally no default), and macro prefix (default is dependent on the type of key). You can reserve key path or bases (\ie, bar future users from using the same path or bases) by the following commands. Once a key family or prefix name has been used, it might be useful barring further use of those names. For example, the \pkg'{ltxkeys} has barred users from defining keys with key family \fx{ltxkeys} and macro prefix \fx{ltxkeys@}.
+By \quoted{key path} we mean the key prefix (default is \fx{KV}), key family (generally no default), and macro prefix (default is dependent on the type of key). You can reserve key path or bases (\ie, bar future users from using the same path or bases) by the following commands. Once a key family or prefix name has been used, it might be useful barring further use of those names. For example, the \pkg'{ltxkeys} has barred users from defining keys with key family \fx{ltxkeys} and macro prefix \fx{ltxkeys}.
\start+{newmacro}[\ltxkeysreservekeyprefix,\ltxkeysreservekeyfamily, etc.]
\ltxkeysreservekeyprefix{|A(list)}
@@ -1563,11 +1611,12 @@ By \quoted{key path} we mean the key prefix (default is \fx{KV}), key family (ge
\ltxkeysreservemacroprefix{|A(list)}
\ltxkeysreservemacroprefix|*{|A(list)}
\finish{newmacro}
-\fxim*{\ltxkeysreservekeyprefix,\ltxkeysreservekeyfamily,\ltxkeysreservemacroprefix}
+\fxim*{\ltxkeysreservekeyprefix,\ltxkeysreservekeyfamily,
+ \ltxkeysreservemacroprefix}
Here, \ang{list} is a comma-separated list of bases. The \stform+ of these commands will defer reservation to the end of the current package or class, while the \unstform+ will effect the reservation immediately. As the package or class author you may want to defer the reservation to the end of your package or class.
-Users can, at their own risk, override reserved key bases simply by issuing the package boolean option \fx{reservenopath}. This can be issued in \hhx{\documentclass,\usepackage} or \fx{\ltxkeysoptions}. This might be too drastic for many users and uses. Therefore, the \pkg'{ltxkeys} also provides the following commands that can be used for selectively unreserving currently reserved key bases:
+Users can, at their own risk, override reserved key bases simply by issuing the package boolean option \fx{reservenopath}. This can be issued in \hhx{\documentclass,\usepackage} or \fx{\setltxkeysoptions}. This might be too drastic for many users and uses. Therefore, the \pkg'{ltxkeys} also provides the following commands that can be used for selectively unreserving currently reserved key bases:
\start+{newmacro}[\ltxkeysunreservekeyprefix,\ltxkeysunreservekeyfamily, etc.]
\ltxkeysunreservekeyprefix{|A(list)}
@@ -1577,7 +1626,8 @@ Users can, at their own risk, override reserved key bases simply by issuing the
\ltxkeysunreservemacroprefix{|A(list)}
\ltxkeysunreservemacroprefix|*{|A(list)}
\finish{newmacro}
-\fxim*{\ltxkeysunreservekeyprefix,\ltxkeysunreservekeyfamily,\ltxkeysunreservemacroprefix}
+\fxim*{\ltxkeysunreservekeyprefix,\ltxkeysunreservekeyfamily,
+ \ltxkeysunreservemacroprefix}
The \stform+ of these commands will defer action to the end of the current package or class, while the \unstform+ will undo the reservation immediately.
@@ -1728,13 +1778,12 @@ can each be used to introduce several options that share the same path or bases
\finish{newmacro}
\fxim*{\ltxkeysdeclaremultitypeoptions}
-Here, the key default value \ang{dft} and callback \ang{cbk} can be absent in all cases. \ang{keytype} may be any one of \fnz{ord,cmd,sty,sty*,bool,choice}. The star (\redstar) in \quoted{sty\Redstar} has the same meaning as in \fx{\ltxkeysstylekey} above, namely, undefined dependants will be defined on the fly when the parent key is set. The optional quantity \ang{mp} is the macro prefix, as in, for example, \sref{sec:cmdkeys}. The syntax for the command \fx{\ltxkeysdeclaremultitypeoptions} is identical to that of \fx{\ltxkeysdeclarekeys} except for the following differences: For \fx{\ltxkeysdeclarekeys} the family is mandatory and must be given in curly braces, while for \fx{\ltxkeysdeclaremultitypeoptions} the family is optional, with the default value of \quotedhx{\@currname.\@currext}, \ie, the name of the class file or package and its file extension. For \fx{\ltxkeysdeclaremultitypeoptions}, the optional family is expected to be given in angled brackets. The \stform of the command \fx{\ltxkeysdeclaremultitypeoptions} defines only undefined options.
+Here, the key default value \ang{dft} and callback \ang{cbk} can be absent in all cases. \ang{keytype} may be any one of \fnz{ord,cmd,sty,sty*,bool,choice}. The star (\redstar) in \quoted{sty\Redstar} has the same meaning as in \fx{\ltxkeysstylekey} above, namely, undefined observers will be defined on the fly when the parent key is set. The optional quantity \ang{mp} is the macro prefix, as in, for example, \sref{sec:cmdkeys}. The syntax for the command \fx{\ltxkeysdeclaremultitypeoptions} is identical to that of \fx{\ltxkeysdeclarekeys} except for the following differences: For \fx{\ltxkeysdeclarekeys} the family is mandatory and must be given in curly braces, while for \fx{\ltxkeysdeclaremultitypeoptions} the family is optional, with the default value of \quotedhx{\@currname.\@currext}, \ie, the name of the class file or package and its file extension. For \fx{\ltxkeysdeclaremultitypeoptions}, the optional family is expected to be given in angled brackets. The \stform of the command \fx{\ltxkeysdeclaremultitypeoptions} defines only undefined options. An alias for the long command \fx{\ltxkeysdeclaremultitypeoptions} is \fx{\declaremultitypeoptions}.
\start{example}[\ltxkeysdeclaremultitypeoptions]
-\ltxkeysdeclaremultitypeoptions*[KV]<fam>[mp@]{%
+\declaremultitypeoptions*[KV]<fam>[mp@]{%
cmd/option1/xx/\def\x##1{##1xx#1};
bool/option2/true;
- sty*
}
\finish{example}
@@ -1803,11 +1852,11 @@ The specification of the mandatory arguments and any optional first argument for
\start+{newmacro}[\ltxkeyscommand,\ltxkeysenvironment, etc]
|A(pref)\ltxkeyscommand|A(cs)[|A(narg)][|A(dft)]<|A(delim)>|(|A(keys)|){|A(defn)}
-|A(pref)\renewltxkeyscommand|A(cs)[|A(narg)][|A(dft)]<|A(delim)>|(|A(keys)|){|A(defn)}
+|A(pref)\reltxkeyscommand|A(cs)[|A(narg)][|A(dft)]<|A(delim)>|(|A(keys)|){|A(defn)}
|A(pref)\ltxkeysenvironment{|A(name)}[|A(narg)][|A(dft)]<|A(delim)>|(|A(keys)|){|A(begdefn)}{|A(enddefn)}
-|A(pref)\renewltxkeysenvironment{|A(name)}[|A(narg)][|A(dft)]<|A(delim)>|(|A(keys)|){|A(begdefn)}{|A(enddefn)}
+|A(pref)\reltxkeysenvironment{|A(name)}[|A(narg)][|A(dft)]<|A(delim)>|(|A(keys)|){|A(begdefn)}{|A(enddefn)}
\finish{newmacro}
-\fxim*{\ltxkeyscommand,\renewltxkeyscommand,\ltxkeysenvironment,\renewltxkeysenvironment,\ltxkeysglobal,
+\fxim*{\ltxkeyscommand,\reltxkeyscommand,\ltxkeysenvironment,\reltxkeysenvironment,\ltxkeysglobal,
\ltxkeysprotected,\ltxkeysrobust}
Here, \ang{pref} is the optional command prefix, which may be either \fx{\ltxkeysglobal} (for global commands) or \fx{\ltxkeysprotected} (for \etex protected commands); \ang{cs} is the command; \ang{name} is the environment name; \ang{narg} is the number of parameters; \ang{dft} is the default value of the first argument; \ang{delim} are the parameter delimiters; \ang{keys} are the keys to be defined for the command or environment; \ang{defn} is the replacement text of the command; \ang{begdefn} is the environment entry text; and \ang{enddefn} is the code to execute while exiting the environment.
@@ -1828,7 +1877,7 @@ In the \latex \hhx'{\newenvironment,\renewenvironment} commands, with the syntax
\finish{macro}
\hxim*{\newenvironment,\renewenvironment}
-the environment's parameters and/or arguments aren't accessible in \ang{enddefn}. If the environment user wants to access the parameters in \ang{enddefn}, he has to save them while still in \ang{begdefn}. This isn't the case with the commands \ffx'{\ltxkeysenvironment,\renewltxkeysenvironment}, for which the user can access the environment parameters while in \ang{enddefn}. To do this, he should call the command \fxim{\envarg}, which expects as argument the corresponding numeral of the parameter text. For example, \ffx'{\envarg{1},\envarg{3}} refer to the first and third arguments of the environment, respectively. Examples are provided later. The current values of environment's keys can always be accessed in \ang{enddefn}.
+the environment's parameters and/or arguments aren't accessible in \ang{enddefn}. If the environment user wants to access the parameters in \ang{enddefn}, he has to save them while still in \ang{begdefn}. This isn't the case with the commands \ffx'{\ltxkeysenvironment,\reltxkeysenvironment}, for which the user can access the environment parameters while in \ang{enddefn}. To do this, he should call the command \fxim{\envarg}, which expects as argument the corresponding numeral of the parameter text. For example, \ffx'{\envarg{1},\envarg{3}} refer to the first and third arguments of the environment, respectively. Examples are provided later. The current values of environment's keys can always be accessed in \ang{enddefn}.
But how do we access the current values or states of keys while in \ang{begdefn} and \ang{enddefn}? To this end the commands \ffx'{\val,\ifval,\ifvalTF,\keyval,\ifkeyval,\ifkeyvalTF} are provided. They have the following syntaxes:
@@ -2024,7 +2073,7 @@ Here, \ang{code} will be executed at the right instance when \ang{keycmd} is bei
\start+{example}[Nested key environments]
\def\testenv{}
-\renewltxkeysenvironment{testenv}|(%
+\reltxkeysenvironment{testenv}|(%
|com(The \y below is just a test:)
cmd/fraclen/0.1cm/\def\y##1{#1yyy##1};
cmd/framerule/.4pt;
@@ -2125,14 +2174,14 @@ The following example shows that in place of the functions \ffx'{\val,\ifval,\if
Sometimes keys are used simply to save values for later use. This can be achieved easily by using the command \fx{\ltxkeysdeclarevariables}.
-\start{newmacro}[\ltxkeysdeclarevariables,\ltxkeyssetvariablevalues,\ltxkeysgetvariablevalue]
+\start{newmacro}[\ltxkeysdeclarevariables,\ltxkeyssetvarvalues,\ltxkeysgetvarvalue]
\ltxkeysdeclarevariables[|A(namespace)]{%
|A(key-1) = |A(dft-1) = |A(cbk-1), ..., |A(key-n) = |A(dft-n) = |A(cbk-n)
}
-\ltxkeyssetvariablevalues[|A(namespace)]{|keyval pairs}
-\ltxkeysgetvariablevalue[|A(namespace)]{|A(key)}
+\ltxkeyssetvarvalues[|A(namespace)]{|keyval pairs}
+\ltxkeysgetvarvalue[|A(namespace)]{|A(key)}
\finish{newmacro}
-\fxim*{\ltxkeysdeclarevariables,\ltxkeyssetvariablevalues,\ltxkeysgetvariablevalue}
+\fxim*{\ltxkeysdeclarevariables,\ltxkeyssetvarvalues,\ltxkeysgetvarvalue}
Here, \ang{key-i}, \ang{dft-i} and \ang{cbk-i} are key name, key default value, and key callback, respectively, for key \quotedfx{i}. The optional \ang{namespace} is the private namespace for the declared variables and is used to avoid clashes of control sequences.
@@ -2146,11 +2195,11 @@ The key default value \ang{dft} and callback \ang{cbk} are optional and may be m
|com(No default value and no callback:)
var3
}
-\ltxkeyssetvariablevalues[mynamespace]{var1=new value1, var2=new value2}
-\edef\x{\ltxkeysgetvariablevalue[mynamespace]{var1}}
+\ltxkeyssetvarvalues[mynamespace]{var1=new value1, var2=new value2}
+\edef\x{\ltxkeysgetvarvalue[mynamespace]{var1}}
\begin{document}
-\ltxkeysgetvariablevalue[mynamespace]{var1}
+\ltxkeysgetvarvalue[mynamespace]{var1}
\end{document}
\finish{example}
@@ -2164,15 +2213,88 @@ The private namespace is optional but clashes of control sequences might occur:
|com(No default value and no callback:)
var3
}
-\ltxkeyssetvariablevalues{var1=new value1, var2=new value2}
-\edef\x{\ltxkeysgetvariablevalue{var1}}
+\ltxkeyssetvarvalues{var1=new value1, var2=new value2}
+\edef\x{\ltxkeysgetvarvalue{var1}}
\begin{document}
-\ltxkeysgetvariablevalue{var1}
+\ltxkeysgetvarvalue{var1}
\end{document}
\finish{example}
+\docsection(sec:ltxkeys-command){The \headfx{\ltxkeys} command}
+
+\start{newmacro}[\ltxkeys]
+\ltxkeys|*|'{|A(code-1) \\ |A(code-2) ... \\ ... |A(code-n)}
+\finish{newmacro}
+\fxim*{\ltxkeys}
+
+The command \fx{\ltxkeys} simply provides an ungrouped\footnote{Meaning no local groups are created.} environment for using the short forms of the commands shown in \sref{tab:ltxkeys-cmdabbrv}. The abbreviated commands are pushed on entry into \fx{\ltxkeys}, they are then assigned the meaning of their longer counterparts, and then popped (to whatever their original meaning was before entry into \fx{\ltxkeys}) on exist of \fx{\ltxkeys}. The list parser within \fx{\ltxkeys} is invariably \quotedfx{\\}. The list is normalized\footnote{Normalization implies replacing double \quotedfx{\\} by single \quotedfx{\\} and removing spurious spaces around each \quotedfx{\\}.} and the given codes \ang{code-i}, $i=1,...,n$, executed on the consecutive loops. The commands \ffx{\ordkeys,\cmdkeys}, \etcc, can be used to define just one key or multiple keys in the same family and of the same callback. \sref{tab:ltxkeys-cmdabbrv} lists the other abbreviations available within \fx{\ltxkeys}.
+
+The \stform of \fx{\ltxkeys} will expand its argument once before commencing the loop and executing the codes \ang{code-i}, $i=1,...,n$. The \pmform is equivalent to invoking the package option \fx{endcallbackline} before calling \fx{\ltxkeys}. Using both \redstar and \redprime makes \hx{\endlinechar} $-1$ but the effect is not enforced, since in the \stform of \fx{\ltxkeys} the argument has already been read.
+
+\begingroup
+\small
+\begin{tabularx}{\linewidth}{|p{4.5cm}|p{5.5cm}|}
+\caption{Command abbreviations available within \headfx{\ltxkeys}
+ \xwmlabel{tab:ltxkeys-cmdabbrv}}\\\hline
+\rowcolor{pink}
+\bf Command & \bf Abbreviation \\\hline
+\endfirsthead
+\hline
+\multicolumn{2}{|l|}{\emph{Continued from last page}}\\\hline
+\bf Command & \bf Abbreviation \\\hline
+\endhead
+\multicolumn{2}{|r|}{\emph{Continued on next page}}\\\hline
+\endfoot
+\hline
+\endlastfoot
+\fx{\ordkey} & \fx{\ltxkeysordkey} \\\hline
+\fx{\ordkeys} & \fx{\ltxkeysordkeys} \\\hline
+\fx{\listkey} & \fx{\ltxkeyslistkey} \\\hline
+\fx{\listkeys} & \fx{\ltxkeyslistkeys} \\\hline
+\fx{\cmdkey} & \fx{\ltxkeyscmdkey} \\\hline
+\fx{\cmdkeys} & \fx{\ltxkeyscmdkeys} \\\hline
+\fx{\boolkey} & \fx{\ltxkeysboolkey} \\\hline
+\fx{\boolkeys} & \fx{\ltxkeysboolkeys} \\\hline
+\fx{\switchkey} & \fx{\ltxkeysswitchkey} \\\hline
+\fx{\switchkeys} & \fx{\ltxkeysswitchkeys} \\\hline
+\fx{\choicekey} & \fx{\ltxkeyschoicekey} \\\hline
+\fx{\choicekeys} & \fx{\ltxkeyschoicekeys} \\\hline
+\fx{\stylekey} & \fx{\ltxkeysstylekey} \\\hline
+\fx{\stylekeys} & \fx{\ltxkeysstylekeys} \\\hline
+\fx{\definekeys} & \fx{\ltxkeysdefinekeys} \\\hline
+\fx{\declarekeys} & \fx{\ltxkeysdeclarekeys} \\\hline
+\fx{\declareoptions} & \fx{\ltxkeysdeclaremultitypeoptions} \\\hline
+\fx{\ifdeclaringkeys}\fx{\then} & \fx{\ifltxkeysdec} \\\hline
+\fx{\setkeys} & \fx{\ltxkeyssetkeys}\\\hline
+\fx{\setrmkeys} & \fx{\ltxkeyssetrmkeys}\\\hline
+\end{tabularx}
+\endgroup
+
+\start{example}[\ltxkeys]
+\ltxkeys|'{
+ \switchkeys|+[KV]{fam}[mp@]{keya,keyb}[true]{
+ \if\@nameuse{mp@\ltxkeyscurrentkey}
+ \def\xx##1{##1*#1*##1}
+ \fi
+ }{%
+ \keyvalueerror
+ }
+ \declarekeys*[KV]{fam}[mp@]{
+ bool/keyc/true/\def\x##1{##1\\#1\\##1};
+ cmd/keyd/keyd-default/\def\currval{#1};
+ }%
+ \\
+ |com(Arbitrary code to be executed on its own:)
+ \def\x##1{x ##1 x}
+ \\
+ \setkeys*[KV]{fam}[keyb,keyc]{keya=false,keyb,keyc=false,keyd=yy}
+ \setrmkeys|*[KV]{fam}[keyc]
+}
+\finish{example}
+
+
\docsection(sec:weirdargs){Keys with argument patterns}
@@ -2185,13 +2307,13 @@ The private namespace is optional but clashes of control sequences might occur:
\ltxkeyscmdkeys \ltxkeysnewcmdkeys
\ltxkeysstylekey \ltxkeysnewstylekey
\ltxkeysstylekeys \ltxkeysnewstylekeys
-\ltxkeysdeclarekeys (only when defining cmd keys)
+\ltxkeysdefinekeys (only when defining cmd keys)
\ltxkeysdeclarekeys (only when defining ord, cmd, sty keys)
\finish{macro}
\fxi*{\ltxkeysordkey,\ltxkeysnewordkey,\ltxkeysordkeys,\ltxkeysnewordkeys,
\ltxkeyscmdkey,\ltxkeysnewcmdkey,\ltxkeyscmdkeys,\ltxkeysnewcmdkeys,
\ltxkeysstylekey,\ltxkeysnewstylekey,\ltxkeysstylekeys,\ltxkeysnewstylekeys,
-\ltxkeysdeclarekeys,\ltxkeysdeclarekeys}
+\ltxkeysdefinekeys,\ltxkeysdeclarekeys}
When using the \pkg'{xkeyval} it is indirectly possible to submit multiple arguments to a key's macro. Suppose we wish to set the text size, then we can define an ordinary key called \texttt{textsize} as follows:
@@ -2226,7 +2348,7 @@ With the \pkg'{ltxkeys} this can be achieved directly as follows:
The argument pattern for the key's macro should be specified within the key's callback as the argument of the undefined command \fx{\argpattern}. The token \argpat can be positioned anywhere within the key's callback, provided it isn't enclosed in curly braces. There is no need to delimit the last argument: an internal delimiter is used.
-The same principles apply when using the macro \ffx'{\ltxkeysdeclarekeys}: simply put \argpat anywhere within the key's callback, but note that it doesn't apply in the case of boolean and choice keys.
+The same principles apply when using the macros \ffx'{\ltxkeysdefinekeys, \ltxkeysdeclarekeys}: simply put \argpat anywhere within the key's callback, but note that it doesn't apply in the case of boolean and choice keys.
\start+{example}[Key callback with multiple arguments]
\ltxkeyscmdkey[KV]{fam}[mp@]{keya}[{default1 and default2}]{%
@@ -2237,19 +2359,12 @@ The same principles apply when using the macro \ffx'{\ltxkeysdeclarekeys}: simpl
\ltxkeysdeclarekeys[KV]{fam}[mp@]{%
cmd/keya/{left/right}/|R(\argpattern){#1/#2}\def\xa##1{#1/##1/#2};
bool/keyb/true/\ifmp@keyb\def\xb##1{#1xx##1}\fi;
- sty*/keyc/blue+green+black/|R(\argpattern){#1+#2+#3}\def\xc##1{#1==#2==#3}/
- |com(Dependant `keyd'. Choice key can't have weird arguments:)
- choice>keyd.{%
- left/.do=\def\y##1{#1 xx ##1},
- right/.do=\def\y##1{##1 yy #1},
- center/.do=\def\y##1{##1 zz #1}
- }>left>\def\xd##1{##1xx#1};
ord/keye/{x y z w}/|R(\argpattern){#1 #2 #3 #4}\def\xe{#1 #2 #3 #4};
}
\ltxkeyssetkeys[KV]{fam}{keya={value1/value2}, keyc={value1+value2+value3}}
\finish{example}
-Caution should be exercised when using \argpat for the dependant key of a style key in the case in which the value of the parent key is used as the default for the dependant key. The following gives an error because, although \ttx{keya} has two arguments, the macros \ffx'{\parentval, \KV@fam@keya@value} will not be expanded before the callbacks of \ttx{keyb,keyc} are called. Errors will be flagged when initializing (or setting without values) \ttx{keyb,keyc}. Remember that the \stform of \fx{\ltxkeysstylekeys} will define and initialize dependant keys on the fly.
+Caution should be exercised when using \argpat for the observer key of a style key in the case in which the value of the parent key is used as the default for the observer key. The following gives an error because, although \ttx{keya} has two arguments, the macros \ffx'{\parentval, \KV@fam@keya@value} will not be expanded before the callbacks of \ttx{keyb,keyc} are called. Errors will be flagged when initializing (or setting without values) \ttx{keyb,keyc}. Remember that the \stform of \fx{\ltxkeysstylekeys} will define and initialize observer keys on the fly.
\start+{example}[Style key callback with multiple arguments]
\ltxkeysstylekeys|*[KV]{fam}[mp@]{keya}[{left right center}]|(%
@@ -2309,31 +2424,31 @@ The commands \ffx'{\ltxkeyscheckinput,\ltxkeyscheckuserinput} apply to comma-sep
\docsubsection(sec:ifinset){Does a test string exist in a string?}
-\start+{newmacro}[\ltxkeys@in,\ltxkeysiffound]
-\ltxkeys@in{|A(teststr)}{|A(str)}
-\ltxkeys@in|*{|A(teststr)}{|A(str)}{|A(true)}{|A(false)}
+\start+{newmacro}[\ltxkeysin,\ltxkeysiffound]
+\ltxkeysin{|A(teststr)}{|A(str)}
+\ltxkeysin|*{|A(teststr)}{|A(str)}{|A(true)}{|A(false)}
\ltxkeysiffound|A(teststr)|R(\in)|A(str)|R(\then) |A(true) \else |A(false) \fi
\finish{newmacro}
-\fxim*{\ltxkeys@in,\ltxkeysiffound}
+\fxim*{\ltxkeysin,\ltxkeysiffound}
-The \unstform of the command \fx{\ltxkeys@in} is identical with \usecsn{latex2e} kernel's (2011/06/27) \hx{\in@}. The command \hx{\in@} tests for the presence of \ang{teststr} in \ang{str} and returns the boolean \hx{\ifin@} as \hx{\iftrue} or \hx{\iffalse}. The \stform of \fx{\ltxkeys@in} returns two \latex branches \ang{true} and \ang{false}. On the other hand, the command \fx{\ltxkeysiffound} requires the first argument to be delimited by \fx{\in} and the second argument by \fx{\then}.
+The \unstform of the command \fx{\ltxkeysin} is identical with \usecsn{latex2e} kernel's (2011/06/27) \hx{\in@}. The command \hx{\in@} tests for the presence of \ang{teststr} in \ang{str} and returns the boolean \hx{\ifin@} as \hx{\iftrue} or \hx{\iffalse}. The \stform of \fx{\ltxkeysin} returns two \latex branches \ang{true} and \ang{false}. On the other hand, the command \fx{\ltxkeysiffound} requires the first argument to be delimited by \fx{\in} and the second argument by \fx{\then}.
\start{example}[\ltxkeysiffound]
\ltxkeysiffound xx\in aax\then \def\x{T}\else \def\x{F}\fi
\finish{example}
\ltsnote
-The command \fx{\ltxkeysiffound} trims leading and trailing spaces around the tokens \ang{teststr} and \ang{str} before the test! The commands \ffx'{\ltxkeys@in,\ltxkeysiffound} aren't expandable.
+The command \fx{\ltxkeysiffound} trims leading and trailing spaces around the tokens \ang{teststr} and \ang{str} before the test! The commands \ffx'{\ltxkeysin,\ltxkeysiffound} aren't expandable.
\docsubsection(sec:ifpattern){Does a given pattern exist in the meaning of a macro?}
-\start{newmacro}[\ltxkeysifpatternTF]
-\ltxkeysifpatternTF{|A(teststr)}|A(cmd){|A(true)}{|A(false)}
+\start{newmacro}[\ltxkeysifpattern]
+\ltxkeysifpattern{|A(teststr)}|A(cmd){|A(true)}{|A(false)}
\finish{newmacro}
-\fxim*{\ltxkeysifpatternTF}
+\fxim*{\ltxkeysifpattern}
-The command \fx{\ltxkeysifpatternTF} simply determines if the meaning of \ang{cmd} contains \ang{teststr}. It returns \ang{true} if \ang{teststr} is found in the meaning of \ang{cmd}, and \ang{false} otherwise.
+The command \fx{\ltxkeysifpattern} simply determines if the meaning of \ang{cmd} contains \ang{teststr}. It returns \ang{true} if \ang{teststr} is found in the meaning of \ang{cmd}, and \ang{false} otherwise.
\docsubsection(sec:ltxkeysifcase)
@@ -2476,52 +2591,38 @@ These commands will normalize the comma-separated \ang{list} (or \ang{list-i}) a
\docsubsection(sec:listparse){Parsing arbitrary csv or kv list}
-% Edit ++++++++++++++++++++++++++++++
-
-\start{newmacro}[\ltxkeysdolist]
-\ltxkeysdolist|A(flag)[|A(parser)]{|A(list)}
-\ltxkeysdolist|*|A(flag)[|A(parser)]{|A(listcmd)}
+\start{newmacro}[\ltxkeysdocsvlist,\ltxkeysdokvlist, etc.]
+\ltxkeysdocsvlist[|A(parser)]{|A(list)}
+\ltxkeysdocsvlist|*[|A(parser)]{|A(listcmd)}
+\ltxkeysparsecsvlist[|A(parser)]{|A(list)}
+\ltxkeysparsecsvlist|*[|A(parser)]{|A(listcmd)}
+\ltxkeysdokvlist[|A(parser)]{|A(list)}
+\ltxkeysdokvlist|*[|A(parser)]{|A(listcmd)}
+\ltxkeysparsekvlist[|A(parser)]{|A(list)}
+\ltxkeysparsekvlist|*[|A(parser)]{|A(listcmd)}
\finish{newmacro}
-\fxim*{\ltxkeysdolist}
+\fxim*{\ltxkeysdocsvlist,\ltxkeysparsecsvlist,\ltxkeysdokvlist,\ltxkeysparsekvlist}
-The unexpandable command \fx{\ltxkeysdolist} is the list processor for the \pkg'{ltxkeys}. It can process both arbitrary \ang{parser}-separated lists and \keyval pairs. It can also be nested to any level, and it keeps each nesting-level independent. The default value of the optional list-item separators \ang{parser} is \qcomma. The list normalizer for \fx{\ltxkeysdolist} is \pkg'{ltxtools}'s \fx{\csv@@normalize}, which can deal with arbitrary list parsers/separators. The \ang{flag}, which must lie in the range $(0,3)$, determines the type of processing that is required. The admissible values of \ang{flag} and their meaning are given in \sref{tab:parser-flags}. The macro \fx{\ltxkeysdolist} loops over the given \ang{parser}-separated \ang{list} and execute the user-defined, one-parameter command \fx{\ltxkeysdo} for every item in the list, passing the item as an argument and preserving outer braces. The default value of \ang{parser} is \qcomma. The \stform of \fx{\ltxkeysdolist} will expand \ang{listcmd} once before commencing the loop.
-
-\begingroup
-\small
-\begin{tabularx}{\linewidth}{|p{1cm}|X|}
-\caption{Flags for command \ltsprotectedtokens{\fx{\ltxkeysdolist}}
- \label{tab:parser-flags}}\\\hline
-\rowcolor{pink}
-\bfseries Flag &\bfseries Meaning\\\hline
-\endfirsthead
-\hline
-\multicolumn{2}{|l|}{\emph{Continued from last page}}\\\hline
-\bfseries Flag &\bfseries Meaning\\\hline
-\endhead
-\multicolumn{2}{|r|}{\emph{Continued on next page}}\\\hline
-\endfoot
-\hline
-\endlastfoot
-$0$ & \ang{list} is assumed to be an ordinary list (\ie, not a list of \keyval pairs); it isn't normalized by \fx{\ltxkeysdolist} prior to parsing. \\\hline
-$1$ & \ang{list} is assumed to be an ordinary list (\ie, not a list of \keyval pairs); it is normalized by \fx{\ltxkeysdolist} prior to parsing. \\\hline
-$2$ & \ang{list} is assumed to be a list of \keyval pairs; it isn't normalized by the command \fx{\ltxkeysdolist} prior to parsing. \\\hline
-$3$ & \ang{list} is assumed to be a list of \keyval pairs; it is normalized by \fx{\ltxkeysdolist} prior to parsing.
-\end{tabularx}
-\endgroup
+The unexpandable command \fx{\ltxkeysdocsvlist} is the list processor for the \pkg'{ltxkeys}. It can process both arbitrary \ang{parser}-separated lists and \keyval pairs. It can also be nested to any level, and it keeps each nesting-level independent. The default value of the optional list-item separators \ang{parser} is \qcomma. The list normalizer for \fx{\ltxkeysdocsvlist} is \pkg'{ltxtools}'s \fx{\csv@@normalize}, which can deal with arbitrary list parsers/separators. The \ang{flag}, which must lie in the range $(0,3)$, determines the type of processing that is required. The admissible values of \ang{flag} and their meaning are given in \sref{tab:parser-flags}. The macro \fx{\ltxkeysdocsvlist} loops over the given \ang{parser}-separated \ang{list} and execute the user-defined, one-parameter command \fx{\ltxkeysdo} for every item in the list, passing the item as an argument and preserving outer braces. The default value of \ang{parser} is \qcomma. The \stform of \fx{\ltxkeysdocsvlist} will expand \ang{listcmd} once before commencing the loop.
-Here are some points to note about the list processor \fx{\ltxkeysdolist}:
+Here are some points to note about the list processor \fx{\ltxkeysdocsvlist}:
\begin{enum}
-\item If an item contains \ang{parser}, it must be wrapped in curly braces when calling the command \fx{\ltxkeysdolist}, otherwise the elements may be mixed up during parsing. The braces will persist thereafter, but will of course be removed during printing (if the items are printed).
-\item White spaces before and after the list separator are always ignored by the normalizer called by \fx{\ltxkeysdolist}. If an item contains \ang{parser} or starts with a space, it must, therefore, be wrapped in curly braces before calling \fx{\ltxkeysdolist}.
-\item Since when \ang{flag} is $0$ or $2$ the command \fx{\ltxkeysdolist} doesn't call the normalizer, in this case it does preserve outer/surrounding spaces in the entries. Empty entries in \ang{list} or \ang{listcmd} will be processed by \fx{\ltxkeysdolist} if the boolean \fx{\ifltxkeys@useempty} is true. You may thus issue \fx{\ltxkeys@useemptytrue} before calling \fx{\ltxkeysdolist}. The ability to parse empty entries is required by packages that use empty key prefixes, and/or families\footnote{The use of empty key prefixes, families and paths is, in general, not advisable.}. \fx{\ifltxkeys@useempty} is false by default, and its state is nesting-level dependant.
-\item The command \fx{\ltxkeysdolist} can be nested to any level and can be mixed with other looping macros.
-\item In the command \fx{\ltxkeysdolist}, it is always possible to break out of the loop prematurely at any level of nesting, simply by issuing the command \fx{\ltxkeysbreakloop}, which toggles the boolean \fx{\ifltxkeys@breakloop}\footnote{The command \fx{\ltxkeysbreakloop} may be called within the loop to terminate the loop prematurely. The unprocessed items of the list will be handled by the command \fx{\ltxkeysdoremainder}, which can be redefined by the user. By default, it is defined as the \latex kernel's \hx{\@gobble}, meaning that it simply throws away the list remainder. The command \fx{\ltxkeysbreaklist} may also be inserted as a list item to break out of the loop prematurely. The commands \ffx'{\ltxkeysbreakloop, \ltxkeysbreaklist} have different syntax and semantics.}. Breaking an inner loop doesn't affect the continuation of the outer loop, and vice versa: loop break is nesting-level dependant.
+\item If an item contains \ang{parser}, it must be wrapped in curly braces when calling the command \fx{\ltxkeysdocsvlist}, otherwise the elements may be mixed up during parsing. The braces will persist thereafter, but will of course be removed during printing (if the items are printed).
+\item White spaces before and after the list separator are always ignored by the normalizer called by \fx{\ltxkeysdocsvlist}. If an item contains \ang{parser} or starts with a space, it must, therefore, be wrapped in curly braces before calling \fx{\ltxkeysdocsvlist}.
+\item Since when \ang{flag} is $0$ or $2$ the command \fx{\ltxkeysdocsvlist} doesn't call the normalizer, in this case it does preserve outer/surrounding spaces in the entries. Empty entries in \ang{list} or \ang{listcmd} will be processed by \fx{\ltxkeysdocsvlist} if the boolean \fx{\ifltxkeysuseempty} is true. You may thus issue \fx{\ltxkeysuseemptytrue} before calling \fx{\ltxkeysdocsvlist}. The ability to parse empty entries is required by packages that use empty key prefixes, and/or families\footnote{The use of empty key prefixes, families and paths is, in general, not advisable.}. \fx{\ifltxkeysuseempty} is false by default, and its state is nesting-level observer.
+\item The command \fx{\ltxkeysdocsvlist} can be nested to any level and can be mixed with other looping macros.
+\item In the command \fx{\ltxkeysdocsvlist}, it is always possible to break out of the loop prematurely at any level of nesting, simply by issuing the command \fx{\ltxkeysbreakloop}\footnote{The command \fx{\ltxkeysbreakloop} may be called within the loop to terminate the loop prematurely. The unprocessed items of the list will be handled by the command \fx{\ltxkeysdoremainder}, which can be redefined by the user. By default, it is defined as the \latex kernel's \hx{\@gobble}, meaning that it simply throws away the list remainder. The command \fx{\ltxkeyslistbreak} may also be inserted as a list item to break out of the loop prematurely. The commands \ffx'{\ltxkeysbreakloop, \ltxkeyslistbreak} have different syntax and semantics.}. Breaking an inner loop doesn't affect the continuation of the outer loop, and vice versa: loop break is nesting-level observer.
\item The argument of the one-parameter command \fx{\ltxkeysdo} can be passed to a multi-parameter command, or to a command that expects delimited arguments.
\end{enum}
-\docsubsection(sec:dosisolist){Parsing arbitrary tsv or nsv lists}
+\docsubsection(sec:sisolist){Parsing nsv/tsv list}
+\start{newmacro}[\ltxkeysdosisolist]
+\ltxkeysdosisolist[|A(parser)]{|A(list)}
+\ltxkeysdosisolist|*[|A(parser)]{|A(listcmd)}
+\finish{newmacro}
+\fxim*{\ltxkeysdosisolist}
@@ -2574,83 +2675,35 @@ where \ang{old-i} is the element to be replaced and \ang{new-i} is its replaceme
The list and key parsers of the \pkg'{ltxkeys} preserve outer braces, but sometimes it is needed to rid a token of one or more of its outer braces. This can be achieved by the following commands:
-\start+{newmacro}[\ltxkeysstripouterbraces, \ltxkeysstripallouterbraces, etc.]
-\ltxkeysstripouterbraces|A(nr){|A(token)}
+\start+{newmacro}[\ltxkeysstripNouterbraces, \ltxkeysstripallouterbraces, etc.]
+\ltxkeysstripNouterbraces|A(nr){|A(token)}
\ltxkeysstripallouterbraces{|A(token)}
\ltxkeysstripallouterbracesincs{|A(cmd)}
\finish{newmacro}
-\fxim*{\ltxkeysstripouterbraces,
+\fxim*{\ltxkeysstripNouterbraces,
\ltxkeysstripallouterbraces,\ltxkeysstripallouterbracesincs}
-The command \fx{\ltxkeysstripouterbraces} strips \ang{nr} number of outer braces from \ang{token}. The command \fx{\ltxkeysstripallouterbraces} strips all outer braces from \ang{token}. The command \fx{\ltxkeysstripallouterbracesincs} strips all the outer braces in the top content of the command \ang{cmd}. All these commands are expandable. Normally, \ang{token} wouldn't be expanded by these commands in the process of stripping off outer braces.
+The command \fx{\ltxkeysstripNouterbraces} strips \ang{nr} number of outer braces from \ang{token}. The command \fx{\ltxkeysstripallouterbraces} strips all outer braces from \ang{token}. The command \fx{\ltxkeysstripallouterbracesincs} strips all the outer braces in the top content of the command \ang{cmd}. All these commands are expandable. Normally, \ang{token} wouldn't be expanded by these commands in the process of stripping off outer braces.
-\start+{example}[\ltxkeysstripouterbraces,\ltxkeysstripallouterbraces, etc.]
+\start+{example}[\ltxkeysstripNouterbraces,\ltxkeysstripallouterbraces, etc.]
\toks@\expandafter\expandafter\expandafter
- {\ltxkeysstripouterbraces{2}{{{\y}}}}
+ {\ltxkeysstripNouterbraces{2}{{{\y}}}}
\edef\x{\unexpanded\expandafter\expandafter\expandafter
- {\ltxkeysstripouterbraces\@m{{{\y}}}}}
+ {\ltxkeysstripNouterbraces\@m{{{\y}}}}}
\edef\x{\ltxkeysstripallouterbraces{{{{\y}}}}}
\finish{example}
-\docsection(sec:add-patch-callback){Adding to and patching key macros}
-
-\subdocsection(sec:adtocallback){Adding to key macros}
-% \ltxkeysadtocallback, \ltxkeysappendtocallback, \ltxkeysprependtocallback
-
-
-\subdocsection(sec:patchcallback){Patching key macros}
-% \ltxkeyspatchcallback, \ltxkeysgpatchcallback
-
-Sometimes you may want to modify the macro of an existing key. For some reasons, redefining the key may not be the best option, besides being uneconomical.
-
-The following \fx{\ltxkeyspatchcallback} command and use syntax can be utilized to patch/modify existing key macros. In rare circumstances one may wish to modify an subsisting key macro, especially one defined in an existing package, without redefining the key afresh. Key macros are intrinsically parameterized functions and \latex kernel's \fx{\g@addto@macro} can't be used to patch parameterized functions.
-
-\start{newmacro}[\ltxkeyspatchcallback]
-\ltxkeyspatchcallback|*|![|nang(keyprefixes)]{|nang(families)}{
- |nang(key-1) {|nang(search-1)} {|nang(replace-1)} ;
- |nang(key-2) {|nang(search-2)} {|nang(replace-2)} ;
- ...
- |nang(key-n) {|nang(search-n)} {|nang(replace-n)}
-}{%
- |nang(fallback-s)
-}{%
- |nang(fallback-f)
-}
-\finish{newmacro}
-\fxim*{\ltxkeyspatchcallback}
-
-Here, \ang{keyprefixes} and \ang{families} are comma-separated lists of key prefixes and families; \ang{key-1} to \ang{key-n} are key names; \ang{search-1} to \ang{search-n} are the search patterns, and the quantities \ang{replace-1} to \ang{replace-n} the corresponding replacement texts. \ang{fallback-s} and \ang{fallback-f} are the actions that should be taken if the patching succeeds or fails for any of the existing keys. \fx{\ltxkeyspatchcallback} loops over the given key prefixes and families to find the listed keys. If a key can't be located (in terms of being previously defined), it is ignored and a warning message is logged (if the package option \fx{verbose} is enabled). Within the \ang{fallback-s} and \ang{fallback-f} blocks, you can use \fx{\ltxkeyscurrentkey}, \fx{\ltxkeyscurrentfamily}, and \fx{\ltxkeyscurrentprefix} to refer to the current key name, family and prefix (see example below). The \clsign instructs \fx{\ltxkeyspatchcallback} to globalize the outcome; the \stsign is explained below.
+\docsection(sec:addkeycode){Adding to key macros}
-Also, within the search-and-replace block you can use \fx{#1} to refer to the parameter of the key macro, which ordinarily corresponds to the value of the current key. There is no need to double the parameter character. But if you're introducing a new parameterized command within this block, you would need to double the parameter character.
-White spaces between the key name and the search pattern are ignored within the block of key names and search and replacement patterns. You can insert \fx{\ltxkeysbreaklist} within this block to prematurely break out of the loop. The remaining elements of the list will be saved in \fx{\ListRemainder} (see \cref{sec:list-process}).
-
-The default list parser in \fx{\ltxkeyspatchcallback} is the semicolon (\fx{;}). This can be changed by using \fx{\ltxkeysdeclarekeypatchparser}, which takes only one argument (the list parser).
-
-\start{example}[\ltxkeyspatchcallback]
-\ltxkeysordkey[KV]{fam}{keya}[value]{\def\x##1{x##1x}}
-\ltxkeysboolkey[KX]{fax}[mp@]{keyb}[true]{\def\y{#1}}
-
-\ltxkeyspatchcallback|*|![KV,KX]{fam,fax}{%
- keya {\def\x##1{x##1x}} {\def\X##1{XX##1XX}},
- keyb {\def\y{y#1y}} {\def\Y{YY#1YY}}
-}{%
- \wlog{Patching of `\ltxkeyscurrentkeymacro' succeeded}%
-}{%
- \wlog{Patching of `\ltxkeyscurrentkeymacro' failed}%
-}
-\show\KV@fam@keya
-\finish{example}
-
-% \ltxkeyspatchcmd
\docsection(sec:todo){To-do list}
This section details additional package features that may become available in the foreseeable future. User views are being solicited in regard of the following proposals.
-\docsubsection(sec:changedependantkeys)
- {Modifying the dependant keys of an existing style key}
+
+\docsubsection(sec:changeobserverkeys){Modifying the observer keys of an existing style key}
\start+{newmacro}[\ltxkeysadddepkeys,etc]
\ltxkeysadddepkeys[|A(pref)]{|A(fam)}{|A(paren)}{|A(deps)}
@@ -2659,7 +2712,7 @@ This section details additional package features that may become available in th
\finish{newmacro}
\fxim*{\ltxkeysadddepkeys,\ltxkeysremovedepkeys,\ltxkeysreplacedepkeys}
-Here, \ang{paren} is the parent key of dependants keys; \ang{deps} is the full specification of new or existing dependant keys (as in \sref{sec:stylekeys}), with their default values and callbacks; \ang{olddeps} are the old dependants to replace with \ang{newdeps}. This would require patching macros of the form \jpreffamkey{dependants}, which might have nested parametered-commands.
+Here, \ang{paren} is the parent key of observers keys; \ang{deps} is the full specification of new or existing observer keys (as in \sref{sec:stylekeys}), with their default values and callbacks; \ang{olddeps} are the old observers to replace with \ang{newdeps}. This would require patching macros of the form \jpreffamkey{observers}, which might have nested parametered-commands.
@@ -2673,18 +2726,21 @@ Introduce toggle keys. The package already contains switch keys (\sref{sec:switc
The following change history highlights significant changes that affect user utilities and interfaces; changes of technical nature are not documented in this section. The \stsign on the right-hand side of the following lists means the subject features in the package but is not reflected anywhere in this user guide.
\begin{versionhist}
+ \begin{version}{0.0.3c}{2012/11/17}
+ \item \fx{\ltxkeys@liskeys} changed to \fx{\ltxkeys@listkeys}\vsecref{sec:listkeys}
+ \end{version}
\begin{version}{0.0.3a-b}{2012/10/14}
- \item Command name changes from \pkg'{catoptions} package.
+ \item Miscellaneous bug fixes\vsecref*
\end{version}
- \begin{version}{0.0.2}{2011/08/22}
- \item Automatically call \fx{\ltxkeyscheckbool} when setting boolean keys \vsecref{sec:utilities}
- \item Raise error for keys that have no user input and no default value \vsecref{sec:examples}
+ \begin{version}{0.0.3}{2011/12/17}
+ \item More flags (\ffx{preset, postset, setrm}, \eetc) have been introduced for pathkeys \vsecref{sec:pathkeys}
\end{version}
- \begin{version}{0.0.1a}{2011/08/14}
- \item Completed the user guide\vsecref*
+ \begin{version}{0.0.2}{2011/09/01}
+ \item Pathkeys introduced\vsecref{sec:pathkeys}
+ \item User guide completed.\vsecref*
\end{version}
- \begin{version}{0.0.1}{2011/08/13}
- \item First public release\vsecref*
+ \begin{version}{0.0.1}{2011/07/30}
+ \item First public release.\vsecref*
\end{version}
\end{versionhist}
@@ -2695,7 +2751,3 @@ The following change history highlights significant changes that affect user uti
\printindex
\end{document}
-
-
-
-Normally, the command \fx{\patchcmd} of \cref{sec:cmd-patch} (and hence \fx{\ltxkeyspatchcallback}) doesn't allow nested commands, and hence no doubling of the parameter character in the replacement text. If you want to nest commands or double the parameter character in the replacement text, you need to use the \stform of \fx{\patchcmd} or \fx{\ltxkeyspatchcallback} (see example below). \ No newline at end of file
diff --git a/Master/texmf-dist/doc/latex/ltxkeys/ltxkeys-test-20121122.tex b/Master/texmf-dist/doc/latex/ltxkeys/ltxkeys-test-20121122.tex
new file mode 100644
index 00000000000..725126ab120
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/ltxkeys/ltxkeys-test-20121122.tex
@@ -0,0 +1,61 @@
+\documentclass{article}
+\usepackage{xcolor}
+\usepackage{ltxkeys}
+\makeatletter
+\def\somemethod#1#2{%
+ \begingroup
+ \color{#1}%
+ \ifltxkeys@novalue
+ \ifnum\ltxkeys@listcount=\@ne
+ \endgraf
+ Using default value of `\ltxkeys@tkey':
+ \fi
+ \else
+ \ifnum\ltxkeys@listcount=\@ne
+ \endgraf
+ Using user value of `\ltxkeys@tkey':
+ \fi
+ \fi
+ \endgroup
+ \endgraf
+ Processing item no. \ltxkeys@listcount: #2%
+}
+% Use comma (,), the default list separator, as the list separator
+% for keya and keyb:
+\ltxkeys@listkey[KV]{fam}{keya,keyb}[default1,default2]{%
+ \somemethod{blue}{#1}%
+ % Process only four (4) items of the list/value for keya and keyb:
+ \ifnum\ltxkeys@listcount=4\relax
+ \stopprocessinglistkey
+ \fi
+}
+
+% Use semicolon (;) as the list separator for keyc and keyd:
+\ltxkeys@listkey[KV]{fam}{keyc,keyd}[default1;default2]{%
+ \listsep{;}\somemethod{red}{#1}%
+}
+
+\makeatother
+
+\begin{document}
+\parindent0pt
+% No values for keya and keyb; use their default values:
+\ltxkeysusekeys[KV]{fam}{keya,keyb}
+
+\par\bigskip
+\ltxkeysusekeys[KV]{fam}{%
+ keya={item1A,item1B,item1C,item1D,item1E,item1F},
+ keyb={item2A,item2B,item2C,item2D,item2E,item2F}
+}
+
+\par\bigskip
+% Set keyc and keyd with their default values:
+\ltxkeysusekeys[KV]{fam}{keyc,keyd}
+
+\par\bigskip
+\ltxkeysusekeys[KV]{fam}{%
+ keyc={item1A;item1B;item1C;item1D},
+ keyd={item2A;item2B;item2C;item2D}
+}
+\end{document}
+