diff options
author | Karl Berry <karl@freefriends.org> | 2013-05-16 22:30:01 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-05-16 22:30:01 +0000 |
commit | 318d628c7989d4f9ede20b1ee66471bedf447437 (patch) | |
tree | e552e9f9b6195d98f3d579088419fdce722df49c /Master/texmf-dist | |
parent | f297f05f92068bd7f54e8ee25ce7b8b8a83c2353 (diff) |
skeyval (16may13)
git-svn-id: svn://tug.org/texlive/trunk@30509 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
16 files changed, 1166 insertions, 879 deletions
diff --git a/Master/texmf-dist/doc/latex/skeyval/README b/Master/texmf-dist/doc/latex/skeyval/README index 00977c54e35..3bf12d11cbc 100644 --- a/Master/texmf-dist/doc/latex/skeyval/README +++ b/Master/texmf-dist/doc/latex/skeyval/README @@ -6,12 +6,19 @@ Ahmed Musa VERSION -Version 1.2, February 10, 2013. +Version 1.3, 2013/05/15. LOCATION ON CTAN macros/latex/contrib/skeyval +ANNOUNCEMENT TEXT + +The package integrates the features of xkeyval and of pgfkeys by +introducing a new set of handlers. Style keys, links, changing +key callbacks and values on the fly, and other features of pgfkeys +are introduced in a new context. + LICENSE Copyright (c) 2010-2013 Ahmed Musa @@ -29,13 +36,14 @@ FILES The following files constitute the skeyval bundle and must be distributed as a whole: - readme, skeyval.sty, skeyval-core.tex, skeyval-for.tex, + README, skeyval.sty, skeyval-core.tex, skeyval-for.tex, skeyval-view.sty, skeyval-ltxpatch.sty, skeyval-ltxcmds.tex, skeyval-pstkey.sty, skeyval-pstkey.tex, skeyval-testclass.cls, - and skeyval-testpkg.sty. + skeyval-testpkg.sty, skeyval-pokayoke1.tex, skeyval-pokayoke2.tex, + skeyval-view-pokayoke1.tex. -The skeyval package can be used by LaTeX and non-LaTeX users. -LaTeX users should load the package via +The skeyval package can be used by LaTeX and non-LaTeX users. LaTeX users +should load the package via \usepackage[<options>]{skeyval} @@ -51,12 +59,16 @@ Users of pre-version-1.0 of skeyval package can access the former version by entering the option 'compatibility' in <options> above. This option will automatically load version 0.73 (the version just before 1.0) of skeyval package. From version 1.0, the package -has changed radically. +has changed radically. Please accept my sincere apologies for making +changes to the implementation and command names without renaming +the package. I hate the practice of creating many forks of the same +package, irrespective of the fact that forking a package is rather +a standard practice in LaTeX. SUMMARY -The 's' in skeyval means 'skeleton keys' or 'master keys'. +The 's' in skeyval means 'skeleton' or 'master' keys. The skeyval package provides commands for compactly defining and initializing all types of key (ordinary, command, boolean, style, choice, @@ -179,7 +191,7 @@ the following. \skvcmdkey{fam}[mp@]{key2}[deafultx,defaulty]{% \def\cmd##1{#1+#2+##1}% } - \skvassignargs{fam}[.expanded]{key2}{#1,#2} + \skvassignargs{fam}{key2}{.expanded{#1,#2}} and much later @@ -189,11 +201,12 @@ the following. ** The callbacks of keys can be readily modified using commands like \skvaddtocallback, \skvprependtocallback, \skvappendtocallback, - or the handlers .prepend code, .append code, .add code. + or (within \directkeys) using the handlers .prepend code, .append code, + .add code. -** Handlers +** Handlers - The skeyval package has many handlers. The handlers of + The skeyval package has many handlers. The handlers of skeyval package start with a dot (.), as in pgfkeys package. Unlike in pgfkeys package, when 'expand' or 'expanded' @@ -207,26 +220,24 @@ the following. \skvappendstyles[KV]{fam}{key1,key2}{keya=.expanded{\vala},keyb=valb} [default of key1&2]{\def\y##1{#1*##1}} - Here the subjects are key1 and key2, while the observers are keya and - keyb. For now, the only thing the subject does is to set the given values + Here the subjects/observable are key1 and key2, while the observers are keya + and keyb. For now, the only thing the subject does is to set the given values of the observers on the current path. In the future, we intend to extend the subject-observer functionality to include more features of the observer pattern found in other programming paradigms. We foresee that subjects will be able to publish their services, and observer keys will be - able to subscribe for notification from subjects. And rather than 'notify - messages' simply setting observer keys with prior prescribed observer - values, as is currently the obtainable, observers may be able to do more - with such messages (such as change observer state patterns). + able to subscribe for notification from subjects. And rather than having + 'notify messages' simply setting observer keys with prior prescribed + observer values, which is what is currently obtainable, observers may be + able to do more with such messages (such as change observer state patterns). ** The parameters/arguments of callbacks of keys can be easily changed by calling \skvdefinekeys, \skvmakekeys, \skvassignargs or \directkeys. \skvordkeys[KV1]{fam2}{keya,keyb}[default-a]{\def\x##1{#1*##1}} - \skvassignargs[KV1,KV2]{fam1,fam2}[x1]{keya,keyb}{#1/#2} + \skvassignargs[KV1,KV2]{fam1,fam2}{keya,keyb}{.expand{#1/#2}} \skvsetkeys[KV1]{fam2}{keya=vala/valb} - 'x1' here means 'expand argument once at setting keys'. - ** \directkeys command: \directkeys{% @@ -385,8 +396,8 @@ the following. ** 'Quick keys' are a new concept. They're quite fast to define and set, but they can't carry pointers. - \quickkeys.define{<family>}[<holder.prefix>]{<list>} - \quickkeys.set{<family>}[<na>]{<kvlist>} + \skvquickkeys.define{<family>}[<holder.prefix>]{<list>} + \skvquickkeys.set{<family>}[<na>]{<kvlist>} When defining keys, the syntax of <list> is: @@ -396,7 +407,7 @@ the following. Example: - \quickkeys.define{fam}[mp@]{% + \skvquickkeys.define{fam}[mp@]{% keya/true/\def\x##1{#1*##1}/true,false; keyb; keyc,keyd/aaa+bbb/\def\y##1{#1*##1*#2}/.na/#1+#2; @@ -765,4 +776,4 @@ the following. \skvdefineordkey{key1}[def1]{\def\cmd##1{#1*##1}} \skvprocesskeys{key1=value1} -% End of readme file of skeyval package. +% End of readme file diff --git a/Master/texmf-dist/doc/latex/skeyval/skeyval-pokayoke1.pdf b/Master/texmf-dist/doc/latex/skeyval/skeyval-pokayoke1.pdf Binary files differindex b38b077fa0a..f94e0f6eda6 100644 --- a/Master/texmf-dist/doc/latex/skeyval/skeyval-pokayoke1.pdf +++ b/Master/texmf-dist/doc/latex/skeyval/skeyval-pokayoke1.pdf diff --git a/Master/texmf-dist/doc/latex/skeyval/skeyval-pokayoke1.tex b/Master/texmf-dist/doc/latex/skeyval/skeyval-pokayoke1.tex index ed79d37585d..6205121ae9f 100644 --- a/Master/texmf-dist/doc/latex/skeyval/skeyval-pokayoke1.tex +++ b/Master/texmf-dist/doc/latex/skeyval/skeyval-pokayoke1.tex @@ -1,3 +1,32 @@ +%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++% +% This is file 'skeyval-pokayoke1.tex', version 1.3, 2013/05/15. % +% % +% 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. % +% % +% The following files constitute the skeyval bundle and must be % +% distributed as a whole: % +% % +% README, skeyval.sty, skeyval-core.tex, skeyval-for.tex, % +% skeyval-view.sty, skeyval-ltxpatch.sty, skeyval-ltxcmds.tex, % +% skeyval-pstkey.sty, skeyval-pstkey.tex, skeyval-testclass.cls, % +% skeyval-testpkg.sty, skeyval-pokayoke1, skeyval-pokayoke2, % +% skeyval-view-pokayoke1. % +% % +% Copyright (c) 2010-2013 Ahmed Musa (amusa22@gmail.com). % +%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++% + \makeatletter \RequirePackage{skeyval-ltxpatch} @@ -63,15 +92,6 @@ % Note: When the value of a handler contains equality sign (=) or % comma (,), it should be enclosed in braces. -\directkeys*{% - % Defining new handlers that can't be overloaded: - .new reserved handlers={ - {.x handler,.x handlers}={ - \dirkeys@defhandlers{00}{#1} - }, - } -} - \directkeys*{ .exec=\skvtestcnt\z@, .prefix = KV1, @@ -246,11 +266,22 @@ .kv={keya=vala,keyc=valc,keyd=vald} }, % .exec code={\show\mysuccesslist}, + % Defining new handlers that can't be overloaded. + % '.resd handler' and '.resd handlers' are reserved handlers. + % They can be used to define new handlers (see below). + .new reserved handlers={ + {.resd handler,.resd handlers}=\dirkeysdefhandlers{00}{#1}, + }, + .resd handlers={ + .example handler1=\def\val{#1}, .example handler2=\edef\val{#1} + }, +% .exec=\skvshowcs{dirkeys@handler@.example handler1}, } \makeatother \begin{document} + \title{The \texttt{\textcolor{blue}{skeyval}} Package\\[1ex] Version 1.1a\\[1ex] \textsf{Test document 1}} diff --git a/Master/texmf-dist/doc/latex/skeyval/skeyval-pokayoke2.pdf b/Master/texmf-dist/doc/latex/skeyval/skeyval-pokayoke2.pdf Binary files differindex 8f1cda84161..995acce9470 100644 --- a/Master/texmf-dist/doc/latex/skeyval/skeyval-pokayoke2.pdf +++ b/Master/texmf-dist/doc/latex/skeyval/skeyval-pokayoke2.pdf diff --git a/Master/texmf-dist/doc/latex/skeyval/skeyval-pokayoke2.tex b/Master/texmf-dist/doc/latex/skeyval/skeyval-pokayoke2.tex index b720169ebbe..3c016c0d3c3 100644 --- a/Master/texmf-dist/doc/latex/skeyval/skeyval-pokayoke2.tex +++ b/Master/texmf-dist/doc/latex/skeyval/skeyval-pokayoke2.tex @@ -1,3 +1,33 @@ +%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++% +% This is file 'skeyval-pokayoke2.tex', version 1.3, 2013/05/15. % +% % +% 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. % +% % +% The following files constitute the skeyval bundle and must be % +% distributed as a whole: % +% % +% README, skeyval.sty, skeyval-core.tex, skeyval-for.tex, % +% skeyval-view.sty, skeyval-ltxpatch.sty, skeyval-ltxcmds.tex, % +% skeyval-pstkey.sty, skeyval-pstkey.tex, skeyval-testclass.cls, % +% skeyval-testpkg.sty, skeyval-pokayoke1, skeyval-pokayoke2, % +% skeyval-view-pokayoke1. % +% % +% Copyright (c) 2010-2013 Ahmed Musa (amusa22@gmail.com). % +%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++% + +% Check the log file for warning about unused global option 'unknown-option': \documentclass[ insertwatermark,watermarkcolor=blue!55, firstpagenumber=2,maketitlepage,unknown-option diff --git a/Master/texmf-dist/tex/latex/skeyval/skeyval-bc.sty b/Master/texmf-dist/tex/latex/skeyval/skeyval-bc.sty index 0e468a36db6..6d90b9958e8 100644 --- a/Master/texmf-dist/tex/latex/skeyval/skeyval-bc.sty +++ b/Master/texmf-dist/tex/latex/skeyval/skeyval-bc.sty @@ -2,7 +2,6 @@ % This is file 'skeyval-bc.sty', version 0.73 of skeyval package, % % 2011/01/01. % % NOTE % -% % % This file is provided only for backward compatibility (bc) of the % % skeyval package. Beginning from version 1.0, September 2012, the % % package has changed radically. Users of pre-version 1.0 of the package % diff --git a/Master/texmf-dist/tex/latex/skeyval/skeyval-core.tex b/Master/texmf-dist/tex/latex/skeyval/skeyval-core.tex index 709b36b5496..9c517aa289a 100644 --- a/Master/texmf-dist/tex/latex/skeyval/skeyval-core.tex +++ b/Master/texmf-dist/tex/latex/skeyval/skeyval-core.tex @@ -1,5 +1,5 @@ %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++% -% This is file 'skeyval-core.tex', version 1.2, 2013/02/10. % +% This is file 'skeyval-core.tex', version 1.3, 2013/05/15. % % % % This package and accompanying files may be distributed and/or % % modified under the conditions of the LaTeX Project Public License, % @@ -18,10 +18,11 @@ % The following files constitute the skeyval bundle and must be % % distributed as a whole: % % % -% readme, skeyval.sty, skeyval-core.tex, skeyval-for.tex, % +% README, skeyval.sty, skeyval-core.tex, skeyval-for.tex, % % skeyval-view.sty, skeyval-ltxpatch.sty, skeyval-ltxcmds.tex, % % skeyval-pstkey.sty, skeyval-pstkey.tex, skeyval-testclass.cls, % -% and skeyval-testpkg.sty. % +% skeyval-testpkg.sty, skeyval-pokayoke1, skeyval-pokayoke2, % +% skeyval-view-pokayoke1. % % % % Copyright (c) 2010-2013 Ahmed Musa (amusa22@gmail.com). % %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++% @@ -87,13 +88,13 @@ \newif\ifskv@tempst \ifx\ProvidesFile\@undefined \skv@latexfalse - \message{File 'skeyval-core.tex' 2013/02/10 v1.2: + \message{File 'skeyval-core.tex' 2013/05/15 v1.3: Core of 'skeyval' key-value parser (AM)} \input skeyval-ltxcmds \else \skv@latextrue \ProvidesFile{skeyval-core.tex} - [2013/02/10 v1.2 Base file of skeyval package (AM)] + [2013/05/15 v1.3 Base file of skeyval package (AM)] \@addtofilelist{skeyval-core.tex} \long\def\@nodocument#1{% \@latex@error{'#1' appeared\on@line\space without @@ -207,13 +208,14 @@ }% } \let\skvnewregisters\skvnewregister -\skvnewregisters\toks{\skv@toksa,\skv@toksb} +\skvnewregisters\toks{\skv@temptoks,\skv@toksa} % Sometimes we change \bgroup temporarily to avoid \futurelet confusing % it with explicit \bgroup character. The change does confuse \skvifnextchar % if we used \bgroup in \skvifnextchar. Hence let us use \skv@orig@bgroup % in \skvifnextchar: \let\skv@orig@bgroup\bgroup +\let\skv@orig@egroup\egroup \def\reserved@a#1{% \def\skvifnextisouter{% @@ -264,7 +266,7 @@ }{% % Test for \egroup, so that, eg, {\loggingall\LoadClass{article}} % doesn't fail because of the closing brace: - \skvsimpleifnextchar\egroup{% + \skvsimpleifnextchar\skv@orig@egroup{% \skvsimpleifnextchar{#1}{#2}{#3}% }{% \skvifnextisouter{% @@ -430,6 +432,9 @@ \skvnewdef\skvafterelseii#1\else#2\fi{\fi#2} \skvnewdef*\skv@simplearg{##1} \skvnewlet\skvsanitizemacro\@onelevel@sanitize +% \skvaddtotoks{<token register>}{<token to add>} +\skvrobustdef*\skvaddtotoks#1#2{#1\expandafter{\the#1#2}} +\skvrobustdef*\skvoaddtotoks#1#2{#1\expandafter{\the\expandafter#1#2}} \skvrobustdef*\skv@usetempst#1#2{% \edef#2{\skvifdefboolTF{skv@tempst}\skvexpandonce\unexpanded{#1}}% } @@ -668,14 +673,27 @@ \skv@err{Invalid boolean value '#1'; expected 'true' or 'false'}\skv@ehd } +% Switches have values of either 00 or 01. + +% \skvifknobTF, unlike \skvifswitchTF, is for use with plain switches, +% ie, switches that have no separate namespace. +\skvnewdef*\skvifknobTF#1{% + \if\@nameuse{#1}\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi +} +\skvnewdef*\skvifknobFT#1{% + \if\@nameuse{#1}\expandafter\@secondoftwo\else\expandafter\@firstoftwo\fi +} % Switches and toggles have separate namespaces. -\skvrobustdef*\skvnewswitch#1{% - \skvifcsdefTF{skv@switch@#1}{% - \skv@err{Switch '\detokenize{#1}' already exists}\skv@ehd - }{% - \skvcsdef{skv@switch@#1}{01}% +\skvrobustdef*\skvnewswitches#1{% + \skvcommaloop{#1}\skv@prova{% + \skvifcsdefTF{skv@switch@\skv@prova}{% + \skv@err{Switch '\skvoxdetok\skv@prova' already exists}\skv@ehd + }{% + \skvcsdef{skv@switch@\skv@prova}{01}% + }% }% } +\skvnewlet\skvnewswitch\skvnewswitches \skvnewdef*\skvifswitchTF#1{% \if \skvifcsdefTF{skv@switch@#1}{% @@ -704,13 +722,19 @@ }% } \skvrobustdef*\skvnewtog#1{% - \skvifcsdefTF{skv@toggle@#1}{% - \skv@err{Switch '\detokenize{#1}' already exists}\skv@ehd - }{% - \skvcslet{skv@toggle@#1}\@secondoftwo + \skvcommaloop{#1}\skv@prova{% + \skvifcsdefTF{skv@toggle@\skv@prova}{% + \skv@err{Switch '\skvoxdetok\skv@prova' already exists}\skv@ehd + }{% + \skvcslet{skv@toggle@\skv@prova}\@secondoftwo + }% + }% +} +\skvrobustdef*\skvdeftog#1{% + \skvcommaloop{#1}\skv@prova{% + \skvcslet{skv@toggle@\skv@prova}\@secondoftwo }% } -\skvrobustdef*\skvdeftog#1{\skvcslet{skv@toggle@#1}\@secondoftwo} \skvnewdef*\skviftogTF#1{% \skvifcsdefTF{skv@toggle@#1}{% \csname skv@toggle@#1\endcsname @@ -734,14 +758,7 @@ \skv@err{No toggle '\detokenize{#1}'}\skv@ehd }% } - -% plasw=plain switch (ie, 00 or 01). -\skvnewdef*\skvifplaswTF#1{% - \if#1\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi -} -\skvnewdef*\skvifplaswFT#1{% - \if#1\expandafter\@secondoftwo\else\expandafter\@firstoftwo\fi -} +% Allow 'f' to stop the search for number: \skvnewdef\skvifcondTF#1\fi{% \csname @#1first\else second\fi oftwo\endcsname } @@ -1239,7 +1256,39 @@ }% } \skvrobustdef*\skvifmacroFT#1{\skvifmacroTF{#1}\@secondoftwo\@firstoftwo} - +% Note: If there're more than 1 alpha/Alpha character, both \skvifloweralpha +% and \skvifupperalpha will return false. Hence double (or more) aphabetic +% characters can't be auto-completed by \skvautocompletelist. +\skvnewdef*\skvifloweralpha#1{% + \skvifblankTF{#1}{% + \@secondoftwo + }{% + \skvifntypeTF{#1}{% + \skvifnumTF`#1>96{% + \skvifnumTF`#1<123{\@firstoftwo}{\@secondoftwo}% + }{% + \@secondoftwo + }% + }{% + \@secondoftwo + }% + }% +} +\skvnewdef*\skvifupperalpha#1{% + \skvifblankTF{#1}{% + \@secondoftwo + }{% + \skvifntypeTF{#1}{% + \skvifnumTF`#1>64{% + \skvifnumTF`#1<91{\@firstoftwo}{\@secondoftwo}% + }{% + \@secondoftwo + }% + }{% + \@secondoftwo + }% + }% +} % If there is a digit present in #1: \skvnewdef*\skvifdigitpresentTF#1{% \skvifcondTF\if0\skvifblankTF{#1}{1}{\skv@ifdigitpresent#1\skv@nnil}\fi @@ -1383,26 +1432,6 @@ \fi } -% Test if a token #1 can be assigned to a \dimendef'd register. We assume -% that #1 isn't a complicated expression and isn't padded with trailing -% \relax's. A complicated expression will be something like -% -% 2pt+3ex-(3pt/4+1.45cc*3) -% -% which is much harder to parse and decide on. -% -% Examples: -% -% \skvifdimensionable{01}{\def\x{T}}{\def\x{F}} -% \skvifdimensionable{01pt}{\def\x{T}}{\def\x{F}} -% \skvifdimensionable{01abpt}{\def\x{T}}{\def\x{F}} -% \skvifdimensionable\paperwidth{\def\x{T}}{\def\x{F}} -% \skvifdimensionable{\skip0}{\def\x{T}}{\def\x{F}} -% \skvifdimensionable{1.2pt}{\def\x{T}}{\def\x{F}} -% \skvifdimensionable{1.2\relax pt}{\def\x{T}}{\def\x{F}} -% \skvifdimensionable{1pt\relax\skvrelax}{\def\x{T}}{\def\x{F}} -% - \skvnewregister\bool{\ifskv@isinteger} % In case the argument of \skvifintegerTF containes \numexpr: @@ -1435,6 +1464,26 @@ }% } \skvrobustdef\skvoifinteger{\skvexpbracenext\skvifintegerTF} + +% Test if a token #1 can be assigned to a \dimendef'd register. We assume +% that #1 isn't a complicated expression and isn't padded with trailing +% \relax's. A complicated expression will be something like +% +% 2pt+3ex-(3pt/4+1.45cc*3) +% +% which is much harder to parse and decide on. +% +% Examples: +% +% \skvifdimensionable{01}{\def\x{T}}{\def\x{F}} +% \skvifdimensionable{01pt}{\def\x{T}}{\def\x{F}} +% \skvifdimensionable{01abpt}{\def\x{T}}{\def\x{F}} +% \skvifdimensionable\paperwidth{\def\x{T}}{\def\x{F}} +% \skvifdimensionable{\skip0}{\def\x{T}}{\def\x{F}} +% \skvifdimensionable{1.2pt}{\def\x{T}}{\def\x{F}} +% \skvifdimensionable{1.2\relax pt}{\def\x{T}}{\def\x{F}} +% \skvifdimensionable{1pt\relax\skvrelax}{\def\x{T}}{\def\x{F}} +% \skvrobustdef\skvifdimensionable#1{% \def\skv@dimunit{}% % Does 'pt' mean 0pt or 1pt? Make it an invalid input: @@ -1609,11 +1658,11 @@ % The following \relax will not be cat-12, so it won't appear in #2: \def\skv@trim@a{% \skvxifinTF{\detokenize{#1}\relax}{\skvoxdetok{#2}\relax}{% - \def\skv@trim@b####1#1\normal@nil{% + \def\skv@trim@b####1#1\skv@normal@nil{% \edef#2{\unexpanded{####1}}% \skv@trim@a }% - \expandafter\skv@trim@b#2\normal@nil + \expandafter\skv@trim@b#2\skv@normal@nil }{}% }% \skv@trim@a @@ -1633,13 +1682,13 @@ % \edef\x{\skvtsvnormalize{ x y {z}}} \skvnewdef*\skvtsvnormalize#1{% \unexpanded\expandafter - {\romannumeral-`\q\skv@tsvnormalize.#1 \normal@nil}% + {\romannumeral-`\q\skv@tsvnormalize.#1 \skv@normal@nil}% } -\skvnewdef*\skv@tsvnormalize#1 #2\normal@nil{% +\skvnewdef*\skv@tsvnormalize#1 #2\skv@normal@nil{% \skvifblankTF{#2} {\expandafter\expandafter\expandafter\space \expandafter\noexpand\@gobble#1} - {\skv@tsvnormalize#1#2\normal@nil}% + {\skv@tsvnormalize#1#2\skv@normal@nil}% } @@ -1654,7 +1703,7 @@ }% \skv@prova csv\skvcsvnormalize kv\skvkvnormalize#1\skv@nnil\skv@nil } -\skvnewswitch{inkv} +\skvnewdef*\skv@switch@inkv{01} % \skvcsvnormalize[<parser>]<listcmd> \skvrobustdef*\skvcsvnormalize{\skv@testopt\skv@csvnormalize,} \skvrobustdef*\skv@csvnormalize[#1]#2{% @@ -1691,12 +1740,12 @@ % a trailing space or <parser> in #1. We remove the trailing space % with \skvtrimspace. \edef#1{\expandafter\skv@normalizelist\expandafter{#1\skv@kvguard}}% - \def\skv@kvnorm##1\skv@kvguard##2\normal@nil{% - \skv@parserequalerr##1##2,=\normal@nil + \def\skv@kvnorm##1\skv@kvguard##2\skv@normal@nil{% + \skv@parserequalerr##1##2,=\skv@normal@nil \edef#1{\skvtrimspace{##1##2}}% \skvtrimlastparser{,}#1% }% - \expandafter\skv@kvnorm#1\normal@nil + \expandafter\skv@kvnorm#1\skv@normal@nil \skvaftergroupdef#1\endgroup } @@ -1708,85 +1757,85 @@ \lowercase{\endgroup \def\skv@normalizelist##1{% \unexpanded\expandafter{\romannumeral-`\q - \skv@activeparser#1##1#1~\normal@nil}% + \skv@activeparser#1##1#1~\skv@normal@nil}% }% - \def\skv@activeparser##1~##2\normal@nil{% + \def\skv@activeparser##1~##2\skv@normal@nil{% \skvifblankTF{##2}{% \skvifdefswitchTF{inkv}{% - \skv@activeequal##1!\normal@nil + \skv@activeequal##1!\skv@normal@nil }{% - \skv@spaceparser##1 #1\normal@nil + \skv@spaceparser##1 #1\skv@normal@nil }% }{% - \skv@activeparser##1#1##2\normal@nil + \skv@activeparser##1#1##2\skv@normal@nil }% }% - \def\skv@activeequal##1!##2\normal@nil{% + \def\skv@activeequal##1!##2\skv@normal@nil{% \skvifblankTF{##2}{% - \skv@spaceparser##1 #1\normal@nil + \skv@spaceparser##1 #1\skv@normal@nil }{% - \skv@activeequal##1=##2\normal@nil + \skv@activeequal##1=##2\skv@normal@nil }% }% }% - \def\skv@spaceparser##1 #1##2\normal@nil{% + \def\skv@spaceparser##1 #1##2\skv@normal@nil{% \skvifblankTF{##2}{% - \skv@parserspace##1#1 \normal@nil + \skv@parserspace##1#1 \skv@normal@nil }{% - \skv@spaceparser##1#1##2\normal@nil + \skv@spaceparser##1#1##2\skv@normal@nil }% }% - \def\skv@parserspace##1#1 ##2\normal@nil{% + \def\skv@parserspace##1#1 ##2\skv@normal@nil{% \skvifblankTF{##2}{% \skvifdefswitchTF{inkv}{% - \skv@spaceequal##1 =\normal@nil + \skv@spaceequal##1 =\skv@normal@nil }{% - \skv@doubleparser##1#1#1\normal@nil + \skv@doubleparser##1#1#1\skv@normal@nil }% }{% - \skv@parserspace##1#1##2\normal@nil + \skv@parserspace##1#1##2\skv@normal@nil }% }% - \def\skv@spaceequal##1 =##2\normal@nil{% + \def\skv@spaceequal##1 =##2\skv@normal@nil{% \skvifblankTF{##2}{% - \skv@equalspace##1= \normal@nil + \skv@equalspace##1= \skv@normal@nil }{% - \skv@spaceequal##1=##2\normal@nil + \skv@spaceequal##1=##2\skv@normal@nil }% }% - \def\skv@equalspace##1= ##2\normal@nil{% + \def\skv@equalspace##1= ##2\skv@normal@nil{% \skvifblankTF{##2}{% - \skv@doubleparser##1#1#1\normal@nil + \skv@doubleparser##1#1#1\skv@normal@nil }{% - \skv@equalspace##1=##2\normal@nil + \skv@equalspace##1=##2\skv@normal@nil }% }% - \def\skv@doubleparser##1#1#1##2\normal@nil{% + \def\skv@doubleparser##1#1#1##2\skv@normal@nil{% \skvifblankTF{##2}{% \skvifdefswitchTF{inkv}{% - \skv@doubleequal##1==\normal@nil + \skv@doubleequal##1==\skv@normal@nil }{% \skvifblankTF{##1}{}{% - \skv@remleadparser##1\normal@nil + \skv@remleadparser##1\skv@normal@nil }% }% }{% - \skv@doubleparser##1#1##2\normal@nil + \skv@doubleparser##1#1##2\skv@normal@nil }% }% - \def\skv@doubleequal##1==##2\normal@nil{% + \def\skv@doubleequal##1==##2\skv@normal@nil{% \skvifblankTF{##2}{% \skvifblankTF{##1}{}{% - \skv@remleadparser##1\normal@nil + \skv@remleadparser##1\skv@normal@nil }% }{% - \skv@doubleequal##1=##2\normal@nil + \skv@doubleequal##1=##2\skv@normal@nil }% }% - \def\skv@remleadparser#1##1\normal@nil{% + \def\skv@remleadparser#1##1\skv@normal@nil{% \expandafter\space\noexpand##1% }% - \def\skv@parserequalerr##1#1=##2\normal@nil{% + \def\skv@parserequalerr##1#1=##2\skv@normal@nil{% \skvifblankTF{##2}{}{% \skv@err{There is '#1=' in your key-value list}\skv@ehd }% @@ -1794,33 +1843,39 @@ } \endgroup -% Special slash normalizer, which doesn't replace double slashes with -% single slash, because a double slash might mean an intentionally +% Define a special parser normalizer that doesn't replace double parsers +% with single parser, because a double parser might mean an intentionally % missing token/property of a key: \begingroup -\catcode`\~=13 \uccode`\~=`\/ -\uppercase{\endgroup - \skvnewdef\skvkeepdoubleslashnormalize#1{% - \unexpanded\expandafter{\romannumeral-`\q - \skv@activeslash#1~\normal@nil}% +\catcode`\~=13 +\skvrobustgdef*\skvdefinekeepdoubleparsernormalizer#1#2{% + \begingroup + \uccode`\~=`#1 + \uppercase{\endgroup + \long\def#2##1{% + \unexpanded\expandafter{\romannumeral-`\q + \skv@keepdouble@activeparser##1~\skv@normal@nil}% + }% + \long\def\skv@keepdouble@activeparser##1~##2\skv@normal@nil{% + \skvifblankTF{##2} + {\skv@keepdouble@spaceparser##1 #1\skv@normal@nil} + {\skv@keepdouble@activeparser##1#1##2\skv@normal@nil}% + }% }% - \skvnewdef\skv@activeslash#1~#2\normal@nil{% - \skvifblankTF{#2} - {\skv@spaceslash#1 /\normal@nil} - {\skv@activeslash#1/#2\normal@nil}% + \long\def\skv@keepdouble@spaceparser##1 #1##2\skv@normal@nil{% + \skvifblankTF{##2} + {\skv@keepdouble@parserspace##1#1 \skv@normal@nil} + {\skv@keepdouble@spaceparser##1#1##2\skv@normal@nil}% + }% + \long\def\skv@keepdouble@parserspace##1#1 ##2\skv@normal@nil{% + \skvifblankTF{##2} + {\skvifblankTF{##1}{}{\expandafter\space\noexpand##1}} + {\skv@keepdouble@parserspace##1#1##2\skv@normal@nil}% }% } -\skvnewdef\skv@spaceslash#1 /#2\normal@nil{% - \skvifblankTF{#2} - {\skv@slashspace#1/ \normal@nil} - {\skv@spaceslash#1/#2\normal@nil}% -} -\skvnewdef\skv@slashspace#1/ #2\normal@nil{% - \skvifblankTF{#2} - {\skvifblankTF{#1}{}{\expandafter\space\noexpand#1}} - {\skv@slashspace#1/#2\normal@nil}% -} +\endgroup +\skvdefinekeepdoubleparsernormalizer{/}\skvkeepdoubleslashnormalize % \skvmacnormalize[<parser>]<listcmd> \skvrobustdef*\skvmacnormalize{\skv@testopt\skv@macnormalize,} @@ -1833,27 +1888,30 @@ % This is for normalizing lists like {x\\ y\\\\ z}, where \\ is % a control sequence. Such parsers may be commands but we don't % expect them to be active characters. +% % Example: +% % \skvsetupmacroparsernormalizer{\\} % \edef\x{\skvmacroparsernormalize{x\\ y\\\\ z}} +% \skvrobustdef*\skvsetupmacroparsernormalizer#1{% \long\def\skvmacroparsernormalize##1{% \unexpanded\expandafter{\romannumeral-`\q - \skv@mac@spaceparser##1 #1\normal@nil}% + \skv@mac@spaceparser##1 #1\skv@normal@nil}% }% - \long\def\skv@mac@spaceparser##1 #1##2\normal@nil{% + \long\def\skv@mac@spaceparser##1 #1##2\skv@normal@nil{% \skvifblankTF{##2} - {\skv@mac@parserspace##1#1 \normal@nil} - {\skv@mac@spaceparser##1#1##2\normal@nil}% + {\skv@mac@parserspace##1#1 \skv@normal@nil} + {\skv@mac@spaceparser##1#1##2\skv@normal@nil}% }% - \long\def\skv@mac@parserspace##1#1 ##2\normal@nil{% + \long\def\skv@mac@parserspace##1#1 ##2\skv@normal@nil{% \skvifblankTF{##2} - {\skv@mac@doubleparser##1#1#1\normal@nil} - {\skv@mac@parserspace##1#1##2\normal@nil}% + {\skv@mac@doubleparser##1#1#1\skv@normal@nil} + {\skv@mac@parserspace##1#1##2\skv@normal@nil}% }% - \long\def\skv@mac@doubleparser##1#1#1##2\normal@nil{% + \long\def\skv@mac@doubleparser##1#1#1##2\skv@normal@nil{% \skvifblankTF{##2}{ ##1} - {\skv@mac@doubleparser##1#1##2\normal@nil}% + {\skv@mac@doubleparser##1#1##2\skv@normal@nil}% }% } % \skvletmanytocmd{<cmd list>}{<cmd>} @@ -2036,8 +2094,8 @@ % \skvnewbools[skv@]{% inclass,inset,viarootofsetkeys,processvalueaslist,st,cl,pl,kf,inpox,inopt,% - inprepo,tracingkeys,swa,swb,verbose,intry,insa,success,inoptionsec,% - inreservedhandler,ignorepointers% + inprepo,tracingkeys,tempsw,swa,verbose,intry,insa,success,inoptionsec,% + inreservedhandler,ignorepointers,addslots@appending% } \skvnewbools{indirectkeys} @@ -2095,8 +2153,8 @@ % A fast key parsing scheme originally designed for \newforeach loop. % -% \quickkeys.define{<family>}[<hp>]{<list>} -% \quickkeys.set{<family>}[<na>]{<kvlist>} +% \skvquickkeys.define{<family>}[<hp>]{<list>} +% \skvquickkeys.set{<family>}[<na>]{<kvlist>} % % 1. Quickly define and set command/store keys. % 2. Pointers aren't used here, to speed up parsing. Use other key @@ -2118,7 +2176,7 @@ % The default parser is semicolon (;). % % Example: -% \quickkeys.define{fam}[mp@]{% +% \skvquickkeys.define{fam}[mp@]{% % keya/true/\def\x##1{#1*##1}/true,false; % keyb; % keyc,keyd/aaa+bbb/\def\x##1{#1*##1*#2}/.na/#1+#2; @@ -2188,7 +2246,7 @@ } \skvrobustdef*\skvsetquickkeysparser{\def\skv@qkeysparser} \skvsetquickkeysparser{;} -\skvrobustdef*\quickkeys#1#{% +\skvrobustdef*\skvquickkeys#1#{% \edef\skv@tempa{\skvtrimspace{#1}}% \skvxifstrcmpTF{\skvexpandonce\skv@tempa}{.define}{% \begingroup\endlinechar\m@ne @@ -2200,7 +2258,7 @@ \skvxifstrcmpTF{\skvexpandonce\skv@tempa}{.preset}{% \skv@presetquickkeys }{% - \skv@err{Unknown task for \string\quickkeys}\skv@ehd + \skv@err{Unknown task for \string\skvquickkeys}\skv@ehd }% }% }% @@ -2239,7 +2297,7 @@ }% } -% \quickkeys.preset{<family>}{<kvlist>} +% \skvquickkeys.preset{<family>}{<kvlist>} % \skvrobustdef*\skv@presetquickkeys#1#2{% \edef\skv@prova{\unexpanded{#2}}% @@ -2249,7 +2307,7 @@ \skvnewnumbers[skv@]{setqkeysdepth} -% \quickkeys.set{<family>}[<na>]{<kvlist>} +% \skvquickkeys.set{<family>}[<na>]{<kvlist>} \skvrobustdef*\skv@setquickkeys#1{\skv@testopt{\skv@setquickkeys@a{#1}}{}} \skvrobustdef*\skv@setquickkeys@a#1[#2]#3{% @@ -2280,8 +2338,8 @@ \skvletcs\skv@tempval{\skv@qkeysfam/##1/qkeys.val}% \skvletcs\reserved@a{\skv@qkeysfam/##1/qkeys.chc}% \skvifdefTF\reserved@a{% - \skvxifinTF{,\detokenize{##2},}{,\skvoxdetok\reserved@a,}{}{% - \skv@err{Value '\detokenize{##2}' for key '##1' + \skvxifinTF{,\skvoxdetok\skv@tempval,}{,\skvoxdetok\reserved@a,}{}{% + \skv@err{Value '\skvoxdetok\skv@tempval' for key '##1' \MessageBreak is not in prescribed list \MessageBreak '\skvoxdetok\reserved@a'}\skv@ehd }% @@ -2323,16 +2381,16 @@ } \skvnewlet\skv@sav@setquickkeys@a\skv@setquickkeys@a \skvrobustdef*\skv@bad@setquickkeys@a{% - \skv@err{'\string\quickkeys.set' can't be nested in a preset + \skv@err{'\string\skvquickkeys.set' can't be nested in a preset \MessageBreak key's callback: this will cause a cyclic call - \MessageBreak to '\string\quickkeys.set'}\skv@ehd + \MessageBreak to '\string\skvquickkeys.set'}\skv@ehd } -% \skvinitializeqkeys{<fam>}[<na>]{<kvlist>} -\skvrobustdef*\skvinitializeqkeys#1{% - \skv@testopt{\skv@initializeqkeys@a{#1}}{}% +% \skvinitializequickkeys{<fam>}[<na>]{<kvlist>} +\skvrobustdef*\skvinitializequickkeys#1{% + \skv@testopt{\skv@initializequickkeys@a{#1}}{}% } -\skvrobustdef*\skv@initializeqkeys@a#1[#2]#3{% +\skvrobustdef*\skv@initializequickkeys@a#1[#2]#3{% \skvindeftrue \skv@setquickkeys{#1}[#2]{#3}% \skvindeffalse @@ -2575,12 +2633,10 @@ \do\ifindirectkeys\do\ifskvdfk@initialize\do\ifskvdfk@saveinitialvalues }\skv@stackdepthlimit -\skvrobustdef\skvappto#1#2{% - \edef#1{\skvexpandonce{#1}\unexpanded{#2}}% -} -\skvrobustdef\skvgappto#1#2{% - \xdef#1{\skvexpandonce{#1}\unexpanded{#2}}% -} +\skvrobustdef\skvappto#1#2{\edef#1{\skvexpandonce{#1}\unexpanded{#2}}} +\skvrobustdef\skvxappto#1#2{\edef#1{\skvexpandonce{#1}#2}} +\skvrobustdef\skvgappto#1#2{\xdef#1{\skvexpandonce{#1}\unexpanded{#2}}} +\skvrobustdef\skvxgappto#1#2{\xdef#1{\skvexpandonce{#1}#2}} \skvrobustdef\skvappendtomacro{\skv@testst{\skv@appendtomacro{app}{e}}} \skvrobustdef\skvgappendtomacro{\skv@testst{\skv@appendtomacro{app}{x}}} \skvrobustdef\skvprependtomacro{\skv@testst{\skv@appendtomacro{pre}{e}}} @@ -3223,7 +3279,7 @@ % Assign arguments to keys: % -% \skvassignargs[<prefixes>]{<families>}[<expansion.type>]{<keys>}{<arg>} +% \skvassignargs[<prefixes>]{<families>}{<keys>}{.<expansion type>{<arg>}} % % 1. Valid expansion types are .expand once, .expand twice, .expanded. % 2. At set keys (not at define keys), the argument to the listed keys will @@ -3236,40 +3292,52 @@ % % Example: % -% \skvassignargs[KV1,KV2]{fam1,fam2}[.expand once]{keya,keyb}{#1/#2} +% \skvassignargs[KV1,KV2]{fam1,fam2}{keya,keyb}{.expanded{#1/#2}} % % The keys could then be set as % -% \skvsetkeys[KV1]{fam2}{keya=vala/valb} +% \skvsetkeys[KV1]{fam2}{keya=\vala/\valb} % % For each prefix and family, this will define parameterless functions % -% \<prefix>/<family>/<key>.@x1arg. +% \<prefix>/<family>/<key>.@xxarg. % % which will be used at setkeys to define and execute the key's callback. % \skvrobustdef*\skvassignargs{\skv@testopt\skv@assignargs\skvdefaultprefix} -\skvrobustdef*\skv@assignargs[#1]#2{% +\skvrobustdef*\skv@assignargs[#1]#2#3#4{% \begingroup - \skv@testopt{\skv@assignargs@a{#1}{#2}}{^skv^}% -} -\skvrobustdef*\skv@assignargs@a#1#2[#3]#4#5{% - \edef\skv@tempb{\skvtrimspace{#5}}% - \def\skv@tempc{}% - \skvifstrcmpTF{#3}{^skv^}{% - \def\skvexpander{x0}% - }{% - \skv@getexpander@a{#3}\skvexpander + \let\skv@temparg\skv@simplearg + \def\skv@expandertype{x0}% + \edef\skv@tempa{\skvtrimspace{#4}}% + \def\do##1##2{% + \ifx\do##1\else + \skvxifinTF{\detokenize{##1}}{\skvoxdetok\skv@tempa}{% + \def\skv@prova####1##1####2####3\skv@arg@nil{% + \edef\skv@temparg{\unexpanded{####2}}% + \def\skv@expandertype{##2}% + }% + \expandafter\skv@prova\skv@tempa\skv@arg@nil + \def\do####1\do\do{}% + }{}% + \expandafter\do + \fi }% + \do{.unexpanded}{x0}{.expand once}{x1}{.expand twice}{x2}% + {.expanded}{xx}{.expand}{xx}\do\do + \def\skv@tempc{}% + % Loop over prefixes: \skvcommaparse{#1}\skv@tempa{% \skv@makeprefix\skv@tempa + % Loop over families: \skvcommaparse{#2}\skv@tempa{% \skv@makeheader\skv@tempa - \skvcommaparse{#4}\skv@tempa{% + % Loop over keys: + \skvcommaparse{#3}\skv@tempa{% \edef\skv@tempc{% \skvexpandonce\skv@tempc - \skvcsedef{\skv@header\skv@tempa.@\skvexpander arg}{% - \noexpand\unexpanded{\skvexpandonce\skv@tempb}% + \skvcsedef{\skv@header\skv@tempa.@\skv@expandertype arg}{% + \noexpand\unexpanded{\skvexpandonce\skv@temparg}% }% }% }% @@ -3277,37 +3345,15 @@ }% \expandafter\endgroup\skv@tempc } - -% \skv@getexpander@a{<expander.type>}{<return.cmd>} -% -% 1. <return.cmd> will contain one of 'x0', 'x1', 'x2', 'xx', which will be -% saved in a key-dependent macro that represents the key's argument. -% -\skvrobustdef*\skv@getexpander@a#1#2{% - \begingroup - \edef\skv@prova{\skvotrimspace{#1}}% - \def\skv@provb##1{% - \def\skv@provb####1##1####2####3\skv@nil{% - \endgroup - \def#2{####2}% - \ifx#2\@nnil - \skv@err{Unknown expansion type '\detokenize{##1}'}\skv@ehd - \fi - }% - \skv@provb .expand once{x1},.expand twice{x2},.expanded{xx},% - .expand{xx},##1{\@nil}\skv@nil - }% - \expandafter\skv@provb\expandafter{\skv@prova}% -} -% \skv@getexpander@b{<expander.type>} +% \skv@getexpander{<expander.type>} % % 1. <expander.type> is one of 'x0', 'x1', 'x2', 'xx', which had been % saved in a key-dependent macro. % -% 2. \skv@getexpander@b returns macro \skvexpander, which will +% 2. \skv@getexpander returns macro \skvexpander, which will % contain one of \unexpanded, \skvexpandonce, \skvexpandtwice, \@iden. % -\skvrobustdef*\skv@getexpander@b#1{% +\skvrobustdef*\skv@getexpander#1{% \begingroup \edef\skv@prova{\skvtrimspace{#1}}% \def\skv@provb##1{% @@ -3670,13 +3716,13 @@ % % The skeyval package allows holder-macro prefixes {<mp>} for choice keys. % -% \skvchoicekey[<pref>]{<fam>}[<mp>]{<key>}[<bins>]{<choices>} +% \skvchoicekey[<pref>]{<fam>}[<mp>]{<keys>}[<bins>]{<choices>} % [<default>]{<callback>} -% \skvchoicekey+[<pref>]{<fam>}[<mp>]{<key>}[<bins>]{<choices>} +% \skvchoicekey+[<pref>]{<fam>}[<mp>]{<keys>}[<bins>]{<choices>} % [<default>]{<callback>}{<fallback>} -% \skvchoicekey*[<pref>]{<fam>}[<mp>]{<key>}[<bins>]{<choices>} +% \skvchoicekey*[<pref>]{<fam>}[<mp>]{<keys>}[<bins>]{<choices>} % [<default>]{<callback>} -% \skvchoicekey*+[<pref>]{<fam>}[<mp>]{<key>}[<bins>]{<choices>} +% \skvchoicekey*+[<pref>]{<fam>}[<mp>]{<keys>}[<bins>]{<choices>} % [<default>]{<callback>}{<fallback>} % % \skvchoicekeys[KV]{fam}[mp@]{key1,key2}[\val\nr]{% @@ -3715,7 +3761,7 @@ \skvcmdexit\skv@altlista\skvcmdexit\skv@altlistb }% } -% \skv@executechoice{00.or.01}{<currentvalue>}{<altlist>} +% \skv@executechoice{00 or 01}{<currentvalue>}{<altlist>} \skvrobustdef*\skv@executechoice#1#2#3{% \begingroup \if#1\lowercase{\fi @@ -3786,7 +3832,7 @@ \skvrobustdef*\skv@choicekey@c[#1]{% \edef\skv@default{\skvtrimspace{#1}}% % Choice can't have braced values, since that will make matching - % to state pattern difficult: + % to the state pattern difficult or impossible: \skvstripouterbraces{2}\skv@default \skvifdefboolTF{skv@pl}\skv@choicekey@e\skv@choicekey@d } @@ -3816,7 +3862,7 @@ \ifx\skv@bins\@empty\else[\skvxonce\skv@bins]\fi {##1}{\skvxonce\skv@altlista}##2% }% - \skv@toksa\expandafter{\skv@prova{##1}{#1}}% + \skv@temptoks\expandafter{\skv@prova{##1}{#1}}% % Why separate \skv@choicekey@g? It is needed by skeyval-view.sty: \skv@choicekey@g } @@ -3831,7 +3877,7 @@ \fi \skvcsedef{\skv@header\skvcurrentkey.@cbk}{% \skvcslet{\skv@hp\skvcurrentkey}\noexpand\skvcurrentvalue - \the\skv@toksa + \the\skv@temptoks }% }% } @@ -3875,7 +3921,7 @@ % \skv@boolkey@a{<key>}{<mp.key>}{<default>}{<callback>} \skvrobustdef*\skv@boolkey@a#1#2#3#4{% \def\skv@tempa{\skv@boolkey@c{#1}{#2}{#3}}% - \skvifplaswTF\skv@typetogkey{% + \skvifknobTF{skv@typetogkey}{% \expandafter\skv@tempa\expandafter{\expandafter{\expandafter \skv@togkey@settog\expandafter{\skv@zapsw}{#2}\skv@value#4}}% }{% @@ -3887,7 +3933,7 @@ % \skv@boolkey@b{<key>}{<mp.key>}{<default>}{<callback>}{<fallback>} \skvrobustdef*\skv@boolkey@b#1#2#3#4#5{% \def\skv@tempa{\skv@boolkey@c{#1}{#2}{#3}}% - \skvifplaswTF\skv@typetogkey{% + \skvifknobTF{skv@typetogkey}{% \expandafter\skv@tempa\expandafter{\expandafter{\expandafter \skv@togkey@settog\expandafter{\skv@zapsw}{#2}\skv@value#4}{#5}}% }{% @@ -3909,8 +3955,8 @@ \ifskv@pl\noexpand\skv@pltrue\else\noexpand\skv@plfalse\fi \skv@checkchoice[\noexpand\skv@value]{##1}{true,false}##2% }% - \skv@toksa\expandafter{\skv@tempa{##1}{#4}}% - \skvcsedef{\skv@header#1.@cbk}{\the\skv@toksa}% + \skv@temptoks\expandafter{\skv@tempa{##1}{#4}}% + \skvcsedef{\skv@header#1.@cbk}{\the\skv@temptoks}% } % % \skvboolkeys[<pref>]{<fam>}[<mp>]{<keys>}[<defa>]{<callback>} @@ -4168,14 +4214,20 @@ % \skvprependslots[<pref>]{<fam>}{<signal.keys>}{<slots>} % [<signal default>]{<signal callback>} % +% Example: +% +% \skvordkeys[KV]{fam}{keya,keyb}{\def\x##1{#1*##1}} +% \skvappendslots[KV]{fam}{keyd,keye}{keya=.expanded{\vala},keyb=valb} +% [def-d&e]{\def\y##1{#1*##1}} +% % 1. <slots> must pre-exist. If slot key is undefined, then the signal-slot % system isn't useful here since the slot will serve no purpose. % % 2. If desired, use pointers/handlers .expanded, .expand once, .expand twice % on values of <slots>. % -% 3. Here, it helps to consider <keys> as parents (or signals or -% subjects) and <slots> as children (or slots or observers). +% 3. Here, it helps to consider <signal.keys> as parents (or signals/ +% subjects/observables) and <slots> as children (or slots/observers). % % 4. <signal.keys> can't be preset, to avoid cyclic setting of keys. % Consider the following, for a signal key in the preset list: @@ -4186,12 +4238,20 @@ % In the attempt to set a slot key, the preset list (that includes % the signal key) will be instantiated. % -% Example: -% -% \skvordkeys[KV]{fam}{keya,keyb}{\def\x##1{#1*##1}} -% \skvappendslots[KV]{fam}{keyd,keye}{keya=.expanded{\vala},keyb=valb} -% [def-d&e]{\def\y##1{#1*##1}} -% +\AtEndOfPackage{% + \skvnewcastcommands{% + \skvslotkeys=\skvappendslots,\skvstylekeys=\skvappendslots, + \skvprependstyles=\skvprependslots, + \skvappendstylesexpanded=\skvappendslotsexpanded, + \skvprependstylesexpanded=\skvprependslotsexpanded, + \skvaddstyles=\skvaddslots, + \skvobserverkeys=\skvappendslots, + \skvprependobservers=\skvprependslots, + \skvappendobserversexpanded=\skvappendslotsexpanded, + \skvprependobserversexpanded=\skvprependslotsexpanded, + \skvaddobservers=\skvaddslots + }% +} \skvrobustdef*\skvappendslots{% \def\skv@type{app}% \let\skvexpanderpointer\@iden @@ -4261,10 +4321,10 @@ {\skvcurrentfamily}{\skvexpandonce\skv@slotlist}% }% }% - % The signal key might already exists, especially when calling + % The signal key might already exists, especially when using % \skvaddslots: \edef\elt{% - \skvifcsdefTF{\skv@header#1.@cbk} + \skvifcsdefTF{\skv@header#1.@cbk}% {\skvexpandcsonce{\skv@header#1.@cbk}}{}% }% \skvcsedef{\skv@header#1.@cbk}{% @@ -4283,6 +4343,7 @@ % (ie, subject) keys. % % Examples: +% % \skvordkeys[KV]{fam}{keya1,keyb1,keya2,keyb2}{\def\x##1{#1*##1}} % \skvaddslots[KV]{fam}{keyd,keye}{keya1=vala,keyb1=valb} % {keya2=vala,keyb2=.expanded{\valb}}[def-d&e]{\def\y##1{#1*##1}} @@ -4305,22 +4366,16 @@ \skvexpanded{% \skvprependslots[\skvcurrentprefix]{\skvcurrentfamily}% \unexpanded{{#1}{#2}[#4]{#5}}% + % Without \ifskv@addslots@appending, when using \skvaddslots, + % signal keys will otherwise be added in the database twice + % (while treating prepended and appended slots). + \noexpand\skv@addslots@appendingtrue \skvappendslots[\skvcurrentprefix]{\skvcurrentfamily}% \unexpanded{{#1}{#3}[#4]{#5}}% + \noexpand\skv@addslots@appendingfalse }% } -\skvnewcastcommands{% - \skvslotkeys=\skvappendslots,\skvstylekeys=\skvappendslots, - \skvprependstyles=\skvprependslots, - \skvappendstylesexpanded=\skvappendslotsexpanded, - \skvprependstylesexpanded=\skvprependslotsexpanded, - \skvaddstyles=\skvaddslots, - \skvobserverkeys=\skvappendslots, - \skvprependobservers=\skvprependslots, - \skvappendobserversexpanded=\skvappendslotsexpanded, - \skvprependobserversexpanded=\skvprependslotsexpanded, - \skvaddobservers=\skvaddslots -} + % Checking the admissible values of keys: % \skvrobustdef*\skvcheckchoice{\skv@testopta{\skv@testopt\skv@checkchoice{}}} @@ -4356,7 +4411,7 @@ \else \def\skv@tempa{\endgroup\def#1{#2}}% \fi - \skvifinTF{,#2,}{,#3,}{% + \skvxifinTF{,\detokenize{#2},}{,\detokenize{#3},}{% \ifskv@pl \skvappendtomacro\skv@tempa{\@firstoftwo}% \else @@ -4521,9 +4576,15 @@ \skvifcsdefTF{\skvcurrentpath/\skvtrimspace{#1}.@cbk}% } \skvnewlet\skvifkeyoncurrentpathTF\skvifkeyincurrentfamilyTF + % \skvifonekeyinfamilyTF{<prefix>/<family>}{<keys>} +% % Given a list of keys, test if at least one of them is defined. -% Example: \edef\x{\skvifonekeyinfamilyTF{KV/fam}{keya,keyb,keyc}{T}{F}}. +% +% Example: +% +% \edef\x{\skvifonekeyinfamilyTF{KV/fam}{keya,keyb,keyc}{T}{F}}. +% \skvnewdef*\skvifonekeyinfamilyTF#1#2{% \ifnum\numexpr0\skv@ifonekeydef{#1}#2,\@nnil,>\skvz@ \expandafter\@firstoftwo @@ -4546,6 +4607,7 @@ % 1. Get keys defined on the given paths. % 2. Remove any redundant star (*) and plus (+) suffix on % \skvgetdefinedkeys. +% \skvrobustdef*\skvgetdefinedkeys{% \skv@testopta{\skv@testopt\skv@getdefinedkeys\skvdefaultprefix}% } @@ -4713,20 +4775,20 @@ \skvdisabledkeysmessagetype{warn} \skvrobustdef*\skvdisablekeys{% - \def\skv@tempa{\skv@ordkey@a{e}}% + \def\skv@disable@temp{\skv@ordkey@a{e}}% \skv@testoptb\skv@disablekeys } \skvrobustdef*\skvgdisablekeys{% - \def\skv@tempa{\skv@ordkey@a{x}}% + \def\skv@disable@temp{\skv@ordkey@a{x}}% \skv@testoptb\skv@disablekeys } \skvrobustdef*\skv@disablekeys#1{% \skvcommaparse{#1}\skv@prova{% - \skvifcsdefTF{\skv@header\skv@prova.@cbk}{% - \skvifcsdefTF{\skv@header\skv@prova.@defa}{% - \edef\skv@provb{\noexpand\skv@tempa{\skv@prova}[]}% + \skvifnamedefTF{\skv@header\skv@prova.@cbk}{% + \skvifnamedefTF{\skv@header\skv@prova.@defa}{% + \edef\skv@provb{\noexpand\skv@disable@temp{\skv@prova}[]}% }{% - \edef\skv@provb{\noexpand\skv@tempa{\skv@prova}[^skv^]}% + \edef\skv@provb{\noexpand\skv@disable@temp{\skv@prova}[^skv^]}% }% \expandafter\skv@provb\expandafter{\expandafter \skv@disabledkeymsg\expandafter{\skv@prova}}% @@ -4735,6 +4797,7 @@ \MessageBreak couldn't be disabled}\skv@ehd }% }% + \skvundef\skv@disable@temp } % We split xkeyval's \presetkeys (which has both head and tail) into @@ -5215,7 +5278,7 @@ }% % ##1=value: \def\skv@prova##1=##2\skv@setkeys@nil{% - \skvifplaswTF\skv@ispntkey{% + \skvifknobTF{skv@ispntkey}{% % \skv@extractpntkey@atsetkey would have extracted key name and % value for the pntkey. }{% @@ -5240,7 +5303,7 @@ \fi \fi \skvifdefboolTF{skv@processvalueaslist}{% - % You can use the pointer '.process list' on the current value to + % You can use the pointer '.process list', etc, on the current value to % signify that the value be processed as a list, in the % manner of a list key. This scheme is costlier than defining the % key as a listkey, using \skvlistkey, but it is more versatile. @@ -5413,11 +5476,15 @@ }% \skvletcs\skv@callback{\skv@header\skvcurrentkey.@cbk}% \skv@getargpattern + \edef\skv@callback{% + \let\noexpand\this\noexpand\skvcurrentkey + \skvexpandonce\skv@callback + }% % 1. Strip outer braces of \skvcurrentvalue, so that the argument can be % grabbed by the, possibly multi-parametered, callback function. % 2. The argument has been obtained from possible explicit definition % of the argument. But if the obtained argument is simple, then the - % argument in the key's call maybe more complex: + % argument in the key's call may be more complex: \ifx\skv@argpattern\skv@simplearg\else \ifcsname\skv@header\skvcurrentkey.@listkey\endcsname \skv@err{A listkey must have a one-parameter argument}\skv@ehd @@ -5773,7 +5840,7 @@ \edef\skv@itemfour{\unexpanded{##4}}% \edef\skv@itemfive{\unexpanded{##5}}% \edef\skv@itemsix{\unexpanded{##6}}% - \skvifplaswTF\skv@isarg{% + \skvifknobTF{skv@isarg}{% \skvdfk@definearg{##1}{##2}{##3}% }{% \if\skv@checkkeyexist @@ -6102,13 +6169,13 @@ \skvifxTF\skv@provb\@empty{% \def\skv@ival{???}% }{% - \skv@getbasetoks{30}\skv@provb\skv@ival + \skv@getshortformofcontent{30}\skv@provb\skv@ival }% }% \skvaftergroupdef\skv@ival\endgroup } -% \skv@getbasetoks{<nr>}{<toks.cmd>}{<result.cmd>} -\skvrobustdef*\skv@getbasetoks#1#2#3{% +% \skv@getshortformofcontent{<nr>}{<toks.cmd>}{<result.cmd>} +\skvrobustdef*\skv@getshortformofcontent#1#2#3{% \begingroup \edef\skv@prova{\detokenize\expandafter{#2}}% \def#3{}\@tempcnta\skvz@ @@ -6511,7 +6578,7 @@ } % \dirkeys@executechoice{<expansion.type>}{<curr.value>}{<choices.and.cbks>} \skvrobustdef*\dirkeys@executechoice#1#2#3{% - \skv@getexpander@b{#1}% + \skv@getexpander{#1}% \edef\skv@prova{\skvexpander{#2}}% \skvdespacecontent\skv@prova \def\do##1##2##3\skv@nil{% @@ -6570,7 +6637,7 @@ % \skvrobustdef*\dirkeys@saveslots#1#2#3{% \begingroup - \skv@getexpander@b{#3}% + \skv@getexpander{#3}% \def\skv@tempd{}% \edef\skv@tempa{\unexpanded{#1}}% \skvcsvnormalize[/]\skv@tempa @@ -6716,7 +6783,7 @@ % \skvrobustdef*\dirkeys@savestores#1#2{% \begingroup - \skv@getexpander@b{#2}% + \skv@getexpander{#2}% \def\skv@tempd{}% \edef\skv@tempa{\unexpanded{#1}}% \skvcsvnormalize[/]\skv@tempa @@ -7512,17 +7579,19 @@ }% }% } -% \dirkeys@defhandlers{<flag>}{<list>} +% \dirkeys@defhandlers{<flag>}{<kvlist>} % % <flag> indicates if we're in <new> (01) or <define> (00) handler. % +% <kvlist> -> {<handlers-1>}={<defn>},...,{<handlers-n>}={<defn>} +% \skvrobustdef*\dirkeys@defhandlers#1#2{% \begingroup \def\skv@collection{}% \def\skv@param{####1\skvhandlereov}% \def\skv@defhandlers@do##1{% \skv@ensurehandlerdot{##1}% - \skvifplaswTF{#1}{% + \skvifknobTF{#1}{% \dirkeys@defhandlers@aux{##1}% }{% \skvifcsdefTF{dirkeys@handler@##1}{% @@ -7548,6 +7617,7 @@ \skvcmdexit\dirkeys@reservedhandlers }% } +\skvnewlet\dirkeysdefhandlers\dirkeys@defhandlers % \dirkeys@defnarghandlers{<flag>}{<list>} % % Define handlers of more than one argument. This is slightly more @@ -7563,7 +7633,7 @@ \def\skv@prova####1####2\handler@nil{% \edef\skv@param{\skvgenerateparameters{1}{####1}\skvhandlereov}% \edef\skv@body{\unexpanded{####2}}% - \skvifplaswTF{#1}{% + \skvifknobTF{#1}{% \dirkeys@defhandlers@aux{##1}% }{% \skvifcsdefTF{dirkeys@handler@##1}{% @@ -7591,6 +7661,8 @@ \skvcmdexit\dirkeys@reservedhandlers }% } +\skvnewlet\dirkeysdefnarghandlers\dirkeys@defnarghandlers + % \dirkeys@handlerlet{<flag>}{<kvlist>} % % 1. <flag> is either 00 (for define) or 01 (for new handler). @@ -7612,7 +7684,7 @@ \ifx\dirkeys@reservedhandlers\@empty\else,\fi##1% }% \fi - \skvifplaswTF{#1}{}{% + \skvifknobTF{#1}{}{% \skvifnamedefFT{dirkeys@handler@##1}{}{% \skv@err{Handler '##1' arealdy exists}\skv@ehd }% diff --git a/Master/texmf-dist/tex/latex/skeyval/skeyval-for.tex b/Master/texmf-dist/tex/latex/skeyval/skeyval-for.tex index a61c4f0c499..205c019dc67 100644 --- a/Master/texmf-dist/tex/latex/skeyval/skeyval-for.tex +++ b/Master/texmf-dist/tex/latex/skeyval/skeyval-for.tex @@ -1,5 +1,5 @@ %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++% -% This is file 'skeyval-for.tex', version 1.2, 2013/02/10. % +% This is file 'skeyval-for.tex', version 1.3, 2013/05/15. % % % % This package and accompanying files may be distributed and/or % % modified under the conditions of the LaTeX Project Public License, % @@ -18,10 +18,11 @@ % The following files constitute the skeyval bundle and must be % % distributed as a whole: % % % -% readme, skeyval.sty, skeyval-core.tex, skeyval-for.tex, % +% README, skeyval.sty, skeyval-core.tex, skeyval-for.tex, % % skeyval-view.sty, skeyval-ltxpatch.sty, skeyval-ltxcmds.tex, % % skeyval-pstkey.sty, skeyval-pstkey.tex, skeyval-testclass.cls, % -% and skeyval-testpkg.sty. % +% skeyval-testpkg.sty, skeyval-pokayoke1, skeyval-pokayoke2, % +% skeyval-view-pokayoke1. % % % % Copyright (c) 2010-2013 Ahmed Musa (amusa22@gmail.com). % %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++% @@ -59,11 +60,11 @@ \expandafter\let\csname skeyval-for-loaded\endcsname\endinput \ifx\ProvidesFile\@undefined - \message{File 'skeyval-for.tex' 2013/02/10 v1.2 + \message{File 'skeyval-for.tex' 2013/05/15 v1.3 Loops for skeyval package (AM)} \else \ProvidesFile{skeyval-for.tex} - [2013/02/10 v1.2 Loops for skeyval package (AM)] + [2013/05/15 v1.3 Loops for skeyval package (AM)] \@addtofilelist{skeyval-for.tex} \fi @@ -98,11 +99,10 @@ \expandafter\skv@provb\skv@prova \skvgadvanceno#2\m@ne } - \skvnewregisters\bool{% \ifbreakallforeachloops,\ifskvbreakloop,\ifforeachlastitem, \ifskvprocessempty,\ifskv@foreach@swa,\ifskv@foreach@swb, - \ifskv@foreach@parenth,\ifskv@useemptylist + \ifskv@foreach@parenthesis,\ifskv@useemptylist,\ifskv@inforeach, } \skvnewlet\skvbreakloop\skvbreaklooptrue \skvnewlet\breaknewforeach\skvbreaklooptrue @@ -129,15 +129,16 @@ % 4. For comma lists, \skvcommaloop and \skvcommaparse are faster. % See later. % 5. For processing kv lists, use \skvparsekvlist. +% 6. The preservation of outer braces isn't a priority in this loop. % \skvrobustdef*\skvdolist{\skv@useemptylistfalse\skv@testst\skv@dolist} \skvrobustdef*\skv@dolist#1#2#3#4{% + \skv@usetempst{#2}#3% % \skvlistcount is used by listkeys. \skvsavestate\skvdolist{% \do\skv@dolist@callback \do\skv@dolist@a\do\skvlistcount\do\ifskv@useemptylist }\skv@dolistdepth - \skv@usetempst{#2}#3% \edef\skv@dolist@callback{\unexpanded{#4}}% \def\skvlistcount{0}% \def\skv@dolist@a##1##2#1{% @@ -290,7 +291,8 @@ % stack any state. % 2. There is no fear of parameter characters in <callback> being mixed % with those of \skv@commaloop@picknext. -% 2. They can be nested to any depth. +% 3. These loops can be nested to any depth. +% 4. The preservation of outer braces isn't a priority in these loops. % % \skvcommaloop{<list>}<holder-cmd>{<callback>} % \skvcommaloop*{<listcmd>}<holder-cmd>{<callback>} @@ -305,6 +307,7 @@ % Don't put \skvcsvnormalize#2 here. Use \skvcommaparse instead. % Some callers of \skvcommaloop already have their lists normalized. \skvifxTF#2\@empty{}{% + \skvbreakloopfalse \skvexpandnext{\skv@commaloop@picknext#2{#3}}#2,\skv@commaloop@nil,% }% } @@ -601,32 +604,7 @@ \fi }% } - -\begingroup -\catcode`P=12 \lccode`P=112 -\catcode`T=12 \lccode`T=116 -\lowercase{\endgroup - \def\skv@foreach@strippoint#1#2{% - \def\reserved@a##1#1\relax{\def#2{##1}}% - \def\do##1.##2PT#1{% - \ifx\do##1\else##1% - \if\skv@foreach@keephighdecimals - \ifdim.##2pt>.5pt\relax##2\fi - \else - \if\skv@foreach@keepdecimals - \ifnum##2>\skvz@.##2\fi - \fi - \fi - \unexpanded{#1}% - \expandafter\do - \fi - }% - \edef#2{\expandafter\do#2#1\do.PT#1}% - \expandafter\reserved@a#2\relax - } -} - -\quickkeys.define{skeyval/foreach}{% +\skvquickkeys.define{skeyval/foreach}{% .exec/ \def\skv@foreach@parser{,} \def\skv@foreach@subparser{/} @@ -793,7 +771,7 @@ \edef\skv@foreach@recoverholders{0\skvifstrcmpTF{true}{#1}01}% /true,false ; - % This default value of 'link' is required by \skv@foreach@filllist: + % This default value of 'link' is required by \skvautocompletelist: .exec code/\def\skv@foreach@link{\@nil}; link/\@nil/ \edef\skv@prova{\unexpanded{#1}}% @@ -819,12 +797,10 @@ ; grow left/true/ \edef\skv@foreach@growleft{0\skvifstrcmpTF{true}{#1}01} - \edef\skv@foreach@growright{0\skvifstrcmpTF{true}{#1}10} /true,false ; grow right/true/ \edef\skv@foreach@growright{0\skvifstrcmpTF{true}{#1}01} - \edef\skv@foreach@growleft{0\skvifstrcmpTF{true}{#1}10} /true,false ; % Keep the decimals in rounded numbers or dimensions when list is @@ -845,7 +821,7 @@ /true,false ; expand before fill,expand list before fill/true/ - \edef\skv@foreach@expandlistbeforefill{0\skvifstrcmpTF{true}{#1}01} + \edef\skv@foreach@expandbeforefill{0\skvifstrcmpTF{true}{#1}01} /true,false ; expand list once,x1,list is a macro,macro list/true/ @@ -866,6 +842,12 @@ \edef\skv@foreach@reverselist{0\skvifstrcmpTF{true}{#1}01} /true,false ; + % 'hide parameters' can be used to avoid doubling the parameter + % characters in the callback. + hide parameters/true/ + \edef\skv@foreach@hideparameters{0\skvifstrcmpTF{true}{#1}01} + /true,false + ; } % The following keys don't need presetting. The user must supply @@ -875,13 +857,13 @@ % link,evaluate,,evaluate num,evaluate dim,expand,count in, % process up to,grow % -\quickkeys.preset{skeyval/foreach}{% +\skvquickkeys.preset{skeyval/foreach}{% parser,subparser,loop stopper,callback terminator,process up to, process empty list=false,item counter,list breaker,list pauser, recover holder values=false,grow left=false,grow right=false, keep decimals=true,keep high decimals=false,inherit=false, expand before fill=false,reverse list=false,expand list once=false, - expand list twice=false,expand list fully=false, + expand list twice=false,expand list fully=false,hide parameters=false } \skvnewdef*\skv@foreach@kvlist{} @@ -892,7 +874,7 @@ }% } \skvrobustdef*\skv@foreach@setkeys#1{% - \def\reserved@a{\quickkeys.set{skeyval/foreach}}% + \def\reserved@a{\skvquickkeys.set{skeyval/foreach}}% \expandafter\reserved@a\expandafter{\skv@foreach@kvlist,#1}% } @@ -1497,13 +1479,14 @@ \skvrobustdef*\skv@foreach@pushstate{% \skvsavestate\skv@foreach@stack{% - \do\skv@foreach@seenstar\do\skv@foreach@parser + \do\skv@foreach@starform\do\skv@foreach@parser \do\skv@foreach@subparser\do\skv@foreach@listisamacro \do\skv@foreach@processupto\do\skv@foreach@processempty \do\skv@foreach@exittester\do\skv@foreach@continuetester \do\skv@foreach@grow\do\skv@foreach@growleft\do\skv@foreach@growright \do\skv@foreach@terminator\do\skv@foreach@recoverholders \do\skv@foreach@normalizelist\do\skv@foreach@callback + \do\skv@foreach@hideparameters\do\skv@foreach@callback@hiddenparameters \do\skv@foreach@auxcallback\do\skv@foreach@precallback \do\skv@foreach@afterprecallback\do\skv@foreach@postcallback \do\skv@foreach@onlyinitially @@ -1518,7 +1501,7 @@ \do\skv@foreach@userlist\do\skv@foreach@inherit \do\skv@foreach@keepdecimals\do\skv@foreach@keephighdecimals \do\skv@foreach@itemcounter\do\skv@foreach@link - \do\skv@foreach@expandlistbeforefill\do\skv@foreach@expandlistonce + \do\skv@foreach@expandbeforefill\do\skv@foreach@expandlistonce \do\skv@foreach@expandlisttwice\do\skv@foreach@expandlistfully \do\skv@listbreakertoks\do\skv@listpausertoks \do\skv@foreach@reverselist\do\foreachcurrentitem @@ -1536,7 +1519,8 @@ \skvnewdef*\skv@foreach@nnil{\skv@foreach@nil} \skvrobustdef*\newforeach{\skv@testst\skv@newforeach@beginprescan} \skvrobustdef*\skv@newforeach@beginprescan{% - \edef\skv@foreach@seenstar{0\ifskv@tempst0\else1\fi}% + \skv@inforeachtrue + \edef\skv@foreach@starform{0\ifskv@tempst0\else1\fi}% \begingroup \def\skv@foreach@holderlist{}% \def\skv@tempa{% @@ -1547,8 +1531,7 @@ }% \let\bgroup\relax \skvifnextchar[{% - \endgroup - \skv@foreach@scanarg + \endgroup\skv@foreach@scanarg }{% \skvifnextchar i{% \endgroup @@ -1598,6 +1581,7 @@ \def\do##1{\def##1{}}% \do\skv@foreach@itemcounter\do\skv@foreach@processupto \do\skv@foreach@callback\do\skv@foreach@auxcallback + \do\skv@foreach@callback@hiddenparameters \do\skv@foreach@precallback\do\skv@foreach@afterprecallback \do\skv@foreach@postcallback\do\skv@foreach@onlyinitially % The keys have to be set here, to determine if the list is a macro, etc. @@ -1609,7 +1593,7 @@ % We've set the keys; let's overrule \skv@foreach@expandlistonce if % we had seen a star suffix. Don't overrule \skv@foreach@expandlisttwice % and \skv@foreach@expandlistfully. - \if\skv@foreach@seenstar + \if\skv@foreach@starform \def\skv@foreach@expandlistonce{00}% \fi \ifcase0% @@ -1780,7 +1764,8 @@ \skv@foreach@mainprocess {\skvexpandonce\skv@foreach@holderlist}% {\skvexpandonce\skv@foreach@userlist}% - }{#1}% + {\skvtrimspace{#1}}% + }% } % #1: holder macros % #2: List or list command @@ -1809,8 +1794,10 @@ \skvifdefTF\foreachprevitem{}{\def\foreachprevitem{}}% \expandafter\skv@foreach@normalize\expandafter[\skv@foreach@parser]% \skv@foreach@userlist - \expandafter\skv@foreach@normalize\expandafter[\skv@foreach@subparser]% - \skv@foreach@userlist + % Why 'keep double parser' here? Think of a list like 32//13,11/23/,... + \skvexpbracenext\skvdefinekeepdoubleparsernormalizer + \skv@foreach@subparser\skv@tempa + \edef\skv@foreach@userlist{\skvexpbracenext\skv@tempa\skv@foreach@userlist}% \ifnum\foreachnestdepth=\skvz@ \breakallforeachloopsfalse \fi @@ -1907,8 +1894,19 @@ \skv@foreach@callback{}% \fi }{% - \expandafter\skv@foreach@filllist\expandafter - {\skv@foreach@parser}\skv@foreach@userlist + \def\do####1{\if####1true\else false\fi}% + \skvexpandsecond{\skvautocompletelist*}{[% + % Note: the value of 'expand list once', etc., can't be + % transferred automatically to \skvautocompletelist since they + % have been used above to expand list. + parser={\skv@foreach@parser}, + link={\skvexpandonce\skv@foreach@link}, + grow left=\do\skv@foreach@growleft, + grow right=\do\skv@foreach@growright, + keep decimals=\do\skv@foreach@keepdecimals, + keep high decimals=\do\skv@foreach@keephighdecimals, + expand before fill=\do\skv@foreach@expandbeforefill + ]}\skv@foreach@userlist\skv@foreach@userlist \if\skv@foreach@reverselist\skvafterfi \expandafter\skv@foreach@doreverselist\expandafter {\skv@foreach@parser}\skv@foreach@userlist @@ -1932,6 +1930,7 @@ \ifnum\foreachnestdepth=\skvz@ \def\skv@warnsubparser{0}% \fi + \skv@inforeachfalse } % \skv@foreach@makeprecode{<holder.list>} @@ -2013,7 +2012,7 @@ % % \def\ditem{D} % \newforeach [ -% continue=\ifx\x\ditem\fi,remember=\x as \rx initially A +% continue=\ifx\x\ditem\fi, remember=\x as \rx initially A % ] \x in { % B,(C1),D,E,[F1],G,H % }{% @@ -2031,9 +2030,11 @@ }% % Add extra subparsers in case some items aren't subparser-complete: \edef\skv@tempa{\skv@generatesubparser{1}}% + \edef\skv@foreach@callback@hiddenparameters{\unexpanded{#1}}% \let\foreacheov\relax \let\do\noexpand \skvexpanded{\endgroup + \skvcmdexit\skv@foreach@callback@hiddenparameters % Define auxiliary callback: \def\do\skv@foreach@auxcallback\skv@foreach@paramlist\foreacheov{% % Holder macro assignments: @@ -2046,15 +2047,24 @@ \ifx\skv@foreach@continuetester\@secondoftwo \noexpand\skv@foreach@continuetester \else - % Expose the parameter characters in \skv@foreach@continuetester: + % Expose the parameter characters in \skv@foreach@continuetester. + % If the user wants to ignore the callback for some items, he can + % use the key 'continue=<condition>': \skvexpandonce\skv@foreach@continuetester \fi {% \relax }{% - % If the user wants to ignore the callback for some items, he can - % use the key 'continue=<condition>': - \unexpanded{#1}% + \if\skv@foreach@hideparameters + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi + {% + \noexpand\skv@foreach@callback@hiddenparameters + }{% + \unexpanded{#1}% + }% % User tests/tasks, eg, if requested from the keys 'remember', % 'exit when', etc: \skvexpandonce\skv@foreach@postcallback @@ -2082,10 +2092,6 @@ {P}{p}{16}{Q}{q}{17}{R}{r}{18}{S}{s}{19}{T}{t}{20}{U}{u}{21}{V}{v}{22}% {W}{w}{23}{X}{x}{24}{Y}{y}{25}{Z}{z}{26}% } -% \skv@foreach@addtolist<parser><add.new><listcmd> -\skvrobustdef*\skv@foreach@addtolist#1#2#3{% - \edef#3{\skvexpandonce#3\ifx#3\@empty\else\unexpanded{#1}\fi#2}% -} \skvrobustdef*\skv@reverselumap#1{% \def\skv@prova##1##2##3##4\skv@nil{% \ifx\@nnil##1% @@ -2098,96 +2104,134 @@ \edef#1{\expandafter\skv@prova\skv@alphamap\@nnil{}{}\skv@nil} } -\skvnewdef*\skv@foreach@ifloweralpha#1{% - \skvifblankTF{#1}{% - \@secondoftwo - }{% - \skvifntypeTF{#1}{% - \skvifnumTF`#1>96{% - \skvifnumTF`#1<123{% - \@firstoftwo - }{% - \@secondoftwo - }% - }{% - \@secondoftwo - }% - }{% - \@secondoftwo - }% - }% + +\skvquickkeys.define{skeyval/autocomplete}{% + .exec/\def\skv@autocomplete@parser{,}; + parser/{,}/ + \edef\skv@autocomplete@parser{\unexpanded{#1}} + \skvstripouterbraces{2}\skv@autocomplete@parser + \skvxifntypeTF{\detokenize{#1}}{% + \begingroup + % It is assumed that every n-type parser and subparser + % must have catcode 12: + \skvexpandnext{\catcode`}\skv@autocomplete@parser=12\relax + \skvrescan\skv@autocomplete@parser + \skvaftergroupdef\skv@autocomplete@parser\endgroup + }{} + ; + % This default value of 'link' is required by \skvautocompletelist: + .exec code/\def\skv@autocomplete@link{\@nil}; + link/\@nil/ + \edef\skv@prova{\unexpanded{#1}}% + \ifcase0% + \ifx\skv@prova\@empty 1\fi + \ifx\skv@prova\@nnil 1\fi\relax + \edef\skv@autocomplete@link{\unexpanded{#1}}% + \skvstripouterbraces{2}\skv@autocomplete@link + \fi + ; + grow/\@nil/ + \edef\skv@prova{\unexpanded{#1}}% + \ifx\skv@prova\@nnil\else + \skvcsedef{skv@autocomplete@grow#1}{00} + \edef\skv@prova{\skvifstrcmpTF{#1}{left}{right}{left}}% + \skvcsedef{skv@autocomplete@grow\skv@prova}{01}% + \fi + /left,right + ; + .exec/ + \def\skv@autocomplete@growleft{01} + \def\skv@autocomplete@growright{01} + ; + grow left/true/ + \edef\skv@autocomplete@growleft{0\skvifstrcmpTF{true}{#1}01} + /true,false + ; + grow right/true/ + \edef\skv@autocomplete@growright{0\skvifstrcmpTF{true}{#1}01} + /true,false + ; + % Keep the decimals in rounded numbers or dimensions when list is + % auto-completed. The value value of this key is 'true'. + keep decimals/true/ + \edef\skv@autocomplete@keepdecimals{0\skvifstrcmpTF{true}{#1}01} + /true,false + ; + keep high decimals,keep only high decimals/true/ + \edef\skv@autocomplete@keephighdecimals{0\skvifstrcmpTF{true}{#1}01} + /true,false + ; + expand before fill,expand list before fill/true/ + \edef\skv@autocomplete@expandbeforefill{0\skvifstrcmpTF{true}{#1}01} + /true,false + ; } -\skvnewdef*\skv@foreach@ifupperalpha#1{% - \skvifblankTF{#1}{% - \@secondoftwo - }{% - \skvifntypeTF{#1}{% - \skvifnumTF`#1>64{% - \skvifnumTF`#1<91{% - \@firstoftwo - }{% - \@secondoftwo - }% - }{% - \@secondoftwo - }% - }{% - \@secondoftwo - }% - }% + +% The keys 'link,grow' don't need presetting. The user must supply +% values when they are called. In internal loops, their values will +% have to be revised from those of the outer loop. +% +\skvquickkeys.preset{skeyval/autocomplete}{% + parser,grow left=false,grow right=false, + keep decimals=true,keep high decimals=false, + expand before fill=false } -% Parse list for 1,2,...,n,1,...,m. Return value in #1: +% \skv@autocomplete@addtolist<parser><add.new><listcmd> +\skvrobustdef*\skv@autocomplete@addtolist#1#2#3{% + \edef#3{\skvexpandonce#3\ifx#3\@empty\else\unexpanded{#1}\fi#2}% +} +% \skv@autocomplete@zerostepwarn{<lower>}{<upper>}{<pt.or.nil>} +\skvrobustdef*\skv@autocomplete@zerostepwarn#1#2#3{% + \skv@warn{The tokens '\detokenize{#1}', '\detokenize{#2}' + give nil step; '1#3' used.\MessageBreak + Maybe you used the font-dependent units\MessageBreak + 'ex' or 'em' \ifskv@latex before \skv@begindoctoks\fi}% +} +% \skvautocompletelist[<kvlist>]{<list>}{<returncmd>} +% \skvautocompletelist*[<kvlist>]{<listcmd>}{<returncmd>} % -% \skv@foreach@filllist{<parser>}<listcmd> -\skvrobustdef*\skv@foreach@filllist#1#2{% +% 1. Parse list of type {1,2,...,n,1,...,m} for auto completion. +% Return outcome in <listcmd> or \skvcompletedlist. +% +\skvrobustdef*\skvautocompletelist{\skv@teststopt\skv@autocompletelist@a{}} +\skvrobustdef*\skv@autocompletelist@a[#1]#2#3{% + \skv@usetempst{#2}\skv@autocomplete@userlist + \skvquickkeys.set{skeyval/autocomplete}{#1}% \def\skv@inalphabetic{01}% \def\skv@isupperalpha{01}% - % If the list is alphabetic, original unit is nil: - \def\skv@foreach@origunit{}% - \def\skv@foreach@filledlist{}% - \edef\skv@foreach@parser{\skvtrimspace{#1}}% - \ifx\skv@foreach@parser\@empty - \def\skv@foreach@parser{,}% - \fi - \def\skv@foreach@iflinkgiven{% - \skvifdefTF\skv@foreach@link{% - \skvifxFT\skv@foreach@link\@nnil - }{% - \skv@err{List auto-completion: 'link' is undefined}\skv@ehd - }% - }% - \skvexpanded{% - \noexpand\skv@foreach@filllist@a - {\skvexpandonce\skv@foreach@parser}{\skvexpandonce{#2}}% - }% - \let#2\skv@foreach@filledlist -} -\skvnewlet\skvautofilllist\skv@foreach@filllist -% \skv@foreach@filllist@a{<parser>}{<list>} -\skvrobustdef*\skv@foreach@filllist@a#1#2{% + \def\skv@preandpostdotspresent{01}% + % If the list is alphabetic or numbers, original unit is nil: + \def\skv@autocomplete@origunit{}% + \def\skvcompletedlist{}% + \skvexpandtwoargsonce + \skv@autocompletelist@b\skv@autocomplete@parser\skv@autocomplete@userlist + \let#3\skvcompletedlist +} +% \skv@autocompletelist@b{<parser>}{<list>} +\skvrobustdef*\skv@autocompletelist@b#1#2{% \edef\skv@tempa{\unexpanded{#2}}% \skv@foreach@normalize[#1]\skv@tempa \def\skv@prova##1{% \skvxifinTF{...}{\detokenize{##1}}{% - \if\skv@foreach@expandlistbeforefill + \if\skv@autocomplete@expandbeforefill \edef\skv@tempa{##1}% \skv@foreach@normalize[#1]\skv@tempa \else \edef\skv@tempa{\unexpanded{##1}}% \fi - \skvexpandargonce{\skv@foreach@filllist@b{#1}}{\skv@tempa}% - \skv@foreach@normalize[#1]\skv@foreach@filledlist + \skvexpandargonce{\skv@autocompletelist@c{#1}}\skv@tempa + \skv@foreach@normalize[#1]\skvcompletedlist }{% - \edef\skv@foreach@filledlist{% - \skvaddlist{#1}\skv@foreach@filledlist\skvtrimspace{##1}% + \edef\skvcompletedlist{% + \skvaddlist{#1}\skvcompletedlist\skvtrimspace{##1}% }% }% }% \expandafter\skv@prova\expandafter{\skv@tempa}% } -% \skv@foreach@filllist@b{<parser>}{<list>} -\skvrobustdef*\skv@foreach@filllist@b#1#2{% +% \skv@autocompletelist@c{<parser>}{<list>} +\skvrobustdef*\skv@autocompletelist@c#1#2{% \skvxiffound{\relax...}\in{\relax\detokenize{#2}}\then \skv@err{I can't find lower limit before '...'}\skv@ehd \else @@ -2197,203 +2241,49 @@ \fi % \newforeach format is '<parser>...<parser>': \skvxifinTF{\detokenize{#1...#1}}{\detokenize{#2}}{% - \skv@foreach@splitonguide{#1}{#2}% + \skv@autocomplete@splitbeforedots{#1}{#2}% \def\skv@prova##1#1##2#1...#1##3#1##4#1##5\skv@nil{% \skvifblankTF{##3}{% \skv@err{I can't find upper limit number or dimension, \MessageBreak i.e., after symbool '...'}\skv@ehd }{% - % \skv@foreach@filllist@a may be reentered. Hence accumulate + % \skv@autocompletelist@b may be reentered. Hence accumulate % filled list: \skviflacus{##1}\then\else - \edef\skv@foreach@filledlist{% - \skvaddlist{#1}\skv@foreach@filledlist\unexpanded{##1}% + \edef\skvcompletedlist{% + \skvaddlist{#1}\skvcompletedlist\unexpanded{##1}% }% \fi % Complete the list: - \skv@foreach@filllist@c{#1}{##1}{##2}{##3}% + \skv@autocompletelist@d{#1}{##1}{##2}{##3}% % In case the list is folded on ellipsis (...): - \skvifblankTF{##4}{}{\skv@foreach@filllist@a{#1}{##4#1##5}}% + \skvifblankTF{##4}{}{\skv@autocompletelist@b{#1}{##4#1##5}}% }% }% \expandafter\skv@prova\skv@tempa#1#1\skv@nil }{% - % Not \newforeach format: try PGF's \foreach format: - \skv@foreach@trypgflikeformat{#1}{#2}% + \skv@autocompletelist@e{#1}{#2}% }% } - -% \skv@foreach@zerostepwarn{<lower>}{<upper>}{<pt.or.nil>} -\skvrobustdef*\skv@foreach@zerostepwarn#1#2#3{% - \skv@warn{The tokens '\detokenize{#1}', '\detokenize{#2}' - give nil step; '1#3' used.\MessageBreak - Maybe you used the font-dependent units\MessageBreak - 'ex' or 'em' \ifskv@latex before \skv@begindoctoks\fi}% -} - -% skv@foreach@filllist@c{<parser>}{<lower1>}{<lower2>}{<upperbound>} +% skv@autocompletelist@d{<parser>}{<lower1>}{<lower2>}{<upperbound>} % % 1. No <guide> here. % -\skvrobustdef*\skv@foreach@filllist@c#1#2#3#4{% - \skv@foreach@iflinkgiven{% - % <link> has been given by the user: - \skv@foreach@splitandgrow{#1}{#2}{#3}{#4}% - }{% +\skvrobustdef*\skv@autocompletelist@d#1#2#3#4{% + \skvifxTF\skv@autocomplete@link\@nnil{% % No <link> has been given. The list has '...' but presumably no link. - % Note: If there're more than 1 alpha/Alpha character, both - % \skv@foreach@ifloweralpha and \skv@foreach@ifupperalpha will - % return false, since double aphabetic characters can't be grown. - % \skv@foreach@filllist@d{<parser>}{<guide>}{<lower1>}{<lower2>}{<upper>} - \skv@foreach@filllist@d{#1}{}{#2}{#3}{#4}% - }% -} - -% skv@foreach@fsplitandgrow{<parser>}{<lower1>}{<lower2>}{<upperbound>} -% -% {0\pi,0.5\pi,...,3\pi} : link = \pi ; grow left -% {1--,4--,...,10--} : link = -- ; grow left -% {2pt,4pt,...,10pt} : link = pt ; grow left (or no additional info.) -% {A_1,C_1,...,Q_1} : link = _ ; grow left -% {2^a,2^c,...,2^q} : link = ^ ; grow right -% -% 1. Automatically split and grow. -% 2. We already know that the key 'link' will reject empty values. -% -\skvrobustdef*\skv@foreach@splitandgrow#1#2#3#4{% - \ifx\skv@foreach@growleft\skv@foreach@growright - \skv@err{I can't grow the list in both directions. - \MessageBreak Maybe you haven't indicated the - \MessageBreak direction of growth (left or right), - \MessageBreak or both directions are 'true'.} - {Try one of the keys 'grow=left or right', - \MessageBreak 'grow left=true or false', - 'grow right=true or false'}\skv@ehd - \fi - \begingroup - \def\skv@prova##1{% - \skv@foreach@swatrue - \skviflacus#2\then\else - \skvifinTF{##1}{#2}{}\skv@foreach@swafalse - \fi - \skvifinTF{##1}{#3}{}\skv@foreach@swafalse - \skvifinTF{##1}{#4}{}\skv@foreach@swafalse - \ifskv@foreach@swa\else - \edef\skv@provb{\ifx\@nnil#2\@nnil\else\unexpanded{#2}, \fi}% - \skv@err{No link '##1' in one of - '\detokenize\expandafter{\skv@provb#3, #4}'}\skv@ehd - \fi - \def\skv@prova####1##1####2\skv@nil{% - \if\skv@foreach@growright - \edef\skv@prova{\skvtrimspace{####1##1}}% - \else - \edef\skv@prova{\skvtrimspace{##1####2}}% - \fi - \def\do########1{{\skvtrimspace{########1}}}% - % \skv@foreach@trypgflikeformat@a<parser><guide><lower1><lower2><upper> - \skvexpanded{\endgroup - \noexpand\skv@foreach@trypgflikeformat@a - {\unexpanded{#1}}{\skvexpandonce\skv@prova}\do{#2}\do{#3}\do{#4}% - }% - }% - \skv@prova#3\skv@nil - }% - \expandafter\skv@prova\expandafter{\skv@foreach@link}% -} -% -% \skv@foreach@splitonguide{<parser>}{<list>} -% -% Get the two elements before '...' or '<guide>,...'. In the case of skeyval -% format, get the two elements before '...'. The PGF format uses <guide>, -% shown in the following examples: -% -% PGF formats: -% {a^1,a^3,a^...,a^9} : <guide> = a^ -% {A_1,B_1,..._1,E_1} : <guide> = _1 -% {1--,4--,...--,16--} : <guide> = -- -% {1pt,4pt,...pt,10pt} : <guide> = pt -% {A_2pt,A_4pt,A_...pt,A_10pt} : <guide> = A_ and pt -% -% skeyval formats: -% {a^1,a^3,a^...,a^9} : no additional info. required -% {A_1,B_1,..._1,E_1} : no additional info. required -% {1--,4--,...--,16--} : no additional info. required -% {1pt,4pt,...pt,10pt} : no additional info. required -% {A_2pt,A_4pt,A_...,A_10pt} : no additional info. required -% -% {a^1,a^3,...,a^9} : link = ^, grow = right -% {A_1,B_1,...,E_1} : link = _, grow = left -% {1--,4--,...,16--} : link = --, grow = left -% {1pt,4pt,...,10pt} : link = pt, grow = left, or no addit. info. -% {A_2pt,A_4pt,...,A_10pt} : link = _, grow = right -% -% The items prior to the last 2 items before '<guide>...' or before '...' -% are called 'before-the-last-2' (BL2). Collect in \skv@tempa BL2 items, -% together with the rest of the list. Save the BL2 items in -% \skv@foreach@filledlist. -% -% Return \skv@foreach@filledlist and \skv@tempa. -% -\skvrobustdef*\skv@foreach@splitonguide#1#2{% - % First count all the elements before '<guide>,...'. We're already - % sure that #2 contains '<guide><parser>...' or '...': - \begingroup - \skv@cnta\skvz@ - \def\do##1#1{% - \skvifinTF{...}{##1}{% - \def\do####1\skv@nil{}% - }{% - \advance\skv@cnta\@ne - }% - \do - }% - \do#2#1\skv@nil - \ifnum\skv@cnta>\tw@ - \skvsetno\skv@foreach@nra\m@ne - \def\do##1#1{% - \skvadvanceno\skv@foreach@nra\@ne - \ifnum\skv@foreach@nra=\numexpr\skv@cnta-\tw@\relax - \def\do####1\skv@nil{\def\skv@tempa{##1#1####1}}% - \else - \edef\skv@foreach@filledlist{% - \skvaddlist{#1}\skv@foreach@filledlist\unexpanded{##1}% - }% - \fi - \do - }% - \do#2#1\skv@nil - \else - \ifnum\skv@cnta=\@ne - \def\skv@tempa{#1#2}% - \else - \ifnum\skv@cnta=\tw@ - \def\skv@tempa{#2}% - \else - \ifnum\skv@cnta=\skvz@ - \skv@err{List <<\detokenize{#2}>>\MessageBreak - contains symbol '...' but not a lowerbound}\skv@ehd - \fi - \fi - \fi - \fi - \skvexpanded{\endgroup - \skvcmdexit\skv@foreach@filledlist\skvcmdexit\skv@tempa + % + % \skv@autocompletelist@h{<parser>}{<guide>}{<lower1>}{<lower2>}{<upper>} + \skv@autocompletelist@h{#1}{}{#2}{#3}{#4}% + }{% + % <link> has been given by the user: + \skv@autocomplete@splitandgrow{#1}{#2}{#3}{#4}% }% } - -% \skv@foreach@trypgflikeformat{<parser>}{<list>} -% -% When we say 'try PGF-like format', we don't actually mean the -% PGF format with left and right guides, as in, -% -% {A_2pt,A_4pt,A_...pt,A_10pt} : <guide> = 'A_(left)' and 'pt(right)' (*) % -% but the syntax '<guide>...' (ie, having only the left-hand-side or only -% the right-hand-side guide). For example, +% \skv@autocompletelist@e{<parser>}{<list>} % -% {A_2pt,A_4pt,A_...,A_10pt} or {1pt,4pt,...pt,10pt} -% -% \skv@foreach@trypgflikeformat will auto-complete this list without +% \skv@autocompletelist@e will auto-complete this list without % knowledge of the values of the keys 'link' and 'grow'. The syntax at (*) % above isn't recognized by the auto-completion scheme of skeyval. % @@ -2401,97 +2291,105 @@ % % {1pt,4pt,...pt,10pt} : no additional info. required % {A_2pt,A_4pt,A_...,A_10pt} : no additional info. required -% {1pt,4pt,...,10pt} : link = pt, grow=right, or no addit. info. +% {\pi0,\pi0.5,\pi...,\pi3} : no additional info. required +% {0\pi,0.5\pi,...\pi,3\pi} : no additional info. required +% {1pt,4pt,...,10pt} : link = pt, grow=left, or no addit. info. % {A_2pt,A_4pt,...,A_10pt} : link =_, grow=right % -% The general PGF format (with left and right guides), e.g., +% The general PGF format with left and right guides (given as 'A_' +% and 'pt') in % % {A_2pt,A_4pt,A_...pt,A_10pt} % -% is illegal here, because the file skeyval-for.tex uses the location -% of the guide (left or right of ...) to determine the direction of growth. +% is still legal in skeyval. % -\skvrobustdef*\skv@foreach@trypgflikeformat#1#2{% - \skv@foreach@splitonguide{#1}{#2}% +\skvrobustdef*\skv@autocompletelist@e#1#2{% + \skv@autocomplete@splitbeforedots{#1}{#2}% + \def\skv@checkguideinbounds##1##2{% + \skv@foreach@swafalse + \def\do####1{% + \ifx\do####1\else + \skviflacus####1\then\else + \skvifinTF{##1}{####1}{}\skv@foreach@swatrue + \fi + \expandafter\do + \fi + }% + \do##2\do + \ifskv@foreach@swa + \skv@err{Guide token '\detokenize{#1}' not found in some + \MessageBreak of the elements: I can't complete + \MessageBreak the current list. This may be + \MessageBreak due to wrong direction of growth}\skv@ehd + \fi + }% \def\skv@prova##1#1##2#1##3...##4#1##5#1##6#1##7\skv@nil{% \skvifblankTF{##5}{% \skv@err{I can't find upper limit number or dimension, \MessageBreak i.e., after symbool '...'}\skv@ehd }{% - % \skv@foreach@filllist@a may be reentered. Hence + % \skv@autocompletelist@b may be reentered. Hence \skviflacus{##1}\then\else - \edef\skv@foreach@filledlist{% - \skvaddlist{#1}\skv@foreach@filledlist + \edef\skvcompletedlist{% + \skvaddlist{#1}\skvcompletedlist \skvtrimspace{##1}% }% \fi - \def\do####1{{\skvtrimspace{####1}}}% + \let\do\unexpanded \skvifblankTF{##3}{% \skvifblankTF{##4}{% \skv@err{No direction of growth before and/or after \MessageBreak symbol '...'}\skv@ehd }{% - \def\skv@foreach@growleft{00}% - \def\skv@foreach@growright{01}% + % Eg, {2pt_A,4pt_A,...pt_A,10pt_A}. Here ##3 is nil, grow left. + \def\skv@autocomplete@growleft{00}% + \def\skv@autocomplete@growright{01}% \skvexpanded{% - \skv@foreach@trypgflikeformat@a - {\unexpanded{#1}}\do{##4}\do{##1}\do{##2}\do{##5}% + \skv@autocompletelist@f + {\do{#1}}{\do{##4}}{\do{##1}}{\do{##2}}{\do{##5}}% }% }% }{% \skvifblankTF{##4}{% - \def\skv@foreach@growright{00}% - \def\skv@foreach@growleft{01}% + % Eg, {A_2pt,A_4pt,A_...,A_10pt}. Here ##4 is nil, grow right. + \def\skv@autocomplete@growright{00}% + \def\skv@autocomplete@growleft{01}% \skvexpanded{% - \skv@foreach@trypgflikeformat@a - {\unexpanded{#1}}\do{##3}\do{##1}\do{##2}\do{##5}% + \skv@autocompletelist@f + {\do{#1}}{\do{##3}}{\do{##1}}{\do{##2}}{\do{##5}}% }% }{% - \skv@err{Having both '\detokenize{'##3' and '##4'} in an - \MessageBreak ellipsis list is illegal in - \MessageBreak\noexpand\newforeach and \noexpand\foreachfox. - \MessageBreak I know that PGF's \noexpand\foreach needs it, - \MessageBreak but I don't need it. I can - \MessageBreak auto-fill your list with information - \MessageBreak on only one side of <<...>>.}\skv@ehd + % Eg, {A_2pt,A_4pt,A_...pt,A_10pt}. + \skvexpanded{% + \skv@autocompletelist@g + {\do{#1}}{\do{##3}}{\do{##4}}{\do{##1}}{\do{##2}}{\do{##5}}% + }% }% }% % In case the list is folded on ellipsis (...): - \skvifblankTF{##6}{}{\skv@foreach@filllist@a{#1}{##6#1##7}}% + \skvifblankTF{##6}{}{\skv@autocompletelist@b{#1}{##6#1##7}}% }% }% \expandafter\skv@prova\skv@tempa#1#1#1\skv@nil } -% -% \skv@foreach@trypgflikeformat@a +% \skv@autocompletelist@f % {<parser>}{<guide>}{<lower1>}{<lower2>}{<upper>} % -% 1. Use the <guide> to get the contant and variable parts of the +% 1. Use the <guide> to get the constant and variable parts of the % elements. % 2. Use the variable parts to determine if the list is Alpah, alpha or % number type. In this format, the unit in dimension type of list may % appear in <guide>. % 3. Use the variable parts to work out the <step>. % 4. Call the relevant macro to fill the list. -% 5. <lower1> has already been saved in \skv@foreach@filledlist. +% 5. <lower1> has already been saved in \skvcompletedlist. % -\skvrobustdef*\skv@foreach@trypgflikeformat@a#1#2#3#4#5{% - \skv@foreach@swafalse - \skviflacus#3\then\else - \skvxifinTF{#2}{#3}{}\skv@foreach@swatrue - \fi - \skvxifinTF{#2}{#4}{}\skv@foreach@swatrue - \skvxifinTF{#2}{#5}{}\skv@foreach@swatrue - \ifskv@foreach@swa - \skv@err{Guide token '\detokenize{#2}' not found in some - \MessageBreak of the elements: I can't complete - \MessageBreak the current list. This may be - \MessageBreak due to wrong direction of growth}\skv@ehd - \fi - % Get from the left or right of 'link' (#2) the components that should be - % grown, without the link: +\skvrobustdef*\skv@autocompletelist@f#1#2#3#4#5{% + \skv@checkguideinbounds{#2}{{#3}{#4}{#5}}% + % Use the 'link' (#2) to get from {<lower1>}, {<lower2>} and {<upper>} + % the left or right sides of the elements that should be grown: \def\skv@prova##1#2##2\skv@nil##3{% - \edef##3{\if\skv@foreach@growleft##1\else##2\fi}% + \edef##3{\if\skv@autocomplete@growleft##1\else##2\fi}% }% % <lower1> is empty when there is only one element before ellipsis: \skviflacus#3\then @@ -2503,69 +2401,105 @@ \skv@prova#5\skv@nil\skv@tempc \let\do\skvexpandonce \skvexpandsecond - {\skv@foreach@filllist@d{#1}{#2}}% + {\skv@autocompletelist@h{#1}{#2}}% {{\do\skv@tempa}{\do\skv@tempb}{\do\skv@tempc}}% } - -% \skv@foreach@filllist@d{<parser>}{<guide>}{<lower1>}{<lower2>}{<upper>} +% \skv@autocompletelist@g +% {<parser>}{<predots>}{<postdots>}{<lower1>}{<lower2>}{<upper>} +\skvrobustdef*\skv@autocompletelist@g#1#2#3#4#5#6{% + \def\skv@preandpostdotspresent{00}% + \skv@checkguideinbounds{#2}{{#4}{#5}{#6}}% + \skv@checkguideinbounds{#3}{{#4}{#5}{#6}}% + % For <lower1>, <lower2> and <upper>, get the tokens between + % <predots> and <postdots>. They are the ones to be grown. + \def\skv@prova##1#2##2#3##3\skv@nil##4{% + \edef##4{##2}% + }% + \ifx\@nnil#4\@nnil + \let\skv@tempa\@empty + \else + \skv@prova#4\skv@nil\skv@tempa + \fi + \skv@prova#5\skv@nil\skv@tempb + \skv@prova#6\skv@nil\skv@tempc + % Pass <guide> as empty to \skv@autocompletelist@h. Through out, the only + % reason for passing <guide> to \skv@autocompletelist@h is to restore + % it in \skv@autocomplete@restore. But while + % \skv@preandpostdotspresent is true, we won't do anything in + % \skv@autocomplete@restore. + \skvexpandsecond + {\skv@autocompletelist@h{#1}{}}% + {{\skv@tempa}{\skv@tempb}{\skv@tempc}}% + % Restore <predots> and <postdots>: + \def\do##1#1{% + \ifx\do##1\else + \edef\skvcompletedlist{% + \skvaddlist{#1}\skvcompletedlist + \unexpanded{#2}##1\unexpanded{#3}\skv@autocomplete@origunit + }% + \expandafter\do + \fi + }% + \expandafter\do\skv@completedlist@partial#1\do#1% +} +% \skv@autocompletelist@h{<parser>}{<guide>}{<lower1>}{<lower2>}{<upper>} % % 1. Use the variable parts to determine if the list is Alpah, alpha or % number type. In this format, the unit in dimension type of list may % appear in <guide>. % 2. Use the variable parts to work out the <step>. % 3. Call the relevant macro to fill the list. -% 4. <lower1> has already been saved in \skv@foreach@filledlist. +% 4. <lower1> has already been saved in \skvcompletedlist. % -\skvrobustdef*\skv@foreach@filllist@d#1#2#3#4#5{% - \begingroup - \def\skv@templist{}% +\skvrobustdef*\skv@autocompletelist@h#1#2#3#4#5{% + \def\skv@completedlist@partial{}% \edef\skv@lowerlower{\ifx\@nnil#3\@nnil\else\unexpanded{#3}, \fi}% - \skv@foreach@ifloweralpha{#4}{% + \skvifloweralpha{#4}{% \skv@foreach@swatrue \ifx\@nnil#3\@nnil\else - \skv@foreach@ifloweralpha{#3}{}\skv@foreach@swafalse + \skvifloweralpha{#3}{}\skv@foreach@swafalse \fi - \skv@foreach@ifloweralpha{#5}{}\skv@foreach@swafalse + \skvifloweralpha{#5}{}\skv@foreach@swafalse \ifskv@foreach@swa \ifx\@nnil#3\@nnil - \def\skv@foreach@step{1}% + \def\skv@autocomplete@step{1}% \else - \edef\skv@foreach@step{\the\numexpr\lccode`#4-\lccode`#3}% - \ifnum\skv@foreach@step=\skvz@ - \def\skv@foreach@step{1}% - \skv@foreach@zerostepwarn{#3}{#4}{}% + \edef\skv@autocomplete@step{\the\numexpr\lccode`#4-\lccode`#3}% + \ifnum\skv@autocomplete@step=\skvz@ + \def\skv@autocomplete@step{1}% + \skv@autocomplete@zerostepwarn{#3}{#4}{}% \fi \fi \def\skv@isupperalpha{01}% - % \skv@foreach@origunit remains nil on this branch: - \skv@foreach@fillalphabetic{#1}{#4}{#5}\skv@templist - % Also update the items already entered in \skv@foreach@filledlist. - \skv@foreach@restoreguideandunit{#1}{#2}\skv@templist + % \skv@autocomplete@origunit remains nil on this branch. + \skv@autocomplete@fillalphabetic{#1}{#4}{#5}\skv@completedlist@partial + % Also update the items already entered in \skvcompletedlist. + \skv@autocomplete@restore{#1}{#2}\skv@completedlist@partial \else \skv@err{The tokens '\detokenize\expandafter{\skv@lowerlower#4, #5}' \MessageBreak aren't of the same type}\skv@ehd \fi }{% - \skv@foreach@ifupperalpha{#4}{% + \skvifupperalpha{#4}{% \skv@foreach@swatrue \ifx\@nnil#3\@nnil\else - \skv@foreach@ifupperalpha{#3}{}\skv@foreach@swafalse + \skvifupperalpha{#3}{}\skv@foreach@swafalse \fi - \skv@foreach@ifupperalpha{#5}{}\skv@foreach@swafalse + \skvifupperalpha{#5}{}\skv@foreach@swafalse \ifskv@foreach@swa \ifx\@nnil#3\@nnil - \def\skv@foreach@step{1}% + \def\skv@autocomplete@step{1}% \else - \edef\skv@foreach@step{\the\numexpr\uccode`#4-\uccode`#3}% - \ifnum\skv@foreach@step=\skvz@ - \def\skv@foreach@step{1}% - \skv@foreach@zerostepwarn{#3}{#4}{}% + \edef\skv@autocomplete@step{\the\numexpr\uccode`#4-\uccode`#3}% + \ifnum\skv@autocomplete@step=\skvz@ + \def\skv@autocomplete@step{1}% + \skv@autocomplete@zerostepwarn{#3}{#4}{}% \fi \fi \def\skv@isupperalpha{00}% - % \skv@foreach@origunit remains nil on this branch: - \skv@foreach@fillalphabetic{#1}{#4}{#5}\skv@templist - \skv@foreach@restoreguideandunit{#1}{#2}\skv@templist + % \skv@autocomplete@origunit remains nil on this branch. + \skv@autocomplete@fillalphabetic{#1}{#4}{#5}\skv@completedlist@partial + \skv@autocomplete@restore{#1}{#2}\skv@completedlist@partial \else \skv@err{The tokens '\detokenize\expandafter{\skv@lowerlower#4, #5}' \MessageBreak aren't of the same type}\skv@ehd @@ -2576,32 +2510,30 @@ \skvifdimensionable{#3}{}\skv@foreach@swafalse \fi \skvifdimensionable{#4}{}\skv@foreach@swafalse - \let\skv@foreach@origunit\skv@dimunit + \let\skv@autocomplete@origunit\skv@dimunit \skvifdimensionable{#5}{}\skv@foreach@swafalse - \ifx\skv@foreach@origunit\skv@dimunit\else + \ifx\skv@autocomplete@origunit\skv@dimunit\else \skv@err{The units on \detokenize{'#4', '#5'} are different}\skv@ehd \fi \ifskv@foreach@swa \ifx\@nnil#3\@nnil - \def\skv@foreach@step{1pt}% + \def\skv@autocomplete@step{1pt}% \else - \edef\skv@foreach@step{\the\dimexpr#4-#3}% - \ifdim\skv@foreach@step=\skvz@ - \def\skv@foreach@step{1pt}% - \skv@foreach@zerostepwarn{#3}{#4}{pt}% + \edef\skv@autocomplete@step{\the\dimexpr#4-#3\relax}% + \ifdim\skv@autocomplete@step=\skvz@ + \def\skv@autocomplete@step{1pt}% + \skv@autocomplete@zerostepwarn{#3}{#4}{pt}% \fi \fi - \skvexpandsecond{% - \skv@foreach@fillnumordim{#1}% - }{% - {#4}{#5}% - }\skv@templist - \skv@foreach@strippoint{#1}\skv@templist + \skvexpandsecond + {\skv@autocomplete@fillnumordim{#1}}{{#4}{#5}}% + \skv@completedlist@partial + \skv@autocomplete@strippoint{#1}\skv@completedlist@partial % Attach the constant part to the elements of the completed list. - % <lower1> was saved earlier in \skv@foreach@trypgflikeformat, and + % <lower1> was saved earlier in \skv@autocompletelist@e, and % <lower2> and <upper> have been saved while filling the list. % Always strip point and restore original unit here. - \skv@foreach@restoreguideandunit{#1}{#2}\skv@templist + \skv@autocomplete@restore{#1}{#2}\skv@completedlist@partial \else \skv@foreach@swatrue \ifx\@nnil#3\@nnil\else @@ -2611,22 +2543,20 @@ \skvifdimensionable{#5pt}{}\skv@foreach@swafalse \ifskv@foreach@swa \ifx\@nnil#3\@nnil - \def\skv@foreach@step{1pt}% + \def\skv@autocomplete@step{1pt}% \else - \edef\skv@foreach@step{\the\dimexpr#4pt-#3pt}% - \ifdim\skv@foreach@step=\skvz@ - \def\skv@foreach@step{1pt}% - \skv@foreach@zerostepwarn{#3}{#4}{pt}% + \edef\skv@autocomplete@step{\the\dimexpr#4pt-#3pt\relax}% + \ifdim\skv@autocomplete@step=\skvz@ + \def\skv@autocomplete@step{1pt}% + \skv@autocomplete@zerostepwarn{#3}{#4}{pt}% \fi \fi - % \skv@foreach@origunit remains nil on this branch: - \skvexpandsecond{% - \skv@foreach@fillnumordim{#1}% - }{% - {#4pt}{#5pt}% - }\skv@templist - \skv@foreach@strippoint{#1}\skv@templist - \skv@foreach@restoreguideandunit{#1}{#2}\skv@templist + % \skv@autocomplete@origunit remains nil on this branch. + \skvexpandsecondonce + {\skv@autocomplete@fillnumordim{#1}}{{#4pt}{#5pt}}% + \skv@completedlist@partial + \skv@autocomplete@strippoint{#1}\skv@completedlist@partial + \skv@autocomplete@restore{#1}{#2}\skv@completedlist@partial \else \skv@err{Sorry, the tokens '\detokenize\expandafter{\skv@lowerlower#4, #5}' @@ -2637,110 +2567,62 @@ \fi }% }% - \skvaftergroupdef\skv@foreach@filledlist\endgroup -} - -% Restore guide and, in the case of numerical sequences, 'original unit'. -% -% \skv@foreach@restoreguideandunit{<parser>}{<guide>}{<listcmd>} -\skvrobustdef*\skv@foreach@restoreguideandunit#1#2#3{% - \def\do##1#1{% - \ifx\do##1\else - \edef\skv@foreach@filledlist{% - \skvaddlist{#1}\skv@foreach@filledlist - \if\skv@foreach@growleft - ##1\skv@foreach@origunit\unexpanded{#2}% - \else - \unexpanded{#2}##1\skv@foreach@origunit - \fi - }% - \expandafter\do - \fi - }% - \expandafter\do#3#1\do#1% } -\skvrobustdef*\skv@foreach@getcomparator{% +% \skv@autocomplete@fillnumordim<parser><lower><upper><listcmd> +\skvrobustdef*\skv@autocomplete@fillnumordim#1#2#3#4{% \begingroup - % 'unit' isn't required in alphabetic sequences: - \if\skv@inalphabetic\else - \let\skvreversedo\@iden - \edef\skv@provb{\skvexpbracenext\skvreverse{\skv@foreach@step}}% - \def\skv@prova##1##2##3\skv@nil{% - \skvxifinTF{,\detokenize{##2##1},}{,\skvoxdetok\skv@validunit,}{% - \def\skv@foreach@unit{}% - }{% - \def\skv@foreach@unit{pt}% - }% - }% - \expandafter\skv@prova\skv@provb\skv@nil - \fi - \def\skv@prova##1##2\skv@nil{% - \edef\skv@foreach@stepisneg{0\if-##10\else1\fi}% - }% - \expandafter\skv@prova\skv@foreach@step\skv@nil - \edef\skv@comparator{\if\skv@foreach@stepisneg>\else<\fi}% - \let\do\skvcmdexit - \skvexpanded{\endgroup - \do\skv@foreach@stepisneg\do\skv@comparator - \if\skv@inalphabetic\else\do\skv@foreach@unit\fi - }% -} -% \skv@foreach@fillnumordim<parser><lower><upper><listcmd> -\skvrobustdef*\skv@foreach@fillnumordim#1#2#3#4{% - \begingroup - \skv@foreach@getcomparator - \if\skv@foreach@stepisneg - \ifdim#3\skv@foreach@unit>#2\skv@foreach@unit\relax - \skv@err{Step '\skv@foreach@step' is negative but upperbound + \skv@autocomplete@getcomparator + \if\skv@autocomplete@stepisneg + \ifdim#3\skv@autocomplete@unit>#2\skv@autocomplete@unit\relax + \skv@err{Step '\skv@autocomplete@step' is negative but upperbound \MessageBreak '\detokenize{#3}' is greater than lowerbound '\detokenize{#2}'}\skv@ehd \fi \else - \ifdim#3\skv@foreach@unit<#2\skv@foreach@unit\relax - \skv@err{Step '\skv@foreach@step' is nonnegative but upperbound + \ifdim#3\skv@autocomplete@unit<#2\skv@autocomplete@unit\relax + \skv@err{Step '\skv@autocomplete@step' is nonnegative but upperbound \MessageBreak '\detokenize{#3}' is less than lowerbound '\detokenize{#2}'}\skv@ehd \fi \fi % The bounds may have decimal places. So the calculation has to be % done with \dimexpr: - \skv@foreach@addtolist{#1}{\the\dimexpr#2\skv@foreach@unit}#4% - % Upper number: - \edef\skv@tempa{\the\dimexpr#3\skv@foreach@unit}% - % Lower number: - \edef\skv@tempb{\the\dimexpr#2\skv@foreach@unit}% - \ifdim\skv@tempa=\skv@tempb\relax\else + \edef\skv@upperlimit{\the\dimexpr#3\skv@autocomplete@unit}% + \edef\skv@lowerlimit{\the\dimexpr#2\skv@autocomplete@unit}% + \skv@autocomplete@addtolist{#1}\skv@lowerlimit#4% + \ifdim\skv@lowerlimit\skv@comparator\skv@upperlimit\relax \def\do{% - \edef\skv@tempb{% - \the\dimexpr\skv@tempb+\skv@foreach@step\skv@foreach@unit\relax + \edef\skv@lowerlimit{% + \the\dimexpr\skv@lowerlimit + +\skv@autocomplete@step\skv@autocomplete@unit\relax }% - \ifdim\skv@tempb\skv@comparator\skv@tempa\relax - \skv@foreach@addtolist{#1}{\skvexpandonce\skv@tempb}#4% + \ifdim\skv@lowerlimit\skv@comparator\skv@upperlimit\relax + \skv@autocomplete@addtolist{#1}\skv@lowerlimit#4% \expandafter\do \fi }% \do - % The last item has to in 'pt', so that 'pt' can be stripped: - \skv@foreach@addtolist{#1}{\the\dimexpr#3\skv@foreach@unit}#4% + % The last item has to in 'pt', so that 'pt' can be stripped. + % Hence \dimexpr. + \skv@autocomplete@addtolist{#1}\skv@upperlimit#4% \fi \skvaftergroupdef#4\endgroup } - -% Fill Alpha or alpha: -% \skv@foreach@fillalphabetic<parser><lower><upper><listcmd> -\skvrobustdef*\skv@foreach@fillalphabetic#1#2#3#4{% +% Fill Alpha or alpha. +% \skv@autocomplete@fillalphabetic<parser><lower><upper><listcmd> +\skvrobustdef*\skv@autocomplete@fillalphabetic#1#2#3#4{% \begingroup \def\skv@inalphabetic{00}% - \skv@foreach@getcomparator + \skv@autocomplete@getcomparator \edef\skv@type{% \if\skv@isupperalpha Upper\else Lower\fi case alphabetic% }% - \edef\reserved@a{\if-\skv@foreach@step\else\skv@foreach@step\fi}% + \edef\reserved@a{\if-\skv@autocomplete@step\else\skv@autocomplete@step\fi}% \skvoifinteger\reserved@a{}{% \skv@err{List is '\skv@type' type but\MessageBreak - step '\skv@foreach@step' isn't an integer}\skv@ehd + step '\skv@autocomplete@step' isn't an integer}\skv@ehd }% - \skv@foreach@addtolist{#1}{#2}#4% + \skv@autocomplete@addtolist{#1}{#2}#4% \skvifstrcmpTF{#2}{#3}{}{% \edef\skv@lowerlimit{#2}% \edef\skv@upperlimit{#3}% @@ -2752,22 +2634,229 @@ \edef\skv@upperlimit{% \the\numexpr\skv@upperlimit-\if\skv@isupperalpha 64\else 96\fi }% - \edef\skv@charcase{\the\numexpr\skv@lowerlimit+\skv@foreach@step}% + \edef\skv@charcase{\the\numexpr\skv@lowerlimit+\skv@autocomplete@step}% \skvrecurse \if\skv@isupperalpha \edef\skv@tempa{\skv@ucalpha\skv@charcase}% \else \edef\skv@tempa{\skv@lcalpha\skv@charcase}% \fi - \skv@foreach@addtolist{#1}\skv@tempa#4% - \edef\skv@charcase{\the\numexpr\skv@charcase+\skv@foreach@step}% + \skv@autocomplete@addtolist{#1}\skv@tempa#4% + \edef\skv@charcase{\the\numexpr\skv@charcase+\skv@autocomplete@step}% \while \ifnum\skv@charcase\skv@comparator\skv@upperlimit\relax \fi - \skv@foreach@addtolist{#1}{#3}#4% + \skv@autocomplete@addtolist{#1}{#3}#4% }% \skvaftergroupdef#4\endgroup } +% +% \skv@autocomplete@splitbeforedots{<parser>}{<list>} +% +% Get the one or two elements before '...' or before '<guide>,...'. +% +% {A_2pt,A_4pt,A_...pt,A_10pt} : no additional info. required +% {a^1,a^3,a^...,a^9} : no additional info. required +% {A_1,B_1,..._1,E_1} : no additional info. required +% {1--,4--,...--,16--} : no additional info. required +% {1pt,4pt,...pt,10pt} : no additional info. required +% {A_2pt,A_4pt,A_...,A_10pt} : no additional info. required +% +% {a^1,a^3,...,a^9} : link = ^, grow = right +% {A_1,B_1,...,E_1} : link = _, grow = left +% {1--,4--,...,16--} : link = --, grow = left +% {1pt,4pt,...,10pt} : link = pt, grow = left, or no addit. info. +% {A_2pt,A_4pt,...,A_10pt} : link = _, grow = right +% +% The items prior to the two before '<guide>...' or before '...' +% are called 'all-before-the-two' (AB2). Collect in \skv@tempa the two +% items before '<guide>...' or before '...' together with the rest of the +% list. Save the AB2 items in \skvcompletedlist. +% +% Return \skvcompletedlist and \skv@tempa. +% +\skvrobustdef*\skv@autocomplete@splitbeforedots#1#2{% + % First count all the elements before '<guide><parser>...' or '...'. + % We're already sure that argument #2 contains '<guide><parser>...' + % or '...'. \skvcompletedlist has been initialized before here. + \begingroup + \skv@cnta\skvz@ + \def\do##1#1{% + \skvifinTF{...}{##1}{% + % Gobble the rest: + \def\do####1\skv@nil{}% + }{% + \advance\skv@cnta\@ne + }% + \do + }% + \do#2#1\skv@nil + \ifnum\skv@cnta>\tw@ + \@tempcnta\m@ne + \def\do##1#1{% + \advance\@tempcnta\@ne + \ifnum\@tempcnta=\numexpr\skv@cnta-\tw@\relax + \def\do####1\skv@nil{\def\skv@tempa{##1#1####1}}% + \else + \edef\skvcompletedlist{% + \skvaddlist{#1}\skvcompletedlist\unexpanded{##1}% + }% + \fi + \do + }% + \do#2#1\skv@nil + \else + \ifnum\skv@cnta=\@ne + % There is only one element before '<guide><parser>...' or '...'. + % Hence simply left-pad argument #2 with <parser> to give the + % impression of at least 2 elements: + \def\skv@tempa{#1#2}% + \else + \ifnum\skv@cnta=\tw@ + \def\skv@tempa{#2}% + \else + \ifnum\skv@cnta=\skvz@ + \skv@err{List <<\detokenize{#2}>>\MessageBreak + contains symbol '...' but not a lowerbound}\skv@ehd + \fi + \fi + \fi + \fi + \skvexpanded{\endgroup + \skvcmdexit\skvcompletedlist\skvcmdexit\skv@tempa + }% +} +% \skv@autocomplete@splitandgrow{<parser>}{<lower1>}{<lower2>}{<upperbound>} +% +% {0\pi,0.5\pi,...,3\pi} : link = \pi ; grow left +% {1--,4--,...,10--} : link = -- ; grow left +% {2pt,4pt,...,10pt} : link = pt ; grow left (or no additional info.) +% {A_1,C_1,...,Q_1} : link = _ ; grow left +% {2^a,2^c,...,2^q} : link = ^ ; grow right +% +% 1. Providing the link avoids the need to use the syntax of PGF's +% \foreach, such as {0\pi,0.5\pi,...\pi,3\pi}. But skeyval can also +% autocomplete lists like {0\pi,0.5\pi,...\pi,3\pi}. +% 2. We already know that the key 'link' will reject empty values. +% +\skvrobustdef*\skv@autocomplete@splitandgrow#1#2#3#4{% + \ifx\skv@autocomplete@growleft\skv@autocomplete@growright + \skv@err{I can't grow the list in both directions. + \MessageBreak Maybe you haven't indicated the + \MessageBreak direction of growth (left or right), + \MessageBreak or both directions are 'true'.} + {Try one of the keys 'grow=left or right', + \MessageBreak 'grow left=true or false', + 'grow right=true or false'}\skv@ehd + \fi + \begingroup + \def\skv@prova##1{% + \skv@foreach@swatrue + \skviflacus#2\then\else + \skvifinTF{##1}{#2}{}\skv@foreach@swafalse + \fi + \skvifinTF{##1}{#3}{}\skv@foreach@swafalse + \skvifinTF{##1}{#4}{}\skv@foreach@swafalse + \ifskv@foreach@swa\else + \edef\skv@provb{\ifx\@nnil#2\@nnil\else\unexpanded{#2}, \fi}% + \skv@err{No link '##1' in one of + '\detokenize\expandafter{\skv@provb#3, #4}'}\skv@ehd + \fi + \def\skv@prova####1##1####2\skv@nil{% + \if\skv@autocomplete@growright + \edef\skv@prova{\skvtrimspace{####1##1}}% + \else + \edef\skv@prova{\skvtrimspace{##1####2}}% + \fi + \def\do########1{{\skvtrimspace{########1}}}% + % \skv@autocompletelist@f<parser><guide><lower1><lower2><upper> + \skvexpanded{\endgroup + \noexpand\skv@autocompletelist@f + {\unexpanded{#1}}{\skvexpandonce\skv@prova}\do{#2}\do{#3}\do{#4}% + }% + }% + \skv@prova#3\skv@nil + }% + \expandafter\skv@prova\expandafter{\skv@autocomplete@link}% +} +\skvrobustdef*\skv@autocomplete@getcomparator{% + \begingroup + % <unit> isn't required in alphabetic sequences: + \if\skv@inalphabetic\else + \let\skvreversedo\@iden + \edef\skv@provb{\skvexpbracenext\skvreverse\skv@autocomplete@step}% + \def\skv@prova##1##2##3\skv@nil{% + \skvxifinTF{,\detokenize{##2##1},}{,\skvoxdetok\skv@validunit,}{% + % That is, the sequence is made up of dimensions. + \def\skv@autocomplete@unit{}% + }{% + \def\skv@autocomplete@unit{pt}% + }% + }% + \expandafter\skv@prova\skv@provb\skv@nil + \fi + % You can't use \ifnum or \ifdim here, since for alphanumeric sequences + % \skv@autocomplete@step isn't a dimension. + \def\skv@prova##1##2\skv@nil{% + \edef\skv@autocomplete@stepisneg{0\if-##10\else1\fi}% + }% + \expandafter\skv@prova\skv@autocomplete@step\skv@nil + \edef\skv@comparator{\if\skv@autocomplete@stepisneg>\else<\fi}% + \let\do\skvcmdexit + \skvexpanded{\endgroup + \do\skv@autocomplete@stepisneg\do\skv@comparator + \if\skv@inalphabetic\else\do\skv@autocomplete@unit\fi + }% +} +\begingroup +\catcode`P=12 \lccode`P=112 +\catcode`T=12 \lccode`T=116 +\lowercase{\endgroup + \def\skv@autocomplete@strippoint#1#2{% + \def\reserved@a##1#1\relax{\def#2{##1}}% + \def\do##1.##2PT#1{% + \ifx\do##1\else##1% + \if\skv@autocomplete@keephighdecimals + \ifdim.##2pt>.5pt\relax##2\fi + \else + \if\skv@autocomplete@keepdecimals + \ifnum##2>\skvz@.##2\fi + \fi + \fi + \unexpanded{#1}% + \expandafter\do + \fi + }% + \edef#2{\expandafter\do#2#1\do.PT#1}% + \expandafter\reserved@a#2\relax + } +} +% \skv@autocomplete@restore{<parser>}{<guide>}{<listcmd>} +% +% Restore guide and, in the case of dimension sequences, 'original unit'. +% +\skvrobustdef*\skv@autocomplete@restore#1#2#3{% + \if\skv@preandpostdotspresent + % Leave it: <predots> and <postdots> will be restored in + % \skv@autocompletelist@g. + \else + \def\do##1#1{% + \ifx\do##1\else + \edef\skvcompletedlist{% + \skvaddlist{#1}\skvcompletedlist + \if\skv@autocomplete@growleft + ##1\skv@autocomplete@origunit\unexpanded{#2}% + \else + \unexpanded{#2}##1\skv@autocomplete@origunit + \fi + }% + \expandafter\do + \fi + }% + \expandafter\do#3#1\do#1% + \fi +} + \skv@for@restorecatcodes \endinput diff --git a/Master/texmf-dist/tex/latex/skeyval/skeyval-ltxcmds.tex b/Master/texmf-dist/tex/latex/skeyval/skeyval-ltxcmds.tex index 0235cf5bfb1..30accb688a6 100644 --- a/Master/texmf-dist/tex/latex/skeyval/skeyval-ltxcmds.tex +++ b/Master/texmf-dist/tex/latex/skeyval/skeyval-ltxcmds.tex @@ -1,5 +1,5 @@ %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++% -% This is file 'skeyval-ltxcmds.tex', version 1.2, 2013/02/10. % +% This is file 'skeyval-ltxcmds.tex', version 1.3, 2013/05/15. % % % % This package and accompanying files may be distributed and/or % % modified under the conditions of the LaTeX Project Public License, % @@ -18,10 +18,11 @@ % The following files constitute the skeyval bundle and must be % % distributed as a whole: % % % -% readme, skeyval.sty, skeyval-core.tex, skeyval-for.tex, % +% README, skeyval.sty, skeyval-core.tex, skeyval-for.tex, % % skeyval-view.sty, skeyval-ltxpatch.sty, skeyval-ltxcmds.tex, % % skeyval-pstkey.sty, skeyval-pstkey.tex, skeyval-testclass.cls, % -% and skeyval-testpkg.sty. % +% skeyval-testpkg.sty, skeyval-pokayoke1, skeyval-pokayoke2, % +% skeyval-view-pokayoke1. % % % % Copyright (c) 2010-2013 Ahmed Musa (amusa22@gmail.com). % %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++% @@ -58,7 +59,7 @@ \csname skeyval-ltxcmds-loaded\endcsname \expandafter\let\csname skeyval-ltxcmds-loaded\endcsname\endinput -\message{skeyval-ltxcmds 2013/02/10 v1.2 skeyval LaTeX header (AM)} +\message{skeyval-ltxcmds 2013/05/15 v1.3 LaTeX header for skeyval (AM)} \countdef\m@ne=22 \m@ne=-1 \def\wlog{\immediate\write\m@ne} diff --git a/Master/texmf-dist/tex/latex/skeyval/skeyval-ltxpatch.sty b/Master/texmf-dist/tex/latex/skeyval/skeyval-ltxpatch.sty index 3bea153e722..fee051aa615 100644 --- a/Master/texmf-dist/tex/latex/skeyval/skeyval-ltxpatch.sty +++ b/Master/texmf-dist/tex/latex/skeyval/skeyval-ltxpatch.sty @@ -1,5 +1,5 @@ %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++% -% This is file 'skeyval-ltxpatch.sty', version 1.2, 2013/02/10. % +% This is file 'skeyval-ltxpatch.sty', version 1.3, 2013/05/15. % % % % The rationale for this package: the patch in 'xkvltxp' package isn't % % strong enough. % @@ -21,10 +21,11 @@ % The following files constitute the skeyval bundle and must be % % distributed as a whole: % % % -% readme, skeyval.sty, skeyval-core.tex, skeyval-for.tex, % +% README, skeyval.sty, skeyval-core.tex, skeyval-for.tex, % % skeyval-view.sty, skeyval-ltxpatch.sty, skeyval-ltxcmds.tex, % -% skeyval-pstkey.sty, skeyval-pstkey.tex, skeyval-testclass.sty, % -% and skeyval-testpkg.sty. % +% skeyval-pstkey.sty, skeyval-pstkey.tex, skeyval-testclass.cls, % +% skeyval-testpkg.sty, skeyval-pokayoke1, skeyval-pokayoke2, % +% skeyval-view-pokayoke1. % % % % Copyright (c) 2010-2013 Ahmed Musa (amusa22@gmail.com). % %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++% @@ -72,7 +73,7 @@ \NeedsTeXFormat{LaTeX2e}[2011/06/27] \ProvidesPackage{skeyval-ltxpatch} - [2013/02/10 v1.2 Patches for LaTeX2e kernel options processing (AM)] + [2013/05/15 v1.3 Patches for LaTeX2e kernel options processing (AM)] \ifdefined\skvz@\else\newdimen\skvz@\fi \def\@space{ } diff --git a/Master/texmf-dist/tex/latex/skeyval/skeyval-pstkey.sty b/Master/texmf-dist/tex/latex/skeyval/skeyval-pstkey.sty index c3f458644e6..caa843aafe1 100644 --- a/Master/texmf-dist/tex/latex/skeyval/skeyval-pstkey.sty +++ b/Master/texmf-dist/tex/latex/skeyval/skeyval-pstkey.sty @@ -1,5 +1,5 @@ %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++% -% This is file 'skeyval-pstkey.sty', version 1.2, 2013/02/10. % +% This is file 'skeyval-pstkey.sty', version 1.3, 2013/05/15. % % % % This package and accompanying files may be distributed and/or % % modified under the conditions of the LaTeX Project Public License, % @@ -18,10 +18,11 @@ % The following files constitute the skeyval bundle and must be % % distributed as a whole: % % % -% readme, skeyval.sty, skeyval-core.tex, skeyval-for.tex, % +% README, skeyval.sty, skeyval-core.tex, skeyval-for.tex, % % skeyval-view.sty, skeyval-ltxpatch.sty, skeyval-ltxcmds.tex, % % skeyval-pstkey.sty, skeyval-pstkey.tex, skeyval-testclass.cls, % -% and skeyval-testpkg.sty. % +% skeyval-testpkg.sty, skeyval-pokayoke1, skeyval-pokayoke2, % +% skeyval-view-pokayoke1. % % % % Copyright (c) 2010-2013 Ahmed Musa (amusa22@gmail.com). % %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++% @@ -69,7 +70,7 @@ \NeedsTeXFormat{LaTeX2e}[2011/06/27] \ProvidesPackage{skeyval-pstkey} - [2013/02/10 v1.2 LaTeX/package wrapper for skeyval-pstkey.tex (AM)] + [2013/05/15 v1.3 LaTeX/package wrapper for skeyval-pstkey.tex (AM)] \expandafter\ifx\csname skeyval-pstkey-loaded\endcsname \endinput\else diff --git a/Master/texmf-dist/tex/latex/skeyval/skeyval-pstkey.tex b/Master/texmf-dist/tex/latex/skeyval/skeyval-pstkey.tex index 4e2dc1f9ad7..18a97c4e729 100644 --- a/Master/texmf-dist/tex/latex/skeyval/skeyval-pstkey.tex +++ b/Master/texmf-dist/tex/latex/skeyval/skeyval-pstkey.tex @@ -1,5 +1,5 @@ %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++% -% This is file 'skeyval-pstkey.tex', version 1.2, 2013/02/10. % +% This is file 'skeyval-pstkey.tex', version 1.3, 2013/05/15. % % % % This package and accompanying files may be distributed and/or % % modified under the conditions of the LaTeX Project Public License, % @@ -18,10 +18,11 @@ % The following files constitute the skeyval bundle and must be % % distributed as a whole: % % % -% readme, skeyval.sty, skeyval-core.tex, skeyval-for.tex, % +% README, skeyval.sty, skeyval-core.tex, skeyval-for.tex, % % skeyval-view.sty, skeyval-ltxpatch.sty, skeyval-ltxcmds.tex, % % skeyval-pstkey.sty, skeyval-pstkey.tex, skeyval-testclass.cls, % -% and skeyval-testpkg.sty. % +% skeyval-testpkg.sty, skeyval-pokayoke1, skeyval-pokayoke2, % +% skeyval-view-pokayoke1. % % % % Copyright (c) 2010-2013 Ahmed Musa (amusa22@gmail.com). % %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++% @@ -58,33 +59,33 @@ \csname skeyval-pstkey-loaded\endcsname \expandafter\let\csname skeyval-pstkey-loaded\endcsname\endinput -\def\skv@@afterfi#1\fi{\fi#1} -\def\skv@@afterelse#1\else#2\fi{\fi#1} +\def\skv@pst@afterfi#1\fi{\fi#1} +\def\skv@pst@afterelse#1\else#2\fi{\fi#1} -\ifx\ProvidesFile\@undefined\skv@@afterelse - \message{File 'skeyval-pstkey.tex' 2013/02/10 v1.2 +\ifx\ProvidesFile\@undefined\skv@pst@afterelse + \message{File 'skeyval-pstkey.tex' 2013/05/15 v1.3 PSTricks specialization of skeyval package (AM)} \input skeyval-core -\else\skv@@afterfi +\else\skv@pst@afterfi \ProvidesFile{skeyval-pstkey.tex} - [2013/02/10 v1.2 PSTricks specialization of skeyval (AM)] + [2013/05/15 v1.3 PSTricks specialization of skeyval (AM)] \@addtofilelist{skeyval-pstkey.tex} \@ifpackageloaded{skeyval}{}{\RequirePackage{skeyval}} \fi \def\pst@famlist{} \def\pst@addfams#1{% - \skvcommaloop{#1}\skvtempa{% - \skvxifin{,\skvtempa,}{,\pst@famlist,}{}{% - \edef\pst@famlist{\pst@famlist,\skvtempa}% + \skvcommaloop{#1}\skv@tempa{% + \skvxifin{,\skv@tempa,}{,\pst@famlist,}{}{% + \edef\pst@famlist{\pst@famlist,\skv@tempa}% }% }% } \def\psset{\skvexpandbracenext{\skv@testopt\pss@t}\pst@famlist} \def\pss@t[#1]#2{\skvsetkeys+[psset]{#1}{#2}\ignorespaces} \def\@psset#1,\@nil{% - \edef\skvtempa{\skvsetkeys+[psset]{\pst@famlist}}% - \skvtempa{#1}% + \edef\skv@tempa{\skvsetkeys+[psset]{\pst@famlist}}% + \skv@tempa{#1}% } \skv@pst@restorecatcodes diff --git a/Master/texmf-dist/doc/latex/skeyval/skeyval-testclass.cls b/Master/texmf-dist/tex/latex/skeyval/skeyval-testclass.cls index ecb846dc99b..771d60160fe 100644 --- a/Master/texmf-dist/doc/latex/skeyval/skeyval-testclass.cls +++ b/Master/texmf-dist/tex/latex/skeyval/skeyval-testclass.cls @@ -1,5 +1,5 @@ %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++% -% This is file 'skeyval-testclass.cls', version 1.2, 2013/02/10. % +% This is file 'skeyval-testclass.cls', version 1.3, 2013/05/15. % % % % This package and accompanying files may be distributed and/or % % modified under the conditions of the LaTeX Project Public License, % @@ -18,15 +18,16 @@ % The following files constitute the skeyval bundle and must be % % distributed as a whole: % % % -% readme, skeyval.sty, skeyval-core.tex, skeyval-for.tex, % +% README, skeyval.sty, skeyval-core.tex, skeyval-for.tex, % % skeyval-view.sty, skeyval-ltxpatch.sty, skeyval-ltxcmds.tex, % % skeyval-pstkey.sty, skeyval-pstkey.tex, skeyval-testclass.cls, % -% and skeyval-testpkg.sty. % +% skeyval-testpkg.sty, skeyval-pokayoke1, skeyval-pokayoke2, % +% skeyval-view-pokayoke1. % % % % Copyright (c) 2010-2013 Ahmed Musa (amusa22@gmail.com). % %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++% -\ProvidesClass{skeyval-testclass}[2013/02/10 v1.2 skeyval test class (AM)] +\ProvidesClass{skeyval-testclass}[2013/05/15 v1.3 skeyval test class (AM)] \NeedsTeXFormat{LaTeX2e}[2011/06/27] \@ifpackageloaded{skeyval}{}{\RequirePackage{skeyval}} \@ifpackageloaded{xcolor}{}{\RequirePackage{xcolor}} diff --git a/Master/texmf-dist/doc/latex/skeyval/skeyval-testpkg.sty b/Master/texmf-dist/tex/latex/skeyval/skeyval-testpkg.sty index d2467bc9f1d..23a949e4831 100644 --- a/Master/texmf-dist/doc/latex/skeyval/skeyval-testpkg.sty +++ b/Master/texmf-dist/tex/latex/skeyval/skeyval-testpkg.sty @@ -1,5 +1,5 @@ %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++% -% This is file 'skeyval-testpkg.sty', version 1.2, 2013/02/10. % +% This is file 'skeyval-testpkg.sty', version 1.3, 2013/05/15. % % % % This package and accompanying files may be distributed and/or % % modified under the conditions of the LaTeX Project Public License, % @@ -18,15 +18,17 @@ % The following files constitute the skeyval bundle and must be % % distributed as a whole: % % % -% readme, skeyval.sty, skeyval-core.tex, skeyval-for.tex, % +% README, skeyval.sty, skeyval-core.tex, skeyval-for.tex, % % skeyval-view.sty, skeyval-ltxpatch.sty, skeyval-ltxcmds.tex, % % skeyval-pstkey.sty, skeyval-pstkey.tex, skeyval-testclass.cls, % -% and skeyval-testpkg.sty. % +% skeyval-testpkg.sty, skeyval-pokayoke1, skeyval-pokayoke2, % +% skeyval-view-pokayoke1. % % % % Copyright (c) 2010-2013 Ahmed Musa (amusa22@gmail.com). % %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++% -\ProvidesPackage{skeyval-testpkg}[2013/02/10 v1.2 skeyval test package (AM)] +\ProvidesPackage{skeyval-testpkg} + [2013/05/15 v1.3 skeyval test package (AM)] \NeedsTeXFormat{LaTeX2e} \@ifpackageloaded{skeyval}{}{\RequirePackage{skeyval}} \RequirePackage{graphicx} diff --git a/Master/texmf-dist/tex/latex/skeyval/skeyval-view.sty b/Master/texmf-dist/tex/latex/skeyval/skeyval-view.sty index 4996acf58b3..a09335b6b03 100644 --- a/Master/texmf-dist/tex/latex/skeyval/skeyval-view.sty +++ b/Master/texmf-dist/tex/latex/skeyval/skeyval-view.sty @@ -1,5 +1,5 @@ %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++% -% This is file 'skeyval-view.sty', version 1.2, 2013/02/10. % +% This is file 'skeyval-view.sty', version 1.3, 2013/05/15. % % % % This package and accompanying files may be distributed and/or % % modified under the conditions of the LaTeX Project Public License, % @@ -18,10 +18,11 @@ % The following files constitute the skeyval bundle and must be % % distributed as a whole: % % % -% readme, skeyval.sty, skeyval-core.tex, skeyval-for.tex, % +% README, skeyval.sty, skeyval-core.tex, skeyval-for.tex, % % skeyval-view.sty, skeyval-ltxpatch.sty, skeyval-ltxcmds.tex, % % skeyval-pstkey.sty, skeyval-pstkey.tex, skeyval-testclass.cls, % -% and skeyval-testpkg.sty. % +% skeyval-testpkg.sty, skeyval-pokayoke1, skeyval-pokayoke2, % +% skeyval-view-pokayoke1. % % % % Copyright (c) 2010-2013 Ahmed Musa (amusa22@gmail.com). % %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++% @@ -69,12 +70,12 @@ \NeedsTeXFormat{LaTeX2e}[2011/06/27] \ProvidesPackage{skeyval-view} - [2013/02/10 v1.2 Viewer utility for skeyval package (AM)] + [2013/05/15 v1.3 Viewer utility for skeyval package (AM)] \@ifpackageloaded{skeyval}{}{\RequirePackage{skeyval}} \directkeys*{% .path=SKVV/skvview, .holder prefix=skvv@, - .initialize keys after define, + .initialize keys after define=false, .every unknown option={ \PackageWarning{skeyval-view}{Unknown option '\CurrentOption' ignored}% }, @@ -84,13 +85,19 @@ .ord/{xcolor-options,load-xcolor-with}// \edef\skvv@xcoloroptions{\unexpanded{#1}} \skvstripouterbraces{1}\skvv@xcoloroptions, + .bool/tabulate/true + }, + .execute options={ + tabulate=true,xcolor-options=false,load-xcolor-with=false }, - .copy class options and process options, + .copy class options and process options } +\skvnewregisters\toks{\skvv@toksa} \AtEndOfPackage{% - \skvdisablekeys[SKVV]{skvview}{% - xcolor-options,load-xcolor-with - }% + \let\ifskvv@tempsw\ifskvv@tabulate + \skvv@tabulatefalse + \skvdisablekeys[SKVV]{skvview}{xcolor-options,load-xcolor-with}% + \let\ifskvv@tabulate\ifskvv@tempsw } \@ifpackageloaded{longtable}{}{\RequirePackage{longtable}} @@ -102,7 +109,7 @@ \directkeys*{ .path=SKVV/skvview, .holder prefix=skvv@, - .initialize after define=false, + .initialize keys after define=false, .define keys={ .ord/{file,wcolsep,weol}/\@nil/ \skvcsedef{skvv@\skvcurrentkey}{\unexpanded{#1}} @@ -115,7 +122,7 @@ \skvaftercsname\skvcsvnormalize{skvv@\skvcurrentkey} , .bool/{view,vlabels,wlabels}/true, - .ord/length of default/20/\def\skvv@lod{#1}, + .ord/length of default/20/\def\skvv@lengthofdefa{#1}, .cmd/color/black, }, .set keys={ @@ -147,87 +154,121 @@ \skvrobustdef*\setupviewkeys{\skvsetkeys[SKVV]{skvview}} \let\skvv@db\@empty -\skvrobustdef*\skvv@tabulate#1#2#3{% - \edef\skv@tempa{\detokenize{#3}}% - \skv@getbasetoks\skvv@lod\skv@tempa\skv@ival - \skvxaddtolist{,}\skvv@db{% - #1=\ifx\skvcurrentprefix\@empty\else - \skvcurrentprefix\fi=\skvcurrentfamily=#2=\skv@ival - }% +\skvrobustdef*\skvv@dotabulate#1#2#3{% + \ifskvv@tabulate + \begingroup + \edef\skv@tempa{\detokenize{#3}}% + \skv@getshortformofcontent\skvv@lengthofdefa\skv@tempa\skv@ival + \skvxaddtolist{,}\skvv@db{% + #1=\ifx\skvcurrentprefix\@empty\else + \skvcurrentprefix\fi=\skvcurrentfamily=#2=\skv@ival + }% + \skvaftergroupdef\skvv@db\endgroup + \fi } -\protected\def\skv@ordkey@a#1[#2]#3{% - % Pointers have been stripped in \skv@ordkey. - \skvifstrcmpTF{#2}{^skv^}{% - \skvv@tabulate{#1}{ordinary}{[none]}% +\protected\def\skv@ordkey@a#1#2[#3]#4{% + \skvifstrcmpTF{#3}{^skv^}{% + \skvv@dotabulate{#2}{ordinary}{[none]}% + }{% + \skv@definedefault{#2}{#3}% + \skvv@dotabulate{#2}{ordinary}{#3}% + }% + % Pointers on key #2 have been stripped in \skv@ordkey. + % The pointer '.hp' may be used to set a holder prefix for the key. + \skvxifinTF{\detokenize{.hp}}{\detokenize{#4}}{% + \def\skv@prova##1.hp##2##3\skv@ord@nil{% + \let\skv@gobble@or@iden\@iden + \edef\skv@hp{\unexpanded{##2}}% + \edef\skv@callback{\unexpanded{##1##3}}% + }% + \skv@prova#4\skv@ord@nil }{% - \skv@definedefault{#1}{#2}% - \skvv@tabulate{#1}{ordinary}{#2}% + \let\skv@gobble@or@iden\@gobble + \edef\skv@callback{\unexpanded{#4}}% + }% + \csname skvcs#1def\endcsname{\skv@header#2.@cbk}{% + % This can be called in #3 access the value of ordinary key. + % No prefix is used here, to reduce macro name: + \skv@gobble@or@iden{\skvcslet{\skv@hp#2}\noexpand\skvcurrentvalue}% + \skvexpandonce\skv@callback }% - \skvcsedef{\skv@header#1.@cbk}{\unexpanded{#3}}% } \protected\def\skv@cmdkey#1#2[#3]#4{% \skv@strippointersfromkey{#2}% \skvifdefboolTF{skv@st}{% \skv@definedefault\skvcurrentkey{#3}% - \skvv@tabulate\skvcurrentkey{command}{#3}% + \skvv@dotabulate\skvcurrentkey{command}{#3}% }{% - \skvv@tabulate\skvcurrentkey{command}{[none]}% + \skvv@dotabulate\skvcurrentkey{command}{[none]}% }% % This is to allow the key name to be expanded before possibly zapping % spaces in key name: \edef\skv@prova{#1\skvcurrentkey}% \edef\skv@prova{\expandafter\skv@zapornot\expandafter {\expandafter\skv@zapsw\expandafter}\expandafter{\skv@prova}}% - \skvcslet{\skv@header\skvcurrentkey.@hp}\skv@prova - \skvcsedef{\skv@header\skvcurrentkey.@cbk}{\unexpanded{#4}}% + \skvcsedef{\skv@header\skvcurrentkey.@cbk}{% + \skvcslet{\skv@prova}\noexpand\skvcurrentvalue + \unexpanded{#4}% + }% } \protected\def\skv@choicekey@g{% \skvcommaparse*\skv@currlist\skv@prova{% \skvexpbracenext\skv@strippointersfromkey\skv@prova \ifx\skv@default\skv@rej - \skvv@tabulate\skvcurrentkey{choice}{[none]}% - \else\skvafterfi + \skvv@dotabulate\skvcurrentkey{choice}{[none]}% + \else \skvexpanded{% - \noexpand\skvv@tabulate + \noexpand\skvv@dotabulate {\skvxonce\skvcurrentkey}{choice}{\skvxonce\skv@default}% \noexpand\skv@definedefault {\skvxonce\skvcurrentkey}{\skvxonce\skv@default}% }% \fi - \skvcsedef{\skv@header\skvcurrentkey.@hp}{\skv@hp\skvcurrentkey}% - \skvcsedef{\skv@header\skvcurrentkey.@cbk}{\the\skv@toksa}% + \skvcsedef{\skv@header\skvcurrentkey.@cbk}{% + \skvcslet{\skv@hp\skvcurrentkey}\noexpand\skvcurrentvalue + \the\skv@temptoks + }% }% } \protected\def\skv@boolkey@c#1#2#3#4{% - % Pointers have been stripped in \skv@boolkey. - \skvcsnewif{\skv@zapornot{\skv@zapsw}{#2}}% - \edef\skvv@boolortog{\if\skv@typetogkey toggle\else bool\fi}% + \if\skv@typetogkey + \skvdeftog{\skv@zapornot{\skv@zapsw}{#2}}% + \else + \skvcsnewif{\skv@zapornot{\skv@zapsw}{#2}}% + \fi \skvifdefboolTF{skv@st}{% \skv@definedefault{#1}{#3}% - \skvv@tabulate{#1}{\skvv@boolortog}{#3}% + \skvv@dotabulate{#1}{\if\skv@typetogkey toggle\else bool\fi}{#3}% }{% - \skvv@tabulate{#1}{\skvv@boolortog}{[none]}% + \skvv@dotabulate{#1}{\if\skv@typetogkey toggle\else bool\fi}{[none]}% }% \edef\skv@tempa##1##2{% \noexpand\skv@sttrue \ifskv@pl\noexpand\skv@pltrue\else\noexpand\skv@plfalse\fi \skv@checkchoice[\noexpand\skv@value]{##1}{true,false}##2% }% - \skv@toksa\expandafter{\skv@tempa{##1}{#4}}% - \skvcsedef{\skv@header#1.@cbk}{\the\skv@toksa}% + \skv@temptoks\expandafter{\skv@tempa{##1}{#4}}% + \skvcsedef{\skv@header#1.@cbk}{\the\skv@temptoks}% } -% #2: styles, #3: default, #4: callback -\protected\def\skv@appendstyles@a#1#2[#3]#4{% +% #2=styles, #3=default, #4=callback +\protected\def\skv@appendslots@a#1#2[#3]#4{% \skvcommaparse{#1}\skv@prova{% \skvexpbracenext\skv@strippointersfromkey\skv@prova \skvexpanded{% \skvifstrcmpTF{#3}{^skv^}{% - \skvv@tabulate{\skvcurrentkey}{style}{[none]}% + % When using \skvaddslots, signal keys will otherwise be added + % in the database twice (while treating prepended and appended + % slots). + \ifskv@addslots@appending\else + \skvv@dotabulate{\skvcurrentkey}{slot/style}{[none]}% + \fi }{% \skv@definedefault{\skvcurrentkey}{\unexpanded{#3}}% - \skvv@tabulate{\skvcurrentkey}{style}{\unexpanded{#3}}% + \ifskv@addslots@appending\else + \skvv@dotabulate{\skvcurrentkey}{slot/style}{\unexpanded{#3}}% + \fi }% - \skv@appendstyles@b{\skvcurrentkey}\unexpanded{{#2}{#4}}% + \skv@appendslots@b{\skvcurrentkey}\unexpanded{{#2}{#4}}% }% }% } @@ -238,7 +279,14 @@ \do\skvv@color\do\ifskvv@view\do\ifskvv@vlabels\do\ifskvv@wlabels }{2} -\skvrobustdef*\skvv@skvview@a#1{% +\skvnewdef*\skvv@@view{% + \ifskvv@tabulate + 0\ifskvv@view 0\else 1\fi + \else + 01% + \fi +} +\skvrobustdef*\skvv@skvview#1{% \skvsetkeys[SKVV]{skvview}{#1}% \ifx\skvv@default\@nnil\else\@onelevel@sanitize\skvv@default\fi \ifx\skvv@columns\@nnil @@ -246,21 +294,32 @@ \skvv@coliitrue\skvv@coliiitrue\skvv@colivtrue\skvv@colvtrue \else \skvsetnumber\skvv@nra\@ne - \@expandtwoargs\skvtestifin{,prefix,}{,\skvv@columns,}% - \ifin@\skvadvanceno\skvv@nra\@ne\skvv@coliitrue\else\skvv@coliifalse\fi - \@expandtwoargs\skvtestifin{,family,}{,\skvv@columns,}% - \ifin@\skvadvanceno\skvv@nra\@ne\skvv@coliiitrue\else\skvv@coliiifalse\fi - \@expandtwoargs\skvtestifin{,type,}{,\skvv@columns,}% - \ifin@ + \skvxifinTF{,prefix,}{,\skvv@columns,}{% + \skvadvanceno\skvv@nra\@ne\skvv@coliitrue + }{% + \skvv@coliifalse + }% + \skvxifinTF{,family,}{,\skvv@columns,}{% + \skvadvanceno\skvv@nra\@ne\skvv@coliiitrue + }{% + \skvv@coliiifalse + }% + \skvxifinTF{,type,}{,\skvv@columns,}{% \skvadvanceno\skvv@nra\@ne\skvv@colivtrue - \else - \@expandtwoargs\skvtestifin{,key type,}{,\skvv@columns,}% - \ifin@\skvadvanceno\skvv@nra\@ne\skvv@colivtrue\else\skvv@colivfalse\fi - \fi - \@expandtwoargs\skvtestifin{,default,}{,\skvv@columns,}% - \ifin@\skvadvanceno\skvv@nra\@ne\skvv@colvtrue\else\skvv@colvfalse\fi + }{% + \skvxifinTF{,key type,}{,\skvv@columns,}{% + \skvadvanceno\skvv@nra\@ne\skvv@colivtrue + }{% + \skvv@colivfalse + }% + }% + \skvxifinTF{,default,}{,\skvv@columns,}{% + \skvadvanceno\skvv@nra\@ne\skvv@colvtrue + }{% + \skvv@colvfalse + }% \fi - \ifskvv@view + \if\skvv@@view \protected@edef\skv@prova{% \noexpand\begin{longtable}[l]{*\skvv@nra l}% \\\noexpand\hline @@ -285,35 +344,37 @@ \\\noexpand\endfoot\noexpand\hline \noexpand\endlastfoot }% - \skv@toksa\expandafter{\skv@prova}% + \skvv@toksa\expandafter{\skv@prova}% + \fi + \ifx\skvv@file\@nnil\else + \immediate\openout\skvv@out\skvv@file \fi - \ifx\skvv@file\@nnil\else\immediate\openout\skvv@out\skvv@file\fi \skvcommaloop*\skvv@db\skv@prova{% \skv@swatrue - \expandafter\skvv@skvview@b\skv@prova\skv@nil + \expandafter\skvv@skvview@a\skv@prova\skv@nil }% - \ifskvv@view - \addto@hook\skv@toksa{\end{longtable}}% + \if\skvv@@view + \skvaddtotoks\skvv@toksa{\end{longtable}}% \begingroup \color{\skvv@color}% - \ttfamily\the\skv@toksa + \ttfamily\the\skvv@toksa \endgroup \fi \ifx\skvv@file\@nnil\else\immediate\closeout\skvv@out\fi } -\skvnewdef*\skvv@skvview@b#1=#2=#3=#4=#5\skv@nil{% +\skvnewdef*\skvv@skvview@a#1=#2=#3=#4=#5\skv@nil{% \skvv@ifin{#2}\skvv@prefix \skvv@ifin{#3}\skvv@family \skvv@ifin{#4}\skvv@type \skvv@ifin{#5}\skvv@default \ifskv@swa - \ifskvv@view + \if\skvv@@view \edef\skv@prova{% #1\ifskvv@colii\fi\ifskvv@coliii\fi \ifskvv@coliv\fi\ifskvv@colv\fi \ifskvv@vlabels\noexpand\label{#2/#3/#1}\fi }% - \skv@toksa\expandafter{\the\expandafter\skv@toksa\skv@prova\\}% + \skvoaddtotoks\skvv@toksa{\skv@prova\\}% \fi \ifx\skvv@file\@nnil\else \immediate\write\skvv@out{% @@ -332,7 +393,6 @@ \skvxifinTF{,\detokenize{#1},}{,\skvoxdetok{#2},}{}\skv@swafalse \fi } - \directkeys*{ .path=SKVV/skvvshow, .holder prefix=skvvs@, @@ -344,7 +404,7 @@ \skvstripouterbraces{2}\skvvs@show \ifx\skvvs@show\@empty\else\skvafterfi \skvpushstate\skvv@state\skvv@depth - \skvexpbracenext\skvv@skvview@a\skvvs@show + \skvexpbracenext\skvv@skvview\skvvs@show \skvpopstate\skvv@state\skvv@depth \fi }, diff --git a/Master/texmf-dist/tex/latex/skeyval/skeyval.sty b/Master/texmf-dist/tex/latex/skeyval/skeyval.sty index 010ce8c51fd..0bd5722fca5 100644 --- a/Master/texmf-dist/tex/latex/skeyval/skeyval.sty +++ b/Master/texmf-dist/tex/latex/skeyval/skeyval.sty @@ -1,5 +1,5 @@ %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++% -% This is file 'skeyval.sty', version 1.2, 2013/02/10. % +% This is file 'skeyval.sty', version 1.3, 2013/05/15. % % % % NOTE % % % @@ -34,10 +34,11 @@ % The following files constitute the skeyval bundle and must be % % distributed as a whole: % % % -% readme, skeyval.sty, skeyval-core.tex, skeyval-for.tex, % +% README, skeyval.sty, skeyval-core.tex, skeyval-for.tex, % % skeyval-view.sty, skeyval-ltxpatch.sty, skeyval-ltxcmds.tex, % % skeyval-pstkey.sty, skeyval-pstkey.tex, skeyval-testclass.cls, % -% and skeyval-testpkg.sty. % +% skeyval-testpkg.sty, skeyval-pokayoke1, skeyval-pokayoke2, % +% skeyval-view-pokayoke1. % % % % Copyright (c) 2010-2013 Ahmed Musa (amusa22@gmail.com). % %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++% @@ -83,7 +84,7 @@ \do 032=10,033=12,036=03,038=04,040=12,041=12,042=12,043=12,% 059=12,045=12,047=12,058=12,063=12,091=12,093=12,126=13,\do=,% -\ProvidesPackage{skeyval}[2013/02/10 v1.2 Robust key-value parser (AM)] +\ProvidesPackage{skeyval}[2013/05/15 v1.3 Robust key-value parser (AM)] \NeedsTeXFormat{LaTeX2e}[2011/06/27] \input skeyval-core @@ -799,8 +800,6 @@ , }, } -%\skvshowcs{SKV/megapox/.options family.@cbk} -%\skvshowcs{SKV/megapox/.pref.@cbk} \skvnewnumbers[skv@]{megapoxdepth} \skvrobustdef*\dirkeys@megaprocessoptions#1{% @@ -891,7 +890,6 @@ .action for unknown options, }, } -%\skvshowcs{dirkeys@handler@.every unknown option} % Loading a package while in options section is illegal. The command % \skvafterprocessoptions can be used to defer the loading of packages @@ -971,13 +969,3 @@ \skv@restorecodes \endinput - - - - - - -\edef\skv@prova{\@currname.\@currext/\skvcurrentkey}% - \skvxifinTF{,\skv@prova,}{,\skvpackagelist,}{}{% - \edef\skvpackagelist{\skvaddlist,\skvpackagelist\skv@prova}% - }% |