diff options
author | Karl Berry <karl@freefriends.org> | 2012-10-17 22:43:42 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-10-17 22:43:42 +0000 |
commit | ca1ccbd9792e9baeae4c8c25ac503272d0027bec (patch) | |
tree | 3c26017539bb4cb633af791904642c7d96e96956 | |
parent | 6785d7ec26154946d07b532acba877cc1bc96e0b (diff) |
ltxkeys (17oct12)
git-svn-id: svn://tug.org/texlive/trunk@28000 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/latex/ltxkeys/README | 8 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/ltxkeys/ltxkeys-guide-table1.tex | 55 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/ltxkeys/ltxkeys-guide.cfg | 49 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/ltxkeys/ltxkeys-guide.tex | 1975 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/ltxkeys/ltxkeys.sty | 52 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/ltxkeys/pathkeys.sty | 703 |
6 files changed, 699 insertions, 2143 deletions
diff --git a/Master/texmf-dist/doc/latex/ltxkeys/README b/Master/texmf-dist/doc/latex/ltxkeys/README index 4e3236c7399..d3609376c67 100644 --- a/Master/texmf-dist/doc/latex/ltxkeys/README +++ b/Master/texmf-dist/doc/latex/ltxkeys/README @@ -2,7 +2,11 @@ This is the README file for the ltxkeys package. VERSION -Version 0.0.3a, August 02, 2012 +Version 0.0.3b, October 14, 2012 + +LOCATION ON CTAN + +macros/latex/contrib/ltxkeys SUMMARY @@ -35,7 +39,7 @@ warranties of merchantability and fitness for any particular purpose. RELATED PACKAGES -keyval.sty, xkeyval.sty +keyval.sty, xkeyval.sty, skeyval.sty AUTHOR diff --git a/Master/texmf-dist/doc/latex/ltxkeys/ltxkeys-guide-table1.tex b/Master/texmf-dist/doc/latex/ltxkeys/ltxkeys-guide-table1.tex new file mode 100644 index 00000000000..7a5a614c4cf --- /dev/null +++ b/Master/texmf-dist/doc/latex/ltxkeys/ltxkeys-guide-table1.tex @@ -0,0 +1,55 @@ +\documentclass[ + use-a4-paper,use-10pt-font,final-version,UK-English, + no-hyperref-msg,wrapquote,subsidfile,verbose=false +]{amltxdoc} + +\makeatletter + +\InputIfFileExists{ltxkeys-guide.cfg}{}{% + \ltxmsg@err{No file 'ltxkeys-guide.cfg' or wrong path}\@ehc +} + +\begin{document} + +\defltablenote{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'{\ltxkeysdefinekeys} will always flag an error if a key is being defined twice, irrespective of the state of the package option \fx{verbose}. 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. +} +\defltablenote{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. 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. +} +\defltablenote{ltxkeys-3}{% + The key-setting commands are \ffx'{\ltxkeyssetkeys,\ltxkeyssetrmkeys,\ltxkeyssetaliaskey}. If you must nest these commands beyond level~4, you have to raise the \fx{keydepthlimit} as a package option. The option \fx{keystacklimit} is an alias for \fx{keydepthlimit}. +} +\defltablenote{4}{% + The use of an empty prefix will normally result from explicitly declaring the prefix as \fx{[]}, rather than leaving it undeclared. Undeclared prefixes assume the default value of \fx{KV}. An empty family will result from submitting the family as empty balanced curly braces \fx{{}}. If keys lack prefix and/or family, there is a strong risk of confusing key macros/functions. For example, without a prefix and/or family, a key named \fx{width} will have a key macro defined as \fx{\width}, which portents sufficient danger. +} + +\extrarowheight=2pt +\arrayrulecolor{yellow} +\colone3cm\coltwo2.0cm +\colthree=\dimexpr\textwidth-(\colone+\coltwo+1.5cm)\relax +\coltotal=\dimexpr\colone+\coltwo+\colthree\relax + +\begingroup\small +\begin{tabularx}{\linewidth}{|m{3cm}|m{2cm}|X|} +\caption{Package options\xwmlabel{tab:pkgoptions}}\\\hline +\rowcolor{pink} +\bfseries Option&\bfseries Default&\bfseries Meaning\\\hline +\endfirsthead +\hline +\multicolumn{3}{|l|}{\emph{Continued from last page}}\\\hline +\bfseries Option&\bfseries Default&\bfseries Meaning\\\hline +\endhead +\multicolumn{3}{|r|}{\emph{Continued on next page}}\\\hline +\endfoot +\hline +\endlastfoot +\fx{verbose} & \hx{false} & The global boolean switch that determines if information should be logged in the transcript for some tasks in the package. \useltablenote[tab:pkgoptions:note1]{ltxkeys-1}\\\hline +\fx{keyparser} & \texttt{;} & The list parser used by some internal loops in defining keys.\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, 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{tabularx} +\endgroup + +\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 187b67e023d..bde62498dc1 100644 --- a/Master/texmf-dist/doc/latex/ltxkeys/ltxkeys-guide.cfg +++ b/Master/texmf-dist/doc/latex/ltxkeys/ltxkeys-guide.cfg @@ -1,19 +1,32 @@ \ProvidesFile{ltxkeys-guide.cfg}% - [2011/12/17 v0.0.3 Configuration file for ltxkeys-guide.tex (AM)] + [2012/10/14 v0.0.3b Configuration file for ltxkeys-guide.tex (AM)] -\cptloadpackages{% - n-xwatermark|printwatermark; % change file name +\hfuzz1pt\vfuzz2pt +\makeindex +\ltsAfterAfterBeginDocument{% + \def\amd@sectitlefmt{\centering\Large\sffamily\color{secheadcolor}}% +} + +\interfootnotelinepenalty=10000 +\let\footnote\ltsfootnote +\extrarowheight=2pt +\arrayrulecolor{yellow} +\def\l@subsection{\@dottedtocline{2}{1.5em}{2.8em}} +\def\l@subsubsection{\@dottedtocline{3}{4.3em}{3.2em}} + +\ltsloadpackages{% array; colortbl; ltablex; } \new@def*\textpgfkeys{\texttt{pgf}~keys\sspace} + \amltxoptions{% geometryoptions = {left=3cm,right=3cm,top=2.5cm,% bottom=2.5cm,includeheadfoot}, reviewdocument = false, parindent = false, - toc = false, + tableofcontents = false, frontpagestyle = empty, pretitleskip = 0ex, posttitleskip = 1ex, @@ -27,21 +40,29 @@ speccolor = teal, sectionheadcolor = blue } -\ltsnewletcs*\sectionbreak\medbreak + +\newletcmd*\sectionbreak\medbreak \AtBeginDocument{\renewdef*\thefootnote{\fnsymbol{footnote}}} -\robust@def*\textnewkey{\mbox{\fx{\ltxkeys@new}xxx\fx{key}}\sspace} -\robust@def*\textltxkey{\mbox{\fx{\ltxkeys@}xxx\fx{key}}\sspace} +\robust@def*\textnewkey{\mbox{\fx{\ltxkeysnew}xxx\fx{key}}\sspace} +\robust@def*\textkey{\mbox{\fx{\ltxkeys}xxx\fx{key}}\sspace} \new@def*\boldreddot{\makered{\textbf{.}}} -\new@def*\keydotchoice#1#2{\ang{#1}\unskip\boldreddot\unskip\ang{{#2}}} +\new@def*\keydotchoice#1#2{% + \ang{#1}\unskip\boldreddot\unskip\leftbrace\ang{#2}\rightbrace +} \new@def*\mpkey{\fnl\bs{mp,key}\sspace} \new@def*\ifmpkey{\mbox{\cmdtext{\bs if}\fnl{}{mp,key}}\sspace} \new@def*\preffamkey{\fnl*'\bs{pref,fam,key}\sspace} \new@def*\ipreffamkey#1{\mbox{\cmdtext{\bs#1}\fnl*{}{pref,fam,key}}} \new@def*\jpreffamkey#1{\mbox{\fnl*'\bs{pref,fam,key}\unskip\fx{@#1}}} \new@def*\jpreffam#1{\fnl*'\bs{pref,fam,#1}} +\def\argpat{% + \fx{\argpattern}\unskip\leftbrace\ang{pattern}\rightbrace + \sspace +} \ifamd@subsidfile\else\ltsafterfi -\usepackage[persistent,useincluput]{ltxtools-incluput} +\usepackage[persistent,useincluput]{incluput} + \fancypagenos[% textalign = center, show-on-page-one = false, @@ -56,12 +77,13 @@ left-header = The \textcolor{macrocolor}{ltxkeys} package, right-header = \ttcl{black}{\today} ] + \newwatermark [page=1,fontfamily=phv,fontsize=11pt,fontseries=m,align=center, - coordunit=pc,width=.975\paperwidth,angle=0,scale=1,xpos=-.62,ypos=30.35]{% + coordunit=pc,width=.978\paperwidth,angle=0,scale=1,xpos=-.62,ypos=30.35]{% \xwmcolorbox[framesep=5pt,framerule=2pt,fillcolor=white, outerframecolor=Orange,innerframecolor=brown,textalign=justified, - width=.975\paperwidth]{% + width=.978\paperwidth]{% \normalfont\small\color{black}\vspace*{-1ex}% \parbox{.95\paperwidth}{% \ltsreddots{1.2}{\large\textsc{License}}\vspace*{1ex}% @@ -72,7 +94,9 @@ implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. \makered{\CopyrightYear}\vspace*{\baselineskip}% \ltsreddots{1}{\large\textsc{Summary}}\vspace*{1ex}% - The \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 and faster than these earlier packages. Yet it comes with many new functions. + The \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 and faster than these earlier packages. Yet it comes with many new functions. \vspace*{1ex}% }% }% @@ -82,3 +106,4 @@ \endinput +%%% End of file ltxkeys-guide.cfg %%% diff --git a/Master/texmf-dist/doc/latex/ltxkeys/ltxkeys-guide.tex b/Master/texmf-dist/doc/latex/ltxkeys/ltxkeys-guide.tex index f391d691602..6e8b021c26c 100644 --- a/Master/texmf-dist/doc/latex/ltxkeys/ltxkeys-guide.tex +++ b/Master/texmf-dist/doc/latex/ltxkeys/ltxkeys-guide.tex @@ -14,22 +14,13 @@ \makeatletter -\ltscommenbegin +\ltsbegincomment % Include the use of the following commands in this manual: +% \ltxkeysifoneincsvlistTF +% \ltxkeysifincsvlistTF +% \ltxkeysifoneintokenlistTF +% \ltxkeysifintsvlistTF % \ifltxkeysnovalue -% \ltxkeysignorekeys -% \ltxkeysgignorekeys -% \ltxkeysremoveignorekeys -% \ltxkeysgremoveignorekeys -% \ltxkeysdeleteignorekeys -% \ltxkeysgdeleteignorekeys - -% \ltxkeyssaveinitialvaluekeys -% \ltxkeysgsaveinitialvaluekeys -% \ltxkeysremovesaveinitialvaluekeys -% \ltxkeysgremovesaveinitialvaluekeys -% \ltxkeysdeletesaveinitialvaluekeys -% \ltxkeysgdeletesaveinitialvaluekeys % \ltxkeysgetrmkeys % \ltxkeysggetrmkeys @@ -38,19 +29,17 @@ % \ltxkeysgpresetkeys % \ltxkeyspostsetkeys % \ltxkeysgpostsetkeys -% \ltxkeyspreposetkeys -% \ltxkeysgpreposetkeys % \ltxkeysinitializermkeys % \ltxkeysginitializermkeys -% \ltxkeysifexpr -% \pathkeysbreaklist, \newpath \ltxkeysifinlistTF, \ltxkeysnormalizeset, \ltxkeysnormalizecsset +\ltxkeysuseandrelaxcsn +\ltxkeysifeltcountTF, \ltxkeyssetinitialkeyvalues, \ltxkeysinitializeafterdeclare \carmustykeys -\ltscommentend +\ltsendcomment \begin{document} @@ -58,7 +47,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.3 of the package. + This user manual corresponds to version~0.0.3b of the package. } \subtitle{A robust key parser for \latex} \titleurl{http://mirror.ctan.org/macros/latex/contrib/ltxkeys/} @@ -78,7 +67,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 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. + 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. } \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. @@ -87,7 +76,10 @@ \docsection(sec:intro){Introduction} -\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}.}: +%\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}.}: %[Braced option values] \start'{example} @@ -124,7 +116,7 @@ The \pkg'{ltxkeys} can compactly define and set all types of key with delimited While some user interfaces of the \pkg'{ltxkeys} are similar to those of the \pkg'{xkeyval}, there are important differences in several areas of syntax, semantics, and internal implementation. The \pkg'{ltxkeys} also provides additional facilities (beyond the \pkg'{xkeyval}) for defining and managing keys. Several types of key (including ordinary keys, command keys, style keys, choice keys, list keys, boolean and biboolean keys) can be efficiently created and managed. In the \pkg'{ltxkeys}, the notions of \quoted{pre-setting} and \quoted{post-setting} keys are similar to those of the \pkg'{xkeyval}. But the \pkg'{ltxkeys} introduces additional concepts in this respect: \quoted{initialized} and \quoted{launched} keys. The latter are special preset keys. The pointer system of the \pkg'{xkeyval}, which was available only at key-setting time, is now available also at key definition time. One more type of pointer (\fx{\needvalue}) has been introduced to require users of \quoted{need-value keys} to supply values for those keys. -Rather than simply issue an error for undefined keys when setting keys, the \pkg'{ltxkeys} provides the \quoted{undefined keys} and \quoted{undefined options} handlers, which are user-customizable. Other new concepts include \quotedlist{definable keys, cross-family keys, option keys, non-option keys, handled keys, pathkeys, key commands, key environments}, accessing the saved value of a key outside \hx{\setkeys} or similar commands, and declaring multiple keys and options (of all genre) using only one command. The notion of pathkeys is particularly interesting and powerful. Users more interested in this concept and its applications can skip many sections of this guide on their way to \sref{sec:pathkeys}. +Rather than simply issue an error for undefined keys when setting keys, the \pkg'{ltxkeys} provides the \quoted{undefined keys} and \quoted{undefined options} handlers, which are user-customizable. Other new concepts include \quotedlist{definable keys, cross-family keys, option keys, non-option keys, handled keys, key commands, key environments}, accessing the saved value of a key outside \hx{\setkeys} or similar commands, and declaring multiple keys and options (of all genre) using only one command. \ltsnote It is not advisable to alias the commands of the \pkg'{xkeyval} to the commands of the \pkg'{ltxkeys}. There are many existing packages that rely on the \pkg'{xkeyval} and aliasing commands that are used by other packages can cause confusion\footnote{A user of version~0.0.1 of the \pkg'{ltxkeys} had sought to do this.}. @@ -140,20 +132,20 @@ What are the \emph{raison d'etre} and origins of the \pkg'{ltxkeys}? Well, I dec The package options are listed in \sref{tab:pkgoptions}. The package options can be passed via the commands \hx{\documentclass}\footnote{Passing \pkg'{ltxkeys} options via \hx{\documentclass} implies that the package is loaded after \hx{\documentclass}. As mentioned elsewhere, the \pkg'{ltxkeys} can be loaded before or after \hx{\documentclass}.}, \hx{\RequirePackage} or \hx{\usepackage} as follows: \start{example}[Package options] -\documentclass[tracingkeys,keyparser={|nv},pathkeys]{article} +\documentclass[tracingkeys,keyparser={|nv}]{article} |orr \usepackage[tracingkeys,keyparser={|nv}]{ltxkeys} \finish{example} -They can also be passed locally via the command \fx{\ltxkeys@options}: +They can also be passed locally via the command \fx{\ltxkeysoptions}: -\start{newmacro}[\ltxkeys@options] -\ltxkeys@options{tracingkeys=false,keyparser={;}} +\start{newmacro}[\ltxkeysoptions] +\ltxkeysoptions{tracingkeys=false,keyparser={;}} \finish{newmacro} -\fxim*{\ltxkeys@options} +\fxim*{\ltxkeysoptions} \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 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. + 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. } \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. @@ -169,7 +161,7 @@ They can also be passed locally via the command \fx{\ltxkeys@options}: \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{\ltxkeys@options}.} \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{\ltxkeysoptions}.} \xwmlabel{tab:pkgoptions} \\\hline \rowcolor{pink} \bfseries Option&\bfseries Default&\bfseries Meaning\\\hline @@ -183,11 +175,10 @@ They can also be passed locally via the command \fx{\ltxkeys@options}: \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 macros \ffx'{\ltxkeysdefinekeys, \ltxkeysdeclarekeys, \pathkeys}. \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 macro \ffx'{\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, but when dealing with \quoted{pathkeys} (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{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 -\fx{pathkeys} & \hx{false} & Load the \pkg'{pathkeys} (see \sref{sec:pathkeys}).\\\hline \fx{endcallbackline} & \hx{false} & At key-definition time, while in the callback of a key, implicitly make \hx{\endlinechar} equal to $-1$ (\ie, automatically insert comment sign at each end of line). If enabled, this option applies to all key-definition commands. The snag with this is that, when enabled, the user has to remember to manually provide explicit spaces that he/she might require at end of lines. \end{tabularx} \endgroup @@ -198,7 +189,7 @@ They can also be passed locally via the command \fx{\ltxkeys@options}: \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 \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. +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. Subsequently we will mention the \textnewkey variants of key-defining commands without necessarily explaining what they mean, since their meaning is henceforth clear. @@ -208,43 +199,43 @@ In the following, syntactic quantities in square brackets (\eg, \fx{[yyy]}) and \docsubsection(sec:ordkeys)<ordinary keys (ord)>{Ordinary keys} \aidx*{key prefix,macro prefix,key macro} -\start+{newmacro}[\ltxkeys@ordkey,\ltxkeys@newordkey] -\ltxkeys@ordkey[|A(pref)]{|A(fam)}{|A(key)}[|A(dft)]{|A(cbk)} -\ltxkeys@newordkey[|A(pref)]{|A(fam)}{|A(key)}[|A(dft)]{|A(cbk)} +\start+{newmacro}[\ltxkeysordkey,\ltxkeysnewordkey] +\ltxkeysordkey[|A(pref)]{|A(fam)}{|A(key)}[|A(dft)]{|A(cbk)} +\ltxkeysnewordkey[|A(pref)]{|A(fam)}{|A(key)}[|A(dft)]{|A(cbk)} \finish{newmacro} -\fxim*{\ltxkeys@ordkey,\ltxkeys@newordkey} +\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{\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.}. +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.}. Run the following example and do \fx{\show\cmdb} and \fx{\show\cmdd}: -\start{example}[\ltxkeys@ordkey] -\ltxkeys@ordkey[KV]{fam}{keya}[\def\cmda#1{aa#1}]{\def\cmdb##1{#1bb##1}} -\ltxkeys@ordkey[KV]{fam}{keyb}[\def\cmdc##1{cc##1}]{\def\cmdd##1{#1dd##1}} +\start{example}[\ltxkeysordkey] +\ltxkeysordkey[KV]{fam}{keya}[\def\cmda#1{aa#1}]{\def\cmdb##1{#1bb##1}} +\ltxkeysordkey[KV]{fam}{keyb}[\def\cmdc##1{cc##1}]{\def\cmdd##1{#1dd##1}} \ltxkeyssetkeys[KV]{fam}{keya,keyb} \finish{example} \docsubsubsection(sec:ordkeys-sameattributes) {Ordinary keys that share the same attributes} -The commands \ffx'{\ltxkeys@ordkey,\ltxkeys@newordkey} can be used to introduce ordinary keys \ang{keys} that share the same path\footnote{The key path is also called the key bases.} (key prefix, key family, and macro prefix) and callback \ang{cbk}. All that is needed is to replace \ang{key} in these commands with the comma-separated list \ang{keys}. Because some users might prefer to see these commands in their plural forms when defining several keys with the same callback, we have provided the following aliases. The internal coding remains the same and no efficiency has been lost in generalization. +The commands \ffx'{\ltxkeysordkey,\ltxkeysnewordkey} can be used to introduce ordinary keys \ang{keys} that share the same path\footnote{The key path is also called the key bases.} (key prefix, key family, and macro prefix) and callback \ang{cbk}. All that is needed is to replace \ang{key} in these commands with the comma-separated list \ang{keys}. Because some users might prefer to see these commands in their plural forms when defining several keys with the same callback, we have provided the following aliases. The internal coding remains the same and no efficiency has been lost in generalization. -\start+{newmacro}[\ltxkeys@ordkeys,\ltxkeys@newordkeys] -\ltxkeys@ordkeys[|A(pref)]{|A(fam)}{|A(keys)}[|A(dft)]{|A(cbk)} -\ltxkeys@newordkeys[|A(pref)]{|A(fam)}{|A(keys)}[|A(dft)]{|A(cbk)} +\start+{newmacro}[\ltxkeysordkeys,\ltxkeysnewordkeys] +\ltxkeysordkeys[|A(pref)]{|A(fam)}{|A(keys)}[|A(dft)]{|A(cbk)} +\ltxkeysnewordkeys[|A(pref)]{|A(fam)}{|A(keys)}[|A(dft)]{|A(cbk)} \finish{newmacro} -\fxim*{\ltxkeys@ordkeys,\ltxkeys@newordkeys} +\fxim*{\ltxkeysordkeys,\ltxkeysnewordkeys} \docsubsection(sec:lispkeys)<lispkeys>{List keys (lispkeys)} -\start+{newmacro}[\ltxkeys@lispkey,\ltxkeys@newlispkey, etc.] -\ltxkeys@lispkey[|A(pref)]{|A(fam)}{|A(key)}[|A(dft)]{|A(cbk)} -\ltxkeys@newlispkey[|A(pref)]{|A(fam)}{|A(key)}[|A(dft)]{|A(cbk)} -\ltxkeys@lispkeys[|A(pref)]{|A(fam)}{|A(keys)}[|A(dft)]{|A(cbk)} -\ltxkeys@newlispkeys[|A(pref)]{|A(fam)}{|A(keys)}[|A(dft)]{|A(cbk)} +\start+{newmacro}[\ltxkeyslispkey,\ltxkeysnewlispkey, etc.] +\ltxkeyslispkey[|A(pref)]{|A(fam)}{|A(key)}[|A(dft)]{|A(cbk)} +\ltxkeysnewlispkey[|A(pref)]{|A(fam)}{|A(key)}[|A(dft)]{|A(cbk)} +\ltxkeyslispkeys[|A(pref)]{|A(fam)}{|A(keys)}[|A(dft)]{|A(cbk)} +\ltxkeysnewlispkeys[|A(pref)]{|A(fam)}{|A(keys)}[|A(dft)]{|A(cbk)} \finish{newmacro} -\fxim*{\ltxkeys@lispkey,\ltxkeys@newlispkey,\ltxkeys@lispkeys,\ltxkeys@newlispkeys} +\fxim*{\ltxkeyslispkey,\ltxkeysnewlispkey,\ltxkeyslispkeys,\ltxkeysnewlispkeys} 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). @@ -252,15 +243,15 @@ Each item will be processed by the key's callback. A lisp key does accept any ar 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}[\ltxkeys@lispkey] -\ltxkeys@lispkey[KV]{fam}{keya}[aaa, bbb]{% +\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}% } |com(User inputs that are comma-separated should be wrapped in braces:) \ltxkeyssetkeys[KV]{fam}{keya={val1, val2, val3}} -\ltxkeys@lispkey[KV]{fam}{keyb}[aaa; bbb]{% +\ltxkeyslispkey[KV]{fam}{keyb}[aaa; bbb]{% |R(\listsep){;}% \ifnum\ltxkeyslispnr>2\relax \ltxkeysbreakloop @@ -275,11 +266,11 @@ It is possible to call the command \fx{\ltxkeysbreakloop} in the key's callback \docsubsection(sec:cmdkeys)<command keys (cmd)>{Command keys} -\start+{newmacro}[\ltxkeys@cmdkey,\ltxkeys@newcmdkey] -\ltxkeys@cmdkey[|A(pref)]{|A(fam)}[|A(mp)]{|A(key)}[|A(dft)]{|A(cbk)} -\ltxkeys@newcmdkey[|A(pref)]{|A(fam)}[|A(mp)]{|A(key)}[|A(dft)]{|A(cbk)} +\start+{newmacro}[\ltxkeyscmdkey,\ltxkeysnewcmdkey] +\ltxkeyscmdkey[|A(pref)]{|A(fam)}[|A(mp)]{|A(key)}[|A(dft)]{|A(cbk)} +\ltxkeysnewcmdkey[|A(pref)]{|A(fam)}[|A(mp)]{|A(key)}[|A(dft)]{|A(cbk)} \finish{newmacro} -\fxim*{\ltxkeys@cmdkey,\ltxkeys@newcmdkey} +\fxim*{\ltxkeyscmdkey,\ltxkeysnewcmdkey} Here, the optional quantity \ang{mp} is the \quoted{macro prefix}. If \ang{mp} is given, the command \mpkey will hold the current user input at key setting time; otherwise (\ie, if \ang{mp} is absent) the user input will be available in the macro \ipreffamkey{cmd}. The command \preffamkey is the \quoted{key macro} and will hold the callback \ang{cbk}. This type of key is traditionally called \quoted{command key} (a name that most likely emanated from the \pkg'{xkeyval}) because it gives rise to the macro \mpkey, but in the \pkg'{ltxkeys} even boolean, style and choice keys are associated with this type of macro. @@ -287,13 +278,13 @@ Here, the optional quantity \ang{mp} is the \quoted{macro prefix}. If \ang{mp} i \docsubsubsection(sec:cmdkeys-sameattributes) {Command keys that share the same attributes} -The commands \ffx'{\ltxkeys@cmdkey,\ltxkeys@newcmdkey} can be used to introduce command keys \ang{keys} that share the same path or bases (key prefix, key family, and macro prefix) and callback \ang{cbk}. Simply replace \ang{key} in these commands with the comma-separated list \ang{keys}. Some users might prefer to see these commands in their plural forms when defining several keys with the same callback. We have therefore provided the following aliases: +The commands \ffx'{\ltxkeyscmdkey,\ltxkeysnewcmdkey} can be used to introduce command keys \ang{keys} that share the same path or bases (key prefix, key family, and macro prefix) and callback \ang{cbk}. Simply replace \ang{key} in these commands with the comma-separated list \ang{keys}. Some users might prefer to see these commands in their plural forms when defining several keys with the same callback. We have therefore provided the following aliases: -\start+{newmacro}[\ltxkeys@cmdkeys,\ltxkeys@newcmdkeys] -\ltxkeys@cmdkeys[|A(pref)]{|A(fam)}[|A(mp)]{|A(keys)}[|A(dft)]{|A(cbk)} -\ltxkeys@newcmdkeys[|A(pref)]{|A(fam)}[|A(mp)]{|A(keys)}[|A(dft)]{|A(cbk)} +\start+{newmacro}[\ltxkeyscmdkeys,\ltxkeysnewcmdkeys] +\ltxkeyscmdkeys[|A(pref)]{|A(fam)}[|A(mp)]{|A(keys)}[|A(dft)]{|A(cbk)} +\ltxkeysnewcmdkeys[|A(pref)]{|A(fam)}[|A(mp)]{|A(keys)}[|A(dft)]{|A(cbk)} \finish{newmacro} -\fxim*{\ltxkeys@cmdkeys,\ltxkeys@newcmdkeys} +\fxim*{\ltxkeyscmdkeys,\ltxkeysnewcmdkeys} \docsubsection(sec:stylekeys){Style keys} @@ -301,13 +292,13 @@ The commands \ffx'{\ltxkeys@cmdkey,\ltxkeys@newcmdkey} can be used to introduce Style keys are keys with dependants (\ie, keys that are processed when the master is set). They have the following syntaxes: -\start+{newmacro}[\ltxkeys@stylekey,\ltxkeys@newstylekey] -\ltxkeys@stylekey[|A(pref)]{|A(fam)}[|A(mp)]{|A(key)}[|A(dft)]|(|A(deps)|){|A(cbk)} -\ltxkeys@stylekey|*[|A(pref)]{|A(fam)}[|A(mp)]{|A(key)}[|A(dft)]|(|A(deps)|){|A(cbk)} -\ltxkeys@newstylekey[|A(pref)]{|A(fam)}[|A(mp)]{|A(key)}[|A(dft)]|(|A(deps)|){|A(cbk)} -\ltxkeys@newstylekey|*[|A(pref)]{|A(fam)}[|A(mp)]{|A(key)}[|A(dft)]|(|A(deps)|){|A(cbk)} +\start+{newmacro}[\ltxkeysstylekey,\ltxkeysnewstylekey] +\ltxkeysstylekey[|A(pref)]{|A(fam)}[|A(mp)]{|A(key)}[|A(dft)]|(|A(deps)|){|A(cbk)} +\ltxkeysstylekey|*[|A(pref)]{|A(fam)}[|A(mp)]{|A(key)}[|A(dft)]|(|A(deps)|){|A(cbk)} +\ltxkeysnewstylekey[|A(pref)]{|A(fam)}[|A(mp)]{|A(key)}[|A(dft)]|(|A(deps)|){|A(cbk)} +\ltxkeysnewstylekey|*[|A(pref)]{|A(fam)}[|A(mp)]{|A(key)}[|A(dft)]|(|A(deps)|){|A(cbk)} \finish{newmacro} -\fxim*{\ltxkeys@stylekey,\ltxkeys@newstylekey} +\fxim*{\ltxkeysstylekey,\ltxkeysnewstylekey} The dependants \ang{deps} have the syntax: @@ -332,8 +323,8 @@ Most of the time it is possible to access the parent key's current value with \f \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: -\start+{example}[\ltxkeys@stylekey] -\ltxkeys@stylekey|*[KV]{fam}[mp@]{keya}[{left}]|(% +\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:) @@ -376,67 +367,67 @@ The braces in the key values above are just to exemplify the fact that braces in \docsubsubsection(sec:stylekeys-sameattributes) {Style keys that share the same attributes} -The commands \ffx'{\ltxkeys@stylekey,\ltxkeys@newstylekey} can be used to introduce style keys \ang{keys} that share the same path or bases (key prefix, key family, and macro prefix) and callback \ang{cbk}. Just replace \ang{key} in these commands with the comma-separated list \ang{keys}. However, some users might prefer to see these commands in their plural forms when defining several keys with the same callback. Hence, we also provide the following aliases: +The commands \ffx'{\ltxkeysstylekey,\ltxkeysnewstylekey} can be used to introduce style keys \ang{keys} that share the same path or bases (key prefix, key family, and macro prefix) and callback \ang{cbk}. Just replace \ang{key} in these commands with the comma-separated list \ang{keys}. However, some users might prefer to see these commands in their plural forms when defining several keys with the same callback. Hence, we also provide the following aliases: -\start+{newmacro}[\ltxkeys@stylekeys,\ltxkeys@newstylekeys] -\ltxkeys@stylekeys[|A(pref)]{|A(fam)}[|A(mp)]{|A(keys)}[|A(dft)]|(|A(deps)|){|A(cbk)} -\ltxkeys@stylekeys|*[|A(pref)]{|A(fam)}[|A(mp)]{|A(keys)}[|A(dft)]|(|A(deps)|){|A(cbk)} -\ltxkeys@newstylekeys[|A(pref)]{|A(fam)}[|A(mp)]{|A(keys)}[|A(dft)]|(|A(deps)|){|A(cbk)} -\ltxkeys@newstylekeys|*[|A(pref)]{|A(fam)}[|A(mp)]{|A(keys)}[|A(dft)]|(|A(deps)|){|A(cbk)} +\start+{newmacro}[\ltxkeysstylekeys,\ltxkeysnewstylekeys] +\ltxkeysstylekeys[|A(pref)]{|A(fam)}[|A(mp)]{|A(keys)}[|A(dft)]|(|A(deps)|){|A(cbk)} +\ltxkeysstylekeys|*[|A(pref)]{|A(fam)}[|A(mp)]{|A(keys)}[|A(dft)]|(|A(deps)|){|A(cbk)} +\ltxkeysnewstylekeys[|A(pref)]{|A(fam)}[|A(mp)]{|A(keys)}[|A(dft)]|(|A(deps)|){|A(cbk)} +\ltxkeysnewstylekeys|*[|A(pref)]{|A(fam)}[|A(mp)]{|A(keys)}[|A(dft)]|(|A(deps)|){|A(cbk)} \finish{newmacro} -\fxim*{\ltxkeys@stylekeys,\ltxkeys@newstylekeys} +\fxim*{\ltxkeysstylekeys,\ltxkeysnewstylekeys} \docsubsection(sec:boolkeys)<boolean keys (bool)>{Boolean keys} -\start+{newmacro}[\ltxkeys@boolkey,\ltxkeys@newboolkey] -\ltxkeys@boolkey[|A(pref)]{|A(fam)}[|A(mp)]{|A(key)}[|A(dft)]{|A(cbk)} -\ltxkeys@boolkey|+[|A(pref)]{|A(fam)}[|A(mp)]{|A(key)}[|A(dft)]{|A(cbk)}{|A(fn)} -\ltxkeys@newboolkey[|A(pref)]{|A(fam)}[|A(mp)]{|A(key)}[|A(dft)]{|A(cbk)} -\ltxkeys@newboolkey|+[|A(pref)]{|A(fam)}[|A(mp)]{|A(key)}[|A(dft)]{|A(cbk)}{|A(fn)} +\start+{newmacro}[\ltxkeysboolkey,\ltxkeysnewboolkey] +\ltxkeysboolkey[|A(pref)]{|A(fam)}[|A(mp)]{|A(key)}[|A(dft)]{|A(cbk)} +\ltxkeysboolkey|+[|A(pref)]{|A(fam)}[|A(mp)]{|A(key)}[|A(dft)]{|A(cbk)}{|A(fn)} +\ltxkeysnewboolkey[|A(pref)]{|A(fam)}[|A(mp)]{|A(key)}[|A(dft)]{|A(cbk)} +\ltxkeysnewboolkey|+[|A(pref)]{|A(fam)}[|A(mp)]{|A(key)}[|A(dft)]{|A(cbk)}{|A(fn)} \finish{newmacro} -\fxim*{\ltxkeys@boolkey,\ltxkeys@newboolkey} +\fxim*{\ltxkeysboolkey,\ltxkeysnewboolkey} In these commands, if \ang{mp} is given, the command \mpkey will hold the current user input for the key at key setting time; otherwise the user input will be available in \ipreffamkey{bool}\footnote{This differs from the system in the \pkg'{xkeyval}.}. If \ang{mp} is specified, a boolean of the form \ifmpkey will be created at key definition, which will be set by \fx{\ltxkeyssetkeys} according to the user input. If \ang{mp} is not specified, a boolean of the form \ipreffamkey{ifbool} will instead be created. The user input for boolean keys must be in the set \fnz*{true,false}. The callback \ang{cbk} is held in the command \preffamkey, which is executed if the user input is valid. -The \plform of \ffx'{\ltxkeys@boolkey,\ltxkeys@newboolkey} will execute \ang{fn} in place of \ang{cbk} if the user input isn't in \fnz*{true,false}; the plain form will issue an error in this case. +The \plform of \ffx'{\ltxkeysboolkey,\ltxkeysnewboolkey} will execute \ang{fn} in place of \ang{cbk} if the user input isn't in \fnz*{true,false}; the plain form will issue an error in this case. \docsubsubsection(sec:boolkeys-sameattributes) {Boolean keys that share the same attributes} -The commands \ffx'{\ltxkeys@boolkey,\ltxkeys@newboolkey} can be used to introduce boolean keys \ang{keys} that share the same path or bases (key prefix, key family, and macro prefix) and callback \ang{cbk}. Just replace \ang{key} in these commands with the comma-separated list \ang{keys}. Because some users might prefer to see these commands in their plural forms when defining several keys with the same callback, we have provided the following aliases: +The commands \ffx'{\ltxkeysboolkey,\ltxkeysnewboolkey} can be used to introduce boolean keys \ang{keys} that share the same path or bases (key prefix, key family, and macro prefix) and callback \ang{cbk}. Just replace \ang{key} in these commands with the comma-separated list \ang{keys}. Because some users might prefer to see these commands in their plural forms when defining several keys with the same callback, we have provided the following aliases: -\start+{newmacro}[\ltxkeys@boolkeys,\ltxkeys@newboolkeys] -\ltxkeys@boolkeys[|A(pref)]{|A(fam)}[|A(mp)]{|A(keys)}[|A(dft)]{|A(cbk)} -\ltxkeys@boolkeys|+[|A(pref)]{|A(fam)}[|A(mp)]{|A(keys)}[|A(dft)]{|A(cbk)}{|A(fn)} -\ltxkeys@newboolkeys[|A(pref)]{|A(fam)}[|A(mp)]{|A(keys)}[|A(dft)]{|A(cbk)} -\ltxkeys@newboolkeys|+[|A(pref)]{|A(fam)}[|A(mp)]{|A(keys)}[|A(dft)]{|A(cbk)}{|A(fn)} +\start+{newmacro}[\ltxkeysboolkeys,\ltxkeysnewboolkeys] +\ltxkeysboolkeys[|A(pref)]{|A(fam)}[|A(mp)]{|A(keys)}[|A(dft)]{|A(cbk)} +\ltxkeysboolkeys|+[|A(pref)]{|A(fam)}[|A(mp)]{|A(keys)}[|A(dft)]{|A(cbk)}{|A(fn)} +\ltxkeysnewboolkeys[|A(pref)]{|A(fam)}[|A(mp)]{|A(keys)}[|A(dft)]{|A(cbk)} +\ltxkeysnewboolkeys|+[|A(pref)]{|A(fam)}[|A(mp)]{|A(keys)}[|A(dft)]{|A(cbk)}{|A(fn)} \finish{newmacro} -\fxim*{\ltxkeys@boolkeys,\ltxkeys@newboolkeys} +\fxim*{\ltxkeysboolkeys,\ltxkeysnewboolkeys} \docsubsubsection(sec:biboolkeys)<biboolean keys>{Biboolean keys} -\start+{newmacro}[\ltxkeys@biboolkeys,\ltxkeys@newbiboolkeys] -\ltxkeys@biboolkeys[|A(pref)]{|A(fam)}[|A(mp)]{|A(bl1),|A(bl2)}[|A(dft)]{|A(cbk1)}{|A(cbk2)} -\ltxkeys@biboolkeys|+[|A(pref)]{|A(fam)}[|A(mp)]{|A(bl1),|A(bl2)}[|A(dft)]{|A(cbk1)}{|A(cbk2)}{|A(fn)} -\ltxkeys@newbiboolkeys[|A(pref)]{|A(fam)}[|A(mp)]{|A(bl1),|A(bl2)}[|A(dft)]{|A(cbk1)}{|A(cbk2)} -\ltxkeys@newbiboolkeys|+ +\start+{newmacro}[\ltxkeysbiboolkeys,\ltxkeysnewbiboolkeys] +\ltxkeysbiboolkeys[|A(pref)]{|A(fam)}[|A(mp)]{|A(bl1),|A(bl2)}[|A(dft)]{|A(cbk1)}{|A(cbk2)} +\ltxkeysbiboolkeys|+[|A(pref)]{|A(fam)}[|A(mp)]{|A(bl1),|A(bl2)}[|A(dft)]{|A(cbk1)}{|A(cbk2)}{|A(fn)} +\ltxkeysnewbiboolkeys[|A(pref)]{|A(fam)}[|A(mp)]{|A(bl1),|A(bl2)}[|A(dft)]{|A(cbk1)}{|A(cbk2)} +\ltxkeysnewbiboolkeys|+ [|A(pref)]{|A(fam)}[|A(mp)]{|A(bl1),|A(bl2)}[|A(dft)]{|A(cbk1)}{|A(cbk2)}{|A(fn)} \finish{newmacro} -\fxim*{\ltxkeys@biboolkeys,\ltxkeys@newbiboolkeys} +\fxim*{\ltxkeysbiboolkeys,\ltxkeysnewbiboolkeys} Biboolean keys always assume opposite states: when one is true, the other is automatically toggled to false; and vice versa. Think of the options \hx{draft} and \hx{final} in a document class, but note that traditional document classes don't currently use biboolean keys. The callback \ang{cbk1} belongs to the boolean key \ang{bl1}, while \ang{cbk2} is of \ang{bl2}. -The \plform of \fx{\ltxkeys@biboolkeys} will execute \ang{fn} in place of \ang{cbk1} or \ang{cbk2} if the input is not in \fnz*{true,false}; the plain form will issue an error in this case. +The \plform of \fx{\ltxkeysbiboolkeys} will execute \ang{fn} in place of \ang{cbk1} or \ang{cbk2} if the input is not in \fnz*{true,false}; the plain form will issue an error in this case. Biboolean keys have equal symmetry (\ie, they can call each other with equal propensity) and they won't bomb out in an infinite reentrance. They normally would know if and when they call each other, or if they're being called by some other keys. -\start+{example}[\ltxkeys@biboolkeys] -\ltxkeys@biboolkeys|+[KV]{fam}[mp@]{keya,keyb}[true]{% +\start+{example}[\ltxkeysbiboolkeys] +\ltxkeysbiboolkeys|+[KV]{fam}[mp@]{keya,keyb}[true]{% \ifmp@keya\def\x##1{##1x#1x##1}\fi }{% \ifmp@keyb\def\y##1{##1y#1y##1}\fi @@ -450,27 +441,27 @@ Biboolean keys have equal symmetry (\ie, they can call each other with equal pro Switch keys look like boolean keys and they expect the same value set as boolean keys, namely, \fnz*{true, false}, but they are cheaper. Internally the value set of a switch key is \fnz*{00,01}. So, while the user input for a switch key must lie in the set \fnz*{true, false}, the input is internally converted to \fnz*{00,01}. This allows the values of switch keys to be tested with \tex's \hx{\if}. While each new boolean results in the creation of three commands, every new switch requires only one command. -\start+{newmacro}[\ltxkeys@switchkey,\ltxkeys@newswitchkey] -\ltxkeys@switchkey[|A(pref)]{|A(fam)}[|A(mp)]{|A(key)}[|A(dft)]{|A(cbk)} -\ltxkeys@switchkey|+[|A(pref)]{|A(fam)}[|A(mp)]{|A(key)}[|A(dft)]{|A(cbk)}{|A(fn)} -\ltxkeys@newswitchkey[|A(pref)]{|A(fam)}[|A(mp)]{|A(key)}[|A(dft)]{|A(cbk)} -\ltxkeys@newswitchkey|+[|A(pref)]{|A(fam)}[|A(mp)]{|A(key)}[|A(dft)]{|A(cbk)}{|A(fn)} +\start+{newmacro}[\ltxkeysswitchkey,\ltxkeysnewswitchkey] +\ltxkeysswitchkey[|A(pref)]{|A(fam)}[|A(mp)]{|A(key)}[|A(dft)]{|A(cbk)} +\ltxkeysswitchkey|+[|A(pref)]{|A(fam)}[|A(mp)]{|A(key)}[|A(dft)]{|A(cbk)}{|A(fn)} +\ltxkeysnewswitchkey[|A(pref)]{|A(fam)}[|A(mp)]{|A(key)}[|A(dft)]{|A(cbk)} +\ltxkeysnewswitchkey|+[|A(pref)]{|A(fam)}[|A(mp)]{|A(key)}[|A(dft)]{|A(cbk)}{|A(fn)} \finish{newmacro} -\fxim*{\ltxkeys@switchkey,\ltxkeys@newswitchkey} +\fxim*{\ltxkeysswitchkey,\ltxkeysnewswitchkey} In these commands, if \ang{mp} is given, the command \mpkey will hold the current user input for the key at key setting time; otherwise the user input will be available in \ipreffamkey{switch}. If \ang{mp} is specified, a switch of the form \mpkey will be created at key definition, which will be set by \fx{\ltxkeyssetkeys} according to the user input. If \ang{mp} is not specified, a switch of the form \ipreffamkey{switch} will instead be created. The callback \ang{cbk} is held in the command \preffamkey, which is executed if the user input is valid, ie, in the set \fnz*{true,false}. -The \plform of \ffx'{\ltxkeys@switchkey,\ltxkeys@newswitchkey} will execute \ang{fn} in place of \ang{cbk} if the user input isn't in \fnz*{true,false}; the plain form will issue an error in this case. +The \plform of \ffx'{\ltxkeysswitchkey,\ltxkeysnewswitchkey} will execute \ang{fn} in place of \ang{cbk} if the user input isn't in \fnz*{true,false}; the plain form will issue an error in this case. \start{example} -\ltxkeys@switchkey[KV]{fam}{keya}[true]{% +\ltxkeysswitchkey[KV]{fam}{keya}[true]{% \if\switchKV@fam@keya \def\x##1{##1*#1*##1}% \fi } -\ltxkeys@switchkey+[KV]{fam}[mp@]{keyb}[true]{% +\ltxkeysswitchkey+[KV]{fam}[mp@]{keyb}[true]{% \if\mp@keyb \def\y##1{##1*#1*##1}% \fi @@ -484,18 +475,18 @@ The \plform of \ffx'{\ltxkeys@switchkey,\ltxkeys@newswitchkey} will execute \ang \docsubsubsection(sec:switchkeys-sameattributes) {Switch keys that share the same attributes} -The commands \ffx'{\ltxkeys@switchkey,\ltxkeys@newswitchkey} can be used to introduce switch keys \ang{keys} that share the same meta (key prefix, key family, macro prefix, and callback \ang{cbk}). Just replace \ang{key} in these commands with the comma-separated list \ang{keys}. Because some users might prefer to see these commands in their plural forms when defining several keys with the same callback, we have provided the following aliases: +The commands \ffx'{\ltxkeysswitchkey,\ltxkeysnewswitchkey} can be used to introduce switch keys \ang{keys} that share the same meta (key prefix, key family, macro prefix, and callback \ang{cbk}). Just replace \ang{key} in these commands with the comma-separated list \ang{keys}. Because some users might prefer to see these commands in their plural forms when defining several keys with the same callback, we have provided the following aliases: -\start+{newmacro}[\ltxkeys@switchkeys,\ltxkeys@newswitchkeys] -\ltxkeys@switchkeys[|A(pref)]{|A(fam)}[|A(mp)]{|A(keys)}[|A(dft)]{|A(cbk)} -\ltxkeys@switchkeys|+[|A(pref)]{|A(fam)}[|A(mp)]{|A(keys)}[|A(dft)]{|A(cbk)}{|A(fn)} -\ltxkeys@newswitchkeys[|A(pref)]{|A(fam)}[|A(mp)]{|A(keys)}[|A(dft)]{|A(cbk)} -\ltxkeys@newswitchkeys|+[|A(pref)]{|A(fam)}[|A(mp)]{|A(keys)}[|A(dft)]{|A(cbk)}{|A(fn)} +\start+{newmacro}[\ltxkeysswitchkeys,\ltxkeysnewswitchkeys] +\ltxkeysswitchkeys[|A(pref)]{|A(fam)}[|A(mp)]{|A(keys)}[|A(dft)]{|A(cbk)} +\ltxkeysswitchkeys|+[|A(pref)]{|A(fam)}[|A(mp)]{|A(keys)}[|A(dft)]{|A(cbk)}{|A(fn)} +\ltxkeysnewswitchkeys[|A(pref)]{|A(fam)}[|A(mp)]{|A(keys)}[|A(dft)]{|A(cbk)} +\ltxkeysnewswitchkeys|+[|A(pref)]{|A(fam)}[|A(mp)]{|A(keys)}[|A(dft)]{|A(cbk)}{|A(fn)} \finish{newmacro} -\fxim*{\ltxkeys@switchkeys,\ltxkeys@newswitchkeys} +\fxim*{\ltxkeysswitchkeys,\ltxkeysnewswitchkeys} \start{example} -\ltxkeys@switchkeys+[KV]{fam}[mp@]{keya,keyb,keyc}[true]{% +\ltxkeysswitchkeys+[KV]{fam}[mp@]{keya,keyb,keyc}[true]{% \if\@nameuse{mp@\ltxkeyscurrentkey}% \def\x##1{value of key `\ltxkeyscurrentkey' = #1 *** arg = ##1}% \fi @@ -510,22 +501,22 @@ The commands \ffx'{\ltxkeys@switchkey,\ltxkeys@newswitchkey} can be used to intr The choice keys of the \pkg'{ltxkeys} differ from those of the \pkg'{xkeyval} in at least two respects; namely, the presence of the macro prefix for choice keys in the \pkg'{ltxkeys} and the introduction of the optional \quoted{\redclam} prefix. -\start+{newmacro}[\ltxkeys@choicekey,\ltxkeys@newchoicekey] -\ltxkeys@choicekey[|A(pref)]{|A(fam)}[|A(mp)]{|A(key)}[|A(bin)]{|A(alt)}[|A(dft)]{|A(cbk)} -\ltxkeys@choicekey|*[|A(pref)]{|A(fam)}[|A(mp)]{|A(key)}[|A(bin)]{|A(alt)}[|A(dft)]{|A(cbk)} -\ltxkeys@choicekey|*|+[|A(pref)]{|A(fam)}[|A(mp)]{|A(key)}[|A(bin)]{|A(alt)}[|A(dft)]{|A(cbk)}{|A(fn)} -\ltxkeys@choicekey|*|+|![|A(pref)]{|A(fam)}[|A(mp)]{|A(key)}[|A(bin)]{|A(alt)}[|A(dft)]{|A(cbk)}{|A(fn)} +\start+{newmacro}[\ltxkeyschoicekey,\ltxkeysnewchoicekey] +\ltxkeyschoicekey[|A(pref)]{|A(fam)}[|A(mp)]{|A(key)}[|A(bin)]{|A(alt)}[|A(dft)]{|A(cbk)} +\ltxkeyschoicekey|*[|A(pref)]{|A(fam)}[|A(mp)]{|A(key)}[|A(bin)]{|A(alt)}[|A(dft)]{|A(cbk)} +\ltxkeyschoicekey|*|+[|A(pref)]{|A(fam)}[|A(mp)]{|A(key)}[|A(bin)]{|A(alt)}[|A(dft)]{|A(cbk)}{|A(fn)} +\ltxkeyschoicekey|*|+|![|A(pref)]{|A(fam)}[|A(mp)]{|A(key)}[|A(bin)]{|A(alt)}[|A(dft)]{|A(cbk)}{|A(fn)} -\ltxkeys@newchoicekey[|A(pref)]{|A(fam)}[|A(mp)]{|A(key)}[|A(bin)]{|A(alt)}[|A(dft)]{|A(cbk)} -\ltxkeys@newchoicekey|*[|A(pref)]{|A(fam)}[|A(mp)]{|A(key)}[|A(bin)]{|A(alt)}[|A(dft)]{|A(cbk)} -\ltxkeys@newchoicekey|*|+ +\ltxkeysnewchoicekey[|A(pref)]{|A(fam)}[|A(mp)]{|A(key)}[|A(bin)]{|A(alt)}[|A(dft)]{|A(cbk)} +\ltxkeysnewchoicekey|*[|A(pref)]{|A(fam)}[|A(mp)]{|A(key)}[|A(bin)]{|A(alt)}[|A(dft)]{|A(cbk)} +\ltxkeysnewchoicekey|*|+ [|A(pref)]{|A(fam)}[|A(mp)]{|A(key)}[|A(bin)]{|A(alt)}[|A(dft)]{|A(cbk)}{|A(fn)} -\ltxkeys@newchoicekey|*|+|! +\ltxkeysnewchoicekey|*|+|! [|A(pref)]{|A(fam)}[|A(mp)]{|A(key)}[|A(bin)]{|A(alt)}[|A(dft)]{|A(cbk)}{|A(fn)} \finish{newmacro} -\fxim*{\ltxkeys@choicekey,\ltxkeys@newchoicekey} +\fxim*{\ltxkeyschoicekey,\ltxkeysnewchoicekey} -Choice keys check the user input against the nominations \ang{alt} suggested by the author of a key. The comma-separated list \ang{alt} is the list of admissible values of the key. The \stform will convert user input to lowercase before checking it against the list of nominations in \ang{alt}. In all the above variants, if the input is valid, then the callback \ang{cbk} will be executed. If the user input isn't valid, the \unplform+ will flag an error, while the \plform+ will execute \ang{fn}. The \clform+ will fully expand the user input before checking it against the nominations in \ang{alt}. The \clform arises from the fact that sometimes macros are passed as the values of choice keys. If \ang{mp} is absent, then \fx{\ltxkeys@choicekey} uses \ipreffamkey{chc} to hold the user input. +Choice keys check the user input against the nominations \ang{alt} suggested by the author of a key. The comma-separated list \ang{alt} is the list of admissible values of the key. The \stform will convert user input to lowercase before checking it against the list of nominations in \ang{alt}. In all the above variants, if the input is valid, then the callback \ang{cbk} will be executed. If the user input isn't valid, the \unplform+ will flag an error, while the \plform+ will execute \ang{fn}. The \clform+ will fully expand the user input before checking it against the nominations in \ang{alt}. The \clform arises from the fact that sometimes macros are passed as the values of choice keys. If \ang{mp} is absent, then \fx{\ltxkeyschoicekey} uses \ipreffamkey{chc} to hold the user input. When \ang{alt} has no literal form \quotedfx{/.do} or forward slash \quotedfx{/} in it, then it is expected to be of the familiar \pkg'{xkeyval} syntax: @@ -567,23 +558,23 @@ 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}. -The \stform of \fx{\ltxkeys@choicekey} will convert the user input to lowercase before checking \ang{alt} and executing the callbacks. The \plform will execute \ang{fn} in place of \ang{cbk} if the user input isn't in \ang{alt}. +The \stform of \fx{\ltxkeyschoicekey} will convert the user input to lowercase before checking \ang{alt} and executing the callbacks. The \plform will execute \ang{fn} in place of \ang{cbk} if the user input isn't in \ang{alt}. -\ang{bin} has, \eg, the syntax \fx{[\userinput\order]}, where \fx{\userinput} will hold the user input (in lowercase if the \stform of \fx{\ltxkeys@choicekey} is called), and \fx{\order} will hold the serial number of the value in the list of nominations \ang{alt}, starting from 0. If the input isn't valid, \fx{\userinput} will still hold the user input, but \fx{\order} will be~$-1$. +\ang{bin} has, \eg, the syntax \fx{[\userinput\order]}, where \fx{\userinput} will hold the user input (in lowercase if the \stform of \fx{\ltxkeyschoicekey} is called), and \fx{\order} will hold the serial number of the value in the list of nominations \ang{alt}, starting from 0. If the input isn't valid, \fx{\userinput} will still hold the user input, but \fx{\order} will be~$-1$. -\start+{example}[\ltxkeys@choicekey nominations] -\ltxkeys@choicekey[KV]{fam}{keya}{% +\start+{example}[\ltxkeyschoicekey nominations] +\ltxkeyschoicekey[KV]{fam}{keya}{% |com(There are no callbacks for these simple nominations:) center,right,left,justified }[center]{|com( <- default value) \def\x##1##2{==##1++#1++##2==}% } -\ltxkeys@choicekey|*|+[KV]{fam}[mp@]{keya}[\userinput\order]{% +\ltxkeyschoicekey|*|+[KV]{fam}[mp@]{keya}[\userinput\order]{% center,right,left,justified }[center]{% \def\x##1##2{==##1++#1++##2==}% @@ -591,7 +582,7 @@ The \stform of \fx{\ltxkeys@choicekey} will convert the user input to lowercase \@latex@error{Inadmissible value `\detokenize{#1}' for keya}\@ehc } -\ltxkeys@choicekey|*|+[KV]{fam}[mp@]{keyb}[\userinput\order]{% +\ltxkeyschoicekey|*|+[KV]{fam}[mp@]{keyb}[\userinput\order]{% |com(There are callbacks for these nominations:) land/.do=\def\x##1{*##1*#1*##1}; air/.do=\edef\z{\expandcsonce\ltxkeyscurrentvalue}; @@ -603,9 +594,9 @@ The \stform of \fx{\ltxkeys@choicekey} will convert the user input to lowercase \@latex@error{Inadmissible value `\detokenize{#1}' for keya}\@ehc } -\ltxkeys@choicekey[KV]{fam}[mp@]{keyb}[\userinput\order]{% +\ltxkeyschoicekey[KV]{fam}[mp@]{keyb}[\userinput\order]{% |com(The callbacks can also take the following form:) - center/\ltxkeys@cmdkey[KV]{fam}[mp@]{keyd}{\def\x####1{####1*##1*####1}}, + center/\ltxkeyscmdkey[KV]{fam}[mp@]{keyd}{\def\x####1{####1*##1*####1}}, right/\let\align\flushright, left/\let\align\flushleft\edef\userinput{\ltstrimspaces{#1}}, justified/\let\align\relax @@ -613,9 +604,9 @@ The \stform of \fx{\ltxkeys@choicekey} will convert the user input to lowercase \def\z##1##2{==##1++#1++##2==}% } -\ltxkeys@choicekeys[KV]{fam}[mp@]{keya,|R(\savevalue\needvalue){keyb}}% +\ltxkeyschoicekeys[KV]{fam}[mp@]{keya,|R(\savevalue\needvalue){keyb}}% [\val\order]{% - center/\ltxkeys@cmdkey[KV]{fam}[mp@]{keyd}[|R(\usevalue){keyb}] + center/\ltxkeyscmdkey[KV]{fam}[mp@]{keyd}[|R(\usevalue){keyb}] {\def\x####1{####1*##1*####1}}, right/\def\y##1{##1++#1++##1}, left/\edef\userinput{\ltstrimspaces{#1}}, @@ -632,29 +623,30 @@ The representations \ffx'{\savevalue,\usevalue,\needvalue} are pointers (see \sr \docsubsubsection(sec:choicekeys-sameattributes) {Choice keys that share the same attributes} -The commands \ffx'{\ltxkeys@choicekey,\ltxkeys@newchoicekey} can be used to introduce choice keys \ang{keys} that share the same path or bases (key prefix, key family, and macro prefix) and callback \ang{cbk}. All the user has to do is to replace \ang{key} in these commands with the comma-separated list \ang{keys}. Some users might prefer to see these commands in their plural forms when defining several keys with the same attributes. We have therefore provided the following aliases without modifying the internal coding: +The commands \ffx'{\ltxkeyschoicekey,\ltxkeysnewchoicekey} can be used to introduce choice keys \ang{keys} that share the same path or bases (key prefix, key family, and macro prefix) and callback \ang{cbk}. All the user has to do is to replace \ang{key} in these commands with the comma-separated list \ang{keys}. Some users might prefer to see these commands in their plural forms when defining several keys with the same attributes. We have therefore provided the following aliases without modifying the internal coding: -\start+{newmacro}[\ltxkeys@choicekeys,\ltxkeys@newchoicekeys] -\ltxkeys@choicekeys[|A(pref)]{|A(fam)}[|A(mp)]{|A(keys)}[|A(bin)]{|A(alt)}[|A(dft)]{|A(cbk)} -\ltxkeys@choicekeys|*[|A(pref)]{|A(fam)}[|A(mp)]{|A(keys)}[|A(bin)]{|A(alt)}[|A(dft)]{|A(cbk)} -\ltxkeys@choicekeys|*|+ +\start+{newmacro}[\ltxkeyschoicekeys,\ltxkeysnewchoicekeys] +\ltxkeyschoicekeys[|A(pref)]{|A(fam)}[|A(mp)]{|A(keys)}[|A(bin)]{|A(alt)}[|A(dft)]{|A(cbk)} +\ltxkeyschoicekeys|*[|A(pref)]{|A(fam)}[|A(mp)]{|A(keys)}[|A(bin)]{|A(alt)}[|A(dft)]{|A(cbk)} +\ltxkeyschoicekeys|*|+ [|A(pref)]{|A(fam)}[|A(mp)]{|A(keys)}[|A(bin)]{|A(alt)}[|A(dft)]{|A(cbk)}{|A(fn)} -\ltxkeys@choicekeys|*|+|! +\ltxkeyschoicekeys|*|+|! [|A(pref)]{|A(fam)}[|A(mp)]{|A(keys)}[|A(bin)]{|A(alt)}[|A(dft)]{|A(cbk)}{|A(fn)} -\ltxkeys@newchoicekeys[|A(pref)]{|A(fam)}[|A(mp)]{|A(keys)}[|A(bin)]{|A(alt)}[|A(dft)]{|A(cbk)} -\ltxkeys@newchoicekeys|*[|A(pref)]{|A(fam)}[|A(mp)]{|A(keys)}[|A(bin)]{|A(alt)}[|A(dft)]{|A(cbk)} -\ltxkeys@newchoicekeys|*|+ +\ltxkeysnewchoicekeys[|A(pref)]{|A(fam)}[|A(mp)]{|A(keys)}[|A(bin)]{|A(alt)}[|A(dft)]{|A(cbk)} +\ltxkeysnewchoicekeys|*[|A(pref)]{|A(fam)}[|A(mp)]{|A(keys)}[|A(bin)]{|A(alt)}[|A(dft)]{|A(cbk)} +\ltxkeysnewchoicekeys|*|+ [|A(pref)]{|A(fam)}[|A(mp)]{|A(keys)}[|A(bin)]{|A(alt)}[|A(dft)]{|A(cbk)}{|A(fn)} -\ltxkeys@newchoicekeys|*|+|! +\ltxkeysnewchoicekeys|*|+|! [|A(pref)]{|A(fam)}[|A(mp)]{|A(keys)}[|A(bin)]{|A(alt)}[|A(dft)]{|A(cbk)}{|A(fn)} \finish{newmacro} -\fxim*{\ltxkeys@choicekeys,\ltxkeys@newchoicekeys} +\fxim*{\ltxkeyschoicekeys,\ltxkeysnewchoicekeys} \docsection{Default values of keys} -The code after \fx{.do=} will be executed whenever the default value of the key is used. -% \ltxkeys@ordkey[KV]{fam}{keya}[\def\y#1{#1}.do=\def\x#1{#1}]{% +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}]{% % \def\cmda##1{##1*#1*##1} % } @@ -678,62 +670,30 @@ The following example defines key-default handler for two key prefixes and two f \finish{example} -\docsubsection(sec:definekeys){Defining boolean and command keys with one command} +\docsubsection(sec:declarekeys){Defining all types of key 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}. +%% Read this section again. \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: +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}[\ltxkeysdefinekeys] +\start{example}[\ltxkeysdeclarekeys] \def\alist{} -\ltxkeysdefinekeys[pref]{fam}[mp]{% - keya/defaulta/\edef\alist{\ifx\alist\@empty\else\alist,\fi#1}; - keyb/defaultb/\def\callback##1{##1*#1}% +\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{\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{\ifltxkeys@dec} 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: +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}[\ltxkeysdefinekeys] +\start{example}[\ltxkeysdeclarekeys] \def\alist{} -\ltxkeysdefinekeys[pref]{fam}[mp]{% +\ltxkeysdeclarekeys[pref]{fam}[mp]{% keya/defaulta/ - \ifltxkeys@dec\else + \ifltxkeysdec\else |com(Don't execute this when defining the key:) \edef\alist{\ifx\alist\@empty\else\alist,\fi#1}% \fi; @@ -741,23 +701,23 @@ If, as is done by the command \fx{\ltxkeysdefinekeys}, \ttx{keya} is automatical } \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}). +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'{\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}. +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}[\ltxkeysdefinekeys] +\start+{example}[\ltxkeysdeclarekeys] |com(The |stform defines new keys:) -\ltxkeysdefinekeys|*[KV]{fam}[mp@]{% +\ltxkeysdeclarekeys|*[KV]{fam}[mp@]{% |com(Command key with callback:) - keya={keepbraced}/\def\x##1{##1*#1*##1}; + cmd/keya/{keepbraced}/\def\x##1{##1*#1*##1}; |com(Boolean key:) - keyb=true/\def\y##1{##1yyy#1}; + bool/keyb/true/\def\y##1{##1yyy#1}; |com(Command key with no callback:) - keyc=xxx; + cmd/keyc/xxx; |com(Choice-like command key:) - keyd=center/\ltxkeyscheckuserinput{#1}{left,right,center} + cmd/keyd/center/\ltxkeyscheckuserinput{#1}{left,right,center} \ifltxkeysinputvalid |label(mac:ifltxkeysinputvalid) \edef\myval{\expandcsonce\userinput} \edef\numberinlist{\number\order} @@ -766,7 +726,7 @@ In \ffx'{\ltxkeysdefinekeys, \ltxkeysdeclarekeys}, if \fx{endcallbackline} is tr \@latex@error{Input `#1' not valid}\@ehd \fi; |com(Boolean key with no callback:) - keye=false; + bool/keye/false; } \finish{example} \fxim*{\ifltxkeysinputvalid,\ltxkeyscheckuserinput,\nominations,\userinput} @@ -775,9 +735,6 @@ In \ffx'{\ltxkeysdefinekeys, \ltxkeysdeclarekeys}, if \fx{endcallbackline} is tr 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:declarekeys){Defining all types of key with one command} -\aidx*{defining multiple keys} - \start{newmacro}[\ltxkeysdeclarekeys] \ltxkeysdeclarekeys[|A(pref)]{|A(fam)}[|A(mp)]{%|label(mac:declarekeys) |A(keytype)/|A(keyname)/|A(dft)/|A(cbk); @@ -793,7 +750,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{\ltxkeys@stylekey} 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 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}. Choice keys must have their names associated with their admissible \ang{alt} values in the format \keydotchoice{keyname}{alt} (see example below). @@ -806,14 +763,14 @@ 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. `.do=' is allowed before callback:) - cmd/keyb/10mm/.do=\rightmargin=#1\def\x##1{##1*#1*##1}; + |com(Command key with callback:) + cmd/keyb/10mm/\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/.do=\def\y##1{##1yyy#1}; + 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(,) @@ -879,7 +836,7 @@ Sometimes you may want to create keys for which the user must always supply his/ To make a key a need-value key, simply attach the pointer \fx{\needvalue} to the key at definition time. This pointer can be used only when defining keys, and not when setting keys. \start'{example}[Need-value keys] -\ltxkeys@cmdkey[KV]{fam}[mp@]{\needvalue{keya}}[blue]{% +\ltxkeyscmdkey[KV]{fam}[mp@]{\needvalue{keya}}[blue]{% \def\x##1{##1x#1x##1}% } \ltxkeyssetkeys[KV]{fam}{keya} @@ -894,7 +851,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'{\ltxkeysdefinekeys,\ltxkeysdeclarekeys}. +Cross-family keys are automatically initialized after being defined---as we saw in the case of the commands \ffx'{\ltxkeysdeclarekeys,\ltxkeysdeclarekeys}. \start+{newmacro}[\ltxkeyssavexfamilykeys,\ltxkeysdefinexfamilykeys] \ltxkeyssavexfamilykeys<|A(id)>{|A(keylist)} @@ -908,9 +865,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{\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}. +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}. -\ang{keylist} and \ang{keylistcmd} have the same syntax as the last arguments of \ffx'{\ltxkeysdefinekeys,\ltxkeysdeclarekeys}: +\ang{keylist} and \ang{keylistcmd} have the same syntax as the last arguments of \ffx'{\ltxkeysdeclarekeys,\ltxkeysdeclarekeys}: \start'{newmacro}[Syntax of keylist] |A(keytype)/|A(keyname)/|A(dft)/|A(cbk); @@ -918,7 +875,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'{\ltxkeysdefinekeys, \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 dependants after \ang{cbk} (see the syntaxes of the commands \ffx'{\ltxkeysdeclarekeys, \ltxkeysdeclarekeys}). The mandatory identifier \ang{id} for each list must be unique, not withstanding the fact that the identifiers have their separate namespace. @@ -959,13 +916,13 @@ If the xfamily keys are all of the same type (\ie, only one of the types \fnz{or \start+{example}[xfamily keys] |com(`keya' and `keyd' are starred style keys but `keyd' has no dependants:) \ltxkeyssavexfamilykeys<a1>|(sty|*|){% - keya/center/.do=\def\xx##1{##1xx#1}/ + keya/center/\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/.do={\def\x{\color{#1}print aaa}}; + keyd/red/\def\x{\color{#1}print aaa}; } |com(Ignore `keyd' in defining keys saved in `a1':) \ltxkeysdefinexfamilykeys*<a1>[KV]{fam}[mp@]{keyd} @@ -1106,13 +1063,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] -\ltxkeysdefinekeys|*[KV]{fam}[mp@]{% +\ltxkeysdeclarekeys|*[KV]{fam}[mp@]{% printsign=true; printmark=true/\ltxkeyssetaliaskey{printsign}[false]; keya=$+++$; keyb=star/\ltxkeyssetaliaskey{keya}[$***$] } -\ltxkeysdefinekeys|*[KV]{fam}[mp@]{% +\ltxkeysdeclarekeys|*[KV]{fam}[mp@]{% keya=sun/\ltxkeyscheckuserinput{#1}{star,sun,moon} \ifltxkeysinputvalid \edef\givenval{\userinput} @@ -1131,8 +1088,8 @@ The example involving \ttx{printsign,printmark} is similar, but not equivalent, Schemes like the following are disallowed, to avoid back-linking of \fx{\ltxkeyssetaliaskey}. The package will flag an error if something like the following occurs: \start+{example}[Illegal nested \ltxkeyssetaliaskey] -\ltxkeys@ordkey[KV]{fam}{keya}[true]{\ltxkeyssetaliaskey{keyb}} -\ltxkeys@ordkey[KV]{fam}{keyb}[true]{\ltxkeyssetaliaskey{keya}} +\ltxkeysordkey[KV]{fam}{keya}[true]{\ltxkeyssetaliaskey{keyb}} +\ltxkeysordkey[KV]{fam}{keyb}[true]{\ltxkeyssetaliaskey{keya}} \ltxkeyssetkeys[KV]{fam}{keya} \finish{example} \aidx*{no nested \headfx{\ltxkeyssetaliaskey}} @@ -1151,7 +1108,7 @@ In key parsing, instead of saving the value of each key tagged with \fx{\saveval Here is an interesting example and proof of concept of pointers: \start'{example}[Key pointers] -\ltxkeys@stylekeys|*[KV]{fam}{% +\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) @@ -1174,30 +1131,30 @@ 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}[\ltxkeys@savevaluekeys,\ltxkeys@addsavevaluekeys, etc.] -\ltxkeys@savevaluekeys[|A(pref)]{|A(fam)}{|A(list)} -\ltxkeys@addsavevaluekeys[|A(pref)]{|A(fam)}{|A(list)} -\ltxkeys@removesavevaluekeys[|A(pref)]{|A(fam)}{|A(list)} -\ltxkeys@undefsavevaluekeys[|A(pref)]{|A(fam)} -\ltxkeys@undefsavevaluekeys|![|A(pref)]{|A(fam)} -\ltxkeys@emptifysavevaluekeys[|A(pref)]{|A(fam)} -\ltxkeys@emptifysavevaluekeys|![|A(pref)]{|A(fam)} +\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)} \finish{newmacro} -\fxim*{\ltxkeys@savevaluekeys,\ltxkeys@addsavevaluekeys, - \ltxkeys@removesavevaluekeys,\ltxkeys@undefsavevaluekeys, - \ltxkeys@emptifysavevaluekeys} +\fxim*{\ltxkeyssavevaluekeys,\ltxkeysaddsavevaluekeys, + \ltxkeysremovesavevaluekeys,\ltxkeysundefsavevaluekeys, + \ltxkeysemptifysavevaluekeys} -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. The command \fx{\ltxkeys@emptifysavevaluekeys} will simplify emptify the content of the save-key list. The \clform of the commands +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 \start+{macro} -\ltxkeys@undefsavevaluekeys -\ltxkeys@emptifysavevaluekeys +\ltxkeysundefsavevaluekeys +\ltxkeysemptifysavevaluekeys \finish{macro} will undefine or emptify the existing save-key list globally. -\start+{example}[\ltxkeys@savevaluekeys] -\ltxkeysdefinekeys[KV]{fam}[mp@]{% +\start+{example}[\ltxkeyssavevaluekeys] +\ltxkeysdeclarekeys[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; @@ -1205,39 +1162,39 @@ will undefine or emptify the existing save-key list globally. \ifcase\order\def\shoot{0}\or\def\shoot{1}\or\def\shoot{2}\fi } -\ltxkeys@savevaluekeys[KV]{fam}{keya,keyb,keyc} -\ltxkeys@addsavevaluekeys[KV]{fam}{keyd} -\ltxkeys@removesavevaluekeys[KV]{fam}{keya,keyb} -\ltxkeys@undefsavevaluekeys[KV]{fam} +\ltxkeyssavevaluekeys[KV]{fam}{keya,keyb,keyc} +\ltxkeysaddsavevaluekeys[KV]{fam}{keyd} +\ltxkeysremovesavevaluekeys[KV]{fam}{keya,keyb} +\ltxkeysundefsavevaluekeys[KV]{fam} \ltxkeyssetkeys[KV]{fam}{keya=\usevalue{keyc},keyb=\usevalue{keya}} \finish{example} The following commands are also available: -\start+{newmacro}[\ltxkeys@needvaluekeys,\ltxkeys@addneedvaluekeys, etc.] -\ltxkeys@needvaluekeys[|A(pref)]{|A(fam)}{|A(list)} -\ltxkeys@addneedvaluekeys[|A(pref)]{|A(fam)}{|A(list)} -\ltxkeys@removeneedvaluekeys[|A(pref)]{|A(fam)}{|A(list)} -\ltxkeys@undefneedvaluekeys[|A(pref)]{|A(fam)} -\ltxkeys@undefneedvaluekeys|![|A(pref)]{|A(fam)} -\ltxkeys@emptifyneedvaluekeys[|A(pref)]{|A(fam)} -\ltxkeys@emptifyneedvaluekeys|![|A(pref)]{|A(fam)} +\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)} -\ltxkeys@forbidvaluekeys[|A(pref)]{|A(fam)}{|A(list)} -\ltxkeys@addforbidvaluekeys[|A(pref)]{|A(fam)}{|A(list)} -\ltxkeys@removeforbidvaluekeys[|A(pref)]{|A(fam)}{|A(list)} -\ltxkeys@undefforbidvaluekeys[|A(pref)]{|A(fam)} -\ltxkeys@undefforbidvaluekeys|![|A(pref)]{|A(fam)} -\ltxkeys@emptifyforbidvaluekeys[|A(pref)]{|A(fam)} -\ltxkeys@emptifyforbidvaluekeys|![|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)} \finish{newmacro} -\fxim*{\ltxkeys@needvaluekeys,\ltxkeys@addneedvaluekeys, - \ltxkeys@removeneedvaluekeys,\ltxkeys@undefneedvaluekeys, - \ltxkeys@emptifyneedvaluekeys, - \ltxkeys@forbidvaluekeys,\ltxkeys@addforbidvaluekeys, - \ltxkeys@removeforbidvaluekeys,\ltxkeys@undefforbidvaluekeys, - \ltxkeys@emptifyforbidvaluekeys +\fxim*{\ltxkeysneedvaluekeys,\ltxkeysaddneedvaluekeys, + \ltxkeysremoveneedvaluekeys,\ltxkeysundefneedvaluekeys, + \ltxkeysemptifyneedvaluekeys, + \ltxkeysforbidvaluekeys,\ltxkeysaddforbidvaluekeys, + \ltxkeysremoveforbidvaluekeys,\ltxkeysundefforbidvaluekeys, + \ltxkeysemptifyforbidvaluekeys } @@ -1255,7 +1212,7 @@ As mentioned earlier, the pointers \ffx'{\savevalue, \usevalue} are available fo Here, \ang{cs} is the macro (defined or undefined) that will receive the saved value of \ang{key}. The plain variant of this command will raise an error message if the value of the key wasn't previously saved, while the \plform will resort to the user-supplied function \ang{fallback}. Only saved key values can be recovered by this command. \start+{example}[\ltxkeysstorevalue] -\ltxkeys@cmdkey[KV]{fam}{\needvalue{keya}}[{left}]{% +\ltxkeyscmdkey[KV]{fam}{\needvalue{keya}}[{left}]{% \def\x##1{##1xx#1} } \ltxkeyssetkeys[KV]{fam}{\savevalue{keya}={\def\y##1{##1}}} @@ -1269,61 +1226,77 @@ Here, \ang{cs} is the macro (defined or undefined) that will receive the saved v \docsubsection(sec:presettingkeys){Pre-setting and post-setting keys} \aidxm*{presetting keys, post-setting keys} -\start+{newmacro}[\ltxkeys@presetkeys,\ltxkeys@postsetkeys,etc.] -\ltxkeys@presetkeys[|A(pref)]{|A(fam)}{|A(keyvals)} -\ltxkeys@presetkeys|![|A(pref)]{|A(fam)}{|A(keyvals)} -\ltxkeys@addpresetkeys[|A(pref)]{|A(fam)}{|A(keyvals)} -\ltxkeys@addpresetkeys|![|A(pref)]{|A(fam)}{|A(keyvals)} -\ltxkeys@removepresetkeys[|A(pref)]{|A(fam)}{|A(keyvals)} -\ltxkeys@removepresetkeys|![|A(pref)]{|A(fam)}{|A(keyvals)} -\ltxkeys@undefpresetkeys[|A(pref)]{|A(fam)} -\ltxkeys@undefpresetkeys|![|A(pref)]{|A(fam)} - -\ltxkeys@postsetkeys[|A(pref)]{|A(fam)}{|A(keyvals)} -\ltxkeys@postsetkeys|![|A(pref)]{|A(fam)}{|A(keyvals)} -\ltxkeys@addpostsetkeys[|A(pref)]{|A(fam)}{|A(keyvals)} -\ltxkeys@addpostsetkeys|![|A(pref)]{|A(fam)}{|A(keyvals)} -\ltxkeys@removepostsetkeys[|A(pref)]{|A(fam)}{|A(keyvals)} -\ltxkeys@removepostsetkeys|![|A(pref)]{|A(fam)}{|A(keyvals)} -\ltxkeys@undefpostsetkeys[|A(pref)]{|A(fam)} -\ltxkeys@undefpostsetkeys|![|A(pref)]{|A(fam)} -\finish{newmacro} -\fxim*{\ltxkeys@presetkeys,\ltxkeys@addpresetkeys,\ltxkeys@removepresetkeys, - \ltxkeys@undefpresetkeys,\ltxkeys@postsetkeys,\ltxkeys@addpostsetkeys, - \ltxkeys@removepostsetkeys,\ltxkeys@undefpostsetkeys} - -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{\ltxkeys@addpresetkeys} is an alias for \fx{\ltxkeys@presetkeys}, and this helps explain that \fx{\ltxkeys@presetkeys} is indeed a list merger. Neither the command \fx{\ltxkeys@presetkeys} nor \fx{\ltxkeys@postsetkeys} 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 every run of the command \fx{\ltxkeyssetkeys} for the given key prefix and family}. \fx{\ltxkeys@addpostsetkeys} is an alias for \fx{\ltxkeys@postsetkeys}. The commands +\start+{newmacro}[\ltxkeyspresetkeys,\ltxkeyspostsetkeys,etc.] +\ltxkeyspresetkeys[|A(pref)]{|A(fam)}{|A(keyvals)} +\ltxkeyspresetkeys|![|A(pref)]{|A(fam)}{|A(keyvals)} +\ltxkeysaddpresetkeys[|A(pref)]{|A(fam)}{|A(keyvals)} +\ltxkeysaddpresetkeys|![|A(pref)]{|A(fam)}{|A(keyvals)} +\ltxkeysremovepresetkeys[|A(pref)]{|A(fam)}{|A(keyvals)} +\ltxkeysremovepresetkeys|![|A(pref)]{|A(fam)}{|A(keyvals)} +\ltxkeysundefpresetkeys[|A(pref)]{|A(fam)} +\ltxkeysundefpresetkeys|![|A(pref)]{|A(fam)} + +\ltxkeyspostsetkeys[|A(pref)]{|A(fam)}{|A(keyvals)} +\ltxkeyspostsetkeys|![|A(pref)]{|A(fam)}{|A(keyvals)} +\ltxkeysaddpostsetkeys[|A(pref)]{|A(fam)}{|A(keyvals)} +\ltxkeysaddpostsetkeys|![|A(pref)]{|A(fam)}{|A(keyvals)} +\ltxkeysremovepostsetkeys[|A(pref)]{|A(fam)}{|A(keyvals)} +\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 +} + +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. + +\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 \start+{macro} -\ltxkeys@removepresetkeys|![|A(pref)]{|A(fam)}{|A(keys)} -\ltxkeys@removepostsetkeys|![|A(pref)]{|A(fam)}{|A(keys)} +\ltxkeysremovepresetkeys|![|A(pref)]{|A(fam)}{|A(keys)} +\ltxkeysremovepostsetkeys|![|A(pref)]{|A(fam)}{|A(keys)} \finish{macro} remove \ang{keys} from preset and post-set lists, respectively. The commands \start+{macro} -\ltxkeys@undefpresetkeys|![|A(pref)]{|A(fam)} -\ltxkeys@undefpostsetkeys|![|A(pref)]{|A(fam)} +\ltxkeysundefpresetkeys|![|A(pref)]{|A(fam)} +\ltxkeysundefpostsetkeys|![|A(pref)]{|A(fam)} \finish{macro} 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}[\ltxkeys@presetkeys, \ltxkeys@postsetkeys, etc.] -\ltxkeysdefinekeys|*[KV1]{fam1}[mp@]{% +\start+{example}[\ltxkeyspresetkeys, \ltxkeyspostsetkeys, etc.] +\ltxkeysdeclarekeys|*[KV1]{fam1}[mp@]{% keya/left/\def\x##1{#1x##1}; \needvalue{keyb}/right; keyc/center; keyd } -\ltxkeys@presetkeys|![KV1]{fam1}{keya=\flushleft,keyb=\flushright} -\ltxkeys@postsetkeys|![KV1]{fam1}{keyd=\flushleft} +\ltxkeyspresetkeys|![KV1]{fam1}{keya=\flushleft,keyb=\flushright} +\ltxkeyspostsetkeys|![KV1]{fam1}{keyd=\flushleft} ... |com(Eventually, only `keya' will be preset:) -\ltxkeys@removepresetkeys|![KV1]{fam1}{keyb=\flushright} +\ltxkeysremovepresetkeys|![KV1]{fam1}{keyb=\flushright} ... |com(Because of the |redstar and |redplus signs on \ltxkeyssetkeys, all unknown) |com(keys |(those with prefix `KV2' and in family `fam2'|) will be saved in) @@ -1332,21 +1305,20 @@ 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'{\ltxkeysdefinekeys, \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'{\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}. -The command \fx{\ltxkeysinitializekeys} can be used in place of \fx{\ltxkeys@executeoptions}, since \fx{\ltxkeys@executeoptions} (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}. +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}. \begin{noteenv} \label{nte:initializekeys} -Keys that have been processed by \fx{\ltxkeys@processoptions} (\ie, keys submitted by the user as package or class options via \hx{\documentclass} or \hx{\usepackage} can't be initialized or launched (see \sref{sec:launchingkeys} below for the meaning of \quoted{launched keys}). This is to avoid unwittingly setting keys to their default values after the user has submitted them as package or class options. This means that \quoted{option keys} (see \sref{sec:optionskeys}) can't be initialized or launched. +Keys that have been processed by \fx{\ltxkeysprocessoptions} (\ie, keys submitted by the user as package or class options via \hx{\documentclass} or \hx{\usepackage} can't be initialized or launched (see \sref{sec:launchingkeys} below for the meaning of \quoted{launched keys}). This is to avoid unwittingly setting keys to their default values after the user has submitted them as package or class options. This means that \quoted{option keys} (see \sref{sec:optionskeys}) can't be initialized or launched. \end{noteenv} @@ -1368,29 +1340,29 @@ Keys across multiple prefixes \ang{prefs} and families \ang{fams} can be launche \docsubsubsection(sec:nonlaunchkeys) <non-launch keys>{Noninitialize and non\-la\-unch keys} -Listing all the keys that shouldn't be reinitialized by \fx{\ltxkeysinitializekeys} in the \ang{na} list every time \fx{\ltxkeysinitializekeys} is called can sometimes be inconvenient, especially when dealing with a large number of keys. Perhaps even more important is the fact that sometimes you don't want some of the keys in a family to be reinitialized even though they are absent keys (\ie, they aren't listed as current keys, meaning that they aren't in the current \keyval list submitted to \fx{\ltxkeyslaunchkeys}). This might be the case with package and class options. The command \fx{\ltxkeys@nonlaunchkeys} provides a convenient means for listing the non-reinitializing keys once and for all. If there are keys in a family that shouldn't be reinitialized/launched with other keys in the same family during any call to \fx{\ltxkeyslaunchkeys} or \fx{\ltxkeysinitializekeys}, they can be listed in the \fx{\ltxkeys@nonlaunchkeys} command: +Listing all the keys that shouldn't be reinitialized by \fx{\ltxkeysinitializekeys} in the \ang{na} list every time \fx{\ltxkeysinitializekeys} is called can sometimes be inconvenient, especially when dealing with a large number of keys. Perhaps even more important is the fact that sometimes you don't want some of the keys in a family to be reinitialized even though they are absent keys (\ie, they aren't listed as current keys, meaning that they aren't in the current \keyval list submitted to \fx{\ltxkeyslaunchkeys}). This might be the case with package and class options. The command \fx{\ltxkeysnonlaunchkeys} provides a convenient means for listing the non-reinitializing keys once and for all. If there are keys in a family that shouldn't be reinitialized/launched with other keys in the same family during any call to \fx{\ltxkeyslaunchkeys} or \fx{\ltxkeysinitializekeys}, they can be listed in the \fx{\ltxkeysnonlaunchkeys} command: -\start{newmacro}[\ltxkeys@nonlaunchkeys] -\ltxkeys@nonlaunchkeys[|A(prefs)]{|A(fams)}{|A(keys)} +\start{newmacro}[\ltxkeysnonlaunchkeys] +\ltxkeysnonlaunchkeys[|A(prefs)]{|A(fams)}{|A(keys)} \finish{newmacro} -\fxim*{\ltxkeys@nonlaunchkeys} +\fxim*{\ltxkeysnonlaunchkeys} -Keys across multiple prefixes and families can be submitted to the \fx{\ltxkeys@nonlaunchkeys} command: undefined keys are simply ignored by \fx{\ltxkeys@nonlaunchkeys}. +Keys across multiple prefixes and families can be submitted to the \fx{\ltxkeysnonlaunchkeys} command: undefined keys are simply ignored by \fx{\ltxkeysnonlaunchkeys}. \ltsnote -The command \fx{\ltxkeys@nonlaunchkeys} doesn't mean that the keys in \ang{keys} can no longer be set via the command \fx{\ltxkeyssetkeys}; it simply implies that keys appearing in \fx{\ltxkeys@nonlaunchkeys} will not be reinitialized to their default values when members of their class are being launched or reinitialized. The command \fx{\ltxkeys@noninitializekeys} is an alias for \fx{\ltxkeys@nonlaunchkeys}. +The command \fx{\ltxkeysnonlaunchkeys} doesn't mean that the keys in \ang{keys} can no longer be set via the command \fx{\ltxkeyssetkeys}; it simply implies that keys appearing in \fx{\ltxkeysnonlaunchkeys} will not be reinitialized to their default values when members of their class are being launched or reinitialized. The command \fx{\ltxkeysnoninitializekeys} is an alias for \fx{\ltxkeysnonlaunchkeys}. \docsubsection(sec:unknownkeyhandler) <unknown key and option handlers>{Handling unknown keys and options} -You can use the macro \fx{\ltxkeys@unknownkeyhandler} to declare to \pkg'{ltxkeys} the course of action to take if, while setting keys, it discovers that a key is undefined or unknown. The command \fx{\ltxkeys@unknownoptionhandler} applies to unknown options (see \sref{sec:declareoption})\usefootnote{2}. The syntax of these commands is +You can use the macro \fx{\ltxkeysunknownkeyhandler} to declare to \pkg'{ltxkeys} the course of action to take if, while setting keys, it discovers that a key is undefined or unknown. The command \fx{\ltxkeysunknownoptionhandler} applies to unknown options (see \sref{sec:declareoption})\usefootnote{2}. The syntax of these commands is -\start+{newmacro}[\ltxkeys@unknownkeyhandler,\ltxkeys@unknownoptionhandler] -\ltxkeys@unknownkeyhandler[|A(prefs)]{|A(fams)}{|A(cbk)} -\ltxkeys@unknownoptionhandler[|A(prefs)]<|A(fams)>{|A(cbk)} +\start+{newmacro}[\ltxkeysunknownkeyhandler,\ltxkeysunknownoptionhandler] +\ltxkeysunknownkeyhandler[|A(prefs)]{|A(fams)}{|A(cbk)} +\ltxkeysunknownoptionhandler[|A(prefs)]<|A(fams)>{|A(cbk)} \finish{newmacro} -\fxim*{\ltxkeys@unknownkeyhandler,\ltxkeys@unknownoptionhandler} +\fxim*{\ltxkeysunknownkeyhandler,\ltxkeysunknownoptionhandler} Here, \ang{prefs} are the optional prefixes and \ang{fams} is the mandatory families; both may contain one or more comma-separated elements. The default value of \ang{prefs} is \fx{KV}. The callback \ang{cbk} signifies the action to take when an unknown key or option is encountered. The default \ang{cbk} is to log the keys and, in each run, warn the user of the presence of unknown keys. The same \ang{cbk} can be used across key prefixes \ang{prefs} and families \ang{fams}. You can use \fx{#1} (or \fx{\ltxkeyscurrentprefix}) in \ang{cbk} to represent the current key prefix, \fx{#2} (or \fx{\ltxkeyscurrentfamily}) for the current family, \fx{#3} (or \fx{\ltxkeyscurrentkey}) for the current key name, and \fx{#4} (or \fx{\ltxkeyscurrentvalue}) for the value of the current key. @@ -1398,17 +1370,17 @@ If \fx{\ltxkeyscurrentvalue} contains undefined macros or active characters, the The following example provides unknown option and key handlers. The unknown key handler is for two key prefixes (\ffx'{KVA, KVB}) and two key families (\ffx'{fam1,fam2}). -\start+{example}[\ltxkeys@unknownkeyhandler,\ltxkeys@unknownoptionhandler] -\ltxkeys@unknownoptionhandler[KV]<fam1,fam2>{% +\start+{example}[\ltxkeysunknownkeyhandler,\ltxkeysunknownoptionhandler] +\ltxkeysunknownoptionhandler[KV]<fam1,fam2>{% \wlog{Prefix: #1/ Family: #2/ Option name: #3/ Value: \unexpanded{#4}}% } -\ltxkeys@unknownkeyhandler[KVA,KVB]{fam1,fam2}{% +\ltxkeysunknownkeyhandler[KVA,KVB]{fam1,fam2}{% \@expandtwoargs\in@{,#3,}{,\myspecialkeys,}% \ifdefboolTF{in@}{% |com(The reader may want to investigate what the parameter texts) |com(##1 and ####1 below stand for |(see |sref(nte:unknownkey) below|):) - \ltxkeys@ordkey[#1]{#2}{#3}[#4]{\def\x####1{####1xx##1}}% + \ltxkeysordkey[#1]{#2}{#3}[#4]{\def\x####1{####1xx##1}}% }{% \ltxmsg@warn{Unknown key `#3' with value `#4' in family `#2' ignored}\@ehd |com(\ltxmsg@warn{Unknown key `\ltxkeyscurrentkey' with value) @@ -1423,14 +1395,14 @@ The macro \fx{\myspecialkeys} in the above example doesn't actually exist; it is \label{nte:unknownkey} To see what the parameter texts \fx{##1} and \fx{####1} above stand for, run the following code on your own and note the outcome of \fx{\show\KV@fam@keyd}. The characters \fx{##1} will turn out to be the parameter text which can be used to access the current values of keys \ffx'{keyd,keye} after they have been defined on the fly. And \fx{####1} will be the parameter text of the arbitrary function \fx{\x}. If you do \fx{\show\KV@fam@keyd}, you'll notice that the parameter texts have been reduced by one level of nesting. -\start+{example}[\ltxkeys@unknownkeyhandler] +\start+{example}[\ltxkeysunknownkeyhandler] \def\myspecialkeys{keyc,keyd,keye} -\ltxkeys@unknownkeyhandler[KV]{fam}{% +\ltxkeysunknownkeyhandler[KV]{fam}{% \@expandtwoargs\in@{,#3,}{,\myspecialkeys,}% \ifin@ - \ltxkeys@ordkey[#1]{#2}{#3}[#4]{\def\x####1{####1xx##1}}% + \ltxkeysordkey[#1]{#2}{#3}[#4]{\def\x####1{####1xx##1}}% \else - \ltxmsg@warn{Unknown key `#3' with value `\ltxkeysinnocentvalue' + \@warning{Unknown key `#3' with value `\ltxkeysinnocentvalue' in family `#2' ignored}\@ehd \fi } @@ -1443,11 +1415,11 @@ To see what the parameter texts \fx{##1} and \fx{####1} above stand for, run the \docsection(sec:ifkeydef)<is key defined?>{Checking if a key is defined} -\start+{newmacro}[\ltxkeys@ifkeydefTF,\ltxkeys@ifkeydefFT] -\ltxkeys@ifkeydefTF[|A(prefs)]{|A(fams)}{|A(key)}{|A(true)}{|A(false)} -\ltxkeys@ifkeydefFT[|A(prefs)]{|A(fams)}{|A(key)}{|A(false)}{|A(true)} +\start+{newmacro}[\ltxkeysifkeydefTF,\ltxkeysifkeydefFT] +\ltxkeysifkeydefTF[|A(prefs)]{|A(fams)}{|A(key)}{|A(true)}{|A(false)} +\ltxkeysifkeydefFT[|A(prefs)]{|A(fams)}{|A(key)}{|A(false)}{|A(true)} \finish{newmacro} -\fxim*{\ltxkeys@ifkeydefTF,\ltxkeys@ifkeydefFT} +\fxim*{\ltxkeysifkeydefTF,\ltxkeysifkeydefFT} These check if \ang{key} is defined with a prefix in \ang{prefs} and in family in \ang{fams}. If the test proves that \ang{key} is defined, \ang{true} text will be executed; otherwise \ang{false} will be executed. @@ -1456,57 +1428,51 @@ These check if \ang{key} is defined with a prefix in \ang{prefs} and in family i \docsubsection{Disabling families} -\start{newmacro}[\ltxkeys@disablefamilies,\ltxkeys@gdisablefamilies] -\ltxkeys@disablefamilies[|A(prefs)]{|A(fams)}[|A(nakeys)] -\ltxkeys@disablefamilies|*[|A(prefs)]{|A(fams)}[|A(nakeys)] -\ltxkeys@gdisablefamilies[|A(prefs)]{|A(fams)}[|A(nakeys)] -\ltxkeys@gdisablefamilies|*[|A(prefs)]{|A(fams)}[|A(nakeys)] +\start{newmacro}[\ltxkeysdisablefamilies,\ltxkeysgdisablefamilies] +\ltxkeysdisablefamilies[|A(prefs)]{|A(fams)}[|A(nakeys)] +\ltxkeysdisablefamilies|*[|A(prefs)]{|A(fams)}[|A(nakeys)] +\ltxkeysgdisablefamilies[|A(prefs)]{|A(fams)}[|A(nakeys)] +\ltxkeysgdisablefamilies|*[|A(prefs)]{|A(fams)}[|A(nakeys)] \finish{newmacro} -\fxim*{\ltxkeys@disablefamilies,\ltxkeys@gdisablefamilies} +\fxim*{\ltxkeysdisablefamilies,\ltxkeysgdisablefamilies} -Here, \ang{prefs} and \ang{fams} are comma-separated lists of prefixes and families to be disabled. Keys listed in the comma-separated list \ang{nakeys} are ignored, \ie, they aren't disabled with their colleagues. The macros \ffx'{\ltxkeys@disablefamilies,\ltxkeys@gdisablefamilies} disable keys and cause an error to be issued when a disabled family is submitted to \fx{\ltxkeyssetkeys} or invoked by the key caller. If the package option \fx{tracingkeys} is true, disabled families are highlighted in the transcript file. The command \fx{\ltxkeys@disablefamilies} acts locally, while \fx{\ltxkeys@gdisablefamilies} has a global effect. +Here, \ang{prefs} and \ang{fams} are comma-separated lists of prefixes and families to be disabled. Keys listed in the comma-separated list \ang{nakeys} are ignored, \ie, they aren't disabled with their colleagues. The macros \ffx'{\ltxkeysdisablefamilies,\ltxkeysgdisablefamilies} disable keys and cause an error to be issued when a disabled family is submitted to \fx{\ltxkeyssetkeys} or invoked by the key caller. If the package option \fx{tracingkeys} is true, disabled families are highlighted in the transcript file. The command \fx{\ltxkeysdisablefamilies} acts locally, while \fx{\ltxkeysgdisablefamilies} has a global effect. -The plain forms of \ffx'{\ltxkeys@disablefamilies,\ltxkeys@gdisablefamilies} 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'{\ltxkeys@disablekeys, \ltxkeys@gdisablekeys}. +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}[\ltxkeys@disablefamilies] -\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/ - }% - \\ - \ltxkeys@disablefamilies[KV1,KV2]{fam1,fam2}[key3,key4] +\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] \showcsn{KV1@fam2@disabledkeys} \finish{example} \docsubsection{Disabling keys} -\start{newmacro}[\ltxkeys@disablekeys,\ltxkeys@gdisablekeys] -\ltxkeys@disablekeys[|A(prefs)]{|A(fams)}{|A(keys)} -\ltxkeys@gdisablekeys[|A(prefs)]{|A(fams)}{|A(keys)} -\ltxkeys@disablekeys|*[|A(prefs)]{|A(fams)}{|A(keys)} -\ltxkeys@gdisablekeys|*[|A(prefs)]{|A(fams)}{|A(keys)} +\start{newmacro}[\ltxkeysdisablekeys,\ltxkeysgdisablekeys] +\ltxkeysdisablekeys[|A(prefs)]{|A(fams)}{|A(keys)} +\ltxkeysgdisablekeys[|A(prefs)]{|A(fams)}{|A(keys)} +\ltxkeysdisablekeys|*[|A(prefs)]{|A(fams)}{|A(keys)} +\ltxkeysgdisablekeys|*[|A(prefs)]{|A(fams)}{|A(keys)} \finish{newmacro} -\fxim*{\ltxkeys@disablekeys,\ltxkeys@gdisablekeys} +\fxim*{\ltxkeysdisablekeys,\ltxkeysgdisablekeys} -Here, \ang{prefs}, \ang{fams} and \ang{keys} are comma-separated lists of prefixes, families and associated keys to be disabled. The macro \fx{\ltxkeys@disablekeys} causes an error to be issued when a disabled key is invoked. If the package option \fx{tracingkeys} is true, undefined keys are highlighted by \fx{\ltxkeys@disablekeys} with a warning message. Because it is possible to mix prefixes and families in \fx{\ltxkeys@disablekeys}, undefined keys may readily be encountered when disabling keys. To see those undefined keys in the transcript file, enable the package option \fx{tracingkeys}. The macro \fx{\ltxkeys@gdisablekeys} will disable the given keys globally. +Here, \ang{prefs}, \ang{fams} and \ang{keys} are comma-separated lists of prefixes, families and associated keys to be disabled. The macro \fx{\ltxkeysdisablekeys} causes an error to be issued when a disabled key is invoked. If the package option \fx{tracingkeys} is true, undefined keys are highlighted by \fx{\ltxkeysdisablekeys} with a warning message. Because it is possible to mix prefixes and families in \fx{\ltxkeysdisablekeys}, undefined keys may readily be encountered when disabling keys. To see those undefined keys in the transcript file, enable the package option \fx{tracingkeys}. The macro \fx{\ltxkeysgdisablekeys} will disable the given keys globally. -The \unstform+ of \fx{\ltxkeys@disablekeys} and \fx{\ltxkeys@gdisablekeys} disable the given keys instantly, while the \stform disable the keys at \hx{\AtBeginDocument}. Authors can use this command to bar users of their keys from calling those keys after a certain point. +The \unstform+ of \fx{\ltxkeysdisablekeys} and \fx{\ltxkeysgdisablekeys} disable the given keys instantly, while the \stform disable the keys at \hx{\AtBeginDocument}. Authors can use this command to bar users of their keys from calling those keys after a certain point. -For a given key prefix \ang{pref} and family \ang{fam}, you can recall the full list of disabled keys (set up earlier by \fx{\ltxkeys@disablekeys} and/or \fx{\ltxkeys@gdisablekeys}) by the command +For a given key prefix \ang{pref} and family \ang{fam}, you can recall the full list of disabled keys (set up earlier by \fx{\ltxkeysdisablekeys} and/or \fx{\ltxkeysgdisablekeys}) by the command \start'{macro}[Recalling list of disabled keys] \|A(pref)@|A(fam)@disabledkeys @@ -1519,49 +1485,49 @@ For a given key prefix \ang{pref} and family \ang{fam}, you can recall the full Sometimes you want to create keys that can only appear in \hhx{\documentclass,\RequirePackage} or \hx{\usepackage}, and at other times you may not want the user to submit a certain set of keys via these commands. The \pkg'{xwatermark}, for example, uses this concept. -\start+{newmacro}[\ltxkeys@optionkeys,\ltxkeys@nonoptionkeys] -\ltxkeys@optionkeys[|A(pref)]{|A(fam)}{|A(keys)} -\ltxkeys@optionkeys|*[|A(pref)]{|A(fam)}{|A(keys)} -\ltxkeys@nonoptionkeys[|A(pref)]{|A(fam)}{|A(keys)} +\start+{newmacro}[\ltxkeysoptionkeys,\ltxkeysnonoptionkeys] +\ltxkeysoptionkeys[|A(pref)]{|A(fam)}{|A(keys)} +\ltxkeysoptionkeys|*[|A(pref)]{|A(fam)}{|A(keys)} +\ltxkeysnonoptionkeys[|A(pref)]{|A(fam)}{|A(keys)} \finish{newmacro} -\fxim*{\ltxkeys@optionkeys,\ltxkeys@nonoptionkeys} +\fxim*{\ltxkeysoptionkeys,\ltxkeysnonoptionkeys} Here, \ang{keys} is a comma-separated list of keys to be made option or non-option keys. -Keys listed in \fx{\ltxkeys@optionkeys} can appear only in arguments of \hhx{\documentclass, \RequirePackage} or \hx{\usepackage}, while keys listed in \fx{\ltxkeys@nonoptionkeys} can't appear in these macros. The \stform of \fx{\ltxkeys@optionkeys} is equivalent to \fx{\ltxkeys@nonoptionkeys}. Only defined keys may appear in \ffx'{\ltxkeys@optionkeys, \ltxkeys@nonoptionkeys}. +Keys listed in \fx{\ltxkeysoptionkeys} can appear only in arguments of \hhx{\documentclass, \RequirePackage} or \hx{\usepackage}, while keys listed in \fx{\ltxkeysnonoptionkeys} can't appear in these macros. The \stform of \fx{\ltxkeysoptionkeys} is equivalent to \fx{\ltxkeysnonoptionkeys}. Only defined keys may appear in \ffx'{\ltxkeysoptionkeys, \ltxkeysnonoptionkeys}. -\start{newmacro}[\ltxkeys@makeoptionkeys] -\ltxkeys@makeoptionkeys[|A(pref)]{|A(fam)} -\ltxkeys@makeoptionkeys|*[|A(pref)]{|A(fam)} -\ltxkeys@makenonoptionkeys[|A(pref)]{|A(fam)} +\start{newmacro}[\ltxkeysmakeoptionkeys] +\ltxkeysmakeoptionkeys[|A(pref)]{|A(fam)} +\ltxkeysmakeoptionkeys|*[|A(pref)]{|A(fam)} +\ltxkeysmakenonoptionkeys[|A(pref)]{|A(fam)} \finish{newmacro} -\fxim*{\ltxkeys@makeoptionkeys} +\fxim*{\ltxkeysmakeoptionkeys} -The command \fx{\ltxkeys@makeoptionkeys} makes all the keys with prefix \ang{pref} and in family \ang{fam} options keys. The command \fx{\ltxkeys@makenonoptionkeys} does the reverse, \ie, makes the keys non-option keys. The \stform of \fx{\ltxkeys@makeoptionkeys} is equivalent to \fx{\ltxkeys@makenonoptionkeys}. +The command \fx{\ltxkeysmakeoptionkeys} makes all the keys with prefix \ang{pref} and in family \ang{fam} options keys. The command \fx{\ltxkeysmakenonoptionkeys} does the reverse, \ie, makes the keys non-option keys. The \stform of \fx{\ltxkeysmakeoptionkeys} is equivalent to \fx{\ltxkeysmakenonoptionkeys}. \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: -\start{newmacro}[\ltxkeys@handledkeys] -\ltxkeys@handledkeys[|A(pref)]{|A(fam)}{|A(list)} +\start{newmacro}[\ltxkeyshandledkeys] +\ltxkeyshandledkeys[|A(pref)]{|A(fam)}{|A(list)} \finish{newmacro} -\fxim*{\ltxkeys@handledkeys} +\fxim*{\ltxkeyshandledkeys} where \ang{list} is a comma-separated list of key names. This command can be issued more than once for the same key prefix \ang{pref} and family \ang{fam}, since the content of \ang{list} is usually merged with the existing list rather than being merely added or overwritten. There is also -\start{newmacro}[\ltxkeys@addhandledkeys] -\ltxkeys@addhandledkeys[|A(pref)]{|A(fam)}{|A(list)} +\start{newmacro}[\ltxkeysaddhandledkeys] +\ltxkeysaddhandledkeys[|A(pref)]{|A(fam)}{|A(list)} \finish{newmacro} -\fxim*{\ltxkeys@addhandledkeys} +\fxim*{\ltxkeysaddhandledkeys} -which is just an alias for \fx{\ltxkeys@handledkeys}. +which is just an alias for \fx{\ltxkeyshandledkeys}. -\start{example}[\ltxkeys@handledkeys] -\ltxkeys@handledkeys[KVA,KVB]{fam1,fam2}{keya,keyb,keyc} +\start{example}[\ltxkeyshandledkeys] +\ltxkeyshandledkeys[KVA,KVB]{fam1,fam2}{keya,keyb,keyc} \finish{example} -For a given key prefix \ang{pref} and family \ang{fam}, you can recall the full list of handled keys (set up earlier by \fx{\ltxkeys@handledkeys}) by the command +For a given key prefix \ang{pref} and family \ang{fam}, you can recall the full list of handled keys (set up earlier by \fx{\ltxkeyshandledkeys}) by the command \start'{macro}[Recalling list of handled keys] \|A(pref)@|A(fam)@handledkeys @@ -1570,50 +1536,48 @@ For a given key prefix \ang{pref} and family \ang{fam}, you can recall the full You can remove handled keys from a given list of handled keys (in a family) by the following command: -\start{newmacro}[\ltxkeys@removehandledkeys] -\ltxkeys@removehandledkeys[|A(pref)]{|A(fam)}{|A(list)} +\start{newmacro}[\ltxkeysremovehandledkeys] +\ltxkeysremovehandledkeys[|A(pref)]{|A(fam)}{|A(list)} \finish{newmacro} -\fxim*{\ltxkeys@removehandledkeys} +\fxim*{\ltxkeysremovehandledkeys} Rather than remove individual handled keys from a list, you might prefer or need to simply undefine or \quoted{emptify} the entire list of handled keys in a family. You can do these with the following commands: -\start+{newmacro}[\ltxkeys@undefhandledkeys,\ltxkeys@emptifyhandledkeys] -\ltxkeys@undefhandledkeys[|A(pref)]{|A(fam)} -\ltxkeys@emptifyhandledkeys[|A(pref)]{|A(fam)} +\start+{newmacro}[\ltxkeysundefhandledkeys,\ltxkeysemptifyhandledkeys] +\ltxkeysundefhandledkeys[|A(pref)]{|A(fam)} +\ltxkeysemptifyhandledkeys[|A(pref)]{|A(fam)} \finish{newmacro} -\fxim*{\ltxkeys@undefhandledkeys,\ltxkeys@emptifyhandledkeys} +\fxim*{\ltxkeysundefhandledkeys,\ltxkeysemptifyhandledkeys} \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). However, when dealing with \quoted{pathkeys} (see \sref{sec:pathkeys}) the term excludes the macro prefix. 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}[\ltxkeys@reservekeyprefix,\ltxkeys@reservekeyfamily, etc.] -\ltxkeys@reservekeyprefix{|A(list)} -\ltxkeys@reservekeyprefix|*{|A(list)} -\ltxkeys@reservekeyfamily{|A(list)} -\ltxkeys@reservekeyfamily|*{|A(list)} -\ltxkeys@reservemacroprefix{|A(list)} -\ltxkeys@reservemacroprefix|*{|A(list)} +\start+{newmacro}[\ltxkeysreservekeyprefix,\ltxkeysreservekeyfamily, etc.] +\ltxkeysreservekeyprefix{|A(list)} +\ltxkeysreservekeyprefix|*{|A(list)} +\ltxkeysreservekeyfamily{|A(list)} +\ltxkeysreservekeyfamily|*{|A(list)} +\ltxkeysreservemacroprefix{|A(list)} +\ltxkeysreservemacroprefix|*{|A(list)} \finish{newmacro} -\fxim*{\ltxkeys@reservekeyprefix,\ltxkeys@reservekeyfamily, - \ltxkeys@reservemacroprefix} +\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{\ltxkeys@options}. 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{\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: -\start+{newmacro}[\ltxkeys@unreservekeyprefix,\ltxkeys@unreservekeyfamily, etc.] -\ltxkeys@unreservekeyprefix{|A(list)} -\ltxkeys@unreservekeyprefix|*{|A(list)} -\ltxkeys@unreservekeyfamily{|A(list)} -\ltxkeys@unreservekeyfamily|*{|A(list)} -\ltxkeys@unreservemacroprefix{|A(list)} -\ltxkeys@unreservemacroprefix|*{|A(list)} +\start+{newmacro}[\ltxkeysunreservekeyprefix,\ltxkeysunreservekeyfamily, etc.] +\ltxkeysunreservekeyprefix{|A(list)} +\ltxkeysunreservekeyprefix|*{|A(list)} +\ltxkeysunreservekeyfamily{|A(list)} +\ltxkeysunreservekeyfamily|*{|A(list)} +\ltxkeysunreservemacroprefix{|A(list)} +\ltxkeysunreservemacroprefix|*{|A(list)} \finish{newmacro} -\fxim*{\ltxkeys@unreservekeyprefix,\ltxkeys@unreservekeyfamily, - \ltxkeys@unreservemacroprefix} +\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. @@ -1652,20 +1616,20 @@ For reasons of efficiency, the \pkg'{ltxkeys} will attempt to catch bad key name You can add to the list of invalid key names by the following command: -\start+{newmacro}[\ltxkeys@badkeynames,\ltxkeys@addbadkeynames] -\ltxkeys@badkeynames{|A(list)} -\ltxkeys@addbadkeynames{|A(list)} +\start+{newmacro}[\ltxkeysbadkeynames,\ltxkeysaddbadkeynames] +\ltxkeysbadkeynames{|A(list)} +\ltxkeysaddbadkeynames{|A(list)} \finish{newmacro} -\fxim*{\ltxkeys@badkeynames,\ltxkeys@addbadkeynames} +\fxim*{\ltxkeysbadkeynames,\ltxkeysaddbadkeynames} where \ang{list} is a comma-separated list of inadmissible names. The updating is done by merging, so that entries are not repeated in the internal list of bad key names. You can remove from the list of bad key names by using the following command: -\start{newmacro}[\ltxkeys@removebadkeynames] -\ltxkeys@removebadkeynames{|A(list)} +\start{newmacro}[\ltxkeysremovebadkeynames] +\ltxkeysremovebadkeynames{|A(list)} \finish{newmacro} -\fxim*{\ltxkeys@removebadkeynames} +\fxim*{\ltxkeysremovebadkeynames} where, again, \ang{list} is comma-separated. It is not advisable to remove any member of the default bad key names. @@ -1673,34 +1637,34 @@ where, again, \ang{list} is comma-separated. It is not advisable to remove any m \docsection(sec:declareoption){Declaring options} \aidxm*{class options, package options} -\start+{newmacro}[\ltxkeys@declareoption,\ltxkeys@unknownoptionhandler] -\ltxkeys@declareoption[|A(pref)]<|A(fam)>{|A(option)}[|A(dft)]{|A(cbk)} -\ltxkeys@declareoption|*[|A(pref)]<|A(fam)>{|A(cbk)} -\ltxkeys@unknownoptionhandler[|A(pref)]<|A(fam)>{|A(cbk)} +\start+{newmacro}[\ltxkeysdeclareoption,\ltxkeysunknownoptionhandler] +\ltxkeysdeclareoption[|A(pref)]<|A(fam)>{|A(option)}[|A(dft)]{|A(cbk)} +\ltxkeysdeclareoption|*[|A(pref)]<|A(fam)>{|A(cbk)} +\ltxkeysunknownoptionhandler[|A(pref)]<|A(fam)>{|A(cbk)} \finish{newmacro} -\fxim*{\ltxkeys@declareoption,\ltxkeys@unknownoptionhandler} +\fxim*{\ltxkeysdeclareoption,\ltxkeysunknownoptionhandler} -The \unstform of \fx{\ltxkeys@declareoption} is simply a form of \fx{\ltxkeys@ordkey}, with the difference that the key family \ang{fam} is now optional and, when specified, must be given in angled brackets. The default family name is \quotedhx{\@currname.\@currext}, \ie, the name of the class file or package and its file extension. +The \unstform of \fx{\ltxkeysdeclareoption} is simply a form of \fx{\ltxkeysordkey}, with the difference that the key family \ang{fam} is now optional and, when specified, must be given in angled brackets. The default family name is \quotedhx{\@currname.\@currext}, \ie, the name of the class file or package and its file extension. -The \stform of \fx{\ltxkeys@declareoption} prescribes the default action to be taken when undefined options with prefix \ang{pref} and in family \ang{fam} are passed to class or package. You may use \fx{\ltxkeyscurrentkey} and \fx{\ltxkeyscurrentvalue} within this macro to pass the unknown option and its value to another class or package or to specify other actions. In fact, you can use \fx{#1} in this macro to represent the current key prefix, \fx{#2} for the current family, \fx{#3} for the current key name, and \fx{#4} for the value of the current key. The command \fx{\ltxkeys@unknownoptionhandler} is equivalent to the \stform of \fx{\ltxkeys@declareoption}. +The \stform of \fx{\ltxkeysdeclareoption} prescribes the default action to be taken when undefined options with prefix \ang{pref} and in family \ang{fam} are passed to class or package. You may use \fx{\ltxkeyscurrentkey} and \fx{\ltxkeyscurrentvalue} within this macro to pass the unknown option and its value to another class or package or to specify other actions. In fact, you can use \fx{#1} in this macro to represent the current key prefix, \fx{#2} for the current family, \fx{#3} for the current key name, and \fx{#4} for the value of the current key. The command \fx{\ltxkeysunknownoptionhandler} is equivalent to the \stform of \fx{\ltxkeysdeclareoption}. \ltsnote -The \stform of \fx{\ltxkeys@declareoption} differs from the starred form of \LaTeX's \hx{\DeclareOption} and the starred form of \pkg'{xkeyval}'s \hx{\DeclareOptionX}. +The \stform of \fx{\ltxkeysdeclareoption} differs from the starred form of \LaTeX's \hx{\DeclareOption} and the starred form of \pkg'{xkeyval}'s \hx{\DeclareOptionX}. -\start+{example}[\ltxkeys@declareoption] -\ltxkeys@declareoption|*[KV]<mypackage>{% +\start+{example}[\ltxkeysdeclareoption] +\ltxkeysdeclareoption|*[KV]<mypackage>{% \PackageWarning{mypackage}{% Unknown option `\ltxkeyscurrentkey' with value `\ltxkeysinnocentvalue' ignored}% } -\ltxkeys@declareoption|*{\PassOptionsToClass{#3}{article}} +\ltxkeysdeclareoption|*{\PassOptionsToClass{#3}{article}} -\ltxkeys@unknownoptionhandler[KV]<mypackage>{% +\ltxkeysunknownoptionhandler[KV]<mypackage>{% \@expandtwoargs\in@{,#3,}{,\KV@mypackage@handledkeys,}% \ifin@ |com(The reader may want to investigate what the parameter texts) |com(##1 and ####1 below stand for:) - \ltxkeys@ordkey[#1]{#2}{#3}[#4]{\def\x####1{####1xx##1}}% + \ltxkeysordkey[#1]{#2}{#3}[#4]{\def\x####1{####1xx##1}}% \else \PassOptionsToClass{#3}{myclass}% \fi @@ -1709,17 +1673,17 @@ The \stform of \fx{\ltxkeys@declareoption} differs from the starred form of \LaT See note~\ref{nte:unknownkey} for the meaning of the parameter texts in this example. The contents of the macro \fx{\KV@mypackage@handledkeys} are handled keys for key prefix \fx{KV} and family \fx{fam}. See \sref{sec:handledkeys} for the meaning of handled keys. -\start+{newmacro}[\ltxkeys@declarecmdoption, \ltxkeys@declarebooloption, etc] -\ltxkeys@declareordoption[|A(pref)]<|A(fam)>{|A(option)}[|A(dft)]{|A(cbk)} -\ltxkeys@declarecmdoption[|A(pref)]<|A(fam)>[|A(mp)]{|A(option)}[|A(dft)]{|A(cbk)} -\ltxkeys@declarebooloption[|A(pref)]<|A(fam)>[|A(mp)]{|A(option)}[|A(dft)]{|A(cbk)} -\ltxkeys@declarechoiceoption[|A(pref)]{|A(fam)}[|A(mp)]{|A(option)}[|A(bin)]{|A(alt)} +\start+{newmacro}[\ltxkeysdeclarecmdoption, \ltxkeysdeclarebooloption, etc] +\ltxkeysdeclareordoption[|A(pref)]<|A(fam)>{|A(option)}[|A(dft)]{|A(cbk)} +\ltxkeysdeclarecmdoption[|A(pref)]<|A(fam)>[|A(mp)]{|A(option)}[|A(dft)]{|A(cbk)} +\ltxkeysdeclarebooloption[|A(pref)]<|A(fam)>[|A(mp)]{|A(option)}[|A(dft)]{|A(cbk)} +\ltxkeysdeclarechoiceoption[|A(pref)]{|A(fam)}[|A(mp)]{|A(option)}[|A(bin)]{|A(alt)} [|A(dft)]{|A(cbk)} \finish{newmacro} -\fxim*{\ltxkeys@declareordoption,\ltxkeys@declarecmdoption, -\ltxkeys@declarebooloption,\ltxkeys@declarechoiceoption} +\fxim*{\ltxkeysdeclareordoption,\ltxkeysdeclarecmdoption, +\ltxkeysdeclarebooloption,\ltxkeysdeclarechoiceoption} -These are the equivalents of the macros \ffx'{\ltxkeys@ordkey,\ltxkeys@cmdkey, \ltxkeys@boolkey, \ltxkeys@choicekey}, respectively, but now the family \ang{fam} is optional (as is \ang{pref}) and, when specified, must be given in angled brackets. The default family name for these new commands is \quotedhx{\@currname.\@currext}, \ie, the current style or class filename and filename extension. \fx{\ltxkeys@declareordoption} is equivalent to the \unstform of \fx{\ltxkeys@declareoption}. See the choice keys in \sref{sec:choicekeys} for the meaning of \ang{bin} and \ang{alt} associated with the command \fx{\ltxkeys@declarechoiceoption}. +These are the equivalents of the macros \ffx'{\ltxkeysordkey,\ltxkeyscmdkey, \ltxkeysboolkey, \ltxkeyschoicekey}, respectively, but now the family \ang{fam} is optional (as is \ang{pref}) and, when specified, must be given in angled brackets. The default family name for these new commands is \quotedhx{\@currname.\@currext}, \ie, the current style or class filename and filename extension. \fx{\ltxkeysdeclareordoption} is equivalent to the \unstform of \fx{\ltxkeysdeclareoption}. See the choice keys in \sref{sec:choicekeys} for the meaning of \ang{bin} and \ang{alt} associated with the command \fx{\ltxkeysdeclarechoiceoption}. \docsubsection(sec:options-sameattributes) @@ -1728,46 +1692,46 @@ These are the equivalents of the macros \ffx'{\ltxkeys@ordkey,\ltxkeys@cmdkey, \ The commands \start+{macro} -\ltxkeys@declareordoption -\ltxkeys@declarecmdoption -\ltxkeys@declarebooloption -\ltxkeys@declarechoiceoption +\ltxkeysdeclareordoption +\ltxkeysdeclarecmdoption +\ltxkeysdeclarebooloption +\ltxkeysdeclarechoiceoption \finish{macro} can each be used to introduce several options that share the same path or bases (option prefix, option family, and macro prefix) and callback \ang{cbk}. All that is needed is to replace \ang{option} in these commands with the comma-separated list \ang{options}. Because some users might prefer to see these commands in their plural forms when defining several options with the same callback, we have provided the following aliases. -\start+{newmacro}[\ltxkeys@declarecmdoptions, \ltxkeys@declarebooloptions, etc] -\ltxkeys@declareordoptions[|A(pref)]<|A(fam)>{|A(option)}[|A(dft)]{|A(cbk)} -\ltxkeys@declarecmdoptions[|A(pref)]<|A(fam)>[|A(mp)]{|A(option)}[|A(dft)]{|A(cbk)} -\ltxkeys@declarebooloptions[|A(pref)]<|A(fam)>[|A(mp)]{|A(option)}[|A(dft)]{|A(cbk)} -\ltxkeys@declarechoiceoptions[|A(pref)]{|A(fam)}[|A(mp)]{|A(option)}[|A(bin)]{|A(alt)} +\start+{newmacro}[\ltxkeysdeclarecmdoptions, \ltxkeysdeclarebooloptions, etc] +\ltxkeysdeclareordoptions[|A(pref)]<|A(fam)>{|A(option)}[|A(dft)]{|A(cbk)} +\ltxkeysdeclarecmdoptions[|A(pref)]<|A(fam)>[|A(mp)]{|A(option)}[|A(dft)]{|A(cbk)} +\ltxkeysdeclarebooloptions[|A(pref)]<|A(fam)>[|A(mp)]{|A(option)}[|A(dft)]{|A(cbk)} +\ltxkeysdeclarechoiceoptions[|A(pref)]{|A(fam)}[|A(mp)]{|A(option)}[|A(bin)]{|A(alt)} [|A(dft)]{|A(cbk)} \finish{newmacro} -\fxim*{\ltxkeys@declareordoptions,\ltxkeys@declarecmdoptions, -\ltxkeys@declarebooloptions,\ltxkeys@declarechoiceoptions} +\fxim*{\ltxkeysdeclareordoptions,\ltxkeysdeclarecmdoptions, +\ltxkeysdeclarebooloptions,\ltxkeysdeclarechoiceoptions} \docsubsection(sec:multitypeoptions){Declaring all types of option with one command} \aidx*{declaring multiple options} -\start{newmacro}[\ltxkeys@declaremultitypeoptions] -\ltxkeys@declaremultitypeoptions[|A(pref)]<|A(fam)>[|A(mp)]{% +\start{newmacro}[\ltxkeysdeclaremultitypeoptions] +\ltxkeysdeclaremultitypeoptions[|A(pref)]<|A(fam)>[|A(mp)]{% |A(keytype)/|A(keyname)/|A(dft)/|A(cbk); another set of key attributes; etc. } -\ltxkeys@declaremultitypeoptions|*[|A(pref)]<|A(fam)>[|A(mp)]{% +\ltxkeysdeclaremultitypeoptions|*[|A(pref)]<|A(fam)>[|A(mp)]{% |A(keytype)/|A(keyname)/|A(dft)/|A(cbk); another set of key attributes; etc. } \finish{newmacro} -\fxim*{\ltxkeys@declaremultitypeoptions} +\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{\ltxkeys@stylekey} 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{\ltxkeys@declaremultitypeoptions} 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{\ltxkeys@declaremultitypeoptions} 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{\ltxkeys@declaremultitypeoptions}, the optional family is expected to be given in angled brackets. The \stform of the command \fx{\ltxkeys@declaremultitypeoptions} defines only undefined options. An alias for the long command \fx{\ltxkeys@declaremultitypeoptions} is \fx{\declaremultitypeoptions}. +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. -\start{example}[\ltxkeys@declaremultitypeoptions] -\declaremultitypeoptions*[KV]<fam>[mp@]{% +\start{example}[\ltxkeysdeclaremultitypeoptions] +\ltxkeysdeclaremultitypeoptions*[KV]<fam>[mp@]{% cmd/option1/xx/\def\x##1{##1xx#1}; bool/option2/true; sty* @@ -1778,42 +1742,42 @@ Here, the key default value \ang{dft} and callback \ang{cbk} can be absent in al \docsection(sec:executeoption){Executing options} -\start{newmacro}[\ltxkeys@executeoptions] -\ltxkeys@executeoptions[|A(prefs)]<|A(fams)>[|A(na)]{|A(keyval)} +\start{newmacro}[\ltxkeysexecuteoptions] +\ltxkeysexecuteoptions[|A(prefs)]<|A(fams)>[|A(na)]{|A(keyval)} \finish{newmacro} -\fxim*{\ltxkeys@executeoptions} +\fxim*{\ltxkeysexecuteoptions} -This executes/sets the \keyval pairs given in \ang{keyval}. The optional \ang{na} specifies the list of keys (without values) to be ignored. \ang{prefs} is the list of prefixes for the keys; and the optional \ang{fams} signifies families in which the keys suggested in \keyval have been defined. The default value of \ang{fams} is \fx{\@currname.\@currext}. The command \fx{\ltxkeys@executeoptions} can thus be used to process keys with different prefixes and from several families. +This executes/sets the \keyval pairs given in \ang{keyval}. The optional \ang{na} specifies the list of keys (without values) to be ignored. \ang{prefs} is the list of prefixes for the keys; and the optional \ang{fams} signifies families in which the keys suggested in \keyval have been defined. The default value of \ang{fams} is \fx{\@currname.\@currext}. The command \fx{\ltxkeysexecuteoptions} can thus be used to process keys with different prefixes and from several families. \docsection(sec:processoption){Processing options} -\start{newmacro}[\ltxkeys@processoptions] -\ltxkeys@processoptions[|A(prefs)]<|A(fams)>[|A(na)] -\ltxkeys@processoptions|*[|A(prefs)]<|A(fams)>[|A(na)] +\start{newmacro}[\ltxkeysprocessoptions] +\ltxkeysprocessoptions[|A(prefs)]<|A(fams)>[|A(na)] +\ltxkeysprocessoptions|*[|A(prefs)]<|A(fams)>[|A(na)] \finish{newmacro} -\fxim*{\ltxkeys@processoptions} +\fxim*{\ltxkeysprocessoptions} -The command \fx{\ltxkeys@processoptions} processes the \keyval pairs passed by the user to the class or package. The optional argument \ang{na} can be used to specify keys that should be ignored. The optional argument \ang{fams} can be used to specify the families that have been used to define the keys. The default value of \ang{fams} is \fx{\@currname.\@currext}. The package command \fx{\ltxkeys@processoptions} doesn't protect expandable macros in the user inputs unless the \pkg'{ltxkeys} is loaded before \hx{\documentclass}, in which case it is also possible to use the command \hx{\XProcessOptions} of the \pkg'{ltxtools}. When used in a class file, the macro \fx{\ltxkeys@processoptions} will ignore unknown keys or options. This allows the user to use global options in the \hx{\documentclass} command which can be inherinted by packages loaded afterwards. +The command \fx{\ltxkeysprocessoptions} processes the \keyval pairs passed by the user to the class or package. The optional argument \ang{na} can be used to specify keys that should be ignored. The optional argument \ang{fams} can be used to specify the families that have been used to define the keys. The default value of \ang{fams} is \fx{\@currname.\@currext}. The package command \fx{\ltxkeysprocessoptions} doesn't protect expandable macros in the user inputs unless the \pkg'{ltxkeys} is loaded before \hx{\documentclass}, in which case it is also possible to use the command \hx{\XProcessOptions} of the \pkg'{ltxtools}. When used in a class file, the macro \fx{\ltxkeysprocessoptions} will ignore unknown keys or options. This allows the user to use global options in the \hx{\documentclass} command which can be inherinted by packages loaded afterwards. -The \stform of \fx{\ltxkeys@processoptions} works like the plain variant except that, if the \pkg'{ltxkeys} is loaded after \hx{\documentclass}, it also copies user input from the command \hx{\documentclass}. When the user specifies an option in the \hx{\documentclass} which also exists in the local family or families of the package issuing \fx{\ltxkeys@processoptions}\Redstar, the local key too will be set. In this case, \fx{#1} in the command \fx{\ltxkeys@declareoption} (or a similar command) will be the value entered in the \hx{\documentclass} command for this key. First the global options from \hx{\documentclass} will set local keys and afterwards the local options, specified via \hx{\usepackage}, \hx{\RequirePackage} or \hx{\LoadClass}, will set local keys, which could overwrite the previously set global options, depending on the way the options sections are constructed. +The \stform of \fx{\ltxkeysprocessoptions} works like the plain variant except that, if the \pkg'{ltxkeys} is loaded after \hx{\documentclass}, it also copies user input from the command \hx{\documentclass}. When the user specifies an option in the \hx{\documentclass} which also exists in the local family or families of the package issuing \fx{\ltxkeysprocessoptions}\Redstar, the local key too will be set. In this case, \fx{#1} in the command \fx{\ltxkeysdeclareoption} (or a similar command) will be the value entered in the \hx{\documentclass} command for this key. First the global options from \hx{\documentclass} will set local keys and afterwards the local options, specified via \hx{\usepackage}, \hx{\RequirePackage} or \hx{\LoadClass}, will set local keys, which could overwrite the previously set global options, depending on the way the options sections are constructed. \docsubsection(sec:afterprocessoptions)<before processoptions,after processoptions> {Hooks for `before' and `after' processing options} -\start+{newmacro}[\ltxkeys@beforeprocessoptions,\ltxkeys@afterprocessoptions] -\ltxkeys@beforeprocessoptions{|A(code)} -\ltxkeys@afterprocessoptions{|A(code)} +\start+{newmacro}[\ltxkeysbeforeprocessoptions,\ltxkeysafterprocessoptions] +\ltxkeysbeforeprocessoptions{|A(code)} +\ltxkeysafterprocessoptions{|A(code)} \finish{newmacro} -\fxim*{\ltxkeys@beforeprocessoptions,\ltxkeys@afterprocessoptions} +\fxim*{\ltxkeysbeforeprocessoptions,\ltxkeysafterprocessoptions} -The macros \ffx'{\ltxkeys@beforeprocessoptions,\ltxkeys@afterprocessoptions} can be used to process an arbitrary code given in \ang{code} before and after \fx{\ltxkeys@processoptions} has been executed. The command \fx{\ltxkeys@afterprocessoptions} is particularly useful when it is required to optionally load a package, with the decision dependent on the state or outcome of an option in the current package. For obvious reasons, \latex's options parser doesn't permit the loading of packages in the options section. The command \fx{\ltxkeys@afterprocessoptions} can be used to load packages after the current package's options have been processed. Here is an example for optionally loading some packages at the end of the options section: +The macros \ffx'{\ltxkeysbeforeprocessoptions,\ltxkeysafterprocessoptions} can be used to process an arbitrary code given in \ang{code} before and after \fx{\ltxkeysprocessoptions} has been executed. The command \fx{\ltxkeysafterprocessoptions} is particularly useful when it is required to optionally load a package, with the decision dependent on the state or outcome of an option in the current package. For obvious reasons, \latex's options parser doesn't permit the loading of packages in the options section. The command \fx{\ltxkeysafterprocessoptions} can be used to load packages after the current package's options have been processed. Here is an example for optionally loading some packages at the end of the options section: -\start{example}[\ltxkeys@afterprocessoptions] -\ltxkeys@cmdkey[KV]{fam}[mp@]{keya}[]{% +\start{example}[\ltxkeysafterprocessoptions] +\ltxkeyscmdkey[KV]{fam}[mp@]{keya}[]{% \iflacus#1\then\else - \ltxkeys@afterprocessoptions{\RequirePackage[#1]{mypackage}}% + \ltxkeysafterprocessoptions{\RequirePackage[#1]{mypackage}}% \fi } \finish{example} @@ -1839,11 +1803,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)\reltxkeyscommand|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)\ltxkeysenvironment{|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)} +|A(pref)\renewltxkeysenvironment{|A(name)}[|A(narg)][|A(dft)]<|A(delim)>|(|A(keys)|){|A(begdefn)}{|A(enddefn)} \finish{newmacro} -\fxim*{\ltxkeyscommand,\reltxkeyscommand,\ltxkeysenvironment,\reltxkeysenvironment,\ltxkeysglobal, +\fxim*{\ltxkeyscommand,\renewltxkeyscommand,\ltxkeysenvironment,\renewltxkeysenvironment,\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. @@ -1864,7 +1828,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,\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}. +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}. 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: @@ -1888,7 +1852,7 @@ The command \fx{\val} yields the current value of a command or environment key, The commands \ffx'{\val,\ifval,\ifvalTF} can be used in expansion contexts (including in \hx{\csname...\endcsname}) but if their arguments aren't defined as keys, they will return an undefined command, either immediately or later. On the hand, their counterparts (namely, the commands \ffx'{\keyval,\ifkeyval,\ifkeyvalTF}) will first check that the key has been defined before attempting to obtain its current value or state. This affects their expandability when a key is undefined. My advice is that the user should always use \ffx'{\keyval,\ifkeyval,\ifkeyvalTF} instead of \ffx'{\val,\ifval,\ifvalTF}, unless he is sure he hasn't committed any mistakes in key's name; but he might be writing a package---that contains these commands---for the use of the \tex community. Also, here there is an advantage in using \hx{\protected@edef} in place of \hx{\edef}: some \latex commands are protected with \hx{\protect}. -The commands \ffx'{\val,\ifval,\ifvalTF, \keyval,\ifkeyval,\ifkeyvalTF}, like the command and environment keys, are available in \ang{defn}, \ang{begdefn} and \ang{enddefn}. These commands (\ie, \ffx'{\val,\ifval,\ifvalTF, \keyval,\ifkeyval,\ifkeyvalTF}) are pushed on entry into \ang{defn} or \ang{begdefn}, and they are popped on exit of \ang{defn} or \ang{enddefn}. Unless they're defined elsewhere outside the \pkg'{ltxkeys}, they're undefined outside \ang{defn}, \ang{begdefn}, \ang{enddefn}, and the environment body\footnote{The commands \ftffx'{\pathkeysval,\ifpathkeysval,\ifpathkeysvalTF, \pathkeyskeyval,\ifpathkeyskeyval,\ifpathkeyskeyvalTF} are always available, but they can be used only in the context of \quoted{pathkeys} (\sref{sec:pathkeys}).}. +The commands \ffx'{\val,\ifval,\ifvalTF, \keyval,\ifkeyval,\ifkeyvalTF}, like the command and environment keys, are available in \ang{defn}, \ang{begdefn} and \ang{enddefn}. These commands (\ie, \ffx'{\val,\ifval,\ifvalTF, \keyval,\ifkeyval,\ifkeyvalTF}) are pushed on entry into \ang{defn} or \ang{begdefn}, and they are popped on exit of \ang{defn} or \ang{enddefn}. Unless they're defined elsewhere outside the \pkg'{ltxkeys}, they're undefined outside \ang{defn}, \ang{begdefn}, \ang{enddefn}, and the environment body. \docsubsection(sec:eoe){Final tokens of every environment} @@ -2060,7 +2024,7 @@ Here, \ang{code} will be executed at the right instance when \ang{keycmd} is bei \start+{example}[Nested key environments] \def\testenv{} -\reltxkeysenvironment{testenv}|(% +\renewltxkeysenvironment{testenv}|(% |com(The \y below is just a test:) cmd/fraclen/0.1cm/\def\y##1{#1yyy##1}; cmd/framerule/.4pt; @@ -2161,14 +2125,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,\ltxkeyssetvarvalues,\ltxkeysgetvarvalue] +\start{newmacro}[\ltxkeysdeclarevariables,\ltxkeyssetvariablevalues,\ltxkeysgetvariablevalue] \ltxkeysdeclarevariables[|A(namespace)]{% |A(key-1) = |A(dft-1) = |A(cbk-1), ..., |A(key-n) = |A(dft-n) = |A(cbk-n) } -\ltxkeyssetvarvalues[|A(namespace)]{|keyval pairs} -\ltxkeysgetvarvalue[|A(namespace)]{|A(key)} +\ltxkeyssetvariablevalues[|A(namespace)]{|keyval pairs} +\ltxkeysgetvariablevalue[|A(namespace)]{|A(key)} \finish{newmacro} -\fxim*{\ltxkeysdeclarevariables,\ltxkeyssetvarvalues,\ltxkeysgetvarvalue} +\fxim*{\ltxkeysdeclarevariables,\ltxkeyssetvariablevalues,\ltxkeysgetvariablevalue} 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. @@ -2182,11 +2146,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 } -\ltxkeyssetvarvalues[mynamespace]{var1=new value1, var2=new value2} -\edef\x{\ltxkeysgetvarvalue[mynamespace]{var1}} +\ltxkeyssetvariablevalues[mynamespace]{var1=new value1, var2=new value2} +\edef\x{\ltxkeysgetvariablevalue[mynamespace]{var1}} \begin{document} -\ltxkeysgetvarvalue[mynamespace]{var1} +\ltxkeysgetvariablevalue[mynamespace]{var1} \end{document} \finish{example} @@ -2200,840 +2164,39 @@ The private namespace is optional but clashes of control sequences might occur: |com(No default value and no callback:) var3 } -\ltxkeyssetvarvalues{var1=new value1, var2=new value2} -\edef\x{\ltxkeysgetvarvalue{var1}} +\ltxkeyssetvariablevalues{var1=new value1, var2=new value2} +\edef\x{\ltxkeysgetvariablevalue{var1}} \begin{document} -\ltxkeysgetvarvalue{var1} +\ltxkeysgetvariablevalue{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{\ltxkeys@ordkey} \\\hline -\fx{\ordkeys} & \fx{\ltxkeys@ordkeys} \\\hline -\fx{\listkey} & \fx{\ltxkeys@listkey} \\\hline -\fx{\listkeys} & \fx{\ltxkeys@listkeys} \\\hline -\fx{\cmdkey} & \fx{\ltxkeys@cmdkey} \\\hline -\fx{\cmdkeys} & \fx{\ltxkeys@cmdkeys} \\\hline -\fx{\boolkey} & \fx{\ltxkeys@boolkey} \\\hline -\fx{\boolkeys} & \fx{\ltxkeys@boolkeys} \\\hline -\fx{\switchkey} & \fx{\ltxkeys@switchkey} \\\hline -\fx{\switchkeys} & \fx{\ltxkeys@switchkeys} \\\hline -\fx{\choicekey} & \fx{\ltxkeys@choicekey} \\\hline -\fx{\choicekeys} & \fx{\ltxkeys@choicekeys} \\\hline -\fx{\stylekey} & \fx{\ltxkeys@stylekey} \\\hline -\fx{\stylekeys} & \fx{\ltxkeys@stylekeys} \\\hline -\fx{\definekeys} & \fx{\ltxkeysdefinekeys} \\\hline -\fx{\declarekeys} & \fx{\ltxkeysdeclarekeys} \\\hline -\fx{\declareoptions} & \fx{\ltxkeys@declaremultitypeoptions} \\\hline -\fx{\ifdeclaringkeys}\fx{\then} & \fx{\ifltxkeys@dec} \\\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:pathkeys)<pathkeys>{Pathkeys} - -Let us start this section with a welcome message: you don't have to repeatedly type in long key paths and commands when using pathkeys. There is plenty of help ahead on how to reduce estate when using pathkeys. - -The \pkg'{pathkeys} can be loaded on its own (via \hx{\RequirePackage} or \hx{\usepackage}) or as an option to the \pkg'{ltxkeys} (see \sref{tab:pkgoptions})\footnote{The user has no access to the command \fx{\pathkeys} unless he/she first loads \pkg'{pathkeys}.}. All the options listed in \sref{tab:pkgoptions} are accepted by the \pkg'{pathkeys}. They are all passed on to \pkg'{ltxkeys}, except \fx{pathkeys} that is simply ignored by \pkg'{pathkeys}. - -Pathkeys are keys with a tree or directory structure\footnote{This might sound like \textpgfkeys, but the semantics, syntaxes, and the implementation here are all different from those of \textpgfkeys.}. When defining and setting pathkeys, the full key path is usually required. This is also the case when seeking the current value or state of a key. When using pathkeys the user is relieved of the need to known and remember where the optional arguments have to be placed in calls to macros. And like the commands \ffx'{\ltxkeysdefinekeys, \ltxkeysdeclarekeys}, pathkeys are automatically initialized after definition, \ie, they are automatically set with their default values. Boolean keys are set with a default value of \quoted{false} irrespective of the user-specified default value. See \sref{sec:definekeys,sec:declarekeys} for an explanation of this philosophy. - -The command for defining and setting pathkeys is \fx{\pathkeys}, which has the following syntax. The same command is used for several other tasks related to pathkeys. The \quoted{flag} entry in the argument of \fx{\pathkeys} determines the action that the command is expected to take. - -\start+{newmacro}[\pathkeys] -\pathkeys|*|'{|A(paths)/|A(flag)|R(:) |A(attrib)} -\finish{newmacro} -\fxim*{\pathkeys} - -The \stform of \fx{\pathkeys} will expand its argument once before commencing the loop and executing the codes on the specified paths. The \pmform is equivalent to invoking the package option \fx{endcallbackline} before calling \fx{\pathkeys}. Using both \redstar and \redprime makes \hx{\endlinechar} $-1$ but the effect is not enforced, since in the \stform of \fx{\pathkeys} the argument has already been read. - -In the argument of command \fx{\pathkeys}, \ang{paths} has the syntax - -\start+{newmacro}[Paths in \pathkeys] -|A(main-1)/|A(sub-1)/|A(subsub-1)|R(,)|A(main-2)/|A(sub-2)/|A(subsub-2),...|R(,)etc. -\finish{newmacro} -\fxim*{\pathkeys} - -in which individual paths are separated by \qcomma. The quantity \ang{main} is the main path and \ang{sub} is the sub path, \eetc. It should be noted that there is no forward slash ~(\fx{/}) before \ang{paths} or \ang{main}. If the path is empty, the default path \quotedfx{pathkeys@default@main/pathkeys@default@sub}, or the user-supplied current path (see later), is used. \emph{Note, however, that when the current path is empty, the default path is not resorted to automatically; you have to indicate that this is your choice.} You can call \fx{\pathkeysusedefaultpath} to indicate that you really want the default path to be the current path. The aim is that users don't leave out the path when they don't actually intend it to be empty. There is more about the default and current paths later in this guide. - -The \ang{attrib}, the property of a pathkey, is determined by the quantity called \ang{flag}. The \ang{flag} determines the action the command \fx{\pathkeys} takes, and must be a member of the set described in \sref{tab:flags}. The action specified by \ang{flag} is, if applicable on all the given paths, taken on all the given paths. Multiple paths should invariably be comma-separated. See the notes of \sref{tab:flags} for the \ang{attrib}'s of the flags. The attributes describe the arguments associated with the flags, \ie, the quantities expected after the \qcolon in the argument of \fx{\pathkeys}. The \ang{na} is the list of keys that are ignored by the \ang{flag}'s action. If it is present in the attribute \ang{attrib} part of \fx{\pathkeys}, it must always be given in square brackets \quotedfx{[]} (see \sref{nte:pathkeys-flags}). Not all the flags expect, or can process, the \ang{na} list. - -Some important points about the command \fx{\pathkeys}: -\begin{enum} -\item A key message of the above syntax of \ang{paths} is that several paths can be submitted to \fx{\pathkeys} in one go. The attribute \ang{attrib} will then apply to all the given paths, according to the given \ang{flag}. If \ang{flag} involves defining keys, the keys will be defined on all the listed paths. If \ang{flag} involves determining if a key is defined on any of the given paths, all the listed paths are searched to find the key. -\item Within the command \fx{\pathkeys}, if the package option \fx{endcallbackline} is enabled, every line implicitly ends with a comment sign. Invariably, within \fx{\pathkeys} the \quoted{at sign} (\fx{@}) has category code~11 (letter). So no need to reassign this category code to~11 within \fx{\pathkeys}. -\item For flags with \redstar, \redplus and \redclam signs, the user should make sure there is no space between the flag and its star, plus or exclamation sign: such a space will not be zapped internally, since syntactic matching is used. The sign is part of the flag's name. -\end{enum} - -\newltablenote{pathkeys-flags-1}{% - The flag \fx{declareoptions}\Redstar simply signifies the user's aim to define definable options; it has nothing to do with the \stform of the command \fx{\ltxkeys@declareoption} of \sref{sec:declareoption}. The attribute is the same as for \fx{define} flag. -} -\newltablenote{pathkeys-flags-2}{% - The key or option handler can have up to a maximum of~4 arguments. The arguments of the unknown key or option handler are the main path (argument 1); subpaths, separated by forward slash (argument 2); key name (argument 3), and the current key value (argument 4). The handler can/should be defined by the user (see \sref{sec:unknownkeyhandler}). -} - -\newcolumntype{C}{>{\hfill}p{.7cm}} -\ltnotenrwidth14pt -\begingroup -\small -\begin{tabularx}{\linewidth}{|C|>{\raggedright}p{2.5cm}|X|} -\caption{Flags and attributes for pathkeys\label{tab:flags}}\\\hline -\ltablenotehead{These notes describe the attributes of key flags, \ie, what are required to be specified in the command \fx{\pathkeys} after the \qcolon sign. \ang{na} keys are the keys to be ignored; they must appear in square brackets, \eg, \ttx{[keya, keyb]}.} -\rowcolor{pink} -\bfseries No. &\bfseries Flag & \bfseries Meaning\\\hline -\endfirsthead -\hline -\multicolumn{3}{|l|}{\emph{Continued from last page}}\\\hline -\bfseries No. &\bfseries Flag & \bfseries Meaning \\\hline -\endhead -\multicolumn{3}{|r|}{\emph{Continued on next page}}\\\hline -\endfoot -\hline -\endlastfoot -\rownr & \fx{define} & Define the keys whether or not they already exist.\ltablenote{See attribute in \sref{nte:pathkeys-flags}.}\\\hline -\rownr & \fx{define}\Redstar & Define the keys only if they don't already exist.\ltablenote{Same as for \fx{define} flag.} \\\hline -\rownr & \fx{declareoptions} & Declare the given options whether or not they already exist.\ltablenote{Same as for \fx{define} flag.} \\\hline -\rownr & \fx{declareoptions}\Redstar & Declare the options if they don't already exist. \useltablenote{pathkeys-flags-1} \\\hline -\rownr & \fx{preset} & Preset the listed keys on the given path. This actually means preparing the list of preset keys, for later use when setting keys with the flag \fx{set} or any key-setting flag. \ltablenote{\keyval pairs (see \sref{sec:presettingkeys}).} \\\hline -\rownr & \fx{preset}\Redclam & Preset the listed keys, saving the list globally. \ltablenote{\keyval pairs (see \sref{sec:presettingkeys}).} \\\hline -\rownr & \fx{postset} & Post-set the listed keys. This actually means preparing the list of postset keys. \ltablenote{\keyval pairs (see \sref{sec:presettingkeys}).} \\\hline -\rownr & \fx{postset}\Redclam & Post-set the listed keys, saving the list globally. \ltablenote{\keyval pairs (see \sref{sec:presettingkeys}).} \\\hline -\rownr & \fx{set} & Set the listed keys. \ltablenote{\ang{na} keys and \keyval pairs (see \sref{sec:settingkeys}).} \\\hline -\rownr & \fx{set}\Redstar & Set the listed keys and save undefined keys in the list of \quoted{remaining keys} without raising errors. \ltablenote{\ang{na} keys and \keyval pairs (see \sref{sec:settingkeys}).} \\\hline -\rownr & \fx{set}\Redstar\Redplus & Set the listed keys in all the given key prefixes and families; save undefined keys in the list of \quoted{remaining keys} without raising errors. \ltablenote{\ang{na} keys and \keyval pairs (see \sref{sec:settingkeys}).} \\\hline -\rownr & \fx{setrm} & Set the \quoted{remaining keys}. \ltablenote{\ang{na} keys (see \sref{sec:rmkeys}).} \\\hline -\rownr & \fx{setrm}\Redstar & Set the \quoted{remaining keys} and again save undefined keys in the revised list of \quoted{remaining keys} without raising errors. \ltablenote{\ang{na} keys (see \sref{sec:rmkeys}).} \\\hline -\rownr & \fx{setrm}\Redstar\Redplus & Set the \quoted{remaining keys} in all the given key prefixes and families; save undefined keys in the revised list of \quoted{remaining keys} without raising errors. \ltablenote{\ang{na} keys (see \sref{sec:rmkeys}).} \\\hline -\rownr & \fx{executeoptions} & Execute the listed options. \ltablenote{\ang{na} keys and \keyval pairs (see \sref{sec:executeoption}).} \\\hline -\rownr & \fx{processoptions} & Process the listed options in the order in which they were declared, and don't copy \hx{\documentclass} options. \ltablenote{\ang{na} keys (see \sref{sec:processoption}).} \\\hline -\rownr & \fx{processoptions}\Redstar & Process the listed options in the order in which they appear in the command \hx{\usepackage}, and copy \hx{\documentclass} options. \ltablenote{\ang{na} keys (see \sref{sec:processoption}).} \\\hline -\rownr & \fx{launch} & Launch the listed keys (see \sref{sec:launchingkeys}). \ltablenote{\keyval pairs.} \\\hline -\rownr & \fx{storevalue} & Store the value of \ang{key} in the given \ang{macro}. \ltablenote{\ang{key} and \ang{macro}, \eg, \ttx{keya}~\fx{\cmda}.} \\\hline -\rownr & \fx{printvalue} & Print the current value of \ang{key}. \ltablenote{\ang{key}, \eg, \ttx{keya}.}\\\hline -\rownr & \fx{addvalue} & Add the specified value to the current value of key. \ltablenote{\ang{key} and \ang{value} to assign.} \\\hline -\rownr & \fx{ifbool} & Test the state of a boolean key. This returns \ang{true} or \ang{false}. \ltablenote{\ang{key}, \eg, \ttx{keya}.}\\\hline -\rownr & \fx{ifdef} & Test if \ang{key} is currently defined on any of the given comma-separated multiple paths. This returns \ang{true} or \ang{false}. This is equivalent to \fx{ifkeyonpath}. \ltablenote{\ang{key}, \eg, \ttx{keya}.}\\\hline -\rownr & \fx{ifkeyonpath} & Test if \ang{key} is currently defined on any of the given comma-separated multiple paths. This returns \ang{true} or \ang{false}. This is synonymous with \fx{ifdef}. \ltablenote{\ang{key}, \eg, \ttx{keya}.}\\\hline -\rownr & \fx{disable} & Immediately disable the given keys. \ltablenote{The attribute is a comma-separated key list.} \\\hline -\rownr & \fx{disable}\Redstar & Disable the given keys at the hook \hx{\AtBeginDocument} and not immediately. \ltablenote{Comma-separated key list.}\\\hline -\rownr & \fx{keyhandler} or \fx{handler} & Unknown key handler.\useltablenote{pathkeys-flags-2}\\\hline -\rownr & \fx{optionhandler} & Unknown option handler (see \sref{sec:unknownkeyhandler}). Options are keys with a special default family. There might be a reason to handle unknown options separately from unknown keys.\\\hline -\rownr & \fx{normalcode} & The given code will simply be executed. Virtually any code can be the \ang{attrib} of this flag. This is the flag to use to, for example, change path within \fx{\pathkeys} command. It should be recalled that path changes within \fx{\pathkeys} command are limited in scope, since the current path is pushed upon entry into this command and popped on exit. -\end{tabularx} -\endgroup - -\begin{noteenv}* -\label{nte:pathkeys-flags} -The syntax for specifying keys to be defined by \fx{\pathkeys} is (see \sref{sec:declarekeys}) - -\start'{newmacro}[Syntax for defining keys in \pathkeys] -\pathkeys{|A(path)/|R(define): - |A(keytype)/|A(keyname)/|A(dft)/|A(cbk); - another set of key attributes; - etc. -} -\finish{newmacro} - -Here, the default list parser (\qsemicolon) is shown. This can be changed by using the package option \fx{keyparser}---see \sref{sec:packageoptions}. The default key value \ang{dft} and the callback \ang{cbk} can be absent in all cases. \ang{keytype} may be any member of the set \fnz{ord,cmd,sty,sty*,bool,choice}. The star (\redstar) in \quoted{sty\Redstar} has the same meaning as in \fx{\ltxkeys@stylekey} (\sref{sec:stylekeys}), namely, undefined dependants will be defined on the fly when the parent is set/executed. \aidx*{style keys (sty*)} - -\start{example}[Syntax for defining pathkeys] -|com(Define keys on only one path:) -\pathkeys{fam/subfam/subsubfam/|R(define): - cmd/keya/defaultval/\def\cmda#1{#1}; - bool/keyb/true; -} -|com(Define keys on multiple paths:) -\pathkeys{fam1/subfam1/subsubfam1,fam2/subfam2/subsubfam2,.../|R(define): - cmd/keya/defaultval/\def\cmda#1{#1}; - bool/keyb/true -} -\finish{example} - -Choice keys must have their names associated with their nominations (\ie, admissible values) in the format \keydotchoice{keyname}{nominations}, as below (see also \sref{sec:declarekeys}): - -\start'{newmacro}[Syntax for defining choice keys in \pathkeys] -|com(`keya' is a choice key with simple nominations and callback, while `keyb') -|com(is a choice key with complex nominations. The function \order is generated) -|com(internally by the package for choice keys. It means the numerical order of) -|com(of the nomination, starting from zero.) -\pathkeys{fam/subfam/subsubfam/|R(define): - choice/keya|boldreddot{left,right,center}/center/ - \edef\x{\ifcase\order 0\or 1\or 2\fi}; - choice/keyb|boldreddot{% - center/.do=\def\textalign{center}, - left/.do=\def\textalign{flushleft}, - |com(`.do=' can be omitted, as in:) - right/\def\textalign{flushright}, - justified/\let\textalign\relax - }/center/\def\x##1{##1xx#1} -} -\finish{newmacro} - -The \ang{na} keys, if they are present in the attribute of \fx{\pathkeys}, must always be given in square brackets \fx{[]}. They can come either before or after the \keyval list to be set in the current run. For example, - -\start{example}[`na' keys] -\pathkeys{fam/subfam/subsubfam/|R(define): - cmd/keya/xx/\def\cmda#1{#1}; - bool/keyb/true -} -|com(Set `keya' and ignore `keyb':) -\pathkeys{fam/subfam/subsubfam/|R(set): keya=zz,keyb=true [keyb]} -|com(or) -\pathkeys{fam/subfam/subsubfam/|R(set): [keyb] keya=zz,keyb=true} -\finish{example} - -See \sref{sec:options-pathkeys} for further examples of the use of ignored keys. Here we can see that a value is provided for \quoted{keyb} and yet we're ignoring the key. However, in practical applications it is often impossible to predict the subset of keys (among a set of them) that may be executed at any time by the user of the keys. Therefore, \ang{na} keys are much more useful than the above example demonstrates\@gobble{.} -\end{noteenv} - -Some of the commands associated with pathkeys are listed below. The abbreviation \ang{pk} means the full key path and key name, all separated by forward slash. - -\start+{newmacro}[\pathkeysval,\ifpathkeysval,\ifpathkeysvalTF, etc.] -|com(The following commands are expandable:) -\pathkeysval{|A(pk)} -\ifpathkeysval{|A(pk)} \then ... \else ... \fi -\ifpathkeysvalTF{|A(pk)}{|A(true)}{|A(false)} -|com(The following commands aren't expandable:) -\pathkeyskeyval{|A(pk)} -\ifpathkeyskeyval{|A(pk)} \then ... \else ... \fi -\ifpathkeyskeyvalTF{|A(pk)}{|A(true)}{|A(false)} -\pathkeysstorevalue{|A(pk)}|A(cmd) -\finish{newmacro} -\fxim*{\pathkeysval,\ifpathkeysval,\ifpathkeysvalTF,\pathkeyskeyval, - \ifpathkeyskeyval,\ifpathkeyskeyvalTF,\pathkeysstorevalue} - -The commands \ffx'{\pathkeysval, \pathkeyskeyval} simply yield the current value of the key. The commands \ffx'{\ifpathkeysval, \ifpathkeyskeyval}, which require \fx{\then} to form balanced conditionals, test the current state of the boolean key \ang{pk} in a \tex-like syntax. The commands \ffx'{\ifpathkeysvalTF, \ifpathkeyskeyvalTF} also test the current state of the boolean key \ang{pk} but return \ang{true} or \ang{false} in a \latex syntax. The command \fx{\pathkeysstorevalue} stores the current value of key \ang{pk} in the given command \ang{cmd}. - -\ltsnote -If called outside an assignment or document environment, the macros \ffx'{\pathkeysval, \pathkeyskeyval} can give \quoted{no document error}, to signify that a token has been output outside these situations. And one source of problem with \ffx'{\ifpathkeysval, \ifpathkeyskeyval} is to omit \fx{\then} after their argument. If you find yourself typing long key paths and the commands \ffx'{\pathkeysval, \pathkeyskeyval}, \eetc, repeatedly, there is help ahead on how to reduce the amount of typing required in using pathkeys. - -The following provide our first examples of pathkeys and a demonstration of some of the commands associated with pathkeys. - -\start+{example}[Pathkeys] -\pathkeys{fam/subfam/subsubfam/|R(define): - cmd/xwidth/\@tempdima/\def\y##1{#1yy##1}; - cmd/keya/\def\cmda#1{#1}; - bool/putframe/true -} -\pathkeys{fam/subfam/subsubfam/|R(set): putframe=true [keya]} -\pathkeys{fam/subfam/subsubfam/|R(ifdef): xwidth}{\def\x{T}}{\def\x{F}} -\pathkeys{fam/subfam/subsubfam,famx/subfamx/subsubfamx/|R(ifkeyonpath): xwidth} - {\def\x{T}}{\def\x{F}} -\pathkeys{fam/subfam/subsubfam/|R(print value): xwidth}=\z@pt -\pathkeys{fam/subfam/subsubfam/|R(store value): keya \cmd} -\pathkeys{fam/subfam/subsubfam/|R(add value): keya=\def\cmdb#1{#1}} -\pathkeysstorevalue{fam/subfam/subsubfam/putframe}\cmd -\edef\x{|R(\ifpathkeysvalTF){fam/subfam/subsubfam/putframe}{T}{F}} -\edef\x{|R(\ifpathkeysval) fam/subfam/subsubfam/putframe|R(\then) T\else F\fi} -\edef\x{|R(\ifpathkeysval) fam/subfam/subsubfam/putframe|R(\then) T\else F\fi} -|com(`xputframe' is undefined. What does the following return?) -\edef\x{|R(\pathkeysval){fam/subfam/subsubfam/xputframe}} -|com(Unknown key handler:) -\pathkeys{fam/subfam/subsubfam/|R(keyhandler): - |com(`#1' is the key's main path, `#2' is the subpaths combined,) - |com(`#3' is the key name, and `#4' is the current value of the key:) - \ltxkeys@warn{Unknown key `#3' with value `#4' ignored.}% -} -\pathkeys{fam/subfam/subsubfam/|R(disable|*): keya,keyb,keyc} -\finish{example} -\fxim*{unknown key handler in pathkeys} - - -\start+{example}[Pathkeys] -\pathkeys{KV/frame/framebox/|R(define*): - cmd/width/\textwidth/\def\x##1{#1xx##1}; - cmd/textcolor/black; - cmd/framecolor/black; - cmd/framesep/3\p@; - cmd/framerule/0.4\p@; - cmd/cornersize/20\p@; - choice/textalign.{% - center/.do=\def\ttextalign{center}, - left/.do=\def\ttextalign{flushleft}, - right/.do=\def\ttextalign{flushright} - }/center; - bool/putframe/true; - cmd/arga; - cmd/argb -} - -\newcommand*\myframebox[1][]{% -|com(Use `set' or `launch' here, but they don't have the same meaning:) - \pathkeys{KV/frame/framebox/|R(set):#1}% - \begingroup - \fboxsep\pathkeysval{KV/frame/framebox/framesep}% - \fboxrule\pathkeysval{KV/frame/framebox/framerule}\relax - \ltsdimdef\boxwidtha{% - \pathkeysval{KV/frame/framebox/width}-2\fboxsep-2\fboxrule - }% - \noindent\begin{lrbox}\@tempboxa - \begin{minipage}[c][\height][s]\boxwidtha - \@killglue - \begin\ttextalign - \textcolor{\pathkeysval{KV/frame/framebox/textcolor}}{% - Arg-1: \pathkeysval{KV/frame/framebox/arga} - \endgraf - Arg-2: \pathkeysval{KV/frame/framebox/argb}% - }% - \end\ttextalign - \end{minipage}% - \end{lrbox}% - \@killglue - \color{\pathkeysval{KV/frame/framebox/framecolor}}% - \ifpathkeysval{KV/frame/framebox/putframe}\then\ovalbox{\fi - \usebox\@tempboxa - \ifpathkeysval{KV/frame/framebox/putframe}\then}\fi - \endgroup -} - -\begin{document} -\myframebox[arga=Text-1,argb={Test text-2\\ ...\\test text-2}, - framerule=2pt,framecolor=blue,textcolor=purple, - putframe=true,textalign=right] -\end{document} -\finish{example} - - -\begin{noteenv} -When using pathkeys (and in general the commands \ffx'{\ltxkeysdefinekeys,\ltxkeysdeclarekeys}), there is a potential problem in deploying forward slashes in key defaults and macros without enclosing those slashes in curly braces. They will confuse the parser. Several solutions exist, including tweaking the relevant internal parser, but I haven't decided on the optimal solution to this possibility. For example, the following will fail: - -\start{example}[Forward slashes in key defaults and macros] -\pathkeys{fam/subfam/subsubfam/define*: - bool/keya/true/\ifpathkeysval fam/subfam/subsubfam/keya\then - \def\x{T}\else\def\x{F}\fi; -} -\finish{example} - -Its correct form is - -\start{example}[Forward slashes in key defaults and macros] -\pathkeys{fam/subfam/subsubfam/define*: - bool/keya/true/\ifpathkeysval|R({)fam/subfam/subsubfam/keya|R(})\then - \def\x{T}\else\def\x{F}\fi; -} -\finish{example} -\end{noteenv} - - -\docsubsection(sec:pathkeys-sametype)<pathkeys of common type> - {Defining pathkeys of common type} - -To define pathkeys of the same/one type (in the set \fnz{ord,cmd,sty,sty*,bool,choice}), simply put \quoted{(\ang{type})}, within the parenthesis, after \ang{flag} and omit \ang{keytype} in \ang{attrib}. For example, the following defines only boolean pathkeys: - -\start{example}[Pathkeys of the same type] -\pathkeys{fam/subfam/subsubfam/|R(define|*|(bool|)): - |com(No |ang(keytype) in the following specifications:) - keya/true/\ifpathkeysval|R({)fam/subfam/subsubfam/keya|R(})\then - \def\x{T}\else\def\x{F}\fi; - keyb/true/\ifpathkeysvalTF{fam/subfam/subsubfam/keyb} - {\def\x##1{##1}}{\def\x{F}} -} -\finish{example} - -And the following defines only command keys: - -\start{example}[Pathkeys of the same type] -\pathkeys{fam/subfam/|R(define|*|(cmd|)): - keya/keya-default/\def\cmda##1{##1}; - keyb/keyb-default -} -\finish{example} - - -\docsubsection(sec:pathkeys-shortcmds){Shortened pathkeys commands} - -As seen above, the estate for deploying pathkeys can be large when compared with the amount of typing required for conventional keys presented in the previous chapters. To reduce the estate, the first line of thought is to store any long path in a macro and call the macro instead of the path. The path is always fully expanded under safe actives. The following example demonstrates this approach. - -\start+{example}[Putting paths in macros] -\def\mypath{fam/subfam/subsubfam} -\pathkeys{\mypath/define: - cmd/xwidth/\@tempdima/\def\y##1{#1yy##1}; - cmd/keya/\def\cmda#1{#1}; - bool/putframe/true -} -\pathkeys{famx/subfamx,fam/subfam/ifkeyonpath: xwidth}{\def\x{T}}{\def\x{F}} -\pathkeys{famx/subfamx,\mypath/ifkeyonpath: xwidth}{\def\x{T}}{\def\x{F}} -\pathkeys{\mypath/set: putframe=true} -\pathkeys{\mypath/ifdef: xwidth}{\def\x{T}}{\def\x{F}} -\pathkeys{\mypath/print value: xwidth}=\z@pt -\pathkeysstorevalue{\mypath/putframe}\cmd -\pathkeysstorevalueof{\mypath/putframe}\cmda -\edef\x{\ifpathkeysvalTF{\mypath/putframe}{T}{F}} -\edef\x{\ifpathkeysval \mypath/putframe\then T\else F\fi} -\edef\x{\ifpathkeysval \mypath/putframe\then T\else F\fi} -\pathkeys{\mypath/add value: keya=\def\cmdb#1{#1}} -\finish{example} - -Instead of defining your own commands like the above \fx{\mypath}, you can use the following name-spaced commands: - -\start+{newmacro}[\pathkeysnewpath,\pathkeysusepaths, etc.] -\pathkeysnewpath{|A(pathname)}{|A(path)} -\pathkeysdefpath{|A(pathname)}{|A(path)} -\pathkeysassignpaths{|A(pathname-1)=|A(path-1),...,|A(pathname-n)=|A(path-n)} -\pathkeyschangepath{|A(pathname)}{|A(path)} -\pathkeysundefpaths{|A(pathname-1),|A(pathname-2),...,|A(pathname-n)} -\pathkeysundefpath{|A(pathname)} -\pathkeysgundefpaths{|A(pathname-1),|A(pathname-2),...,|A(pathname-n)} -\pathkeysgundefpath{|A(pathname)} -\pathkeysusepaths{|A(pathname-1),|A(pathname-2),...,|A(pathname-n)} -\pathkeysusepath{|A(pathname)} -\finish{newmacro} -\fxim*{\pathkeysnewpath,\pathkeysdefpath,\pathkeysassignpaths, \pathkeyschangepath,\pathkeysundefpaths, \pathkeysgundefpaths,\pathkeysusepaths} - -These commands have their own separate namespace. Internally, the plural forms of these commands are the same as their singular variants. Here, -\begin{enum} -\item After the definition of \ang{pathname}, it is used as an abbreviation for the full path \ang{path}. -\item The command \fx{\pathkeysnewpath} creates \ang{pathname} if it didn't already exist. -\item The command \fx{\pathkeysdefpath} creates \ang{pathname} whether or not it exists. -\item The command \fx{\pathkeyschangepath} is equivalent to \fx{\pathkeysdefpath}. -\item The commands \ffx'{\pathkeysundefpaths, \pathkeysgundefpaths} undefine the comma-separated list of \ang{pathnames} locally and globally, respectively. -\item The command \fx{\pathkeysassignpaths} defines a series of unique pathnames as shown by its use syntax above. The equality sign in that syntax is mandatory. Existing paths are not overwritten. -\item The commands \ffx'{\pathkeysusepaths,\pathkeysusepath} are synonymous and expand the comma-separated entries in \ang{pathnames} or \ang{pathname} to their full meaning. The action specified by \ang{flag} is then executed on all the listed paths. -\item The macros - \start{syntax} - \pathkeysnewpath \pathkeysdefpath \pathkeysassignpaths - \pathkeyschangepath \pathkeysundefpaths \pathkeysundefpath - \pathkeysgundefpaths \pathkeysgundefpath \pathkeysusepaths - \pathkeysusepath - \finish{syntax} - have shorter counterparts via the command \fx{\pathkeysuseshortcmds} (see \sref{tab:pathkeys-cmdabbrv}). -\end{enum} - -The macros \ffx'{\usepaths, \usepath}, which are available only within the \fx{\pathkeys} command, are synonymous with their longer variants. -%\endtrace - -\start+{example}[\pathkeysassignpaths, \pathkeysusepaths] -\pathkeysassignpaths{path1=fam/subfam/subsubfam1,path2=fam/subfam/subsubfam2} -|com(Define `keya' and `keyb' on paths 1 and 2:) -\pathkeys{|R(\usepaths){path1,path2}/define|R(*): - cmd/keya/xx/\def\cmda#1{#1}; - bool/keyb/true -} -|com(Check if `keya' is defined on either path 1 or 2:) -\pathkeys{|R(\usepaths){path1,path2}/ifkeyonpath: keya}{\def\x{T}}{\def\x{F}} -|com(\usepaths and \usepath aren't available outside \pathkeys:) -\pathkeysstorevalue{|R(\pathkeysusepath){path1}/keyb}\cmd -\edef\x{\ifpathkeysvalTF{|R(\pathkeysusepaths){path1}/keya}{T}{F}} - -|com(Force redefine `path1' and `path2':) -\pathkeysdefpath{path1}{fam/subfam/subsubfam1} -\pathkeysdefpath{path2}{fam/subfam/subsubfam2} -|com(Define `key1' on `path1' and `path2':) -\pathkeys{|R(\usepaths){path1,path2}/define: - cmd/key1/12cm/\def\y##1{#1yy##1} -} -|com(Set keys on `path1' and `path2' and put undefined keys in the `rm list') -|com(instead of raising errors:) -\pathkeys{|R(\usepaths){path1,path2}/|R(set*+): - key1=10cm,key2=true,key3=xx -} -|com(Set `rm keys' and again put undefined keys in the `rm list') -|com(instead of raising errors:) -\pathkeys{|R(\usepaths){path1,path2}/|R(setrm*+):} -\finish{example} - -The shortened counterparts of the pathkeys commands are provided in \sref{tab:pathkeys-cmdabbrv}. The abbreviated commands become available only after the user has invoked the macro \fx{\pathkeysuseshortcmds} (or \fx{\pathkeysuseshortnames}), which expects no argument. The abbreviations-building macro \fx{\pathkeysuseshortcmds} has only local effect, \ie, the abbreviations may be localized to a group. The abbreviations are defined only if they're definable (\ie, didn't exist before calling the command \fx{\pathkeysuseshortcmds})\footnote{The user can introduce his own abbreviations using the command \ftfx{\pathkeysmakeshortcmds}.}. - -\begingroup\small -\begin{tabularx}{\linewidth}{|p{4cm}|p{2.25cm}|p{4cm}|p{2.25cm}|} -\caption{Pathkeys command abbreviations\xwmlabel{tab:pathkeys-cmdabbrv}}\\\hline -\rowcolor{pink} -\bf Command & \bf Abbreviation & \bf Command & \bf Abbreviation\\\hline -\endfirsthead -\hline -\multicolumn{4}{|l|}{\emph{Continued from last page}}\\\hline -\bf Command & \bf Abbreviation & \bf Command & \bf Abbreviation\\\hline -\endhead -\multicolumn{4}{|r|}{\emph{Continued on next page}}\\\hline -\endfoot -\hline -\endlastfoot -\fx{\pathkeysval} & \fx{\pkv} & \fx{\pathkeyskeyval} & \fx{\pkkv} \\\hline -\fx{\ifpathkeysval} & \fx{\ifpkv} & \fx{\ifpathkeyskeyval} & \fx{\ifpkkv} \\\hline -\fx{\ifpathkeysvalTF} & \fx{\ifpkvTF} & \fx{\ifpathkeyskeyvalTF} & \fx{\ifpkkvTF} \\\hline -\fx{\pathkeysnewpath} & \fx{\newpath} & \fx{\pathkeysdefpath} & \fx{\defpath} \\\hline -\fx{\pathkeyschangepath} & \fx{\changepath} & \fx{\pathkeysassignpaths} & \fx{\assignpaths} \\\hline -\fx{\pathkeysundefpaths} & \fx{\undefpaths} & \fx{\pathkeysundefpath} & \fx{\undefpath} \\\hline -\fx{\pathkeysgundefpaths} & \fx{\gundefpaths} & \fx{\pathkeysgundefpath} & \fx{\gundefpath} \\\hline -\fx{\pathkeysusepath} & \fx{\usepath} & \fx{\pathkeysusepaths} & \fx{\usepaths} \\\hline -\end{tabularx} -\endgroup - -The user isn't constrained to use the short form commands of \sref{tab:pathkeys-cmdabbrv}. He can define his own short forms by using the command \fx{\pathkeysmakeshortcmds}, which has the syntax: - -\start{newmacro}[\pathkeysmakeshortcmds] -\pathkeysmakeshortcmds{|A(short-1)=|A(long-1), ..., |A(short-n)=|A(long-n)} -\finish{newmacro} - -where \ang{short-i} and \ang{long-i} are the short (new) and long (existing) aliases of the command \ang{i}. The \eqsign is mandatory here. You don't have to (in fact, you shouldn't) call \fx{\pathkeysuseshortcmds} after calling \fx{\pathkeysmakeshortcmds}. - -\start{example}[\pathkeysmakeshortcmds] -\pathkeysmakeshortcmds{\kval=\pathkeyskeyval,\ifkvalTF=\ifpathkeyskeyvalTF} -\finish{example} - - -\docsubsection(sec:pathkeys-dftpath){Default and current paths} - -We begin the section with a note of caution: path changes within the \fx{\pathkeys} command are limited in scope, since the current path is pushed upon entry into this command and popped on exit. To change the current path while in \fx{\pathkeys} command, use the \fx{normalcode} flag of \sref{tab:flags}. - -\start+{newmacro}[\pathkeyscurrentpath, etc.] -\pathkeysaddtodefaultpath{|A(path)} -\pathkeyschangedefaultpath{|A(path)} -\pathkeyscurrentpath{|A(path)} -\pathkeysusedefaultpath -\pathkeyspushcurrentpath -\pathkeyspopcurrentpath -\pathkeyspathhistory -\finish{newmacro} -\fxim*{\pathkeysaddtodefaultpath,\pathkeyschangedefaultpath, - \pathkeyscurrentpath,\pathkeysusedefaultpath,\pathkeyspushcurrentpath, - \pathkeyspopcurrentpath,\pathkeyspathhistory} - -If the key path is empty, then the current path will be used. If there is no current path, the default path will be used, \emph{but only after the user has issued \fx{\pathkeysusedefaultpath}}. The default path is \quotedfx{pathkeys@default@main/pathkeys@default@sub}. The default path can be made the current path by invoking the command \fx{\pathkeysusedefaultpath}, which is parameterless. The default path can be changed by the one-parameter commands \ffx'{\pathkeysaddtodefaultpath, \pathkeyschangedefaultpath}. - -The current path can be declared by providing an argument to the non-expandable one-parameter command \fx{\pathkeyscurrentpath}. The declared current path will be available in the macro \fx{\pathkeyscurrentpathtext}, which is expandable. \emph{A call to \fx{\pathkeyscurrentpath} immediately changes the current path}. The internal macro \fx{\pathkeyscurrentpathtext} always holds the current path. It is possible for the user to change \fx{\pathkeyscurrentpathtext} directly, but this is not recommended, since it will not allow the path history to be revised. That is why \fx{\pathkeyscurrentpathtext} doesn't look like a user command. For example, the following assignment is possible but not advisable: - -\start{syntax}[\pathkeyscurrentpathtext] -\let\pathkeyscurrentpathtext=\pathkeysdefaultpath -\finish{syntax} -\fxi*{\pathkeyscurrentpathtext} - -This should only be done via \fx{\pathkeysusedefaultpath}. - -If you change the default path by calling any of the commands \ffx'{\pathkeysaddtodefaultpath, \pathkeyschangedefaultpath}, you will have to call \fx{\pathkeysusedefaultpath} to update \fx{\pathkeyscurrentpathtext}. For some reason, this is not done automatically. - -It isn't mandatory, but it is useful, to first push the prevailing path before changing it. This can be done by calling the parameterless command \fx{\pathkeyspushcurrentpath}. When you're done with the current path, you can revert to the path before the current path by calling the command \fx{\pathkeyspopcurrentpath}. You can get the entire history of path changes from the container \fx{\pathkeyspathhistory}, which is useful in complex situations. However, it should be noted that \fx{\pathkeyspathhistory} doesn't contain a chronological order of path changes: if a path is already contained in it, it wouldn't be added again. Also, \fx{\pathkeyspathhistory} is built and revised globally: path changes in local groups will appear in \fx{\pathkeyspathhistory} outside the groups. The commands \ffx'{\pathkeysundefpaths, \pathkeysgundefpaths} don't affect this behavior. - -I can't see a user need for it, but you can use the command \fx{\pathkeysifnopath} to ascertain if a given \ang{path} actually contains a valid path. This is used internally. - -\start{newmacro}[\pathkeysifnopath] -\pathkeysifnopath{|A(path)}{|A(true)}{|A(false)} -\finish{newmacro} -\fxim*{\pathkeysifnopath} - -Before the current path is resorted to (\ie, used), the path specified in the the commands \ffx{\pathkeys, \pathkeysval, \ifpathkeysval}, \eetc must be empty (\ie, no main and no subs). Therefore, in any given setting, the path that is dominant can be made current so that it isn't given in \ffx{\pathkeys, \pathkeysval, \ifpathkeysval}, \eetc. The non-dominant paths could then be listed in full. Of course, there can't be more than one current path. Perhaps a better approach is to use \ffx{\pathkeysnewpath, \pathkeysusepaths}, etc. - -\start+{example}[\pathkeyscurrentpath, etc.] -\newcommand*\myframebox[1][]{% - |R(\pathkeyscurrentpath){KV/frame/framebox}% - \pathkeys{launch:#1}% - \begingroup - |R(\pathkeysuseshortcmds) - \fboxsep\pkv{framesep}\fboxrule\pkv{framerule}\relax - \ltsdimdef\boxwidtha{\pkv{width}-2\fboxsep-2\fboxrule}% - \noindent\begin{lrbox}\@tempboxa - \begin{minipage}[c][\height][s]\boxwidtha - \@killglue - \begin\ttextalign - \textcolor{\pkv{textcolor}}{Arg-1: \pkv{arga}\endgraf Arg-2: \pkv{argb}}% - \end\ttextalign - \end{minipage}% - \end{lrbox}% - \@killglue - \color{\pkv{framecolor}}% - \ifpkv{putframe}\then\ovalbox{\fi - \usebox\@tempboxa - \ifpkv{putframe}\then}\fi - \endgroup -} - -\begin{document} -\myframebox[arga=Text-1,argb={Test text-2\\ ...\\test text-2}, - framerule=2pt,framecolor=blue,textcolor=purple, - putframe=true,textalign=right] -\end{document} -\finish{example} - -\start+{example}[Tiling with pathkeys] -\documentclass{article} -\usepackage{atbegshi,picture,graphicx,ifpdf} -\usepackage{pathkeys} -\makeatletter -\pathkeys{wallpaper/fam/|R(define*|(cmd|)): - viewport/00 00 100 100; - xtilenr/2; - ytilenr/2; - wpxoffset/0pt; - wpyoffset/0pt; - inputpath// -} -\newcommand*\mytilewallpaper[2][]{% - \begingroup - \pathkeyscurrentpath{wallpaper/fam}% - \pathkeys{set:#1}% - \pathkeysuseshortcmds - \edef\ffileext{\ifpdf pdf\else eps\fi}% - \edef\reserved@a{\pkv{inputpath}}% - \edef\reserved@a{\expandafter\ltxkeysstripallouterbraces - \expandafter{\reserved@a}}% - \edef\Ginput@path{\ifcsemptyTF\reserved@a{}{{\reserved@a/}}}% - \ltsdimdef\tilewidth{|(\paperwidth-\pkv{wpxoffset}*2|)/\pkv{xtilenr}}% - \ltsdimdef\tileheight{|(\paperheight-\pkv{wpyoffset}*2|)/\pkv{ytilenr}}% - \ltsdimdef\tileY{-\paperheight+\pkv{wpyoffset}}% - \@tempcntb\z@ - \ltswhilenum\@tempcntb<\pkv{ytilenr}\do{% - \edef\tileX{\pkv{wpxoffset}}% - \@tempcnta\z@ - \ltswhilenum\@tempcnta<\pkv{xtilenr}\do{% - \leavevmode\@killglue - \ltsexpanded{\noexpand\put|(\tileX,\tileY|){\noexpand\includegraphics - [viewport=\pkv{viewport},height=\tileheight,width=\tilewidth,clip]% - {#2.\ffileext}}}% - \advance\@tempcnta\@ne - \ltsdimadd\tileX{\tilewidth}% - }% - \advance\@tempcntb\@ne - \ltsdimadd\tileY{\tileheight}% - }% - \endgroup -} -\makeatother - -\begin{document} -\def\wpspec{[viewport=20 21 590 400,xtilenr=4,ytilenr=4, - wpxoffset=2cm,wpyoffset=2cm,inputpath={./graphics}]{comet1}} -\AtBeginShipout{% - \AtBeginShipoutUpperLeft{% - \ifnumoddTF\thepage{}{\expandafter\mytilewallpaper\wpspec}% -}} -x -\end{document} -\finish{example} - - -\docsubsection(sec:nestedpathkeys){Nested pathkeys} - -The command \fx{\pathkeys} can be nested, as the following example shows: - -\start{example}[Nested pathkeys] -\def\mypath{fam/subfam/subsubfam} -|R(\pathkeys){\mypath/define: - cmd/xwidth/\@tempdima/\def\y##1{#1yy##1}; - |com(The default, not callback, of `keya' is \def\cmda#1{#1}. The key) - |com(has no callback:) - cmd/keya/\def\cmda#1{#1}; - |com(The callback of `keyb' says ``if `keyb' is `true', define `keyc''':) - bool/keyb/true/ - |R(\pathkeys){\mypath/ifbool: keyb}{% - |R(\pathkeys){\mypath/define: cmd/keyc/xx/\def\cmdc####1{####1#1}} - }{ - |com(`keyd' has no callback:) - |R(\pathkeys){\mypath/define: choice/keyd.{yes,no}/yes} - } -} -\pathkeys{\mypath/set: keyb=true} -\finish{example} - -Try to find out why the following produces an error: - -\start{example}[Nested pathkeys] -\def\mypath{fam/subfam/subsubfam} -|R(\pathkeys){\mypath/define: - cmd/keya/keyadefault/ - |R(\pathkeys){\mypath/define|*: cmd/keyb/xx/\def\cmdb####1{####1}}; -} -\pathkeys{\mypath/set: keya=bbb} -\finish{example} - -The reason is that \ttx{keyb} was defined when the default was being set up for \ttx{keya} after the definition of \ttx{keya}. The second setting of \ttx{keya} prompts an error that \ttx{keyb} is being redefined. Notice that \ttx{keyb} is to be defined uniquely by the flag \fx{define}\Redstar. To avoid this type of error, you may consider removing \redstar from \fx{define}\Redstar. - - -\docsubsection(sec:options-pathkeys){Pathkeys as class or package options} - -To use the command \fx{\pathkeys} for declaring class or package options, the user should simply call \fx{\pathkeys} with the flag \fx{declareoptions} (or \fx{declareoptions}\Redstar for defining only unique options). The flags \ffx'{executeoptions, processoptions, processoptions}\Redstar can be used to execute and process options, respectively. In this respect, although not necessary, you may want to change the default or current path to reflect the class file or package name. - -\start{example}[Declaring and processing options] -\ProvidesPackage{mypackage}[2011/11/11 v0.1 My test package] -\pathkeysnewpath{mypath}{mypackage/myfunc/myfunckeys} -|com(Declare three unique options:) -\pathkeys{\pathkeysusepath{mypath}/|R(declareoptions)|*: - cmd/opt1/12cm/\def\y##1{#1yy##1}; - bool/opt2/true/\ifpathkeysval{\pathkeysusepaths{mypath}/opt2}\then - \def\x{T}\else\def\x{F}\fi; - ord/opt3/zz/\def\z##1{#1zz##1} -} -|com(Set up defaults for options `opt1' and `opt2', ignoring option `opt3':) -\pathkeys{\pathkeysusepaths{mypath}/|R(executeoptions): - opt1=10cm,opt2=true,opt3=yy [opt3] -} -|com(Ignore `opt1' when processing options:) -\pathkeys{\pathkeysusepath{mypath}/|R(processoptions)|*: [opt1]} - -\documentclass[opt1=2cm,opt2=false]{article} -\usepackage[opt3=somevalue]{mypackage} -\finish{example} - - -\docsubsection(sec:classes-pathkeys)<classes in pathkeys> - {\headquoted{Classes} in \headfx{pathkeys} command} - -The \fx{\pathkeys} command indeed can accommodate \quoted{classes}. This is one of its advantages. Each class is made up of one unit of \ang{paths}, \ang{flag} and \ang{attrib}, as in - -\start+{newmacro}[A single classes in \pathkeys] -\pathkeys|*[|A(classparser)]{|A(paths)/|A(flag)|R(:) |A(attrib)} -\finish{newmacro} -\fxi*{\pathkeys} - -The \stform of \fx{\pathkeys} expects a macro that contains the given classes. It will expand the given macro once before processing its contents further. The optional argument \ang{classparser} is the class list parser/separator (see below)\footnote{The default list parser for \ang{attrib} remains \qsemicolon. This too can be changed via the package option \ftfx{keyparser} (see \sref{tab:pkgoptions}).}. The default list parser for classes is double bar \quotedfx{||}, but this can be changed, within limits, by the user. It can be changed to one or a combination of characters that aren't in the set \fx{{,;:@|/}}. Active bars that are list parsers will be normalized internally. Those bars that aren't list parsers will be left intact. - -The following is the syntax for multiple classes in \fx{\pathkeys}: - -\start+{newmacro}[Classes in \pathkeys] -\pathkeys|*[|A(classparser)]{ - |A(paths-1)/|A(flag-1)|R(:) |A(attrib-1) |dbar - |A(paths-2)/|A(flag-2)|R(:) |A(attrib-2) |dbar - ... |dbar - |A(paths-n)/|A(flag-n)|R(:) |A(attrib-n) -} -\finish{newmacro} - -Here, \ang{attrib-1} will be executed on all the paths listed in \ang{paths-1}, \ang{attrib-2} on all of \ang{paths-2}, \eetc. - -\start+{example}[Classes in \pathkeys] -\ltxkeys@options{endcallbackline=true} -\pathkeys{ - |com(Define command keys `keya' and `keyb' on path `fam1/subfam1':) - |R(fam1/subfam1/define*|(cmd|)): - keya/keya-default/\def\cmda##1{##1}; - keyb/keyb-default - |dbar - |com(Define boolean keys `keyc' and `keyd' on path `fam1/subfam1':) - |R(fam1/subfam1/define*|(bool|)): - keyc/true/\ifpathkeysval{fam1/subfam1/keyc}\then\def\cmdb##1{##1}\fi; - keyd/true - |dbar - |com(Define command option `opt1' on path `options1/suboptions1':) - |R(options1/suboptions1/declareoptions|(cmd|)): - opt1/{default-arg1,default-arg2}/ - |com(The boolean `\ifpathkeys@dec' is true when keys are being defined,) - |com(and false otherwise. It requires \then to follow it. In its place,) - |com(you can use `\ifltxkeys@dec', which requires no \then.) - |com(`\argpattern' is introduced in |sref(sec:weirdargs).) - |R(\argpattern){#1,#2} - \ifpathkeys@dec\then\else - \def\cmda##1{#1***##1} - \def\cmdb##1{#2+++##1} - \fi; - |dbar - |com(Set `keya' and `keyc' on path `fam1/subfam1'; ignore `keyb':) - |R(fam1/subfam1/set): keya=xx, keyb=yy, keyc=false [keyb] - |dbar - |com(Set 2-argument `opt1' on path `options1/suboptions1':) - |R(options1/suboptions1/set): opt1={x,y} - |dbar - |com(Change current path to `fam2/subfam2' and define command \cmde:) - |R(normalcode): - \pathkeyscurrentpath{fam2/subfam2} - \def\cmde##1{x##1x} - |dbar - |com(Define command keys `keya' and `keyb' on current path `fam2/subfam2':) - |R(define|(cmd|)): - keya/keya-default/\def\cmda##1{##1}; - keyb/keyb-default - |dbar - |com(Set `keya' and `keyb' on current path `fam2/subfam2':) - |R(set): keya=ww, keyb=zz - |dbar - |com(Define `keya' and `keyb' on paths `fam3/subfam3' and `fam4/subfam4':) - |R(fam3/subfam3,fam4/subfam4/define): - cmd/keya/keya-default/\def\cmda##1{##1}; - |com(What is the problem with the next definition? This illustrates) - |com(a point of caution about defining keys on multiple paths. When) - |com(setting `keyb' on path `fam4/subfam4', we will be executing its) - |com(callback on path `fam3/subfam3':) - bool/keyb/true/\ifpathkeysvalTF{fam3/subfam3/keyb}{\def\x{T}}{\def\x{F}} - |dbar - |com(Define the following keys on paths `fam1/subfam1' and `fam2/subfam2':) - fam1/subfam1,fam2/subfam2/define*: - choice/boxalign.{% - center/.do=\def\ttextalign{center}\def\cmd##1{#1xx##1}, - left/.do=\def\ttextalign{flushleft}, - right/.do=\def\ttextalign{flushright} - }/center; - bool/putframe/true; - cmd/boxlength/2cm; - ord/boxheight/1.5cm -} -\finish{example} - -It should be recalled that path changes within \fx{\pathkeys} command are limited in scope, since the current path is pushed upon entry into this command and popped on exit. - \docsection(sec:weirdargs){Keys with argument patterns} \quoted{Argument pattern} simply means the structure of the arguments that a key's macro expects in order to execute the key's callback. In \pkg'{ltxkeys} it is possible to specify the nature of the parameter pattern for the key macro, but this makes sense only in the case of ordinary (\fx{ord}), command (\fx{cmd}) and style (\fx{sty} or \fx{sty}\Redstar) keys. Boolean and choice keys can't have weird (\ie, multiple or delimited) arguments, since their expected values are restricted: boolean keys must have a value of either \hx{true} or \hx{false}, and choice keys must have \quoted{nominations}, \ie, admissible or alternate values. Therefore, the concept introduced in this section applies only to the following key-definition commands: \start+{macro}[Key-definition commands that can have argument pattern] -\ltxkeys@ordkey \ltxkeys@newordkey -\ltxkeys@ordkeys \ltxkeys@newordkeys -\ltxkeys@cmdkey \ltxkeys@newcmdkey -\ltxkeys@cmdkeys \ltxkeys@newcmdkeys -\ltxkeys@stylekey \ltxkeys@newstylekey -\ltxkeys@stylekeys \ltxkeys@newstylekeys -\ltxkeysdefinekeys (only when defining cmd keys) +\ltxkeysordkey \ltxkeysnewordkey +\ltxkeysordkeys \ltxkeysnewordkeys +\ltxkeyscmdkey \ltxkeysnewcmdkey +\ltxkeyscmdkeys \ltxkeysnewcmdkeys +\ltxkeysstylekey \ltxkeysnewstylekey +\ltxkeysstylekeys \ltxkeysnewstylekeys +\ltxkeysdeclarekeys (only when defining cmd keys) \ltxkeysdeclarekeys (only when defining ord, cmd, sty keys) -\pathkeys (only when defining ord, cmd, sty keys) \finish{macro} -\fxi*{\ltxkeys@ordkey,\ltxkeys@newordkey,\ltxkeys@ordkeys,\ltxkeys@newordkeys, -\ltxkeys@cmdkey,\ltxkeys@newcmdkey,\ltxkeys@cmdkeys,\ltxkeys@newcmdkeys, -\ltxkeys@stylekey,\ltxkeys@newstylekey,\ltxkeys@stylekeys,\ltxkeys@newstylekeys, -\ltxkeysdefinekeys,\ltxkeysdeclarekeys} +\fxi*{\ltxkeysordkey,\ltxkeysnewordkey,\ltxkeysordkeys,\ltxkeysnewordkeys, +\ltxkeyscmdkey,\ltxkeysnewcmdkey,\ltxkeyscmdkeys,\ltxkeysnewcmdkeys, +\ltxkeysstylekey,\ltxkeysnewstylekey,\ltxkeysstylekeys,\ltxkeysnewstylekeys, +\ltxkeysdeclarekeys,\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: \start{example}[Key callback with multiple arguments] -\ltxkeys@ordkey[KV]{fam}{textsize}[{2cm,8cm}]{% +\ltxkeysordkey[KV]{fam}{textsize}[{2cm,8cm}]{% |com(Since `ltxkeys' package preserves outer braces in values of keys,) |com(first strip any possible outer braces from the key's value:) \ltsstripallouterbraces{#1}\reserved@a @@ -3055,7 +2218,7 @@ When using the \pkg'{xkeyval} it is indirectly possible to submit multiple argum With the \pkg'{ltxkeys} this can be achieved directly as follows: \start{example}[Key callback with multiple arguments] -\ltxkeys@ordkey[KV]{fam}{textsize}[{2cm,8cm}]{% +\ltxkeysordkey[KV]{fam}{textsize}[{2cm,8cm}]{% |R(\argpattern){#1,#2} \textwidth=#1 \textheight=#2\relax } \ltxkeyssetkeys[KV]{fam}{textsize={4cm,10cm}} @@ -3063,10 +2226,10 @@ 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 macros \ffx'{\ltxkeysdefinekeys, \ltxkeysdeclarekeys, \pathkeys}: 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 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. \start+{example}[Key callback with multiple arguments] -\ltxkeys@cmdkey[KV]{fam}[mp@]{keya}[{default1 and default2}]{% +\ltxkeyscmdkey[KV]{fam}[mp@]{keya}[{default1 and default2}]{% |R(\argpattern){#1 and #2}\def\z##1{#1xx##1xx#2} } \ltxkeyssetkeys[KV]{fam}{keya={arg1 and arg2}} @@ -3086,10 +2249,10 @@ The same principles apply when using the macros \ffx'{\ltxkeysdefinekeys, \ltxke \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{\ltxkeys@stylekeys} will define and initialize dependant keys on the fly. +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. \start+{example}[Style key callback with multiple arguments] -\ltxkeys@stylekeys|*[KV]{fam}[mp@]{keya}[{left right center}]|(% +\ltxkeysstylekeys|*[KV]{fam}[mp@]{keya}[{left right center}]|(% ord/keyb/\parentval/|R(\argpattern){#1,#2}\edef\y{\expandcsonce{#1}#2}; ord/keyc/\KV@fam@keya@value/|R(\argpattern){#1,#2}\def\y##1{#1xx##1xx#2}; cmd/keyd/{center} @@ -3165,12 +2328,12 @@ The command \fx{\ltxkeysiffound} trims leading and trailing spaces around the to \docsubsection(sec:ifpattern){Does a given pattern exist in the meaning of a macro?} -\start{newmacro}[\ltxkeys@ifpattern] -\ltxkeys@ifpattern{|A(teststr)}|A(cmd){|A(true)}{|A(false)} +\start{newmacro}[\ltxkeysifpatternTF] +\ltxkeysifpatternTF{|A(teststr)}|A(cmd){|A(true)}{|A(false)} \finish{newmacro} -\fxim*{\ltxkeys@ifpattern} +\fxim*{\ltxkeysifpatternTF} -The command \fx{\ltxkeys@ifpattern} 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{\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. \docsubsection(sec:ltxkeysifcase) @@ -3246,24 +2409,24 @@ Here, \ang{nomatch} is returned when the test fails in all cases. For the sake o \docsubsection(sec:ifincsvlist){Is the number of elements from a sublist found in a csv list $\ge n$?} -\start{newmacro}[\ltxkeys@ifincsvlistTF] -\ltxkeys@ifincsvlistTF[A(parser)]|(|A(nr)|){|A(sub)}{|A(main)}{|A(true)}{|A(false)} -\ltxkeys@ifincsvlistTF|*[A(parser)]|(|A(nr)|){|A(sub)}{|A(main)}{|A(true)}{|A(false)} +\start{newmacro}[\ltxkeysifincsvlistTF] +\ltxkeysifincsvlistTF[A(parser)]|(|A(nr)|){|A(sub)}{|A(main)}{|A(true)}{|A(false)} +\ltxkeysifincsvlistTF|*[A(parser)]|(|A(nr)|){|A(sub)}{|A(main)}{|A(true)}{|A(false)} \finish{newmacro} -\fxim*{\ltxkeys@ifincsvlistTF} +\fxim*{\ltxkeysifincsvlistTF} -The command \fx{\ltxkeys@ifincsvlistTF} checks if the number of elements of \ang{parser}-separated (csv) list \ang{sub} found in \ang{main} is equal or greater than \ang{nr}. The argument \ang{main} is the main list and \ang{sub} is the sublist of test strings. Normally, \ang{sub} will be a user input and \ang{main} the list of nominations. Neither \ang{main} nor \ang{sub} is expanded in the test. If the test is true, \fx{\ltxkeys@itemspresent} returns all the elements found, \fx{\ltxkeys@nritems} returns the number of elements found, and \ang{true} is executed. If the test fails, \fx{\ltxkeys@itemspresent} returns empty, \fx{\ltxkeys@nritems} returns $-1$, and \ang{false} is executed. The \stform of \fx{\ltxkeys@ifincsvlistTF} will turn both input and nominations to lowercase before the test. The default values of the optional list \ang{parser} and the optional number of elements to find \ang{nr} are \qcomma and $1$, respectively. +The command \fx{\ltxkeysifincsvlistTF} checks if the number of elements of \ang{parser}-separated (csv) list \ang{sub} found in \ang{main} is equal or greater than \ang{nr}. The argument \ang{main} is the main list and \ang{sub} is the sublist of test strings. Normally, \ang{sub} will be a user input and \ang{main} the list of nominations. Neither \ang{main} nor \ang{sub} is expanded in the test. If the test is true, \fx{\ltxkeysitemspresent} returns all the elements found, \fx{\ltxkeysnritems} returns the number of elements found, and \ang{true} is executed. If the test fails, \fx{\ltxkeysitemspresent} returns empty, \fx{\ltxkeysnritems} returns $-1$, and \ang{false} is executed. The \stform of \fx{\ltxkeysifincsvlistTF} will turn both input and nominations to lowercase before the test. The default values of the optional list \ang{parser} and the optional number of elements to find \ang{nr} are \qcomma and $1$, respectively. \docsubsection(sec:ifintsvlist){Is the number of elements from a sublist found in a tsv list $\ge n$?} -\start{newmacro}[\ltxkeys@ifintsvlistTF] -\ltxkeys@ifintsvlistTF|(|A(nr)|){|A(sub)}{|A(main)}{|A(true)}{|A(false)} -\ltxkeys@ifintsvlistTF|*|(|A(nr)|){|A(sub)}{|A(main)}{|A(true)}{|A(false)} +\start{newmacro}[\ltxkeysifintsvlistTF] +\ltxkeysifintsvlistTF|(|A(nr)|){|A(sub)}{|A(main)}{|A(true)}{|A(false)} +\ltxkeysifintsvlistTF|*|(|A(nr)|){|A(sub)}{|A(main)}{|A(true)}{|A(false)} \finish{newmacro} -\fxim*{\ltxkeys@ifintsvlistTF} +\fxim*{\ltxkeysifintsvlistTF} -The command \fx{\ltxkeys@ifintsvlistTF} checks if the number of elements of nonparser-separated (tsv) list \ang{sub} found in \ang{main} is equal or greater than \ang{nr}. The argument \ang{main} is the main list and \ang{sub} is the sublist of test strings. Normally, \ang{sub} will be a user input and \ang{main} the list of nominations. Neither \ang{main} nor \ang{sub} is expanded in the test. If the test is true, \fx{\ltxkeys@itemspresent} returns all the elements found, \fx{\ltxkeys@nritems} returns the number of elements found, and \ang{true} is executed. If the test fails, \fx{\ltxkeys@itemspresent} returns empty, \fx{\ltxkeys@nritems} returns $-1$, and \ang{false} is executed. The \stform of \fx{\ltxkeys@ifintsvlistTF} will turn both input and nominations to lowercase before the test. +The command \fx{\ltxkeysifintsvlistTF} checks if the number of elements of nonparser-separated (tsv) list \ang{sub} found in \ang{main} is equal or greater than \ang{nr}. The argument \ang{main} is the main list and \ang{sub} is the sublist of test strings. Normally, \ang{sub} will be a user input and \ang{main} the list of nominations. Neither \ang{main} nor \ang{sub} is expanded in the test. If the test is true, \fx{\ltxkeysitemspresent} returns all the elements found, \fx{\ltxkeysnritems} returns the number of elements found, and \ang{true} is executed. If the test fails, \fx{\ltxkeysitemspresent} returns empty, \fx{\ltxkeysnritems} returns $-1$, and \ang{false} is executed. The \stform of \fx{\ltxkeysifintsvlistTF} will turn both input and nominations to lowercase before the test. Normally, tsv-matching requires that the test strings in \ang{sub} are unique in the nominations \ang{main}. Some caution is, therefore, necessary when dealing with tsv lists. @@ -3271,30 +2434,30 @@ Normally, tsv-matching requires that the test strings in \ang{sub} are unique in \docsubsection(sec:ifeltcount) {Is the number of elements in a csv list $\ge n$ or $\le n$?} -\start{newmacro}[\ltxkeys@ifeltcountTF] -\ltxkeys@ifeltcountTF[|A(parser)]|(|A(rel)|){|A(nr)}{|A(list)}{|A(true)}{|A(false)} -\ltxkeys@ifeltcountTF|*[|A(parser)]|(|A(rel)|){|A(nr)}{|A(listcmd)}{|A(true)}{|A(false)} +\start{newmacro}[\ltxkeysifeltcountTF] +\ltxkeysifeltcountTF[|A(parser)]|(|A(rel)|){|A(nr)}{|A(list)}{|A(true)}{|A(false)} +\ltxkeysifeltcountTF|*[|A(parser)]|(|A(rel)|){|A(nr)}{|A(listcmd)}{|A(true)}{|A(false)} \finish{newmacro} -\fxim*{\ltxkeys@ifeltcountTF} +\fxim*{\ltxkeysifeltcountTF} -The command \fx{\ltxkeys@ifeltcountTF} checks if the number of elements in \ang{parser}-separated list \ang{list} has relation \ang{rel} ($>=<$) with number \ang{nr}. If the test is true, \ang{true} is executed, otherwise \ang{false} is executed. The \stform of \fx{\ltxkeys@ifeltcountTF} will expand \ang{listcmd} once before the test. Double parsers and empty entries in \ang{list} are ignored. The default values of the optional list \ang{parser} and the optional relational type \ang{rel} are \qcomma and \quoted{$=$}, respectively. The number \ang{nr} is a mandatory argument. +The command \fx{\ltxkeysifeltcountTF} checks if the number of elements in \ang{parser}-separated list \ang{list} has relation \ang{rel} ($>=<$) with number \ang{nr}. If the test is true, \ang{true} is executed, otherwise \ang{false} is executed. The \stform of \fx{\ltxkeysifeltcountTF} will expand \ang{listcmd} once before the test. Double parsers and empty entries in \ang{list} are ignored. The default values of the optional list \ang{parser} and the optional relational type \ang{rel} are \qcomma and \quoted{$=$}, respectively. The number \ang{nr} is a mandatory argument. The following example returns \ang{false} (\ie, \fx{\meaning\x -> F}). -\start{example}[\ltxkeys@ifeltcountTF] -\ltxkeys@ifeltcountTF[;]|(<|){2}{a;b;c}{\def\x{T}}{\def\x{F}} +\start{example}[\ltxkeysifeltcountTF] +\ltxkeysifeltcountTF[;]|(<|){2}{a;b;c}{\def\x{T}}{\def\x{F}} \finish{example} \docsubsection(sec:getorder){What is the numerical order of an element in a csv list?} -\start{newmacro}[\ltxkeys@getorder] -\ltxkeys@getorder[|A(parser)]{|A(elt)}{|A(list)} -\ltxkeys@getorder|*[|A(parser)]{|A(elt)}{|A(listcmd)} +\start{newmacro}[\ltxkeysgetorder] +\ltxkeysgetorder[|A(parser)]{|A(elt)}{|A(list)} +\ltxkeysgetorder|*[|A(parser)]{|A(elt)}{|A(listcmd)} \finish{newmacro} -\fxim*{\ltxkeys@getorder,\ltxkeys@order} +\fxim*{\ltxkeysgetorder,\ltxkeysorder} -The command \fx{\ltxkeys@getorder} returns in \fx{\ltxkeys@order} the numerical order of \ang{elt} in \ang{parser}-separated \ang{list} or \ang{listcmd}. The value of \fx{\ltxkeys@order} is the numerical order of the first match found. The count starts from zero ($0$). The \stform will expand \ang{listcmd} once before commencing the search for \ang{elt}. If no match is found, \fx{\ltxkeys@order} returns $-1$, which can be used for taking further decisions. +The command \fx{\ltxkeysgetorder} returns in \fx{\ltxkeysorder} the numerical order of \ang{elt} in \ang{parser}-separated \ang{list} or \ang{listcmd}. The value of \fx{\ltxkeysorder} is the numerical order of the first match found. The count starts from zero ($0$). The \stform will expand \ang{listcmd} once before commencing the search for \ang{elt}. If no match is found, \fx{\ltxkeysorder} returns $-1$, which can be used for taking further decisions. \docsubsection(sec:list-normalization){List normalization} @@ -3313,18 +2476,20 @@ These commands will normalize the comma-separated \ang{list} (or \ang{list-i}) a \docsubsection(sec:listparse){Parsing arbitrary csv or kv list} -\start{newmacro}[\ltxkeyslistparse] -\ltxkeyslistparse|A(flag)[|A(parser)]{|A(list)} -\ltxkeyslistparse|*|A(flag)[|A(parser)]{|A(listcmd)} +% Edit ++++++++++++++++++++++++++++++ + +\start{newmacro}[\ltxkeysdolist] +\ltxkeysdolist|A(flag)[|A(parser)]{|A(list)} +\ltxkeysdolist|*|A(flag)[|A(parser)]{|A(listcmd)} \finish{newmacro} -\fxim*{\ltxkeyslistparse} +\fxim*{\ltxkeysdolist} -The unexpandable command \fx{\ltxkeyslistparse} 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{\ltxkeyslistparse} 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{\ltxkeyslistparse} 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{\ltxkeyslistparse} will expand \ang{listcmd} once before commencing the loop. +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{\ltxkeyslistparse}} +\caption{Flags for command \ltsprotectedtokens{\fx{\ltxkeysdolist}} \label{tab:parser-flags}}\\\hline \rowcolor{pink} \bfseries Flag &\bfseries Meaning\\\hline @@ -3337,24 +2502,29 @@ The unexpandable command \fx{\ltxkeyslistparse} is the list processor for the \p \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{\ltxkeyslistparse} 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{\ltxkeyslistparse} prior to parsing. \\\hline -$2$ & \ang{list} is assumed to be a list of \keyval pairs; it isn't normalized by the command \fx{\ltxkeyslistparse} prior to parsing. \\\hline -$3$ & \ang{list} is assumed to be a list of \keyval pairs; it is normalized by \fx{\ltxkeyslistparse} prior to parsing. +$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 -Here are some points to note about the list processor \fx{\ltxkeyslistparse}: +Here are some points to note about the list processor \fx{\ltxkeysdolist}: \begin{enum} -\item If an item contains \ang{parser}, it must be wrapped in curly braces when calling the command \fx{\ltxkeyslistparse}, 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{\ltxkeyslistparse}. If an item contains \ang{parser} or starts with a space, it must, therefore, be wrapped in curly braces before calling \fx{\ltxkeyslistparse}. -\item Since when \ang{flag} is $0$ or $2$ the command \fx{\ltxkeyslistparse} 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{\ltxkeyslistparse} if the boolean \fx{\ifltxkeys@useempty} is true. You may thus issue \fx{\ltxkeys@useemptytrue} before calling \fx{\ltxkeyslistparse}. 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{\ltxkeyslistparse} can be nested to any level and can be mixed with other looping macros. -\item In the command \fx{\ltxkeyslistparse}, 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{\ifltxkeysbreakloop}\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 dependant. +\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 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:removeelements){Remove one or all occurrences of elements from a csv list} \start{newmacro}[\ltxkeysremoveelements] @@ -3404,46 +2574,40 @@ 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}[\ltxkeysstripNouterbraces, \ltxkeysstripallouterbraces, etc.] -\ltxkeysstripNouterbraces|A(nr){|A(token)} +\start+{newmacro}[\ltxkeysstripouterbraces, \ltxkeysstripallouterbraces, etc.] +\ltxkeysstripouterbraces|A(nr){|A(token)} \ltxkeysstripallouterbraces{|A(token)} \ltxkeysstripallouterbracesincs{|A(cmd)} \finish{newmacro} -\fxim*{\ltxkeysstripNouterbraces, +\fxim*{\ltxkeysstripouterbraces, \ltxkeysstripallouterbraces,\ltxkeysstripallouterbracesincs} -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. +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. -\start+{example}[\ltxkeysstripNouterbraces,\ltxkeysstripallouterbraces, etc.] +\start+{example}[\ltxkeysstripouterbraces,\ltxkeysstripallouterbraces, etc.] \toks@\expandafter\expandafter\expandafter - {\ltxkeysstripNouterbraces{2}{{{\y}}}} + {\ltxkeysstripouterbraces{2}{{{\y}}}} \edef\x{\unexpanded\expandafter\expandafter\expandafter - {\ltxkeysstripNouterbraces\@m{{{\y}}}}} + {\ltxkeysstripouterbraces\@m{{{\y}}}}} \edef\x{\ltxkeysstripallouterbraces{{{{\y}}}}} \finish{example} -\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. - - - -\docsection(sec:add-patch-keycode){Adding to and patching key macros} +\docsection(sec:add-patch-callback){Adding to and patching key macros} -\subdocsection(sec:addkeycode){Adding to key macros} -% \krdaddkeycode, \krdappendkeycode, \krdprependkeycode +\subdocsection(sec:adtocallback){Adding to key macros} +% \ltxkeysadtocallback, \ltxkeysappendtocallback, \ltxkeysprependtocallback -\subdocsection(sec:patchkeycode){Patching key macros} -% \krdpatchkeycode, \krdgpatchkeycode +\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{\krdpatchkeycode} 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. +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}[\krdpatchkeycode] -\krdpatchkeycode|*|![|nang(keyprefixes)]{|nang(families)}{ +\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)} ; ... @@ -3454,42 +2618,46 @@ The following \fx{\krdpatchkeycode} command and use syntax can be utilized to pa |nang(fallback-f) } \finish{newmacro} -\fxim*{\krdpatchkeycode} +\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{\krdpatchkeycode} 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{\krd@currkey}, \fx{\curr@fam}, and \fx{\krd@pref} to refer to the current key name, family and prefix (see example below). The \clsign instructs \fx{\krdpatchkeycode} to globalize the outcome; the \stsign is explained below. +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. -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. Normally, the command \fx{\patchcmd} of \cref{sec:cmd-patch} (and hence \fx{\krdpatchkeycode}) 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{\krdpatchkeycode} (see example below). +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{\ltxkeyslistbreak} 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}). +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{\krdpatchkeycode} is the semicolon (\fx{;}). This can be changed by using \fx{\krdDeclareKeyPatchParser}, which takes only one argument (the list parser). +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}[\krdpatchkeycode] -\declare@ordkey[KV]{fam}{keya}[value]{\def\x##1{x##1x}} -\declare@boolkey[KX]{fax}[mp@]{keyb}[true]{\def\y{#1}} +\start{example}[\ltxkeyspatchcallback] +\ltxkeysordkey[KV]{fam}{keya}[value]{\def\x##1{x##1x}} +\ltxkeysboolkey[KX]{fax}[mp@]{keyb}[true]{\def\y{#1}} -\krdpatchkeycode|*|![KV,KX]{fam,fax}{% +\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 `\krdcurrentkeymacro' succeeded}% + \wlog{Patching of `\ltxkeyscurrentkeymacro' succeeded}% }{% - \wlog{Patching of `\krdcurrentkeymacro' failed}% + \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} -\start+{newmacro}[\ltxkeys@adddepkeys,etc] -\ltxkeys@adddepkeys[|A(pref)]{|A(fam)}{|A(paren)}{|A(deps)} -\ltxkeys@removedepkeys[pref]{fam}{|A(paren)}{|A(deps)} -\ltxkeys@replacedepkeys[pref]{fam}{|A(paren)}{|A(olddeps)}{|A(newdeps)} +\start+{newmacro}[\ltxkeysadddepkeys,etc] +\ltxkeysadddepkeys[|A(pref)]{|A(fam)}{|A(paren)}{|A(deps)} +\ltxkeysremovedepkeys[pref]{fam}{|A(paren)}{|A(deps)} +\ltxkeysreplacedepkeys[pref]{fam}{|A(paren)}{|A(olddeps)}{|A(newdeps)} \finish{newmacro} -\fxim*{\ltxkeys@adddepkeys,\ltxkeys@removedepkeys,\ltxkeys@replacedepkeys} +\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. @@ -3505,15 +2673,18 @@ 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.3}{2011/12/17} - \item More flags (\ffx{preset, postset, setrm}, \eetc) have been introduced for pathkeys \vsecref{sec:pathkeys} + \begin{version}{0.0.3a-b}{2012/10/14} + \item Command name changes from \pkg'{catoptions} package. \end{version} - \begin{version}{0.0.2}{2011/09/01} - \item Pathkeys introduced\vsecref{sec:pathkeys} - \item User guide completed.\vsecref* + \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} \end{version} - \begin{version}{0.0.1}{2011/07/30} - \item First public release.\vsecref* + \begin{version}{0.0.1a}{2011/08/14} + \item Completed the user guide\vsecref* + \end{version} + \begin{version}{0.0.1}{2011/08/13} + \item First public release\vsecref* \end{version} \end{versionhist} @@ -3524,3 +2695,7 @@ 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/tex/latex/ltxkeys/ltxkeys.sty b/Master/texmf-dist/tex/latex/ltxkeys/ltxkeys.sty index 779a04a6270..4a1efbd718e 100644 --- a/Master/texmf-dist/tex/latex/ltxkeys/ltxkeys.sty +++ b/Master/texmf-dist/tex/latex/ltxkeys/ltxkeys.sty @@ -1,6 +1,5 @@ %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++% -% % -% This is file 'ltxkeys.sty', version 0.0.3a, August 02, 2012. % +% This is file 'ltxkeys.sty', version 0.0.3b, October 14, 2012. % % % % This package and accompanying files may be distributed and/or % % modified under the conditions of the LaTeX Project Public License, % @@ -17,21 +16,20 @@ % purpose. % % % % Copyright (c) 2011-2012 Ahmed Musa (amusa22@gmail.com). % -% % %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++% \@ifpackageloaded{catoptions}{% - \@ifpackagelater{catoptions}{2012/08/02}{}{% + \@ifpackagelater{catoptions}{2012/10/14}{}{% \@latex@error{Loaded version of catoptions package is not current}\@ehc }% }{% - \RequirePackage{catoptions}[2012/08/02]% + \RequirePackage{catoptions}[2012/10/14]% } \UseNormalCatcodes \StyleFilePurpose{A robust key-value parser (AM)} \StyleFileRCSInfo -$Id: ltxkeys.sty,v 0.0.3a 2012/08/02 09:00:00 Ahmed Musa Exp $ +$Id: ltxkeys.sty,v 0.0.3b 2012/10/14 09:00:00 Ahmed Musa Exp $ \ProvidesPackage{ltxkeys}[\StyleFileInfo] \NeedsTeXFormat{LaTeX2e}[2011/06/27] \SetStyleFileMessages[ltxkeys@]{info}{warn}{err} @@ -64,11 +62,11 @@ $Id: ltxkeys.sty,v 0.0.3a 2012/08/02 09:00:00 Ahmed Musa Exp $ \new@def*\ltxkeys@antiquark{\@gobble\ltxkeys@antiquark} \new@def*\ltxkeys@cdr#1#2\ltxkeys@nil{#2} \new@def*\ltxkeys@spcdr#1#2\ltxkeys@nil{\detokenize{#2}} -\new@def\ltxkeys@ifxFT#1#2{\ltxkeys@ifxTF{#1}{#2}\iiofii\iofii} +\new@def\ltxkeys@ifxFT#1#2{\ltxkeys@ifxTF{#1}{#2}\cptiiofii\cptiofii} \new@def\ltxkeys@ifxTF#1#2{% \expandafter\cptswap\cpt@car#1\ltxkeys@quark\car@nil {\expandafter\ifx\cpt@car#2\ltxkeys@antiquark\car@nil}% - \expandafter\iofii\else\expandafter\iiofii\fi + \expandafter\cptiofii\else\expandafter\cptiiofii\fi } \new@def*\ltxkeys@ifcsemptyTF#1{% \expandafter\ltxkeys@ifxTF\cpt@car#1\ltxkeys@quark\car@nil\@empty @@ -166,11 +164,11 @@ $Id: ltxkeys.sty,v 0.0.3a 2012/08/02 09:00:00 Ahmed Musa Exp $ } \robust@def*\ltxkeys@teststpl#1{\ltxkeys@testst{\ltxkeys@testpl{#1}}} \robust@def*\ltxkeys@state{% - \ltxkeys@keys,\ltxkeys@prefs,\ltxkeys@fams,\ltxkeys@nakeys, - \ltxkeys@tpref,\ltxkeys@ttpref,\ltxkeys@tfam,\ltxkeys@tkey, - \ltxkeys@tval,\ifltxkeys@st,\ifltxkeys@pl,\ifltxkeys@cl, - \ifltxkeys@kf,\ifltxkeys@pxop,\ifltxkeys@exop,\ifltxkeys@ini, - \CurrentKeyval,\CurrentKey,\CurrentVal + \\\ltxkeys@keys\\\ltxkeys@prefs\\\ltxkeys@fams\\\ltxkeys@nakeys + \\\ltxkeys@tpref\\\ltxkeys@ttpref\\\ltxkeys@tfam\\\ltxkeys@tkey + \\\ltxkeys@tval\\\ifltxkeys@st\\\ifltxkeys@pl\\\ifltxkeys@cl + \\\ifltxkeys@kf\\\ifltxkeys@pxop\\\ifltxkeys@exop\\\ifltxkeys@ini + \\\CurrentKeyval\\\CurrentKey\\\CurrentVal } \robust@def\ltxkeys@trimspacesincs#1{% \expandafter\ltxkeys@trimspaces\expandafter{#1}{#1}% @@ -389,7 +387,7 @@ $Id: ltxkeys.sty,v 0.0.3a 2012/08/02 09:00:00 Ahmed Musa Exp $ \edef\reserved@a{\ifcpt@st*\fi}% \def\eltnum{0}% \def\ltxkeys@do##1{% - \pushnumber\eltnum + \cptpushnumber\eltnum }% \expandafter\ltxkeys@parse\reserved@a1[#1]{#4}% \aftercsname\endgroup{@\ifnum\eltnum#2\numexpr#3% @@ -436,7 +434,7 @@ $Id: ltxkeys.sty,v 0.0.3a 2012/08/02 09:00:00 Ahmed Musa Exp $ \provide@def\first@to@endif#1#2\endif{#1} \new@def*\ltxkeys@ifcassenumcmpTF#1#2#3{% \ifdim#1pt#2pt % - \expandafter\iofii\else\expandafter\iiofii\fi + \expandafter\cptiofii\else\expandafter\cptiiofii\fi } \new@def\ltxkeys@ifcasse#1{% \ifstrcmpTF{#1}\elseif{% @@ -642,7 +640,7 @@ $Id: ltxkeys.sty,v 0.0.3a 2012/08/02 09:00:00 Ahmed Musa Exp $ \ifstrcmpTF{##1}{#3}{% \cpt@choicefdtrue\loopbreak }{% - \pushnumber#2% + \cptpushnumber#2% }% }% \cptexpandsecond{\ltxkeys@parse0}{[\ltxkeys@ccparser]}{#4}% @@ -890,9 +888,10 @@ $Id: ltxkeys.sty,v 0.0.3a 2012/08/02 09:00:00 Ahmed Musa Exp $ } \robust@def*\ltxkeys@parse@b[#1]#2{% \cpt@stchoose{cpt@st}{#2}\ltxkeys@arg\ltxkeys@parse - \pushfunctions\ltxkeys@parse{\ifloopbreak,\ifltxkeys@useempty,% - \ltxkeys@doo,\ltxkeys@parse@c,\ltxkeys@parse@d,% - \ltxkeys@loopcbk}\cpt@csvdepth + \cptpushfunctions\ltxkeys@parse{% + \\\ifloopbreak\\\ifltxkeys@useempty\\\ltxkeys@doo + \\\ltxkeys@parse@c\\\ltxkeys@parse@d\\\ltxkeys@loopcbk + }\cpt@csvdepth \ifdefTF\ltxkeys@do {\let\ltxkeys@doo\ltxkeys@do}{\cpt@notdeferr\ltxkeys@do}% \def\ltxkeys@parse@c{% @@ -916,7 +915,7 @@ $Id: ltxkeys.sty,v 0.0.3a 2012/08/02 09:00:00 Ahmed Musa Exp $ }{}% \loopbreakfalse \expandafter\ltxkeys@parse@c\ltxkeys@arg#1\ltxkeys@nil#1% - \popfunctions\ltxkeys@parse\cpt@csvdepth + \cptpopfunctions\ltxkeys@parse\cpt@csvdepth \ifnum\cpt@csvdepth=\z@pt\undefcs\ltxkeys@do\fi } \def\ltxkeys@keyprefixhook{} @@ -3956,12 +3955,13 @@ $Id: ltxkeys.sty,v 0.0.3a 2012/08/02 09:00:00 Ahmed Musa Exp $ } \robust@def*\ltxkeys@keycommand@j#1(#2){% \ltxkeys@setkeys[CMDKEY]{ltxkeys@#1}{#2}% - \pushfunctions\ltxkeyscmd{\val,\ifval,\ifvalTF, - \keyval,\ifkeyval,\ifkeyvalTF}\ltxkeyscmd@depth + \cptpushfunctions\ltxkeyscmd{% + \\\val\\\ifval\\\ifvalTF\\\keyval\\\ifkeyval\\\ifkeyvalTF + }\ltxkeyscmd@depth \def\val##1{\usename{#1@\cpttrimspace{##1}}}% \def\ifval##1\then{\usename{if#1@\cpttrimspace{##1}}}% \def\ifvalTF##1{% - \ifval##1\then\expandafter\iofii\else\expandafter\iiofii\fi + \ifval##1\then\expandafter\cptiofii\else\expandafter\cptiiofii\fi }% \def\keyval##1{% \ifcsndefTF{#1@\cpttrimspace{##1}}{% @@ -3980,7 +3980,7 @@ $Id: ltxkeys.sty,v 0.0.3a 2012/08/02 09:00:00 Ahmed Musa Exp $ }% }% \def\ifkeyvalTF##1{% - \ifkeyval##1\then\expandafter\iofii\else\expandafter\iiofii\fi + \ifkeyval##1\then\expandafter\cptiofii\else\expandafter\cptiiofii\fi }% \long\def\reserved@a##1##2\ltxkeys@nil{% % \ifswitch won't work here: @@ -3988,7 +3988,7 @@ $Id: ltxkeys.sty,v 0.0.3a 2012/08/02 09:00:00 Ahmed Musa Exp $ ##2% }{% ##2% - \popfunctions\ltxkeyscmd\ltxkeyscmd@depth + \cptpopfunctions\ltxkeyscmd\ltxkeyscmd@depth }% }% \expandafter\reserved@a\ltxkeys@cmdbody\ltxkeys@nil @@ -4066,7 +4066,7 @@ $Id: ltxkeys.sty,v 0.0.3a 2012/08/02 09:00:00 Ahmed Musa Exp $ \l@ngrel@x\csn@def{end#1}{% \def\envarg####1{\usename{keyenvarg@\romannumeral####1}}% #6\relax - \popfunctions\ltxkeyscmd\ltxkeyscmd@depth + \cptpopfunctions\ltxkeyscmd\ltxkeyscmd@depth \ltxkeys@everyeoehook }% } diff --git a/Master/texmf-dist/tex/latex/ltxkeys/pathkeys.sty b/Master/texmf-dist/tex/latex/ltxkeys/pathkeys.sty deleted file mode 100644 index 7223aaba413..00000000000 --- a/Master/texmf-dist/tex/latex/ltxkeys/pathkeys.sty +++ /dev/null @@ -1,703 +0,0 @@ -%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++% -% % -% This is file 'pathkeys.sty', version 0.0.3, December 2011. % -% % -% This package and accompanying files may be distributed and/or % -% modified under the conditions of the LaTeX Project Public License, % -% either version 1.3 of this license or any later version. The latest % -% version of this license is in http://www.latex-project.org/lppl.txt % -% and version 1.3 or later is part of all distributions of LaTeX % -% version 2005/12/01 or later. % -% % -% The LPPL maintenance status of this software is 'author-maintained'. % -% % -% This software is provided 'as it is', without warranty of any kind, % -% either expressed or implied, including, but not limited to, the % -% implied warranties of merchantability and fitness for a particular % -% purpose. % -% % -% Copyright (c) 2011 Ahmed Musa (amusa22@gmail.com). % -% % -%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++% - -\@ifpackageloaded{ltxkeys}{% - \@ifpackagelater{ltxkeys}{2011/12/10}{}{% - \@latex@error{Loaded version of ltxkeys package is - not current}\@ehc - }% -}{% - \RequirePackage{ltxkeys}[2011/12/10]% -} -\UseNormalCatcodes -\StyleFilePurpose{A robust 'path' key-value parser (AM)} -\StyleFileRCSInfo -$Id: pathkeys.sty,v 0.0.3 2011/12/17 09:00:00 Ahmed Musa Exp $ -\ProvidesPackage{pathkeys}[\StyleFileInfo] -\NeedsTeXFormat{LaTeX2e}[2011/06/27] -\SetStyleFileMessages[pathkeys@]{info}{warn}{err} -\cptnewvariables{count}[pathkeys@]{cnta}[\z@pt] -\AtEndOfPackage{% - \newletcsset{% - \pathkeyscurrentpath=\pathkeys@currentpath, - \pathkeyspushcurrentpath=\pathkeys@pushcurrentpath, - \pathkeyspopcurrentpath=\pathkeys@popcurrentpath, - \pathkeysusedefaultpath=\pathkeys@usedefaultpath, - \pathkeysstorevalue=\pathkeys@storevalue, - \pathkeysstorevalueof=\pathkeys@storevalue, - \pathkeysval=\pathkeys@getval, - \pathkeysvalueof=\pathkeys@getval, - \pathkeyskeyval=\pathkeys@getkeyval, - \changepath=\defpath, - \pathkeys@c@rrentpath=\pathkeys@defaultpath, - \pathkeysuseshortcmds=\pathkeys@useshortcmds, - \pathkeysmakeshortcmds=\pathkeys@makeshortcmds - }% -} -\cpt@setupsafeactivesedef -\robust@def*\pathkeys@getkeypath#1{% - \xifinsetTF{:}{\detokenize{#1}}{}{% - \pathkeys@err{I can't find ':' in argument of - \string\pathkeys}\ltxkeys@ehc - }% - \def\reserved@a##1:##2\ltxkeys@nil{% - \iflacus##1\dolacus - \pathkeys@err{Nil flag in argument of \string\pathkeys}\ltxkeys@ehc - \fi - \ltxkeys@trimspaces{##1}\key@path@flag - \ltxkeys@trimspaces{##2}\key@list - \csv@@normalize*[/]\key@path@flag - \s@expandarg\pathkeys@getkeyflag\key@path@flag - }% - \reserved@a#1\ltxkeys@nil -} -\robust@def*\pathkeys@getkeyflag#1{% - \ltxkeys@ifoneintokenlist{{define}{declareoptions}}{#1}{% - \pathkeys@g@tkeyflag{#1}% - }{% - \def\onekeytype{}% - \def\key@path@flag{#1}% - }% - \def\do##1,##2\ltxkeys@nil{% - \xifinsetTF{\detokenize{##1}\relax}{\cptoxdetok\key@path@flag\relax}{% - \def\reserved@a####1##1\relax{% - \ltxkeys@trimspaces{##1}\key@flag - \ltxkeys@trimspaces{####1}\key@path - \csv@@normalize*[/]\key@path - \cptsafeactivesedef\key@path\key@path - }% - \expandafter\reserved@a\key@path@flag\relax - }{% - \ifnullTF{##2}{% - \pathkeys@err{Unknown flag in argument of - \string\pathkeys}\ltxkeys@ehc - }{% - \do##2\ltxkeys@nil - }% - }% - }% - \do define*,define,declareoptions*,declareoptions,% - preset,preset!,postset,postset!,set*+,set*,set,setrm*+,% - setrm*,setrm,executeoptions,processoptions*,processoptions,% - launch,key handler,option handler,ifbool,add value,store value,% - print value,disable*,disable,ifdef,ifkeyonpath,\ltxkeys@nil -} -\robust@def*\pathkeys@g@tkeyflag#1{% - \xifinsetTF{)\relax}{\detokenize{#1}\relax}{% - \xifinsetTF{(}{\detokenize{#1}}{% - \def\reserved@a##1(##2)##3\ltxkeys@nil{% - \iflacus##3\dolacus - \def\key@path@flag{##1}% - \def\onekeytype{##2}% - \else - \pathkeys@err{Inconsistent path or flag in argument of - \string\pathkeys}{The invalid part is ||\detokenize{##3}||}% - \fi - }% - \reserved@a#1\ltxkeys@nil - }{% - \pathkeys@err{Inconsistent flag in argument of - \string\pathkeys}\ltxkeys@ehc - }% - }{% - \def\onekeytype{}% - \def\key@path@flag{#1}% - }% -} -\robust@def*\pathkeys@splitpath#1{% - \def\main@path{}\def\sub@path{}% - \@tempcnta\z@pt - \def\do##1/{% - \defifxTF{##1}\ltxkeys@nnil{}{% - \advance\@tempcnta\@ne - \ifnum\@tempcnta=\@ne - \def\main@path{##1}% - \else - \edef\sub@path{\csliststack{/}\sub@path##1}% - \fi - \do - }% - }% - \do#1/\ltxkeys@nil/% -} -\robust@def*\pathkeys@checkpath#1{% - \iflacus#1\dolacus - \ltxkeys@debug{==}{Empty key path in \string\pathkeys: default used}% - \let\key@path\pathkeys@c@rrentpath - \else - \def\reserved@a##1/##2/##3/##4\ltxkeys@nil{% - \iflacus##2\dolacus - \pathkeys@err{Empty key <sub> in \string\pathkeys}\ltxkeys@ehc - \fi - }% - \reserved@a#1///\ltxkeys@nil - \fi -} -\robust@def*\pathkeys@getkeyname#1{% - \def\reserved@a##1/##2\ltxkeys@nil{% - \ltxkeys@trimspaces{##1}\key@type - }% - \reserved@a#1\ltxkeys@nil - \xifstrcmpTF{\detokenize{choice}}{\cptoxdetok\key@type}{% - \def\reserved@a##1/##2.##3\ltxkeys@nil{% - \ltxkeys@trimspaces{##2}\key@name - }% - \reserved@a#1\ltxkeys@nil - }{% - \def\reserved@a##1/##2/##3\ltxkeys@nil{% - \ltxkeys@trimspaces{##2}\key@name - \ltxkeys@ifrejname{% - \pathkeys@err{I can't find key name in attributes of - key in ||\detokenize{#1}||}\ltxkeys@ehc - }% - }% - \reserved@a#1/^?^/\ltxkeys@nil - }% -} -\robust@def*\pathkeys@checkifdef{% - \def\ltxkeys@resa{}% - \def\ltxkeys@do##1{% - \ltxkeys@ifcsemptyTF\onekeytype{% - \edef\reserved@a{\unexpanded{##1}}% - }{% - \edef\reserved@a{\onekeytype/\unexpanded{##1}}% - }% - \cptexpandbracenext\pathkeys@getkeyname\reserved@a - \begingroup - \let\needvalue\cpttrimspace - \let\savevalue\cpttrimspace - \let\usevalue\cpttrimspace - \ifcsndefTF{pathkeys/curr/\ltxkeys@iffirstnull\main@path/% - \ltxkeys@iffirstnull\sub@path/\key@name - }{% - \xdef\ltxkeys@resa{\csliststack,\ltxkeys@resa\key@name}% - }{}% - \endgroup - }% - \cptexpandsecond{\ltxkeys@parse*1}{[\ltxkeys@keyparser]}\key@list - \ifx\ltxkeys@resa\@empty\else - \pathkeys@err{Key names ||\ltxkeys@resa||% - in argument of \noexpand\pathkeys are already in - use on path '\key@path'}\ltxkeys@ehc - \fi -} -\robust@def*\pathkeys#1{% - \pathkeys@getkeypath{#1}% - \ltxkeys@ifcsemptyTF\key@path{% - \let\key@path\pathkeys@c@rrentpath - }{}% - \pathkeys@addtopathhistory\key@path - \xifinsetTF{,\key@flag,}{,ifdef,ifkeyonpath,}\pathkeys@b\pathkeys@a -} -\robust@def*\pathkeys@a{% - \def\ltxkeys@do##1{% - \def\key@path{##1}% - \pathkeys@checkpath{##1}% - \pathkeys@splitpath{##1}% - \xifinsetTF{,\key@flag,} - {,define,define*,declareoptions,declareoptions*,}{% - \pathkeys@checkifdef - }{}% - \pathkeys@b - }% - \ltxkeys@parse*1[,]\key@path -} -\robust@def*\pathkeys@b{% - \begingroup - \let\xp\expandcsonce - \let\elta\ltxkeys@iffirstnull - \def\eltb{{\main@path}{\sub@path}{\xp\key@list}}% - \def\eltc{[\main@path]{\sub@path}{\xp\key@list}}% - \def\eltd{pathkeys/curr/\elta\main@path/\elta\sub@path/}% - \def\reserved@a##1{% - \def\reserved@a####1##1####2####3\ltxkeys@nil{% - \defifxTF{####2}\ltxkeys@nil{% - \endgroup - \pathkeys@err{Unknown flag '####1' in argument of - \string\pathkeys}\ltxkeys@ehc - }{% - \cptexpanded{\endgroup####2}% - }% - }% - \expandafter\reserved@a\pathkeys@act##1{\ltxkeys@nil}\ltxkeys@nil - }% - \s@expandarg\reserved@a\key@flag -} -\robust@def*\pathkeys@act{% - define{\pathkeys@defkey{define}{}}% - define*{\pathkeys@defkey{define}{*}}% - declareoptions{\pathkeys@defkey{declareoptions}{}}% - declareoptions*{\pathkeys@defkey{declareoptions}{*}}% - set{\pathkeys@setkeys{}{}\eltb}% - set*{\pathkeys@setkeys{}{*}\eltb}% - set*+{\pathkeys@setkeys{}{*+}\eltb}% - setrm{\pathkeys@setkeys{rm}{}\eltb}% - setrm*{\pathkeys@setkeys{rm}{*}\eltb}% - setrm*+{\pathkeys@setkeys{rm}{*+}\eltb}% - preset{\pathkeys@presetkeys{pre}{}}% - preset!{\pathkeys@presetkeys{pre}{!}}% - postset{\pathkeys@presetkeys{post}{}}% - postset!{\pathkeys@presetkeys{post}{!}}% - executeoptions{\pathkeys@executeoptions\eltb}% - processoptions{\pathkeys@processoptions{}\eltb}% - processoptions*{\pathkeys@processoptions{*}\eltb}% - launch{\ltxkeys@launchkeys\eltc}% - handler{\ltxkeys@unknownkeyhandler\eltc}% - key handler{\ltxkeys@unknownkeyhandler\eltc}% - option handler{\pathkeys@unknownoptionhandler}% - ifbool{\noexpand\ifp@thkeys@keyvalTF{\key@list}{\eltd\key@list}}% - add value{\p@thkeys@addtovalue{\xp\key@list}{\eltd}}% - store value{\p@thkeys@storevalue{\xp\key@list}{\eltd}}% - print value{\noexpand\p@thkeys@keyval{\key@list}{\eltd\key@list}}% - disable{\ltxkeys@disablekeys\eltc}% - disable*{\ltxkeys@disablekeys*\eltc}% - ifdef{\noexpand\ifp@thkeys@keydef{\key@path}{\key@list}}% - ifkeyonpath{\noexpand\ifp@thkeys@keydef{\key@path}{\key@list}}% -} -\new@def*\pathkeys@defkey#1#2{% - \noexpand\ltxkeys@inkeycmdtrue - \expandafter\noexpand\csname - ltxkeys@% - \cptifcasse\ifstrcmpTF{#1} - {define}{declarekeys} - {declareoptions}{declaremultitypeoptions} - \endif - \endcsname - #2\ltxkeys@ifcsemptyTF\onekeytype{}{(\onekeytype)}[\main@path]% - \cptifcasse\ifstrcmpTF{#1} - {define}{{\sub@path}} - {declareoptions}{<\sub@path>} - \endif - [\eltd]{\expandcsonce\key@list}% - \noexpand\ltxkeys@inkeycmdfalse -} -\new@def*\pathkeys@presetkeys#1#2{% - \noexpandcsn{ltxkeys@#1setkeys}% - #2[\main@path]{\sub@path}{\expandcsonce\key@list}% -} -\robust@def*\pathkeys@setkeys#1#2#3#4#5{% - \edef\ltxkeys@tempa{\noexpandcsn{ltxkeys@set#1keys}#2}% - \def\ltxkeys@tempb##1{% - \iflacus##1\dolacus\else - \ltxkeys@err{Wrong use syntax for flag 'setrm'} - {Only [na] keys are expected in attribute of flag 'setrm'.}% - \fi - }% - \xifinsetTF{\relax[}{\relax\detokenize{#5}}{% - \def\reserved@a[##1]##2\ltxkeys@nil{% - \ifstrcmpTF{#1}{rm}{% - \ltxkeys@tempb{##2}% - \ltxkeys@tempa[#3]{#4}[##1]% - }{% - \ltxkeys@tempa[#3]{#4}[##1]{##2}% - }% - }% - \reserved@a#5\ltxkeys@nil - }{% - \xifinsetTF{]\relax}{\detokenize{#5}\relax}{% - \def\reserved@a##1[##2]\ltxkeys@nil{% - \ifstrcmpTF{#1}{rm}{% - \ltxkeys@tempb{##1}% - \ltxkeys@tempa[#3]{#4}[##2]% - }{% - \ltxkeys@tempa[#3]{#4}[##2]{##1}% - }% - }% - \reserved@a#5\ltxkeys@nil - }{% - \ifstrcmpTF{#1}{rm}{% - \ltxkeys@tempb{#5}% - \ltxkeys@tempa[#3]{#4}% - }{% - \ltxkeys@tempa[#3]{#4}{#5}% - }% - }% - }% -} -\robust@def*\pathkeys@executeoptions#1#2#3{% - \xifinsetTF{\relax[}{\relax\detokenize{#3}}{% - \def\reserved@a[##1]##2\ltxkeys@nil{% - \ltxkeys@executeoptions[#1]<#2>[##1]{##2}% - }% - \reserved@a#3\ltxkeys@nil - }{% - \xifinsetTF{]\relax}{\detokenize{#3}\relax}{% - \def\reserved@a##1[##2]\ltxkeys@nil{% - \ltxkeys@executeoptions[#1]<#2>[##2]{##1}% - }% - \reserved@a#3\ltxkeys@nil - }{% - \ltxkeys@executeoptions[#1]<#2>{#3}% - }% - }% -} -\robust@def*\pathkeys@processoptions#1#2#3#4{% - \def\ltxkeys@tempb##1{% - \iflacus##1\dolacus\else - \pathkeys@err{Wrong use of 'processoptions' flag in - \string\pathkeys}{The invalid part is '\detokenize{##1}'}% - \fi - }% - \xifinsetTF{\relax[}{\relax\detokenize{#4}}{% - \def\reserved@a[##1]##2\ltxkeys@nil{% - \ltxkeys@tempb{##2}% - \ltxkeys@processoptions#1[#2]<#3>[##1]% - }% - \reserved@a#4\ltxkeys@nil - }{% - \xifinsetTF{]\relax}{\detokenize{#4}\relax}{% - \def\reserved@a##1[##2]\ltxkeys@nil{% - \ltxkeys@tempb{##1}% - \ltxkeys@processoptions#1[#2]<#3>[##2]% - }% - \reserved@a#4\ltxkeys@nil - }{% - \ltxkeys@tempb{#4}% - \ltxkeys@processoptions#1[#2]<#3>% - }% - }% -} -\new@def*\pathkeys@unknownoptionhandler{% - \ltxkeys@unknownoptionhandler - [\main@path]<\sub@path>{\xp\key@list}% -} -\robust@def*\p@thkeys@storevalue#1#2{% - \ltxkeys@getlasttoken{#1}% - \ltxkeys@trimspacesincs\ltxkeys@lasttoken - \ltxkeys@trimspacesincs\ltxkeys@resttokens - \ifcsndefTF{#2\ltxkeys@resttokens}{% - \expandafter\edef\ltxkeys@lasttoken - {\expandcsnonce{#2\ltxkeys@resttokens}}% - }{% - \pathkeys@err{Key '\ltxkeys@resttokens' not defined}\ltxkeys@ehc - }% -} -\robust@def*\p@thkeys@addtovalue#1#2{% - \begingroup - \ltxkeys@splitkeyval#1\ltxkeys@nil\ltxkeys@tempa\ltxkeys@tempb - \ifcsndefTF{#2\ltxkeys@tempa}{% - \csn@edef{#2\ltxkeys@tempa}{% - \expandcsnonce{#2\ltxkeys@tempa}% - \expandcsonce\ltxkeys@tempb - }% - \postgroupcsndef{#2\ltxkeys@tempa}\endgroup - }{% - \pathkeys@err{Key '\ltxkeys@tempa' not defined}\ltxkeys@ehc - \endgroup - }% -} -\new@def*\p@thkeys@keyval#1#2{% - \ifcsndefTF{#2}{% - \expandcsnonce{#2}% - }{% - \pathkeys@err{Key '#1' not defined on the given path}\ltxkeys@ehc - }% -} -\new@def*\ifp@thkeys@keyval#1#2\then{% - \ifcsndefTF{if#2}{% - \usename{if#2}% - }{% - \pathkeys@err{Key '#1' not defined or not a boolean}\ltxkeys@ehc - }% -} -\new@def*\ifp@thkeys@keyvalTF#1#2{% - \ifp@thkeys@keyval{#1}{#2}\then\expandafter\iofii\else - \expandafter\iiofii\fi -} -\robust@def*\ifp@thkeys@keydef#1#2{% - \begingroup - \def\pathkeys@chfd{01}% - \def\ltxkeys@do##1{% - \pathkeys@checkpath{##1}% - \pathkeys@splitpath{##1}% - \let\elt\ltxkeys@iffirstnull - \ifcsndefTF{pathkeys/curr/\elt\main@path/\elt\sub@path/#2}{% - \def\pathkeys@chfd{00}% - \loopbreak - }{% - \ifcsndefTF{\main@path @\sub@path @#2}{% - \def\pathkeys@chfd{00}% - \loopbreak - }{}% - }% - }% - \ltxkeys@parse1[,]{#1}% - \expandafter\endgroup\if\pathkeys@chfd - \expandafter\iofii\else\expandafter\iiofii\fi -} - -\begingroup -\uccode`\~=`\/% -\uppercase{\endgroup - \def\pathkeys@normalizeslash#1{% - \unexpanded\expandafter{\romannumeral-`\q - \pathkeys@activeslash/#1/~\ltxkeys@nil}% - }% - \def\pathkeys@activeslash#1~#2\ltxkeys@nil{% - \ifblankTF{#2} - {\pathkeys@spaceslash#1 /\ltxkeys@nil} - {\pathkeys@activeslash#1/#2\ltxkeys@nil}% - }% -} -\def\pathkeys@spaceslash#1 /#2\ltxkeys@nil{% - \ifblankTF{#2} - {\pathkeys@slashspace#1/ \ltxkeys@nil} - {\pathkeys@spaceslash#1/#2\ltxkeys@nil}% -} -\def\pathkeys@slashspace#1/ #2\ltxkeys@nil{% - \ifblankTF{#2} - {\pathkeys@doubleslash#1//\ltxkeys@nil} - {\pathkeys@slashspace#1/#2\ltxkeys@nil}% -} -\def\pathkeys@doubleslash#1//#2\ltxkeys@nil{% - \ifblankTF{#2}{% - \ifblankTF{#1}{}{\@gobble#1}% - }{% - \pathkeys@doubleslash#1/#2\ltxkeys@nil - }% -} -\new@def*\pathkeys@n@rmalizeslash#1{% - \pathkeys@ifnopath{#1}{% - \expandafter\pathkeys@normalizeslash\expandafter - {\pathkeys@c@rrentpath/#1}% - }{% - \pathkeys@normalizeslash{#1}% - }% -} -\def\pathkeys@replaceslash#1/#2\ltxkeys@nil{% - \ifblankTF{#2}{% - #1% - }{% - \pathkeys@replaceslash#1@#2\ltxkeys@nil - }% -} -\new@def*\pathkeys@pathhistory{} -\robust@def*\pathkeys@addtopathhistory#1{% - \begingroup - \cptsafeactivesedef\reserved@e{#1}% - \def\reserved@f##1{% - \xifinsetTF{;##1;}{;\pathkeys@pathhistory;}{}{% - \xdef\pathkeys@pathhistory{\csliststack;\pathkeys@pathhistory##1}% - }% - }% - \xifinsetTF,\reserved@e{% - \def\ltxkeys@do##1{\reserved@f{##1}}% - \ltxkeys@parse*1[,]\reserved@e - }{% - \reserved@f\reserved@e - }% - \endgroup -} -\robust@def*\newpath#1#2{% - \ifcsndefTF{pathkeys@path@\cpttrimspace{#1}}{% - \pathkeys@err{Path '#1' already in use}\@ehc - }{% - \csn@edef{pathkeys@path@\cpttrimspace{#1}}{\cpttrimspace{#2}}% - \pathkeys@addtopathhistory{#2}% - }% -} -\robust@def*\defpath#1#2{% - \csn@edef{pathkeys@path@\cpttrimspace{#1}}{\cpttrimspace{#2}}% - \pathkeys@addtopathhistory{#2}% -} -\robust@def*\undefpath#1{% - \edef\ltxkeys@tempa{\usename{pathkeys@path@\cpttrimspace{#1}}}% - \pathkeys@undefpath - \undefcsn{pathkeys@path@\cpttrimspace{#1}}% -} -\robust@def*\pathkeys@undefpath{% - \xifinsetTF{;\ltxkeys@tempa;}{;\pathkeys@pathhistory;}{% - \def\reserved@a##1{% - \def\reserved@a####1##1####2\ltxkeys@nil{% - \def\pathkeys@pathhistory{####1####2}% - \xifinsetTF{;;}\pathkeys@pathhistory{% - \def\reserved@a########1;;########2\ltxkeys@nil{% - \def\pathkeys@pathhistory{########1;########2}% - }% - \expandafter\reserved@a\pathkeys@pathhistory\ltxkeys@nil - }{}% - \pathkeys@undefpath - }% - \expandafter\reserved@a\pathkeys@pathhistory\ltxkeys@nil - }% - \s@expandarg\reserved@a\ltxkeys@tempa - }{}% -} -\new@def*\usepath#1{% - \expandafter\pathkeys@usepath\romannumeral - -`\q\cptcommanormalize{#1},\ltxkeys@nil,\ltxkeys@nnil{}% -} -\new@def*\pathkeys@usepath#1,#2\ltxkeys@nnil#3{% - \ifstrcmpTF{#1}\ltxkeys@nil{% - \@gobble#3% - }{% - \ifcsndefTF{pathkeys@path@#1}{% - \pathkeys@usepath#2\ltxkeys@nnil{#3,\usename{pathkeys@path@#1}}% - }{% - \pathkeys@usepath#2\ltxkeys@nnil{#3,\usename{#1=undefinedpath}}% - }% - }% -} -\new@def*\pathkeys@defaultpath{dft@main/dft@sub} -\robust@def*\pathkeys@addtodefaultpath#1{% - \edef\pathkeys@defaultpath - {\expandcsonce\pathkeys@defaultpath/\expandcsonce{#1}}% - \csv@@normalize*[/]\pathkeys@defaultpath - \pathkeys@addtopathhistory\pathkeys@defaultpath -} -\robust@def*\pathkeys@changedefaultpath#1{% - \edef\pathkeys@defaultpath{\expandcsonce{#1}}% - \csv@@normalize*[/]\pathkeys@defaultpath - \pathkeys@addtopathhistory\pathkeys@defaultpath -} -\robust@def*\pathkeys@currentpath#1{% - \edef\pathkeys@c@rrentpath{\expandcsonce{#1}}% - \csv@@normalize*[/]\pathkeys@c@rrentpath - \pathkeys@addtopathhistory\pathkeys@c@rrentpath -} -\robust@def*\pathkeys@usedefaultpath{% - \let\pathkeys@c@rrentpath\pathkeys@defaultpath - \pathkeys@addtopathhistory\pathkeys@c@rrentpath -} -\new@def*\pathkeys@currentpathstack{} -\robust@def*\pathkeys@pushcurrentpath{% - \xdef\pathkeys@currentpathstack{% - \gdef\noexpand\pathkeys@c@rrentpath - {\expandcsonce\pathkeys@c@rrentpath}% - \ltxkeys@nil{\expandcsonce\pathkeys@currentpathstack}% - }% -} -\robust@def*\pathkeys@popcurrentpath{% - \begingroup - \def\reserved@a##1\ltxkeys@nil{\endgroup - ##1\gdef\pathkeys@currentpathstack - }% - \expandafter\reserved@a\pathkeys@currentpathstack - \pathkeys@addtopathhistory\pathkeys@c@rrentpath -} -\new@def*\pathkeys@ifnop@th#1/{} -\new@def*\pathkeys@ifnopath#1{% - \ifcat$\cptoxdetok{\pathkeys@ifnop@th#1{}/}$% - \expandafter\iofii\else\expandafter\iiofii\fi -} -\new@def*\pathkeys@getkeyval#1{% - \ifcsndefTF{pathkeys/curr/\pathkeys@n@rmalizeslash{#1}}{% - \expandcsnonce{pathkeys/curr/\pathkeys@n@rmalizeslash{#1}}% - }{% - \pathkeys@err{Key '\cpttrimspace{#1}' not defined}\ltxkeys@ehc - }% -} -\new@def*\pathkeys@storevalue#1#2{% - \ifescapedTF{#2}{% - \edef#2{\unexpanded\expandafter - {\romannumeral-`\q\pathkeys@getkeyval{#1}}}% - }{% - \cpt@notescapederr{#2}% - }% -} -\new@def*\ifpathkeyskeyval#1\then{% - \usename{if\pathkeys@getkeyval{#1}}% -} -\new@def*\ifpathkeyskeyvalTF#1{% - \ifpathkeyskeyval#1\then\expandafter\iofii\else - \expandafter\iiofii\fi -} -\new@def*\pathkeys@getval#1{% - \ifcsndefTF{pathkeys/curr/\pathkeys@n@rmalizeslash{#1}}{% - \expandcsnonce{pathkeys/curr/\pathkeys@n@rmalizeslash{#1}}% - }{% - undefinedpathkey% - }% -} -\new@def*\ifundefinedpathkey{undefinedpathkey\iffalse} -\new@def*\ifpathkeysval#1\then{\usename{if\pathkeys@getval{#1}}} -\new@def*\ifpathkeysvalTF#1{% - \ifpathkeysval#1\then\expandafter\iofii\else - \expandafter\iiofii\fi -} -\robust@def*\pathkeys@useshortcmds{% - \let\pathkeys@useshortcmds\relax - \pathkeys@makeshortcmds{% - \pkv=\pathkeysval,\ifpkv=\ifpathkeysval,\ifpkvTF=\ifpathkeysvalTF, - \pkkv=\pathkeyskeyval,\ifpkkv=\ifpathkeyskeyval, - \ifpkkvTF=\ifpathkeyskeyvalTF - }% -} -\robust@def*\pathkeys@makeshortcmds#1{% - \def\ltxkeys@do##1{% - \ifinsetTF{=}{##1}{% - \def\reserved@a####1=####2\@nil{% - \ifdefTF{####1}{% - \ifx####1####2\else - \pathkeys@err{Command '\string####1' already exists: - \MsgBrk it can't be redefined by - \string\pathkeys@makeshortcmds}\@ehc - \fi - }{% - \let####1=####2% - }% - }% - \reserved@a##1\@nil - }{% - \pathkeys@err{No '=' in short command assignment}\ltxkeys@ehc - }% - }% - \ltxkeys@parse3[,]{#1}% -} -\robust@def*\pathkeys@defineoptions#1{% - \begintoksgroup - \def\do##1/##2/##3\ltxkeys@nil{% - \toks@\expandafter{\the\toks@ - \ifstrcmpTF{##2}{pathkeys}{% - \usename{ltxkeys@declare##1option}% - [KV]<pathkeys>[pathkeys@]{##2}[##3]{}% - }{% - \usename{ltxkeys@declare##1option}% - [KV]<pathkeys>[pathkeys@]{##2}[##3]{% - \ltxkeys@options{##2=####1}% - }% - }% - }% - }% - \def\ltxkeys@do##1{\do##1\ltxkeys@nil}% - \ltxkeys@parse1[;]{#1}% - \endtoksgroup -} -\pathkeys@defineoptions{% - cmd/keyparser/{;}; - cmd/keydepthlimit/4; - cmd/keystacklimit/4; - bool/tracingkeys/true; - bool/reservenopath/true; - bool/allowemptypath/true; - bool/pathkeys/false; -} -\ltxkeys@declareoption*[KV]<pathkeys>{% - \pathkeys@warn{Unknown option '\CurrentKey' with - value '\InnocentVal' ignored.}% -} -\ltxkeys@processoptions*[KV]<pathkeys>\relax -\cpt@optioncleanup\ltxkeys@processedoptions - -\endinput - -%% End of file pathkeys.sty %% |