summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/ltxkeys
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-12-21 23:44:02 +0000
committerKarl Berry <karl@freefriends.org>2011-12-21 23:44:02 +0000
commit117036c8b17ada73b5a49c31661201ffdf6a55d8 (patch)
tree45e6c2fad0d1192d07e8024887a556c4b75c5624 /Master/texmf-dist/tex/latex/ltxkeys
parent96d75501059aaba75f35e407391703be9cf3b21f (diff)
ltxkeys 0.0.3 (19dec11)
git-svn-id: svn://tug.org/texlive/trunk@24898 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/ltxkeys')
-rw-r--r--Master/texmf-dist/tex/latex/ltxkeys/ltxkeys.sty582
-rw-r--r--Master/texmf-dist/tex/latex/ltxkeys/pathkeys.sty424
2 files changed, 716 insertions, 290 deletions
diff --git a/Master/texmf-dist/tex/latex/ltxkeys/ltxkeys.sty b/Master/texmf-dist/tex/latex/ltxkeys/ltxkeys.sty
index 7b735cc143c..ad892504860 100644
--- a/Master/texmf-dist/tex/latex/ltxkeys/ltxkeys.sty
+++ b/Master/texmf-dist/tex/latex/ltxkeys/ltxkeys.sty
@@ -1,6 +1,6 @@
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++%
% %
-% This is file 'ltxkeys.sty', version 0.0.2, October 2011. %
+% This is file 'ltxkeys.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, %
@@ -21,23 +21,22 @@
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++%
\@ifpackageloaded{catoptions}{%
- \@ifpackagelater{catoptions}{2011/10/22}{}{%
+ \@ifpackagelater{catoptions}{2011/12/10}{}{%
\@latex@error{Loaded version of catoptions package is
not current}\@ehc
}%
}{%
- \RequirePackage{catoptions}[2011/10/22]%
+ \RequirePackage{catoptions}[2011/12/10]%
}
\UseNormalCatcodes
-\StyleFilePurpose{A robust and fast key-value parser (AM)}
+\StyleFilePurpose{A robust key-value parser (AM)}
\StyleFileRCSInfo
-$Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
+$Id: ltxkeys.sty,v 0.0.3 2011/12/17 09:00:00 Ahmed Musa Exp $
\ProvidesPackage{ltxkeys}[\StyleFileInfo]
-\NeedsTeXFormat{LaTeX2e}[2005/12/01]
+\NeedsTeXFormat{LaTeX2e}[2011/06/27]
\SetStyleFileMessages[ltxkeys@]{info}{warn}{err}
-\catcode`\&=3
-\catcode`\^=3
\cpt@setupsafeactivesedef
+\catcode`\&=3
\new@def\ltxkeys@afterfi#1\ltxkeys@fi{\fi#1}
\new@def\ltxkeys@after@i#1\ltxkeys@else#2\ltxkeys@fi{\fi#1}
\new@def\ltxkeys@after@ii#1\ltxkeys@else#2\ltxkeys@fi{\fi#2}
@@ -45,7 +44,7 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\newletcs\ltxkeys@fi\fi
\new@def*\ltxkeys@ehc{%
\ifx\protect\string\ltxkeys@afterfi
- A serious error has been ecountered.\MsgBrk
+ A serious error has occurred.\MsgBrk
Try typing <return>\space to proceed.\MsgBrk
If that fails, type X and then <return>\space to quit.
\ltxkeys@fi
@@ -62,21 +61,19 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\newletcs\ltxkeys@nil\relax
\new@def*\ltxkeys@nnil{\ltxkeys@nil}
\new@def*\ltxkeys@quark{\@gobble\ltxkeys@quark}
+\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@ifxTF#1#2{%
- \ifx#1#2\ltxkeys@quark
- \expandafter\iofii\else\expandafter\iiofii\fi
-}
\new@def\ltxkeys@ifxFT#1#2{\ltxkeys@ifxTF{#1}{#2}\iiofii\iofii}
-\new@def\ltxkeys@ifcseqTF#1#2{%
+\new@def\ltxkeys@ifxTF#1#2{%
\expandafter\cptswap\cpt@car#1\ltxkeys@quark\car@nil
- {\expandafter\ltxkeys@ifxTF\cpt@car#2\relax\car@nil}%
+ {\expandafter\ifx\cpt@car#2\ltxkeys@antiquark\car@nil}%
+ \expandafter\iofii\else\expandafter\iiofii\fi
}
\new@def*\ltxkeys@ifcsemptyTF#1{%
\expandafter\ltxkeys@ifxTF\cpt@car#1\ltxkeys@quark\car@nil\@empty
}
-\robust@def*\ltxkeys@letmanytocs#1#2{\cptfor#1\dofor{\let##1=#2}}
+\robust@def*\ltxkeys@letmanytocs#1#2{\cptfor#1\dofor{\let##1= #2}}
\robust@def*\ltxkeys@error#1#2{\ltxkeys@err{#1}{#2}\@gobble}
\robust@def*\ltxkeys@debug#1#{%
\ifboolTF{ltxkeys@tracingkeys}{%
@@ -92,19 +89,19 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\robust@def*\ltxkeys@d@bug#1#2{%
\wlog{\ifcpt@st^^J\fi ltxkeys debug [#1] #2.}%
}
-\newvariables{if}[ltxkeys@]{break,st,pl,cl,sw,sv,nv,noval,pxop,exop,
+\cptnewvariables{if}[ltxkeys@]{break,st,pl,cl,sw,sv,nv,noval,pxop,exop,
preset,disable,ini,kf,rm,ssk,dec,dep,twk,tracingkeys,useempty,chdef,
swa,reservenopath,global,protected,inkeycmd}[false]
-\newvariables{if}{inputvalid}[false]
-\newvariables{switch}{infdpointers,infdp@inters}[false]
-\newvariables{count}[ltxkeys@]{csvdepth,keydepth}[\z@pt]
+\cptnewvariables{if}{inputvalid}[false]
+\cptnewvariables{switch}{infdpointers,infdp@inters}[false]
+\cptnewvariables{count}[ltxkeys@]{csvdepth,keydepth}[\z@pt]
\robust@def*\setslavewithmaster{\global\ltxkeys@ssktrue}
\robust@def*\setnoslavewithmaster{\global\ltxkeys@sskfalse}
\setnoslavewithmaster
\robust@def*\allowemptykeypath{\global\ltxkeys@useemptytrue}
\robust@def*\disallowemptykeypath{\global\ltxkeys@useemptyfalse}
\DefSuffixChecker\ltxkeys@suffixcheck{*}{+}{!}
-\let\ltxkeys@documentclass\cpt@undefined
+\newletcs\ltxkeys@documentclass\cpt@undefined
\robust@def*\ltxkeys@getdocumentclass{%
\def\csv@do##1{%
\filename@parse{##1}%
@@ -120,7 +117,7 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\csv@@parse*\@filelist
\ifdefTF\ltxkeys@documentclass{}{%
\ltxkeys@debug{==}{'ltxkeys' package loaded before
- \string\documentclass: \MsgBrk no problem}%
+ \string\documentclass:\MsgBrk no problem}%
}%
}
\cptpassunexpanded{%
@@ -208,18 +205,34 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\@do#1,\@nil\@nil,%
}
\new@def*\ltxkeys@iffirstnull#1#2{\ltxkeys@ifcsemptyTF#1{}{#1#2}}
+\robust@def*\ltxkeys@remdottrimspaces#1#2{%
+ \cptexpandbracenext\ltxkeys@trimspaces{\@gobble#1}#2%
+}
+\robust@def*\ltxkeys@simplesplitkeyval#1{%
+ \expandafter\ltxkeys@simplespl@tkeyval#1=^?^=^?^=\ltxkeys@nil
+}
+\robust@def*\ltxkeys@simplespl@tkeyval#1={%
+ \def\reserved@a##1={%
+ \def\reserved@a####1=####2\ltxkeys@nil{%
+ \ltxkeys@trimspaces{#1}\key@name
+ \ltxkeys@remdottrimspaces{##1}\key@value
+ \ltxkeys@remdottrimspaces{####1}\remainder
+ }%
+ \reserved@a.%
+ }%
+ \reserved@a.%
+}
\robust@def*\ltxkeys@splitkeyattrib#1{%
\begingroup
\def\ltxkeys@splita##1/##2/{%
\ltxkeys@trimspacesset{{##1}\key@type,{##2}\key@name}%
\ltxkeys@ifrejname{%
- \ltxkeys@err{Wrong syntax for attributes of a key}
- \ltxkeys@ehc
+ \ltxkeys@err{Wrong syntax for attributes of a key}\ltxkeys@ehc
}%
\ltxkeys@splitb.%
}%
\def\ltxkeys@splitb##1/{%
- \s@expandarg\ltxkeys@trimspaces{\@gobble##1}\key@default
+ \ltxkeys@remdottrimspaces{##1}\key@default
\ltxkeys@splitc.%
}%
\def\ltxkeys@splitc##1/{%
@@ -228,22 +241,23 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\ltxkeys@splitd.%
}%
\def\ltxkeys@splitd##1/##2\ltxkeys@nil{%
- \s@expandarg\ltxkeys@trimspaces{\@gobble##1}\key@dependants
+ \ltxkeys@remdottrimspaces{##1}\key@dependants
}%
- \ltxkeys@splita#1/^?/^?/^?/^?/^?/\ltxkeys@nil
+ \ltxkeys@splita#1/^?^/^?^/^?^/^?^/^?^/\ltxkeys@nil
\let\do\cpt@csexit
\cptexpanded{\endgroup
\do\key@type\do\key@name\do\key@default\do\key@macro
\do\key@dependants
}%
}
-\new@def*\ltxkeys@rej{^?}
+\new@def*\ltxkeys@rej{^?^}
+% Does #1 start with '.code'? If it does, remove '.code':
\robust@def*\ltxkeys@stripdotcode#1{%
\ltxkeys@trimspacesincs#1%
\xifinsetTF{\relax\detokenize{.code=}}{\relax\cptoxdetok{#1}}{%
\def\reserved@a##1.code=##2\ltxkeys@nil{%
\def\reserved@a####1.\ltxkeys@nil{%
- \s@expandarg\ltxkeys@trimspaces{\@gobble####1}#1%
+ \ltxkeys@remdottrimspaces{####1}#1%
}%
\reserved@a.##2\ltxkeys@nil
}%
@@ -255,7 +269,7 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\xifinsetTF{\detokenize{/.code=}}{\detokenize{#1}}{%
\def\reserved@a##1/.code=##2\ltxkeys@nil{%
\def\reserved@a####1.\ltxkeys@nil{%
- \s@expandarg\ltxkeys@trimspaces{\@gobble####1}\reserved@a
+ \ltxkeys@remdottrimspaces{####1}\reserved@a
\edef#2{\expandcsonce{\@gobble##1}/\expandcsonce\reserved@a}%
}%
\reserved@a.##2\ltxkeys@nil
@@ -275,7 +289,7 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\ltxkeys@trimspaces{#1}\reserved@a
\ltxkeys@trimspaces{#2}\reserved@b
\ltxkeys@stfalse
- \cptexpandargonce\ltxkeys@in@a\reserved@a\reserved@b
+ \cptexpandtwoargsonce\ltxkeys@in@a\reserved@a\reserved@b
\ifin@
}
\robust@def*\ltxkeys@ifchcfd#1\endgroup{%
@@ -309,21 +323,27 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\fi
#2%
}
-\new@def\ltxkeys@stripouterbraces#1#2{%
- \romannumeral\expandafter\ltxkeys@str@pouterbraces
- \expandafter{\romannumeral\number#1000m}{#2}%
+\new@def\ltxkeys@stripNouterbraces#1#2{%
+ \romannumeral\expandafter\ltxkeys@str@pNouterbraces
+ \expandafter{\romannumeral\number#1000m}\strip@nil#2\strip@nil
}
-\new@def\ltxkeys@str@pouterbraces#1#2{%
+\new@def\ltxkeys@str@pNouterbraces#1\strip@nil#2\strip@nil{%
\ifbracedTF{#2}{%
\expandafter\ifnullTF\expandafter{\@gobble#2}{%
\expandafter\ifnullTF\expandafter{\@gobble#1}{0 #2}{%
- \s@expandarg\ltxkeys@str@pouterbraces{\@gobble#1}#2%
+ \cptexpandbracenext\ltxkeys@str@pNouterbraces{\@gobble#1}%
+ \strip@nil#2\strip@nil
}%
}{0 #2}%
}{0 #2}%
}
-\robust@def\ltxstripouterbraces#1#2#3{%
- \edef#3{\unexpanded\cptthreexp{\ltxkeys@stripouterbraces{#1}{#2}}}%
+\new@def*\ltxkeys@stripallouterbraces#1{\ltxkeys@stripNouterbraces\@m{#1}}
+\new@def*\ltxkeys@stripallouterbracesincs#1{%
+ \ifmacroTF{#1}{%
+ \edef#1{\cptexpandbracenext{\ltxkeys@stripNouterbraces\@m}{#1}}%
+ }{%
+ \cpt@notcserr{#1}%
+ }%
}
\robust@def*\ltxkeys@getbasechars{\cpt@teststopt\ltxkeys@g@tchars{1}}
\robust@def*\ltxkeys@g@tchars[#1]#2#3{%
@@ -409,6 +429,31 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
}%
}%
}
+\provide@def\all@to@endif#1\endif{#1}
+\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
+}
+\new@def\ltxkeys@ifcasse#1{%
+ \ifstrcmpTF{#1}\elseif{%
+ \all@to@endif
+ }{%
+ \ifstrcmpTF{#1}\endif{}{\ltxkeys@ifcasse@a{#1}}%
+ }%
+}
+\new@def\ltxkeys@ifcasse@a#1#2{%
+ \ifstrcmpTF{#2}\elseif{%
+ \all@to@endif
+ }{%
+ \ifstrcmpTF{#2}\endif{}{%
+ \ltxkeystestcmd{#1}{#2}\first@to@endif{\ltxkeys@ifcasse@b{#1}}%
+ }%
+ }%
+}
+\new@def\ltxkeys@ifcasse@b#1#2{%
+ \ifstrcmpTF{#2}\endif{}{\ltxkeys@ifcasse@a{#1}}%
+}
\robust@def*\ltxkeys@removeelements{\cpt@teststopt\ltxkeys@rem@veelements,}
\robust@def*\ltxkeys@rem@veelements[#1]{%
\cpt@testpnopt{\ltxkeys@rem@veelem@nts{#1}}\@ne
@@ -416,10 +461,10 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\robust@def\ltxkeys@rem@veelem@nts#1(#2)#3#4{%
\let\ltxkeys@tempa#3%
\ifcpt@st\else
- \ifnum#2=\z@pt\cptthreexp\cpt@gobbletorelax\fi
+ \ifnum#2=\z@pt\cptthreexp\cptgobbletorelax\fi
\fi
\iflacus#4\dolacus
- \expandafter\cpt@gobbletorelax
+ \expandafter\cptgobbletorelax
\fi
\begingroup
\let\detk\detokenize
@@ -464,10 +509,10 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\robust@def\ltxkeys@r@pl@ceelements#1(#2)#3#4{%
\let\ltxkeys@tempa#3%
\ifcpt@st\else
- \ifnum#2=\z@pt\cptthreexp\cpt@gobbletorelax\fi
+ \ifnum#2=\z@pt\cptthreexp\cptgobbletorelax\fi
\fi
\iflacus#4\dolacus
- \expandafter\cpt@gobbletorelax
+ \expandafter\cptgobbletorelax
\fi
\begingroup
\let\if@replst\ifcpt@st
@@ -621,6 +666,25 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\ltxkeys@error{User input '\ltxkeys@userinput' not in list
of nominations ||\ltxkeys@nominations||}\ltxkeys@ehc
}
+\robust@def*\ltxkeys@ifoneincsvlist{\cpt@teststopt\ltxkeys@ifoneincsvl@st,}
+\robust@def*\ltxkeys@ifoneincsvl@st[#1]#2#3{%
+ \begingroup
+ \ifcpt@st
+ \let\test@list#2%
+ \let\master@list#3%
+ \else
+ \edef\test@list{\unexpanded{#2}}%
+ \edef\master@list{\unexpanded{#3}}%
+ \fi
+ \csv@@normalize*[#1]\master@list
+ \cpt@choicefdfalse
+ \def\csv@do##1{%
+ \oifinset@sp@TF#1{##1}\master@list{\cpt@choicefdtrue\loopbreak}{}%
+ }%
+ \csv@@parse*[#1]\test@list
+ \expandafter\endgroup
+ \ifcpt@choicefd\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi
+}
\robust@def*\ltxkeys@ifincsvlistTF{\cpt@teststopt\ltxkeys@ifincsvlist,}
\robust@def*\ltxkeys@ifincsvlist[#1]{%
\cpt@testpnopt{\ltxkeys@if@ncsvlist#1}{1}%
@@ -636,7 +700,7 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\cpt@cnta\z@pt
\def\ltxkeys@itemspresent{}%
\def\ltxkeys@do##1{%
- \xifinsetFT{\detokenize{#1##1#1}}
+ \xifinsetFT{\detokenize{#1##1#1}}%
{\parser\cptoxdetok\ltxkeys@tempb\parser}{}{%
\edef\ltxkeys@itemspresent
{\csliststack,\ltxkeys@itemspresent\unexpanded{##1}}%
@@ -658,6 +722,26 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\noexpand\@firstoftwo\fi
}%
}
+\robust@def*\ltxkeys@ifoneintokenlist{\cpt@testst\ltxkeys@ifoneint@kenlist}
+\robust@def*\ltxkeys@ifoneint@kenlist#1#2{%
+ \begingroup
+ \ifcpt@st
+ \let\test@list#1%
+ \let\master@list#2%
+ \else
+ \edef\test@list{\unexpanded{#1}}%
+ \edef\master@list{\unexpanded{#2}}%
+ \fi
+ \cpt@choicefdfalse
+ \def\tsv@do##1{%
+ \edef\reserved@a{\ltxkeys@stripNouterbraces{1}{##1}}%
+ \xifinsetTF{\cptoxdetok\reserved@a}
+ {\cptoxdetok\master@list}{\cpt@choicefdtrue\loopbreak}{}%
+ }%
+ \tsv@@parse*\test@list
+ \expandafter\endgroup
+ \ifcpt@choicefd\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi
+}
\robust@def*\ltxkeys@ifintsvlistTF{%
\cpt@testst{\cpt@testpnopt\ltxkeys@ifintsvlist{1}}%
}
@@ -768,11 +852,11 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\ifcsdefinable{#1}\relax
\begingroup
\ltxkeys@letmanytocs{#1,\ifstrcmpTF,\cptexpandnext,
- \ltxkeys@ifcseqTF,\listbreak,\ltxkeys@parser@nil}\relax
+ \ltxkeys@ifxTF,\listbreak,\ltxkeys@parser@nil}\relax
\def\elta##1{\noexpandcsn{\cptgobblescape#1@list@##1}}%
\def\eltb##1{\cptexpandnext{\elta{b}##1}{########1}%
#2\ltxkeys@parser@nil#2?{}}%
- \def\eltc{\ltxkeys@ifcseqTF!\unexpanded{{####1}{####4}%
+ \def\eltc{\ltxkeys@ifxTF!\unexpanded{{####1}{####4}%
{\unexpanded{####4}}}}%
\cptexpanded{\endgroup
\def#1####1{%
@@ -780,7 +864,7 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
}%
\def\elta{a}####1{\eltb!}%
\def\elta{b}####1####2#2####3?####4####5{%
- \ltxkeys@ifcseqTF\ltxkeys@parser@nil{####2}{\eltc}{%
+ \ltxkeys@ifxTF\ltxkeys@parser@nil{####2}{\eltc}{%
\ifstrcmpTF{####2}{\listbreak}{\eltc}{%
\elta{b}{####1}####3?{####4####5{####2}}{####5}%
}%
@@ -1047,17 +1131,17 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\csn@xdef{\ltxkeys@hdr#1keys}{\expandcsonce{#2}}%
}%
}
-\robust@def*\ltxkeys@addtop@intedkeys#1#2#3{%
- \edef\ltxkeys@tempa{#2{\expandcsonce{#3}}}%
- \letcstocsn\reserved@e{@\ltxkeys@hdr#1keys}%
+\robust@def*\ltxkeys@addtosavedvalue#1#2{%
+ \edef\ltxkeys@tempa{#1{\expandcsonce{#2}}}%
+ \letcstocsn\reserved@e{\ltxkeys@hdr @savedvaluelist}%
\ifdefTF\reserved@e{%
- \xifinsetTF{,\cptoxdetok\ltxkeys@tempa,}{,\cptoxdetok\reserved@e,}%
- {}{%
- \csn@xdef{@\ltxkeys@hdr#1keys}%
+ \oifinset@sp@TF,\ltxkeys@tempa\reserved@e{}{%
+ \csn@xdef{\ltxkeys@hdr @savedvaluelist}%
{\csliststack,\reserved@e\expandcsonce\ltxkeys@tempa}%
}%
}{%
- \csn@xdef{@\ltxkeys@hdr#1keys}{\expandcsonce\ltxkeys@tempa}%
+ \csn@xdef{\ltxkeys@hdr @savedvaluelist}%
+ {\expandcsonce\ltxkeys@tempa}%
}%
}
\new@def*\ltxkeys@currtriple{%
@@ -1155,8 +1239,8 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\def\@do##1,##2,##3;{%
\ifnot@nil{##1}{%
\ifnum\numexpr
- \ifdefTF##2{0}{-1}\ltxkeys@ifcsemptyTF##2{-1}{0}%
- \ifdefTF##3{0}{-1}\ltxkeys@ifcsemptyTF##3{-1}{0}<\z@pt
+ \ifdefTF##2{0}{-1}\ltxkeys@ifcsemptyTF##2{-1}{+0}%
+ \ifdefTF##3{+0}{-1}\ltxkeys@ifcsemptyTF##3{-1}{+0}<\z@pt
\else
\oifinset@sp@FT,##2##3{}{%
\ltxkeys@error{##1 '##2' is reserved}
@@ -1302,6 +1386,8 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
}%
}
\robust@def*\ltxkeys@boolkey@e#1#2#3#4#5{%
+ % We've delayed the calling of \ltxkeys@checkdefkey till
+ % here because of biboolkeys:
\def\reserved@a##1#2\ltxkeys@nil{%
\def\ltxkeys@macpref{##1}%
}%
@@ -1316,25 +1402,47 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
{##1}{true,false}#5}%
}%
}
+% \ltxkeys@biboolkeys[pref]{fam}[mp]{key1,key2}[dft]{key1-fn}{key2-fn}
+% \ltxkeys@biboolkeys+[pref]{fam}[mp]{key1,key2}[dft]{key1-fn}{key2-fn}
+% {<fallback>}
+% <fallback> will be called if input isn't valid (ie, not in the
+% set {true | false}.
\robust@def*\ltxkeys@biboolkeys{%
\ltxkeys@swtrue
\ltxkeys@testpl{\ltxkeys@testopt@e\ltxkeys@biboolkeys@a{}}%
}
\robust@def*\ltxkeys@newbiboolkeys{\ltxkeys@chdeftrue\ltxkeys@biboolkeys}
+% #1: <mp>
+% #2: keys
+% #3: default value
\robust@def*\ltxkeys@biboolkeys@a#1#2[#3]{%
\ifboolTF{ltxkeys@pl}\ltxkeys@biboolkeys@c\ltxkeys@biboolkeys@b
{#1}{#2}{#3}%
}
+% #1: <mp>
+% #2: keys
+% #3: default value
+% #4: callback for primary boolean key
+% #5: callback for secondary boolean key
\robust@def*\ltxkeys@biboolkeys@b#1#2#3#4#5{%
\ltxkeys@biboolkeys@d{#1}{#2}{#3}%
\ltxkeys@tempa{#4}%
\ltxkeys@tempb{#5}%
}
+% #1: <mp>
+% #2: keys
+% #3: default value
+% #4: callback for primary boolean key
+% #5: callback for secondary boolean key
+% #6: callback if user-supplied value isn't valid
\robust@def*\ltxkeys@biboolkeys@c#1#2#3#4#5#6{%
\ltxkeys@biboolkeys@d{#1}{#2}{#3}%
\ltxkeys@tempa{#4}{#6}%
\ltxkeys@tempb{#5}{#6}%
}
+% #1: <mp>
+% #2: keys
+% #3: default value
\robust@def*\ltxkeys@biboolkeys@d#1#2#3{%
\ltxkeys@ifeltcountTF[,](=)\tw@{#2}{}{%
\ltxkeys@error{Biboolean keys '#2' not equal to 2}\ltxkeys@ehc
@@ -1355,16 +1463,26 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
{\ltxkeys@keys\ltxkeys@nil{\ltxkeys@ttpref}{\ltxkeys@tfam}}%
\undefcs\ltxkeys@tkeya
}
+% #1: primary key
+% #2: secondary key
+% #3: <mp>
+% #4: default value
+% #5: key prefix
+% #6: key family
\robust@def\ltxkeys@biboolkeys@e#1#2#3#4#5#6{%
\ifltxkeys@pl
+ % For primary key:
\long\def\ltxkeys@tempa##1##2{%
+ % ##1->callback if input is valid, ##2->callback otherwise
\aftercsname\ltxkeys@boolkey@e{\ltxkeys@hdr#1}{#1}{#3#1}{#4}{{%
\ltxkeys@setbool\ltxkeys@resa\usename{#3#1\ltxkeys@resa}%
##1\relax
\ltxkeys@biboolkeys@f{#1}{#2}{#3#1}{#5}{#6}%
}{##2}}%
}%
+ % For secondary key:
\long\def\ltxkeys@tempb##1##2{%
+ % ##1->callback if input is valid, ##2->callback otherwise
\aftercsname\ltxkeys@boolkey@e{\ltxkeys@hdr#2}{#2}{#3#2}{#4}{{%
\ltxkeys@setbool\ltxkeys@resa\usename{#3#2\ltxkeys@resa}%
##1\relax
@@ -1372,14 +1490,18 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
}{##2}}%
}%
\else
+ % For primary key:
\long\def\ltxkeys@tempa##1{%
+ % ##1->callback if input is valid
\aftercsname\ltxkeys@boolkey@e{\ltxkeys@hdr#1}{#1}{#3#1}{#4}{%
\ltxkeys@setbool\ltxkeys@resa\usename{#3#1\ltxkeys@resa}%
##1\relax
\ltxkeys@biboolkeys@f{#1}{#2}{#3#1}{#5}{#6}%
}%
}%
+ % For secondary key:
\long\def\ltxkeys@tempb##1{%
+ % ##1->callback if input is valid
\aftercsname\ltxkeys@boolkey@e{\ltxkeys@hdr#2}{#2}{#3#2}{#4}{%
\ltxkeys@setbool\ltxkeys@resa\usename{#3#2\ltxkeys@resa}%
##1\relax
@@ -1389,14 +1511,39 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\fi
}
\robust@def\ltxkeys@biboolkeys@f#1#2#3#4#5{%
+ % If #1 is not being called by its twin (#2):
\iftogTF{\ltxkeys@hdr#1}{}{%
+ % Set flag to show that #2 is being set within its twin (#1):
\settogtrue{\ltxkeys@hdr#2}%
\cptexpandarg{\ltxkeys@setkeys[#4]{#5}}{#2=\thebool@reverse{#3}}%
\settogfalse{\ltxkeys@hdr#2}%
}%
}
+%%++
+% \ltxkeys@stylekey[<pref>]{<fam>}[<mp>]{<key>}[<dft>](<deps>){<fn>}.
+% The dependants <deps> have the syntax:
+% {<keytype>/<keyname>/<dft>/<callback>; another set of dependant; etc}.
+%
+% <keytype> can be 'ord' (ordinary key), 'cmd' (command key), 'bool'
+% (boolean key), or 'choice' (choice key).
+%
+% If the *-form is used, all undefined dependants will be defined and set
+% on the fly as the parent is being set. If the *-form isn't used and
+% undefined dependants occur, then an error message will be flagged
+% at the time the parent is being set.
+
+% It is possible to refer to the parent key's name and current value
+% (with \parentkey and \parentval) and parent key's callback
+% (with full macro name) within <dft> and <callback> of <deps>.
+%
+% '#1' in the callback of dependant key refers to the current value of
+% the dependant key.
+
\robust@def*\ltxkeys@stylekey{%
\ltxkeys@swfalse
+ % The test for star here is for the 2 types of style key.
+ % The test for defining a default for the key is at
+ % \ltxkeys@testopt@f, via \ltxkeys@testopt@e.
\ltxkeys@testst{%
\cpt@cnta\ifltxkeys@st1\else0\fi\relax
\ltxkeys@testopt@e\ltxkeys@stylekey@a{style}%
@@ -1447,12 +1594,18 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
}%
}%
}
+
+% #1: style type, '1' (*-form) or '0' (plain, non-*-form).
+% #2: <macro prefix>
\robust@def*\ltxkeys@setdependants#1#2{%
\letcstocsn\ltxkeys@tempa{\ltxkeys@hdr\ltxkeys@tkey @dependants}%
+ % If no dependants:
\ltxkeys@ifcsemptyTF\ltxkeys@tempa{}{%
\cpt@sttrue
\expandafter\cpt@csvnormalize
\expandafter[\ltxkeys@keyparser]\ltxkeys@tempa
+ % If we're in \ltxkeys@declarekeys, don't set dependants
+ % when setting up defaults:
\ifboolTF{ltxkeys@dec}{}{%
\cptexpandargonce{\ltxkeys@s@tdependants{#1}{#2}}\ltxkeys@tempa
}%
@@ -1466,9 +1619,12 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\ltxkeys@s@td@p@ndants{#1}%
}%
\cptexpandsecond{\ltxkeys@parse0}{[\ltxkeys@keyparser]}{#3}%
+ % We're in a group: so \ifblankTF can be temporarily redefined:
\let\ifblankTF\relax
\cptpassexpanded{%
\endgroup
+ % If we're in dependant keys, use the user-supplied value
+ % of parent key to initialize the slave key in \ltxkeys@declarekeys:
\noexpand\ltxkeys@deptrue
\ifblankTF{\the\toks0}{}%
{\ltxkeys@setkeys[\expandcsonce\ltxkeys@ttpref]%
@@ -1496,14 +1652,20 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\robust@def*\ltxkeys@s@td@pendants#1{%
\begingroup
\def\key@name{}\def\key@default{}\def\key@macro{}%
+ % '#1' may come with nested parameters that will make it
+ % impossible to include '#1' directly in \temp@err.
+ % So we put '#1' in a token register:
\@temptokena{#1}%
\def\ltxkeys@splita##1/##2/{%
\ifblankTF{##1##2}{%
+ % No keys to read (remove forward slashes):
\ltxkeys@err{Something is wrong with dependant keys}\ltxkeys@ehc
\expandafter\gobble@to@sentinel\expandafter
\ltxkeys@nil\ltxkeys@keyparser
}{%
\ltxkeys@trimspaces{##1}\key@type
+ % To avoid back-linking, a style key can't have another
+ % style key as a dependant:
\expandafter\ltxkeys@striplaststar
\key@type\@empty*\@empty\ltxkeys@nil\key@type
\xifstrcmpFT\key@type{sty}{}{%
@@ -1536,7 +1698,7 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\edef\key@macro{\unexpanded{##2}}%
\ltxkeys@stripdotcode\key@macro
}%
- \ltxkeys@splita#1/^?/^?/^?/\ltxkeys@nil
+ \ltxkeys@splita#1/^?^/^?^/^?^/\ltxkeys@nil
\let\do\cpt@csexit
\cptpassexpanded{%
\endgroup
@@ -1551,6 +1713,8 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
}%
}{%
\cptpassexpanded{%
+ % Test if the parent was defined with the
+ % *-form of \ltxkeys@stylekey, ie, if #1=1 or 0:
\ifnum\numexpr#1=\@ne
\toks1{%
\the\toks1\oifblankTF{\the\toks1}{}{\ltxkeys@keyparser}%
@@ -1565,6 +1729,20 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
}%
}%
}
+
+%%++
+% \ltxkeys@choicekey*+![<pref]{<fam>}[<mp>]{<key>}[<bin>]{<alt>}[<dft>]{<f1>}{<f2>}
+% If <mp> is absent, then \ltxkeys@choicekey uses \chc<pref>@<family>@<key>
+% to hold user input.
+%
+% When there are no callbacks in <alt> ist has the syntax
+% {choice1, choice2, etc}.
+%
+% But when <alt> has callbacks, it has the syntax:
+% {choice1/.code=callback1; choice2/.code=callback2; etc}.
+%
+% It is possible to refer to the current value of <key> as '#1' in <alt>.
+%
\robust@def*\ltxkeys@choicekey{%
\ltxkeys@swfalse
\ltxkeys@suffixcheck{\ltxkeys@teststpl{\ltxkeys@testcl
@@ -1574,6 +1752,8 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\newletcs\ltxkeys@choicekeys\ltxkeys@choicekey
\robust@def*\ltxkeys@newchoicekey{\ltxkeys@chdeftrue\ltxkeys@choicekey}
\newletcs\ltxkeys@newchoicekeys\ltxkeys@newchoicekey
+% #1: <mp> (prefix for user-input holder) name;
+% #2: keynames
\robust@def*\ltxkeys@choicekey@a[#1]#2{%
\edef\ltxkeys@macpref{#1}%
\begingroup
@@ -1581,10 +1761,13 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\catcode`\;=12\catcode`\.=12
\cpt@testopt{\expandafter\endgroup\ltxkeys@choicekey@b{#1}{#2}}{}%
}
+% #3: bin
+% #4 alt values
\robust@def*\ltxkeys@choicekey@b#1#2[#3]#4{%
\ifblankTF{#4}{%
\ltxkeys@err{Choice key can't have empty nominations}\ltxkeys@ehc
}{}%
+ % Make \ltxkeys@chclist for the choice key:
\ltxkeys@makechclist{#4}{0}%
\cpt@ifbrack{%
\ltxkeys@sttrue\ltxkeys@bracedefault
@@ -1593,6 +1776,7 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\ltxkeys@stfalse\ltxkeys@choicekey@c{#1}{#2}{#3}{#4}[]%
}%
}
+% #1: mp, #2: keynames, #3: bin, #4: alt, #5: default
\robust@def*\ltxkeys@choicekey@c#1#2#3#4[#5]{%
\ltxkeys@commanormalize{#2}\ltxkeys@tempa
\edef\ltxkeys@tempa{\unexpanded{{#1}}{\expandcsonce\ltxkeys@tempa}}%
@@ -1602,6 +1786,7 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
}%
\ltxkeys@tempa{#3}{#4}{#5}%
}
+% #1: mp, #2: keyname, #3: default
\robust@def*\ltxkeys@choicekey@d#1#2#3{%
\ltxkeys@findpointers{#2}%
\ltxkeys@debug{==}{Choice key '\ltxkeys@tkey' is being defined}%
@@ -1613,30 +1798,37 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
{#1\ltxkeys@tkey}{##1}{##2}{##3}%
}%
}
+% #1: mp, #2: keynames, #3: bin, #4: alt, #5: default, #6: cbk
\robust@def*\ltxkeys@choicekey@e#1#2#3#4#5#6{%
\edef\ltxkeys@loopcbk##1{%
\ltxkeys@choicekey@d{#1}{##1}\unexpanded{{#5}}%
\noexpand\ltxkeys@resa\unexpanded{{#3}{#4}{{#6}}}%
}%
\ifinsetTF,{#2}{%
- \def\ltxkeys@do##1{\ltxkeys@loopcbk{##1}}%
+ \def\ltxkeys@do##1{%
+ \ltxkeys@loopcbk{##1}%
+ }%
\ltxkeys@parse1{#2}%
}{%
\ltxkeys@loopcbk{#2}%
}%
}
+% #1: mp, #2: keyname, #3: bin, #4: alt, #5: default, #6: cbk1, #7: cbk2
\robust@def*\ltxkeys@choicekey@f#1#2#3#4#5#6#7{%
\edef\ltxkeys@loopcbk##1{%
\ltxkeys@choicekey@d{#1}{##1}\unexpanded{{#5}}%
\noexpand\ltxkeys@resa\unexpanded{{#3}{#4}{{#6}{#7}}}%
}%
\ifinsetTF,{#2}{%
- \def\ltxkeys@do##1{\ltxkeys@loopcbk{##1}}%
+ \def\ltxkeys@do##1{%
+ \ltxkeys@loopcbk{##1}%
+ }%
\ltxkeys@parse1{#2}%
}{%
\ltxkeys@loopcbk{#2}%
}%
}
+% #1: keymacro, #2: mp+keyname, #3: bin, #4: alt, #5: cbk
\robust@def*\ltxkeys@choicekey@g#1#2#3#4#5{%
\ifinsetTF{/.code=}{#4}{%
\def\ltxkeys@tempa{\ltxkeys@executechclist}%
@@ -1661,9 +1853,13 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
{\expandcsonce\ltxkeys@chclist}\unexpanded{#5}%
\expandcsonce\ltxkeys@tempa{\unexpanded{#4}}%
}%
+ % Believe it or not, this is one of the tricks that works:
\def\ltxkeys@tempa{\def#1####1}%
\expandafter\ltxkeys@tempa\expandafter{#1}%
}
+% Make the list of valid alternate values of a choice key:
+% #1: alt-list (containing choice callbacks)
+% #2: caller identifier (0 for defining, 1 for setting key)
\robust@def*\ltxkeys@makechclist#1#2{%
\begingroup
\def\ltxkeys@chclist{}%
@@ -1674,15 +1870,17 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\ltxkeys@tempd{##1}{##2}%
}%
\def\ltxkeys@tempd##1##2{%
- \expandafter\ltxkeys@trimspaces\expandafter
- {\@gobble##1}\ltxkeys@tempa
+ \ltxkeys@remdottrimspaces{##1}\ltxkeys@tempa
\ifcase#2\relax
+ % We're defining a choice key:
\cptaddtolist*[,]\ltxkeys@chclist\ltxkeys@tempa
\or
+ % We're setting a choice key:
\cptexpandarg\lowercase{%
\def\noexpand\ltxkeys@tempa{\expandcsonce\ltxkeys@tempa}%
\def\noexpand\ltxkeys@tval{\expandcsonce\ltxkeys@tval}%
}%
+ % The comparison must be catcode agonistic:
\oifstrcmpTF\ltxkeys@tempa\ltxkeys@tval{%
\edef\ltxkeys@chclist{\unexpanded{##2}}%
\loopbreak
@@ -1710,11 +1908,15 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
}%
\postgroupdef\ltxkeys@chclist\endgroup
}
+% Execute the callback for alternate values of a choice key:
+% #1: alt-list (containing choice callbacks)
\robust@def*\ltxkeys@executechclist#1{%
\begingroup
\ltxkeys@makechclist{#1}{1}%
\expandafter\endgroup\ltxkeys@chclist
}
+% #1: key name
+% #2: default value
\robust@def*\ltxkeys@definedefault#1#2{%
\xifstrcmpTF{\detokenize{#2}}{\detokenize{\parentval}}{%
\s@expandarg\ltxkeys@trimspaces{#2}\ltxkeys@tempa
@@ -1746,7 +1948,8 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\ltxkeys@novalfalse
\begingroup
\def\ltxkeys@tempa##1=##2\ltxkeys@nil{\endgroup
- \s@expandarg\ltxkeys@trimspaces{\@gobble##1}#3%
+% \s@expandarg\ltxkeys@trimspaces{\@gobble##1}#3%
+ \ltxkeys@remdottrimspaces{##1}#3%
\let\CurrentVal#3%
}%
\ltxkeys@tempa.#2\ltxkeys@nil
@@ -1758,6 +1961,8 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\ltxkeys@getkeyname#1=\ltxkeys@nil#2%
\ltxkeys@getkeyvalue#1=\ltxkeys@nil#3%
}
+% Keys that must (or not) appear in \usepackage and \RequirePackage:
+% \ltxkeys@optionkeys[<prf>]{<fam>}{<keys>}
\robust@def*\ltxkeys@optionkeys{%
\ltxkeys@notinpkgclserr\ltxkeys@optionkeys
\cpt@testst\ltxkeys@opti@nkeys
@@ -1804,6 +2009,8 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
}%
\ltxkeys@parse1{#2}%
}
+% Make defined keys option-keys from their <pref> and <fam>.
+% The starred (*) variant makes non-option keys.
\robust@def*\ltxkeys@makeoptionkeys{%
\cpt@teststopt\ltxkeys@m@keoptionkeys{KV}%
}
@@ -1838,6 +2045,7 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\ltxkeys@testcl{\ltxkeys@testopt@g{emptifyh@ndledkeys}{handled}}%
}
\robust@def*\ltxkeys@savevaluekeys{%
+ % \<KV>@<fam>@savevalue@keys is used by pointed keys.
\ltxkeys@testopt@g{h@ndledkeys}{savevalue}%
}
\newletcs\ltxkeys@addsavevaluekeys\ltxkeys@savevaluekeys
@@ -1928,8 +2136,7 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
}%
}
\robust@def*\ltxkeys@testsavevaluekey{%
- \ltxkeys@debug{==}{Testing if '\ltxkeys@tkey' is a
- savevalue key}%
+ \ltxkeys@debug{==}{Testing if '\ltxkeys@tkey' is a savevalue key}%
\ltxkeys@iftkeyinlist{savevaluekeys}{%
\ltxkeys@svtrue
}{%
@@ -1937,6 +2144,7 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\ltxkeys@debug{==}{'\ltxkeys@tkey' is not a savevalue key}%
}%
}
+% Test for option or non-option keys:
\robust@def*\ltxkeys@testoptionkey#1{%
\begingroup
\def\ltxkeys@tempc{\ifstrcmpTF{#1}{non}{not }{}}%
@@ -1979,6 +2187,15 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
}%
}%
}
+
+% Gather keys and their values for use in (declaring
+% or defining keys). \key@vals must have been initialized
+% by the caller.
+%
+% #1: default value
+% #2: Key macro (for testing if it contains '\ltxkeys@setaliaskey').
+% If the key macro contains '\ltxkeys@setaliaskey', then the key is a
+% twin/alias key:
\robust@def*\ltxkeys@accumkeyvals#1#2{%
\ifblankTF{#1}{%
\ltxkeys@twkfalse
@@ -1998,20 +2215,37 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\edef\key@vals{%
\csliststack,\key@vals\expandcsonce\key@name=%
\ifltxkeys@dep
+ % We're dealing with a dependant key; use the user-supplied value:
\expandcsonce\elt
\else
\ifstrcmpTF{#1}{true}{false}{\expandcsonce\elt}%
\fi
}%
+ % Set slave key with master when 'ltxkeys@ssk' is true, whether
+ % or not the key macro contains '\ltxkeys@setaliaskey':
\ifltxkeys@ssk
\gletcs\key@vals\key@vals
\else
+ % If the key macro contains '\ltxkeys@setaliaskey', don't include
+ % it in the list:
\ifltxkeys@twk\else
\gletcs\key@vals\key@vals
\fi
\fi
\endgroup
}
+% Define boolean and command keys compactly & robustly:
+% 1. \ltxkeys@definekeys[pref]{<fam>}[macropf]{<keyname>=<dft>
+% /<callback>; ...}.
+% Key default value and macro can be absent,
+% but boolean keys must have values (<true> | <false>),
+% to be distinguishable from cmd keys.
+% 2. Use \ltxkeys@checkchoice or \CheckUserInput to introduce
+% choice keys as command keys.
+% 3. Ordinary and choice keys can't be introduced directly by
+% this command (use \ltxkeys@declarekeys).
+% 4. The *-form can be used to define new keys (in the sense
+% of \newcommand).
\robust@def*\ltxkeys@definekeys{%
\begingroup
\endlinechar\m@one
@@ -2031,6 +2265,10 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
}%
\toks@{}%
\def\key@vals{}%
+ % We want \ltxkeys@definekeys to have a slightly different
+ % syntax to \ltxkeys@declarekeys. So we use '=' here. But
+ % the equality sign can always be replaced with '/' and
+ % this won't cause any problems:
\def\ltxkeys@splita##1={\ltxkeys@splitc##1/.}%
\def\ltxkeys@splitb##1/{\ltxkeys@splitc##1/.}%
\def\ltxkeys@splitc##1/##2/##3/##4\ltxkeys@nil{%
@@ -2052,7 +2290,7 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\oifblankTF{\@gobble##2}{%
\def\key@default{}%
}{%
- \s@expandarg\ltxkeys@trimspaces{\@gobble##2}\key@default
+ \ltxkeys@remdottrimspaces{##2}\key@default
}%
\edef\key@macro{\unexpanded{##3}}%
\ltxkeys@stripdotcode\key@macro
@@ -2082,12 +2320,13 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\ltxkeys@removedotcode{##1}\ltxkeys@tempa
\expandafter\ltxkeys@in\expandafter*\expandafter
=\expandafter{\ltxkeys@tempa}{%
- \expandafter\ltxkeys@splita\ltxkeys@tempa/^?/^?/\ltxkeys@nil
+ \expandafter\ltxkeys@splita\ltxkeys@tempa/^?^/^?^/\ltxkeys@nil
}{%
- \expandafter\ltxkeys@splitb\ltxkeys@tempa/^?/^?/\ltxkeys@nil
+ \expandafter\ltxkeys@splitb\ltxkeys@tempa/^?^/^?^/\ltxkeys@nil
}%
}%
\cptexpandsecond{\ltxkeys@parse1}{[\ltxkeys@keyparser]}{#4}%
+ % Define and initialize the keys here directly:
\cptexpandsecond\endgroup{%
\the\toks@
\noexpand\ltxkeys@twkfalse
@@ -2099,6 +2338,24 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\ltxkeys@decfalse
}
\new@def*\ltxkeys@badkeytypes{}
+% Robustly define keys of all types by one command:
+% 1. \ltxkeys@declarekeys[pref]{<fam>}[macropf]{<keytype>/<keyname>
+% /<dft>/<callback><parser> ...}.
+% Key default and macro can be absent.
+% 2. keytype = <ord> | <cmd> | <sty> | <sty*> | <bool> | <choice>.
+% 3. Choice keys must have their names associated with
+% their admissible values in the format <keyname.chclist>.
+% 4. * -> We're defining new keys (in the sense of \newcommand).
+%
+% Example:
+% \ltxkeys@declarekeys*[KV]{<fam>}[mp@]{%
+% cmd/keya/mm/\def\x##1{##1*#1*##1};
+% bool/keyb;
+% sty/keyc/xxx/\def\y##1{##1yyy#1};
+% sty*/keyd/mm/\def\y##1{##1#1}/cmd>keye>#1>\def\z####1{####1+##1+####1}
+% }
+% Notice the >...> for the dependant key attributes.
+%
\robust@def*\ltxkeys@declarekeys{%
\begingroup
\endlinechar\m@one
@@ -2124,7 +2381,7 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\toks@{}%
\def\ltxkeys@splita##1/##2/{%
\ifescapedTF{##1}{%
- \ltxkeys@err{Key type can't be a macro: '\detokenize{##1}'}
+ \ltxkeys@err{Key type can't be a macro: '\detokenize{##1}'}%
\ltxkeys@ehc
}{}%
\ltxkeys@trimspacesset{{##1}\key@type,{##2}\key@name}%
@@ -2142,11 +2399,11 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\ltxkeys@ehc
\fi
\ifx\key@name\@empty
- \ltxkeys@err{Empty key name in \string\ltxkeys@declarekeys}
+ \ltxkeys@err{Empty key name in \string\ltxkeys@declarekeys}%
\ltxkeys@ehc
\fi
\ltxkeys@ifrejname{%
- \ltxkeys@err{Wrong syntax for \string\ltxkeys@declarekeys}
+ \ltxkeys@err{Wrong use syntax for \string\ltxkeys@declarekeys}%
\ltxkeys@ehc
}%
\ifltxkeys@inkeycmd
@@ -2247,11 +2504,12 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
}%
}%
\ifdefTF\ltxkeys@keyparser{%
- \stripallouterbracesincs\ltxkeys@keyparser
+ \ltxkeys@stripallouterbracesincs\ltxkeys@keyparser
}{%
\def\ltxkeys@keyparser{;}%
}%
\ifblankTF{#1}{%
+ % No 'onekeytype':
\edef\ltxkeys@tempa{\unexpanded{#5}}%
}{%
\def\ltxkeys@tempa{}%
@@ -2265,7 +2523,7 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
}%
\def\ltxkeys@do##1{%
\ifblankTF{##1}{}{%
- \ltxkeys@splita##1/^?/^?/^?/^?/\ltxkeys@nil
+ \ltxkeys@splita##1/^?^/^?^/^?^/^?^/\ltxkeys@nil
}%
}%
\cptexpandsecond{\ltxkeys@parse0}
@@ -2278,6 +2536,7 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\ifx\ltxkeys@badkeytypes\@empty\else
\cpt@err{Invalid key types '\ltxkeys@badkeytypes'}\ltxkeys@ehc
\fi
+ % Initialize keys:
\ltxkeys@ifcsemptyTF\key@vals{}{%
\cptexpandargonce{\ltxkeys@setkeys[#2]{#3}}\key@vals
}%
@@ -2290,7 +2549,7 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
}
\robust@def\ltxkeys@declarekeys@e#1{%
\ifblankTF{#1}{%
- \def\key@dependants{}\cpt@gobbletorelax
+ \def\key@dependants{}\cptgobbletorelax
}{}%
\begingroup
\ifinsetTF{>}{#1}{}{%
@@ -2318,7 +2577,7 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
}%
\def\key@dependants{}%
\def\ltxkeys@do##1{%
- \ltxkeys@splita##1>^?>^?>^?>\ltxkeys@nil
+ \ltxkeys@splita##1>^?^>^?^>^?^>\ltxkeys@nil
}%
\ltxkeys@parse1[,]{#1}%
\postgroupdef\key@dependants\endgroup
@@ -2350,7 +2609,7 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\ltxkeys@tempa#2/\unexpanded{##1}%
}%
}%
- \cptexpandsecond{\def\ltxkeys@tempa{}\ltxkeys@parse1}
+ \cptexpandsecond{\def\ltxkeys@tempa{}\ltxkeys@parse1}%
{[\ltxkeys@keyparser]{\expandcsonce\ltxkeys@tempa}}%
}%
\cptexpandsecond{\endgroup\csn@edef}
@@ -2407,7 +2666,7 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
}%
\def\ltxkeys@tempa{}%
\def\ltxkeys@do##1{%
- \ltxkeys@splita##1/^?/^?/^?/^?/\ltxkeys@nil
+ \ltxkeys@splita##1/^?^/^?^/^?^/^?^/\ltxkeys@nil
}%
\cptexpandsecond{\ltxkeys@parse1}
{[\ltxkeys@keyparser]{\expandcsnonce{xfamilykeys@id@#1}}}%
@@ -2441,19 +2700,21 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\def\ltxkeys@do##1{%
\ltxkeys@splitkeyval##1\ltxkeys@nil\ltxkeys@tkey\ltxkeys@tval
\ifcsndefFT{\ltxkeys@hdr\ltxkeys@tkey}{%
- \ltxkeys@err{Key '\ltxkeys@currtriple' is undefined.}
+ \ltxkeys@err{Key '\ltxkeys@currtriple' is undefined.}%
\ltxkeys@ehc
}{%
- \ifcsndefTF{@\ltxkeys@hdr#1setkeys}{}{%
- \cptemptifycsn{@\ltxkeys@hdr#1setkeys}%
+ \ifcsndefTF{\ltxkeys@hdr#1setkeys@alreadysaved}{}{%
+ \csn@def{\ltxkeys@hdr#1setkeys@alreadysaved}{}%
}%
- \xifinsetTF{,\cptoxdetok\ltxkeys@tkey,}
- {,\cptsxdetok{\usename{@\ltxkeys@hdr#1setkeys},}}{%
+ % You can't enter the same key twice in either
+ % preset or post-set lists in the same family and prefix:
+ \xifinsetTF{,\cptoxdetok\ltxkeys@tkey,}%
+ {,\cptsxdetok{\usename{\ltxkeys@hdr#1setkeys@alreadysaved},}}{%
\ltxkeys@err{Double entry for key '\ltxkeys@currtriple' in\MsgBrk
#1set key list}\ltxkeys@ehc
}{%
\edef\ltxkeys@rsvda{\csliststack,\ltxkeys@rsvda
- \ltxkeys@tkey\ltxkeys@ifcsemptyTF\ltxkeys@tval{}
+ \ltxkeys@tkey\ltxkeys@ifcsemptyTF\ltxkeys@tval{}%
{=\expandcsonce\ltxkeys@tval}}%
\edef\ltxkeys@rsvdb{\csliststack,\ltxkeys@rsvdb
\expandcsonce\ltxkeys@tkey}%
@@ -2461,21 +2722,24 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
}%
}%
\ltxkeys@parse3{#2}%
+ % '...@alreadysaved' saves key names irrespective
+ % of value, for testing if a preset key is being saved twice:
\ltxkeys@ifcsemptyTF\ltxkeys@rsvda{}{%
\ifcsndefTF{\ltxkeys@hdr#1setkeys}{%
\cptpassexpanded{%
\cptfiltermergekv\noexpandcsn{\ltxkeys@hdr#1setkeys}%
{\expandcsonce\ltxkeys@rsvda}\noexpand\nofilter
- \cptfiltermergecsv\noexpandcsn{@\ltxkeys@hdr#1setkeys}
+ \cptfiltermergecsv\noexpandcsn{\ltxkeys@hdr#1setkeys@alreadysaved}%
{\ltxkeys@rsvdb}\noexpand\nofilter
}%
}{%
\csn@edef{\ltxkeys@hdr#1setkeys}{\expandcsonce\ltxkeys@rsvda}%
- \csn@edef{@\ltxkeys@hdr#1setkeys}{\expandcsonce\ltxkeys@rsvdb}%
+ \csn@edef{\ltxkeys@hdr#1setkeys@alreadysaved}%
+ {\expandcsonce\ltxkeys@rsvdb}%
}%
\ifltxkeys@cl
\globalizecsn{\ltxkeys@hdr#1setkeys}%
- \globalizecsn{@\ltxkeys@hdr#1setkeys}%
+ \globalizecsn{\ltxkeys@hdr#1setkeys@alreadysaved}%
\fi
}%
}
@@ -2488,18 +2752,18 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\def\ltxkeys@do##1{%
\ltxkeys@splitkeyval##1=\ltxkeys@nil\ltxkeys@tkey\ltxkeys@tval
\ifcsndefFT{\ltxkeys@hdr\ltxkeys@tkey}{%
- \ltxkeys@err{Key '\ltxkeys@currtriple' is undefined}
+ \ltxkeys@err{Key '\ltxkeys@currtriple' is undefined}%
\ltxkeys@ehc
}{%
\xifinsetTF{,\cptoxdetok\ltxkeys@tkey=\cptoxdetok\ltxkeys@tval,}%
{,\cptsxdetok{\usename{\ltxkeys@hdr#1setkeys}},}{%
\edef\ltxkeys@rsvda{\csliststack,\ltxkeys@rsvda
- \ltxkeys@tkey\ltxkeys@ifcsemptyTF\ltxkeys@tval{}
+ \ltxkeys@tkey\ltxkeys@ifcsemptyTF\ltxkeys@tval{}%
{=\expandcsonce\ltxkeys@tval}}%
\edef\ltxkeys@rsvdb{\csliststack,\ltxkeys@rsvdb
\expandcsonce\ltxkeys@tkey}%
}{%
- \ltxkeys@err{Key '\ltxkeys@currtriple' not a #1set key}
+ \ltxkeys@err{Key '\ltxkeys@currtriple' not a #1set key}%
\ltxkeys@ehc
}%
}%
@@ -2507,14 +2771,14 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\ltxkeys@parse3{#2}%
\ltxkeys@ifcsemptyTF\ltxkeys@rsvda{}{%
\cptpassexpanded{%
- \cptfilterremovekv\noexpandcsn{\ltxkeys@hdr#1setkeys}
+ \cptfilterremovekv\noexpandcsn{\ltxkeys@hdr#1setkeys}%
{\expandcsonce\ltxkeys@rsvda}\noexpand\nofilter
- \cptfilterremovecsv\noexpandcsn{@\ltxkeys@hdr#1setkeys}
+ \cptfilterremovecsv\noexpandcsn{\ltxkeys@hdr#1setkeys@alreadysaved}%
{\ltxkeys@rsvdb}\noexpand\nofilter
}%
\ifltxkeys@cl
\globalizecsn{\ltxkeys@hdr#1setkeys}%
- \globalizecsn{@\ltxkeys@hdr#1setkeys}%
+ \globalizecsn{\ltxkeys@hdr#1setkeys@alreadysaved}%
\fi
}%
}%
@@ -2525,9 +2789,12 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
and family '\ltxkeys@tfam'}\ltxkeys@ehc
}{%
\usename{\ifltxkeys@cl g\fi undefcsn}{\ltxkeys@hdr#1setkeys}%
- \usename{\ifltxkeys@cl g\fi undefcsn}{@\ltxkeys@hdr#1setkeys}%
+ \usename{\ifltxkeys@cl g\fi undefcsn}%
+ {\ltxkeys@hdr#1setkeys@alreadysaved}%
}%
}
+% Set a main key after setting its twin/alias. This is NOT
+% related to dependant or style keys:
\robust@def*\ltxkeys@setaliaskey#1{%
\ltxkeys@commanormalize{#1}\ltxkeys@tempa
\xifinsetTF{,}{\cptoxdetok\ltxkeys@tempa}{%
@@ -2573,6 +2840,8 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
}%
\ltxkeys@tempa#1..\ltxkeys@nil
}
+% #1: key prefix
+% #2: key family
\robust@def*\ltxkeys@setinitialkeyvals#1#2{%
\ltxkeys@initrue
\ifcsndefFT{#1@#2@initialkeyvals}{}{%
@@ -2585,6 +2854,15 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
}%
\ltxkeys@inifalse
}
+
+% \ltxkeys@initializekeys[<prefixes>]{<fams>}[<na>]
+% 1. Preset all keys defined in families <fams>;
+% ignore keys listed in <na>. <na> comes from key-val
+% pairs that the user wants to use as current values
+% of keys. Their keys are to be ignored when setting
+% up defaults.
+% 2. The key-val list to be preset comes from the macros
+% \<pref>@<fam>@initialkeyvals:
\robust@def*\ltxkeys@initializekeys{%
\cpt@testopt\ltxkeys@in@tializekeys{KV}%
}
@@ -2614,6 +2892,7 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
{[\ltxkeys@keynames]{\expandcsonce\ltxkeys@resa}}%
\ltxkeys@inifalse
}
+% Remove disabled and pox keys:
\robust@def*\ltxkeys@remdispox#1{%
\begingroup
\letcstocsn\ltxkeys@tempd{\ltxkeys@hdr disabledkeys}%
@@ -2621,7 +2900,7 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\letcstocsn\ltxkeys@tempe{\ltxkeys@hdr poxkeys}%
\ifdefTF\ltxkeys@tempe{}{\def\ltxkeys@tempe{}}%
\ltxkeys@ifcsemptyTF\ltxkeys@tempd{%
- \ltxkeys@ifcsemptyTF\ltxkeys@tempe\cpt@gobbletorelax\relax
+ \ltxkeys@ifcsemptyTF\ltxkeys@tempe\cptgobbletorelax\relax
}{}%
\edef\ltxkeys@tempd
{\expandcsonce\ltxkeys@tempd,\expandcsonce\ltxkeys@tempe}%
@@ -2635,6 +2914,10 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\cpt@relax
\postgroupdef#1\endgroup
}
+% \ltxkeys@launchkeys*+[<prefix>]{<fams>}{<curr>}
+% 1. First preset all family keys before setting keys in <curr>.
+% 2. <curr> are the key-vals to be set in the current run; they
+% will be ignored when initializing the keys of families <fams>:
\robust@def*\ltxkeys@launchkeys{%
\ltxkeys@teststpl{\cpt@testopt\ltxkeys@l@unchkeys{KV}}%
}
@@ -2649,7 +2932,7 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
}{}%
\cptexpandsecond\ltxkeys@in@ti@lizekeys
{{\ltxkeys@prefs}{\ltxkeys@fams}}[#3]%
- \ifblankTF{#3}\cpt@gobbletorelax\relax
+ \ifblankTF{#3}\cptgobbletorelax\relax
\begingroup
\def\ltxkeys@resa{}%
\def\ltxkeys@do##1{%
@@ -2828,7 +3111,7 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\MsgBrk in families '\ltxkeys@fams'}\ltxkeys@ehc
\fi
}{%
- \xifinsetTF{,\ltxkeys@tkey,}{,\ltxkeys@nakeys,}{}{%
+ \oifinset@sp@TF,\ltxkeys@tkey\ltxkeys@nakeys{}{%
\ltxkeys@setkeys@d
}%
}%
@@ -2942,7 +3225,7 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\edef\reserved@e{\ltxkeys@currtriple,\InnocentVal}%
\@onelevel@sanitize\reserved@e
\letcstocsn\reserved@f{\ltxkeys@hdr executedkeys}%
- \xifinsetTF{*\reserved@e*}{*\reserved@f*}{%
+ \oifinset@sp@TF*\reserved@e\reserved@f{%
\ltxkeys@debug{!!}{Key '\ltxkeys@currtriple' multiply
set with same value}%
}{%
@@ -2961,7 +3244,7 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\ifcsndefTF{\ltxkeys@hdr savevaluekeys}{\ltxkeys@testsavevaluekey}{}%
}%
\ifboolTF{ltxkeys@sv}{%
- \ltxkeys@addtop@intedkeys{savevalue}\ltxkeys@tkey\ltxkeys@tval
+ \ltxkeys@addtosavedvalue\ltxkeys@tkey\ltxkeys@tval
}{}%
\ifboolTF{ltxkeys@noval}{%
\ifcsndefTF{\ltxkeys@hdr needvaluekeys}{\ltxkeys@testneedvaluekey}{}%
@@ -3037,7 +3320,7 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\edef\ltxkeys@tempc{\unexpanded{##2}}%
\ltxkeys@ifxTF\ltxkeys@tempc\ltxkeys@nnil\@secondoftwo\@firstoftwo
}%
- \cptsevenxp\reserved@a\usename{@\ltxkeys@hdr savevaluekeys}%
+ \cptsevenxp\reserved@a\usename{\ltxkeys@hdr @savedvaluelist}%
#1{\ltxkeys@nil}\ltxkeys@nil
}
\robust@def*\ltxkeys@replacepointers#1{%
@@ -3119,29 +3402,33 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\robust@def*\ltxkeys@getinnovalnopad{\ltxkeys@swafalse\ltxkeys@g@tinnoval}
\robust@def*\ltxkeys@g@tinnoval{%
\begingroup
- \ltxkeys@ifxTF\ltxkeys@tval\@empty{%
+ \ltxkeys@ifcsemptyTF\ltxkeys@tval{%
\def\InnocentVal{???}%
}{%
+ \@tempcnta\z@pt
\def\InnocentVal{}%
\def\ltxkeys@tempa{\\}%
- \def\@do##1##2##3##4##5##6##7##8##9\@@{%
- \def\siso@do####1{%
- \def\reserved@a{####1}%
- \edef\InnocentVal{%
- \InnocentVal
- \ifx\reserved@a\ltxkeys@tempa
- \ifltxkeys@swa\@space\fi
- \else
- \if\reserved@a\cpt@leftbracechar[\else
- \if\reserved@a\cpt@rightbracechar]\else####1\fi
+ \def\do##1{%
+ \def\reserved@a{##1}%
+ \ltxkeys@ifxTF\reserved@a\ltxkeys@nnil{}{%
+ \advance\@tempcnta\@ne
+ \ifnum\@tempcnta<20\relax
+ \edef\InnocentVal{%
+ \InnocentVal
+ \ifx\reserved@a\ltxkeys@tempa
+ \ifltxkeys@swa\@space\fi
+ \else
+ ##1%
\fi
- \fi
- }%
+ }%
+ \else
+ \def\do####1\ltxkeys@nil{}%
+ \fi
+ \do
}%
- \siso@@loop{##1##2##3##4##5##6##7##8}%
}%
- \expandafter\@do\detokenize\expandafter
- {\ltxkeys@tval}\\\\\\\\\\\\\\\\\\\@@
+ \expandafter\do\detokenize\expandafter
+ {\ltxkeys@tval}\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ltxkeys@nil
}%
\postgroupdef\InnocentVal\endgroup
}
@@ -3349,16 +3636,25 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\cpt@testfam{\ltxkeys@d@cl@r@opti@n{#1}}%
}
\robust@def*\ltxkeys@d@cl@r@opti@n#1<#2>{\ltxkeys@tempa[#1]{#2}}
+
\robust@def*\ltxkeys@declaremultitypeoptions{%
- \cpt@teststopt\ltxkeys@d@claremultitypeoptions{KV}%
+ \cpt@testst\ltxkeys@d@claremultitypeoptions
}
\newletcs\declaremultitypeoptions\ltxkeys@declaremultitypeoptions
-\robust@def*\ltxkeys@d@claremultitypeoptions[#1]{%
- \cpt@testfam{\ltxkeys@d@cl@remultitypeoptions{#1}}%
+\robust@def*\ltxkeys@d@claremultitypeoptions{%
+ \cpt@testpnopt\ltxkeys@d@cl@remultitypeoptions{}%
}
-\robust@def*\ltxkeys@d@cl@remultitypeoptions#1<#2>{%
- \cptsafeactivesedef\reserved@b{#2}%
- \cptexpanded{\ltxkeys@declarekeys\ifcpt@st*\fi[#1]{\reserved@b}}%
+\robust@def*\ltxkeys@d@cl@remultitypeoptions(#1){%
+ \cpt@testopt{\ltxkeys@d@cl@rem@ltitypeoptions{#1}}{KV}%
+}
+\robust@def*\ltxkeys@d@cl@rem@ltitypeoptions#1[#2]{%
+ \cpt@testfam{\ltxkeys@d@cl@rem@ltitypeopti@ns{#1}{#2}}%
+}
+\robust@def*\ltxkeys@d@cl@rem@ltitypeopti@ns#1#2<#3>{%
+ \cptexpanded{%
+ \ltxkeys@declarekeys\ifcpt@st*\fi
+ \iflacus#1\dolacus\else(#1)\fi[#2]{#3}%
+ }%
}
\robust@def*\ltxkeys@executeoptions#1{%
\ltxkeys@nostarform{#1}\ltxkeys@executeoptions
@@ -3396,6 +3692,7 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\reserved@a
}%
}
+
\def\ltxkeys@processedoptions{}
\robust@def*\ltxkeys@processoptions{%
\ifcsndefTF{\@currname @\@currext @ltxkeys@beginprocessopt}{%
@@ -3619,7 +3916,7 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\ltxkeys@err{Number of delimiters exceeds
number of parameters}\ltxkeys@ehc
\fi
- \xifinsetTF{,\expandcsonce\ltxkeys@tempa,}
+ \xifinsetTF{,\expandcsonce\ltxkeys@tempa,}%
{,1,2,3,4,5,6,7,8,9,}{}{%
\ltxkeys@err{Invalid delimiter syntax:
\MsgBrk no digit [1-9] found before
@@ -3683,6 +3980,7 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\ifkeyval##1\then\expandafter\iofii\else\expandafter\iiofii\fi
}%
\long\def\reserved@a##1##2\ltxkeys@nil{%
+ % \ifswitch won't work here:
\ifcondTF\if##1\fi{%
##2%
}{%
@@ -3838,6 +4136,44 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
}
\ltxkeys@everyeoe\ignorespacesafterend
+\robust@def*\setvarvalues{\cpt@testopt\ltxkeys@setvarvalues{var@subfam}}
+\robust@def*\ltxkeys@setvarvalues[#1]#2{\pathkeys{pathkeys@var@fam/#1/set:#2}}
+\new@def*\getvarvalue{\cpt@newxtestopt\ltxkeys@getvarvalue{var@subfam}}
+\new@def*\ltxkeys@getvarvalue[#1]#2{\pathkeysval{pathkeys@var@fam/#1/#2}}
+\robust@def*\ltxkeys@declarevariables{%
+ \cpt@testopt\ltxkeys@d@clarevariables{var@subfam}%
+}
+\robust@def*\ltxkeys@d@clarevariables[#1]#2{%
+ \begingroup
+ \def\elt##1{\oifstrcmpTF{^?^}{##1}{}{/\expandcsonce##1}}%
+ \cptdocommalist{#2}{%
+ \ltxkeys@d@cl@revariables##1=^?^=^?^=\ltxkeys@nil
+ }%
+ \cptexpanded{\endgroup
+ \pathkeys{pathkeys@var@fam/#1/define*:\expandcsonce\key@list}%
+ }%
+}
+\robust@def*\ltxkeys@d@cl@revariables#1={%
+ \def\reserved@a##1={%
+ \def\reserved@a####1=####2\ltxkeys@nil{%
+ \ltxkeys@trimspaces{#1}\reserved@a
+ \ltxkeys@remdottrimspaces{##1}\reserved@b
+ \ltxkeys@remdottrimspaces{####1}\reserved@c
+ \cptexpanded{%
+ \cptgaddtolist[;]\noexpand\key@list{%
+ \cptexpandbracenext{\cptifcasse\ifstrcmpTF}\reserved@a
+ {true}{bool}{false}{bool}%
+ \elseif
+ cmd%
+ \endif
+ /\expandcsonce\reserved@a\elt\reserved@b\elt\reserved@c
+ }%
+ }%
+ }%
+ \reserved@a.%
+ }%
+ \reserved@a.%
+}
\robust@def*\ltxkeys@emergencystop{%
\immediate\write\sixt@@n{OK, I'm exiting now.}%
\interactionmode\z@pt
@@ -3870,7 +4206,7 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
value '\InnocentVal' ignored.}%
}
\ltxkeys@declarecmdoption[KV]<ltxkeys>[ltxkeys@]{keyparser}[{;}]{%
- \stripallouterbracesincs\ltxkeys@keyparser
+ \ltxkeys@stripallouterbracesincs\ltxkeys@keyparser
}
\ltxkeys@declarecmdoption[KV]<ltxkeys>[ltxkeys@]{%
\needvalue{keydepthlimit}%
@@ -3887,7 +4223,7 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
}{%
\ltxkeys@setaliaskey{keydepthlimit}%
}
-\ltxkeys@declarebooloption[KV]<ltxkeys>[ltxkeys@]{pathkeys}{%
+\ltxkeys@declarebooloption[KV]<ltxkeys>[ltxkeys@]{pathkeys}[true]{%
\ifltxkeys@pathkeys
\ltxkeys@afterprocessoptions{\RequirePackage{pathkeys}}%
\fi
@@ -3899,7 +4235,9 @@ $Id: ltxkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\ltxkeys@executeoptions[KV]<ltxkeys>
{keyparser,keydepthlimit=4}\relax
\ltxkeys@processoptions*[KV]<ltxkeys>\relax
+
\cpt@optioncleanup\ltxkeys@processedoptions
+
\robust@def*\ltxkeys@options#1{%
\ifblankTF{#1}{}{\ltxkeys@setkeys[KV]{ltxkeys}{#1}}%
}
diff --git a/Master/texmf-dist/tex/latex/ltxkeys/pathkeys.sty b/Master/texmf-dist/tex/latex/ltxkeys/pathkeys.sty
index d047ec0b90e..7223aaba413 100644
--- a/Master/texmf-dist/tex/latex/ltxkeys/pathkeys.sty
+++ b/Master/texmf-dist/tex/latex/ltxkeys/pathkeys.sty
@@ -1,6 +1,6 @@
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++%
% %
-% This is file 'pathkeys.sty', version 0.0.2, October 2011. %
+% 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, %
@@ -21,24 +21,39 @@
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++%
\@ifpackageloaded{ltxkeys}{%
- \@ifpackagelater{ltxkeys}{2011/10/22}{}{%
+ \@ifpackagelater{ltxkeys}{2011/12/10}{}{%
\@latex@error{Loaded version of ltxkeys package is
not current}\@ehc
}%
}{%
- \RequirePackage{ltxkeys}[2011/10/22]%
+ \RequirePackage{ltxkeys}[2011/12/10]%
}
\UseNormalCatcodes
-\StyleFilePurpose{A robust and fast key-value parser (AM)}
+\StyleFilePurpose{A robust 'path' key-value parser (AM)}
\StyleFileRCSInfo
-$Id: pathkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
+$Id: pathkeys.sty,v 0.0.3 2011/12/17 09:00:00 Ahmed Musa Exp $
\ProvidesPackage{pathkeys}[\StyleFileInfo]
-\NeedsTeXFormat{LaTeX2e}[2005/12/01]
+\NeedsTeXFormat{LaTeX2e}[2011/06/27]
\SetStyleFileMessages[pathkeys@]{info}{warn}{err}
-\newvariables{count}[pathkeys@]{cnta}[\z@pt]
-\newvariables{if}[pathkeys@]{chfd}[false]
-\newletcs\pathkeys@relax\relax
-\new@def\pathkeys@gobbletorelax#1\pathkeys@relax{}
+\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
@@ -46,31 +61,31 @@ $Id: pathkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
}%
\def\reserved@a##1:##2\ltxkeys@nil{%
\iflacus##1\dolacus
- \pathkeys@err{Nil flag in argument of
- \string\pathkeys}\ltxkeys@ehc
+ \pathkeys@err{Nil flag in argument of \string\pathkeys}\ltxkeys@ehc
\fi
- \ltxkeys@trimspaces{##1}\key@path
+ \ltxkeys@trimspaces{##1}\key@path@flag
\ltxkeys@trimspaces{##2}\key@list
- \csv@@normalize*[/]\key@path
- \s@expandarg\pathkeys@getkeyflag\key@path
- \csv@@normalize*[/]\key@path
- \cptsafeactivesedef\key@path\key@path
- \xifstrcmpTF\key@flag{ifkeyonpath}{%
- \pathkeys@gobbletorelax
- }{%
- \pathkeys@listadd*![;]\pathkeys@pathhistory\key@path
- }%
+ \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}{\detokenize{#1}\relax}{%
+ \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
}%
- \reserved@a#1\relax
+ \expandafter\reserved@a\key@path@flag\relax
}{%
\ifnullTF{##2}{%
\pathkeys@err{Unknown flag in argument of
@@ -80,10 +95,33 @@ $Id: pathkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
}%
}%
}%
- \do define,define*,declareoptions,declareoptions*,set,%
- executeoptions,processoptions,processoptions*,launch,%
- key handler,option handler,ifbool,add value,store value,%
- print value,disable,disable*,fdef,ifkeyonpath,\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{}%
@@ -128,104 +166,170 @@ $Id: pathkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\def\reserved@a##1/##2/##3\ltxkeys@nil{%
\ltxkeys@trimspaces{##2}\key@name
\ltxkeys@ifrejname{%
- \pathkeys@err{^^JI can't find key name in attributes of
- key in^^J||\detokenize{#1}||^^J}\ltxkeys@ehc
+ \pathkeys@err{I can't find key name in attributes of
+ key in ||\detokenize{#1}||}\ltxkeys@ehc
}%
}%
- \reserved@a#1/^?/\ltxkeys@nil
+ \reserved@a#1/^?^/\ltxkeys@nil
}%
}
\robust@def*\pathkeys@checkifdef{%
- \xifinsetTF{,\key@flag,}{,define*,declareoptions*,}{%
- \def\ltxkeys@resa{}%
- \def\ltxkeys@do##1{%
- \pathkeys@getkeyname{##1}%
- \ifcsndefTF{pathkeys/curr/\ltxkeys@iffirstnull\main@path/%
- \ltxkeys@iffirstnull\sub@path/\key@name
- }{%
- \edef\ltxkeys@resa{\csliststack,\ltxkeys@resa\key@name}%
- }{}%
+ \def\ltxkeys@resa{}%
+ \def\ltxkeys@do##1{%
+ \ltxkeys@ifcsemptyTF\onekeytype{%
+ \edef\reserved@a{\unexpanded{##1}}%
+ }{%
+ \edef\reserved@a{\onekeytype/\unexpanded{##1}}%
}%
- \cptexpandsecond{\ltxkeys@parse*1}{[\ltxkeys@keyparser]}\key@list
- \ifx\ltxkeys@resa\@empty\else
- \pathkeys@err{^^JKey names^^J||\ltxkeys@resa||^^J%
- in argument of \noexpand\pathkeys are already in
- use on path '\key@path'}\ltxkeys@ehc
- \fi
- }{}%
+ \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
}
-\cpt@setupsafeactivesedef
\robust@def*\pathkeys#1{%
- \begintoksgroup
\pathkeys@getkeypath{#1}%
- \s@expandarg\pathkeys@checkpath\key@path
- \s@expandarg\pathkeys@splitpath\key@path
- \pathkeys@checkifdef
- \pathkeys@relax
+ \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\elt\ltxkeys@iffirstnull
+ \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{\toks@{####2}}%
+ \cptexpanded{\endgroup####2}%
}%
}%
- \expandafter\reserved@a\pathkeys@actions##1{\ltxkeys@nil}\ltxkeys@nil
+ \expandafter\reserved@a\pathkeys@act##1{\ltxkeys@nil}\ltxkeys@nil
}%
\s@expandarg\reserved@a\key@flag
- \endtoksgroup
}
-\robust@def*\pathkeys@actions{%
- define{\pathkeys@defkey\ltxkeys@declarekeys{{\sub@path}}}%
- define*{\pathkeys@defkey{\ltxkeys@declarekeys*}{{\sub@path}}}%
- declareoptions{\pathkeys@defkey
- \ltxkeys@declaremultitypeoptions{<\sub@path>}}%
- declareoptions*{\pathkeys@defkey
- {\ltxkeys@declaremultitypeoptions*}{<\sub@path>}}%
- set{\pathkeys@setkeys{\main@path}{\sub@path}{\xp\key@list}}%
- executeoptions{\pathkeys@executeoptions{\main@path}%
- {\sub@path}{\xp\key@list}}%
- processoptions{\pathkeys@processoptions{\main@path}%
- {\sub@path}{\xp\key@list}}%
- processoptions*{\pathkeys@processoptions*{\main@path}%
- {\sub@path}{\xp\key@list}}%
- launch{\ltxkeys@launchkeys[\main@path]{\sub@path}{\xp\key@list}}%
- handler{\ltxkeys@unknownkeyhandler[\main@path]%
- {\sub@path}{\xp\key@list}}%
- key handler{\ltxkeys@unknownkeyhandler[\main@path]%
- {\sub@path}{\xp\key@list}}%
- option handler{\ltxkeys@unknownoptionhandler[\main@path]%
- <\sub@path>{\xp\key@list}}%
- ifbool{\noexpand\ifp@thkeys@keyvalTF{\key@list}%
- {pathkeys/curr/\elt\main@path/\elt\sub@path/\key@list}}%
- add value{\p@thkeys@addtovalue{\xp\key@list}%
- {pathkeys/curr/\elt\main@path/\elt\sub@path/}}%
- store value{\p@thkeys@storevalue{\xp\key@list}%
- {pathkeys/curr/\elt\main@path/\elt\sub@path/}}%
- print value{\noexpand\p@thkeys@keyval{\key@list}%
- {pathkeys/curr/\elt\main@path/\elt\sub@path/\key@list}}%
- disable{\ltxkeys@disablekeys[\main@path]{\sub@path}{\key@list}}%
- disable*{\ltxkeys@disablekeys*[\main@path]{\sub@path}{\key@list}}%
- ifdef{\noexpand\ifp@thkeys@keydef{\main@path}{\sub@path}{\key@list}}%
- ifkeyonpath{\noexpand\ifp@thkeys@onpath{\key@path}{\key@list}}%
-}
-\robust@def*\pathkeys@setkeys#1#2#3{%
- \xifinsetTF{\relax[}{\relax\detokenize{#3}}{%
+\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{%
- \ltxkeys@setkeys[#1]{#2}[##1]{##2}%
+ \ifstrcmpTF{#1}{rm}{%
+ \ltxkeys@tempb{##2}%
+ \ltxkeys@tempa[#3]{#4}[##1]%
+ }{%
+ \ltxkeys@tempa[#3]{#4}[##1]{##2}%
+ }%
}%
- \reserved@a#3\ltxkeys@nil
+ \reserved@a#5\ltxkeys@nil
}{%
- \xifinsetTF{]\relax}{\detokenize{#3}\relax}{%
+ \xifinsetTF{]\relax}{\detokenize{#5}\relax}{%
\def\reserved@a##1[##2]\ltxkeys@nil{%
- \ltxkeys@setkeys[#1]{#2}[##2]{##1}%
+ \ifstrcmpTF{#1}{rm}{%
+ \ltxkeys@tempb{##1}%
+ \ltxkeys@tempa[#3]{#4}[##2]%
+ }{%
+ \ltxkeys@tempa[#3]{#4}[##2]{##1}%
+ }%
}%
- \reserved@a#3\ltxkeys@nil
+ \reserved@a#5\ltxkeys@nil
}{%
- \ltxkeys@setkeys[#1]{#2}{#3}%
+ \ifstrcmpTF{#1}{rm}{%
+ \ltxkeys@tempb{#5}%
+ \ltxkeys@tempa[#3]{#4}%
+ }{%
+ \ltxkeys@tempa[#3]{#4}{#5}%
+ }%
}%
}%
}
@@ -246,40 +350,35 @@ $Id: pathkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
}%
}%
}
-\robust@def*\pathkeys@processoptions{%
- \ltxkeys@testst\pathkeys@pr@cessoptions
-}
-\robust@def*\pathkeys@pr@cessoptions#1#2#3{%
- \edef\reserved@e{\ifltxkeys@st*\fi}%
- \xifinsetTF{\relax[}{\relax\detokenize{#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{%
- \iflacus##2\dolacus\else
- \pathkeys@err{Wrong use of 'processoptions' flag in
- \string\pathkeys}{The invalid part is '\detokenize{##2}'}%
- \fi
- \expandafter\ltxkeys@processoptions\reserved@e[#1]<#2>[##1]%
+ \ltxkeys@tempb{##2}%
+ \ltxkeys@processoptions#1[#2]<#3>[##1]%
}%
- \reserved@a#3\ltxkeys@nil
+ \reserved@a#4\ltxkeys@nil
}{%
- \xifinsetTF{]\relax}{\detokenize{#3}\relax}{%
+ \xifinsetTF{]\relax}{\detokenize{#4}\relax}{%
\def\reserved@a##1[##2]\ltxkeys@nil{%
- \iflacus##1\dolacus\else
- \pathkeys@err{Wrong use of 'processoptions' flag in
- \string\pathkeys}{The invalid part is '\detokenize{##1}'}%
- \fi
- \expandafter\ltxkeys@processoptions\reserved@e[#1]<#2>[##2]%
+ \ltxkeys@tempb{##1}%
+ \ltxkeys@processoptions#1[#2]<#3>[##2]%
}%
- \reserved@a#3\ltxkeys@nil
+ \reserved@a#4\ltxkeys@nil
}{%
- \expandafter\ltxkeys@processoptions\reserved@e[#1]<#2>%
+ \ltxkeys@tempb{#4}%
+ \ltxkeys@processoptions#1[#2]<#3>%
}%
}%
}
-\new@def*\pathkeys@defkey#1#2{%
- \noexpand\ltxkeys@inkeycmdtrue
- #1[\main@path]#2[pathkeys/curr/\elt\main@path/\elt\sub@path/]%
- {\expandcsonce\key@list}%
- \noexpand\ltxkeys@inkeycmdfalse
+\new@def*\pathkeys@unknownoptionhandler{%
+ \ltxkeys@unknownoptionhandler
+ [\main@path]<\sub@path>{\xp\key@list}%
}
\robust@def*\p@thkeys@storevalue#1#2{%
\ltxkeys@getlasttoken{#1}%
@@ -324,36 +423,25 @@ $Id: pathkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\ifp@thkeys@keyval{#1}{#2}\then\expandafter\iofii\else
\expandafter\iiofii\fi
}
-\new@def*\ifp@thkeys@keydef#1#2#3{%
- \begingroup
- \pathkeys@chfdfalse
- \ifcsndefTF{pathkeys/curr/#1/#2/#3}{%
- \pathkeys@chfdtrue
- }{%
- \ifcsndefTF{#1@#2@#3}{%
- \pathkeys@chfdtrue
- }{}%
- }%
- \expandafter\endgroup\ifpathkeys@chfd
- \expandafter\iofii\else\expandafter\iiofii\fi
-}
-\robust@def*\ifp@thkeys@onpath#1#2{%
+\robust@def*\ifp@thkeys@keydef#1#2{%
\begingroup
- \pathkeys@chfdfalse
+ \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}{%
- \pathkeys@chfdtrue\loopbreak
+ \def\pathkeys@chfd{00}%
+ \loopbreak
}{%
\ifcsndefTF{\main@path @\sub@path @#2}{%
- \pathkeys@chfdtrue\loopbreak
+ \def\pathkeys@chfd{00}%
+ \loopbreak
}{}%
}%
}%
\ltxkeys@parse1[,]{#1}%
- \expandafter\endgroup\ifpathkeys@chfd
+ \expandafter\endgroup\if\pathkeys@chfd
\expandafter\iofii\else\expandafter\iiofii\fi
}
@@ -402,43 +490,47 @@ $Id: pathkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\pathkeys@replaceslash#1@#2\ltxkeys@nil
}%
}
-\newletcs\pathkeys@addcons\@empty
-\robust@def*\pathkeys@listadd{%
- \cpt@testst{\cpt@testcl{\cpt@testopt\pathkeys@l@stadd,}}%
-}
-\robust@def*\pathkeys@l@stadd[#1]#2#3{%
- \ifcpt@st
- \let\pathkeys@addcons\@space
- \fi
- \ifcpt@cl\global\fi
- \edef#2{\csliststack{#1\pathkeys@addcons}#2\expandcsonce{#3}}%
- \let\pathkeys@addcons\@empty
+\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@listadd*![;]\pathkeys@pathhistory{#2}%
+ \pathkeys@addtopathhistory{#2}%
}%
}
\robust@def*\defpath#1#2{%
\csn@edef{pathkeys@path@\cpttrimspace{#1}}{\cpttrimspace{#2}}%
- \pathkeys@listadd*![;]\pathkeys@pathhistory{#2}%
+ \pathkeys@addtopathhistory{#2}%
}
-\newletcs\changepath\defpath
\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{%
+ \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{%
+ \xifinsetTF{;;}\pathkeys@pathhistory{%
+ \def\reserved@a########1;;########2\ltxkeys@nil{%
\def\pathkeys@pathhistory{########1;########2}%
}%
\expandafter\reserved@a\pathkeys@pathhistory\ltxkeys@nil
@@ -466,26 +558,25 @@ $Id: pathkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
}%
}
\new@def*\pathkeys@defaultpath{dft@main/dft@sub}
-\newletcs\pathkeys@c@rrentpath\pathkeys@defaultpath
\robust@def*\pathkeys@addtodefaultpath#1{%
\edef\pathkeys@defaultpath
{\expandcsonce\pathkeys@defaultpath/\expandcsonce{#1}}%
\csv@@normalize*[/]\pathkeys@defaultpath
- \pathkeys@listadd*![;]\pathkeys@pathhistory\pathkeys@defaultpath
+ \pathkeys@addtopathhistory\pathkeys@defaultpath
}
\robust@def*\pathkeys@changedefaultpath#1{%
\edef\pathkeys@defaultpath{\expandcsonce{#1}}%
\csv@@normalize*[/]\pathkeys@defaultpath
- \pathkeys@listadd*![;]\pathkeys@pathhistory\pathkeys@defaultpath
+ \pathkeys@addtopathhistory\pathkeys@defaultpath
}
\robust@def*\pathkeys@currentpath#1{%
\edef\pathkeys@c@rrentpath{\expandcsonce{#1}}%
\csv@@normalize*[/]\pathkeys@c@rrentpath
- \pathkeys@listadd*![;]\pathkeys@pathhistory\pathkeys@c@rrentpath
+ \pathkeys@addtopathhistory\pathkeys@c@rrentpath
}
\robust@def*\pathkeys@usedefaultpath{%
\let\pathkeys@c@rrentpath\pathkeys@defaultpath
- \pathkeys@listadd*![;]\pathkeys@pathhistory\pathkeys@c@rrentpath
+ \pathkeys@addtopathhistory\pathkeys@c@rrentpath
}
\new@def*\pathkeys@currentpathstack{}
\robust@def*\pathkeys@pushcurrentpath{%
@@ -501,7 +592,7 @@ $Id: pathkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
##1\gdef\pathkeys@currentpathstack
}%
\expandafter\reserved@a\pathkeys@currentpathstack
- \pathkeys@listadd*![;]\pathkeys@pathhistory\pathkeys@c@rrentpath
+ \pathkeys@addtopathhistory\pathkeys@c@rrentpath
}
\new@def*\pathkeys@ifnop@th#1/{}
\new@def*\pathkeys@ifnopath#1{%
@@ -515,7 +606,6 @@ $Id: pathkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\pathkeys@err{Key '\cpttrimspace{#1}' not defined}\ltxkeys@ehc
}%
}
-\newletcs\pathkeyskeyval\pathkeys@getkeyval
\new@def*\pathkeys@storevalue#1#2{%
\ifescapedTF{#2}{%
\edef#2{\unexpanded\expandafter
@@ -538,7 +628,6 @@ $Id: pathkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
undefinedpathkey%
}%
}
-\newletcs\pathkeysval\pathkeys@getval
\new@def*\ifundefinedpathkey{undefinedpathkey\iffalse}
\new@def*\ifpathkeysval#1\then{\usename{if\pathkeys@getval{#1}}}
\new@def*\ifpathkeysvalTF#1{%
@@ -606,7 +695,6 @@ $Id: pathkeys.sty,v 0.0.2 2011/10/22 09:00:00 Ahmed Musa Exp $
\pathkeys@warn{Unknown option '\CurrentKey' with
value '\InnocentVal' ignored.}%
}
-%\ltxkeys@executeoptions[KV]<pathkeys>{}\relax
\ltxkeys@processoptions*[KV]<pathkeys>\relax
\cpt@optioncleanup\ltxkeys@processedoptions