diff options
author | Norbert Preining <norbert@preining.info> | 2020-12-29 03:00:50 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2020-12-29 03:00:50 +0000 |
commit | ec483f80cce5e50f1ea09f9cdea99d26fbba5c5d (patch) | |
tree | 69bf255fb4232c3d9113c03f460cf21b3a74df91 /macros/generic | |
parent | 07b20138841bb0e4c45e74a2a1d06cc91fe5a861 (diff) |
CTAN sync 202012290300
Diffstat (limited to 'macros/generic')
-rw-r--r-- | macros/generic/expkv-def/README.md | 2 | ||||
-rw-r--r-- | macros/generic/expkv-def/expkv-def.dtx | 90 | ||||
-rw-r--r-- | macros/generic/expkv-def/expkv-def.pdf | bin | 356349 -> 379054 bytes | |||
-rw-r--r-- | macros/generic/expkv/README.md | 2 | ||||
-rw-r--r-- | macros/generic/expkv/expkv.dtx | 235 | ||||
-rw-r--r-- | macros/generic/expkv/expkv.pdf | bin | 410888 -> 411252 bytes |
6 files changed, 156 insertions, 173 deletions
diff --git a/macros/generic/expkv-def/README.md b/macros/generic/expkv-def/README.md index b2172d3ab1..ffea8dd5ca 100644 --- a/macros/generic/expkv-def/README.md +++ b/macros/generic/expkv-def/README.md @@ -1,7 +1,7 @@ ------------------------------------------------------------------------------- # expkv-def -- a key-defining frontend for expkv -Version 2020-10-12 v0.6 +Version 2020-12-28 v0.7 Released under the LaTeX Project Public License v1.3c or later See http://www.latex-project.org/lppl.txt diff --git a/macros/generic/expkv-def/expkv-def.dtx b/macros/generic/expkv-def/expkv-def.dtx index 2dc4164153..5edf48780c 100644 --- a/macros/generic/expkv-def/expkv-def.dtx +++ b/macros/generic/expkv-def/expkv-def.dtx @@ -171,6 +171,7 @@ and the derived files expkv-def.pdf \DoNotIndex{\@,\unexpanded,\string,\expanded,\dimexpr,\global,\glueexpr,\hbox} \DoNotIndex{\numexpr,\RequirePackage,\setbox,\the,\unless,\xdef,\@firstofone} \DoNotIndex{\@firstoftwo,\@gobble,\@secondoftwo,\meaning,\detokenize} +\DoNotIndex{\romannumeral,\^} \DoNotIndex{\ifcsname} \DoNotIndex{\ifx} \DoNotIndex{\ifdefined} @@ -362,7 +363,7 @@ and the derived files expkv-def.pdf % |\edef|. % \end{function} % -% \begin{function}{default,qdefault,edefault} +% \begin{function}{default,qdefault,odefault,fdefault,edefault} % \begin{syntax} % default \key\ = \marg{definition} \prefixes3223 % \end{syntax} @@ -370,11 +371,18 @@ and the derived files expkv-def.pdf % \key\ can be of any argument-grabbing kind, and when used without a \val\ % it will be passed \meta{definition} instead. The |qdefault| variant will % expand the \key's code once, so will be slightly quicker, but not change if -% you redefine \key. The |edefault| on the other hand fully expands the -% \key-code with \meta{definition} as its argument inside of an |\edef|. +% you redefine \key. |odefault| is just another name for |qdefault|. The +% |fdefault| version will expand the key code until a non-expandable token or +% a space is found, a space would be gobbled.\footnotemark{} The |edefault| on the other hand fully expands +% the \key-code with \meta{definition} as its argument inside of an |\edef|. % \end{function} +% \footnotetext +% {^^A +% For those familiar with \TeX-coding: This uses a +% \cs[no-index]{romannumeral}-expansion. +% } % -% \begin{function}{initial,oinitial,einitial} +% \begin{function}{initial,oinitial,finitial,einitial} % \begin{syntax} % initial \key\ = \{\val\} \prefixes3333 % \end{syntax} @@ -382,8 +390,11 @@ and the derived files expkv-def.pdf % taking \key. It'll just call the key-macro of \key\ and pass it \val. The % |einitial| variant will expand \val\ using an |\edef| expansion prior to % passing it to the key-macro and the |oinitial| variant will expand the first -% token in \val\ once. +% token in \val\ once. |finitial| will expand \val\ until a non-expandable +% token or a space is found, a space would be +% gobbled.\footnotemark % \end{function} +% \footnotetext{Again using \cs[no-index]{romannumeral}.} % % \begin{function}{bool,gbool,boolTF,gboolTF} % \begin{syntax} @@ -755,8 +766,8 @@ and the derived files expkv-def.pdf % \begin{macro}{\ekvdVersion,\ekvdDate} % We're on our first input, so lets store the version and date in a macro. % \begin{macrocode} -\def\ekvdVersion{0.6} -\def\ekvdDate{2020-10-12} +\def\ekvdVersion{0.7} +\def\ekvdDate{2020-12-28} % \end{macrocode} % \end{macro} % @@ -904,15 +915,11 @@ and the derived files expkv-def.pdf {% \ekvd@ifalso {% - \ekv@expB@unbraceA{\ekv@expB@unbraceA{\ekvd@add@noval{#1}}}% + \ekv@expargtwice{\ekvd@add@noval{#1}}% {\ekvchangeset{#2}}% \ekvd@assert@not@protected@also }% - {% - \ekv@expB@unbraceA - {\ekv@expB@unbraceA{\ekvdefNoVal\ekvd@set{#1}}}% - {\ekvchangeset{#2}}% - }% + {\ekv@expargtwice{\ekvdefNoVal\ekvd@set{#1}}{\ekvchangeset{#2}}}% }% }% } @@ -942,7 +949,7 @@ and the derived files expkv-def.pdf \ekvd@assert@not@long \ekvd@prot#1\ekvd@tmp{#3}% \ekvd@ifalso - {\ekv@expB@unbraceA{\ekvd@add@noval{#2}}\ekvd@tmp{}}% + {\ekv@exparg{\ekvd@add@noval{#2}}\ekvd@tmp{}}% {\ekvletNoVal\ekvd@set{#2}\ekvd@tmp}% }% }% @@ -964,7 +971,7 @@ and the derived files expkv-def.pdf {% \ekvd@prot\ekvd@long#1\ekvd@tmp##1{#3}% \ekvd@ifalso - {\ekv@expB@unbraceA{\ekvd@add@val{#2}}{\ekvd@tmp{##1}}{}}% + {\ekv@exparg{\ekvd@add@val{#2}}{\ekvd@tmp{##1}}{}}% {\ekvlet\ekvd@set{#2}\ekvd@tmp}% }% }% @@ -974,35 +981,41 @@ and the derived files expkv-def.pdf % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\ekvd@type@default,\ekvd@t@default,\ekvd@t@qdefault} +% \begin{macro}[internal] +% { +% \ekvd@type@default,\ekvd@t@default,\ekvd@t@qdefault,\ekvd@t@odefault, +% \ekvd@t@fdefault +% } % |\ekvd@type@default| asserts there was an argument, also the key for which one % wants to set a default has to be already defined (this is not so important for % |default|, but |qdefault| requires is). If everything is good, |\edef| a % temporary macro that expands |\ekvd@set| and the |\csname| for the key, and in % the case of |qdefault| does the first expansion step of the key-macro. % \begin{macrocode} -\protected\long\def\ekvd@type@default#1#2#3% +\protected\long\def\ekvd@type@default#1#2#3#4% {% \ekvd@assert@arg {% - \ekvifdefined\ekvd@set{#2}% + \ekvifdefined\ekvd@set{#3}% {% \ekvd@assert@not@new \ekvd@assert@not@long \ekvd@prot\edef\ekvd@tmp {% \unexpanded\expandafter#1% - {\csname\ekv@name\ekvd@set{#2}\endcsname{#3}}% + {#2\csname\ekv@name\ekvd@set{#3}\endcsname{#4}}% }% \ekvd@ifalso - {\ekv@expB@unbraceA{\ekvd@add@noval{#2}}\ekvd@tmp{}}% - {\ekvletNoVal\ekvd@set{#2}\ekvd@tmp}% + {\ekv@exparg{\ekvd@add@noval{#3}}\ekvd@tmp{}}% + {\ekvletNoVal\ekvd@set{#3}\ekvd@tmp}% }% - {\ekvd@err@undefined@key{#2}}% + {\ekvd@err@undefined@key{#3}}% }% } -\protected\def\ekvd@t@default{\ekvd@type@default{}} -\protected\def\ekvd@t@qdefault{\ekvd@type@default{\expandafter\expandafter}} +\protected\def\ekvd@t@default{\ekvd@type@default{}{}} +\protected\def\ekvd@t@qdefault{\ekvd@type@default{\expandafter\expandafter}{}} +\let\ekvd@t@odefault\ekvd@t@qdefault +\protected\def\ekvd@t@fdefault{\ekvd@type@default{}{\romannumeral`\^^@}} % \end{macrocode} % \end{macro} % @@ -1021,7 +1034,7 @@ and the derived files expkv-def.pdf \ekvd@prot\edef\ekvd@tmp {\csname\ekv@name\ekvd@set{#1}\endcsname{#2}}% \ekvd@ifalso - {\ekv@expB@unbraceA{\ekvd@add@noval{#1}}\ekvd@tmp{}}% + {\ekv@exparg{\ekvd@add@noval{#1}}\ekvd@tmp{}}% {\ekvletNoVal\ekvd@set{#1}\ekvd@tmp}% }% {\ekvd@err@undefined@key{#1}}% @@ -1030,28 +1043,31 @@ and the derived files expkv-def.pdf % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\ekvd@t@initial,\ekvd@t@oinitial,\ekvd@t@einitial} +% \begin{macro}[internal] +% {\ekvd@t@initial,\ekvd@t@oinitial,\ekvd@t@finitial,\ekvd@t@einitial} % \begin{macrocode} -\long\def\ekvd@type@initial#1#2#3% +\long\def\ekvd@type@initial#1#2#3#4% {% \ekvd@assert@arg {% - \ekvifdefined\ekvd@set{#2}% + \ekvifdefined\ekvd@set{#3}% {% \ekvd@assert@not@new \ekvd@assert@not@also \ekvd@assert@not@long \ekvd@assert@not@protected - #1{#3}% - \csname\ekv@name\ekvd@set{#2}\expandafter\endcsname\expandafter + #1{#2#4}% + \csname\ekv@name\ekvd@set{#3}\expandafter\endcsname\expandafter {\ekvd@tmp}% }% - {\ekvd@err@undefined@key{#2}}% + {\ekvd@err@undefined@key{#3}}% }% } -\def\ekvd@t@initial{\ekvd@type@initial{\def\ekvd@tmp}} -\def\ekvd@t@oinitial{\ekvd@type@initial{\ekv@expB@unbraceA{\def\ekvd@tmp}}} -\def\ekvd@t@einitial{\ekvd@type@initial{\edef\ekvd@tmp}} +\def\ekvd@t@initial{\ekvd@type@initial{\def\ekvd@tmp}{}} +\def\ekvd@t@oinitial{\ekvd@type@initial{\ekv@exparg{\def\ekvd@tmp}}{}} +\def\ekvd@t@einitial{\ekvd@type@initial{\edef\ekvd@tmp}{}} +\def\ekvd@t@finitial + {\ekvd@type@initial{\ekv@exparg{\def\ekvd@tmp}}{\romannumeral`\^^@}} % \end{macrocode} % \end{macro} % @@ -1346,7 +1362,7 @@ and the derived files expkv-def.pdf \edef\ekvd@tmp{\ekvd@set}% \expandafter\ekvd@type@meta@a\expandafter{\ekvd@tmp}{#7}{#2}% \ekvd@ifalso - {\ekv@expB@unbraceA{#3{#6}}{\ekvd@tmp#4}{#5}}% + {\ekv@exparg{#3{#6}}{\ekvd@tmp#4}{#5}}% {\csname ekvlet#1\endcsname\ekvd@set{#6}\ekvd@tmp}% }% }% @@ -1386,7 +1402,7 @@ and the derived files expkv-def.pdf {% \ekvd@type@meta@a#7{#2}% \ekvd@ifalso - {\ekv@expB@unbraceA{#3{#6}}{\ekvd@tmp#4}{#5}}% + {\ekv@exparg{#3{#6}}{\ekvd@tmp#4}{#5}}% {\csname ekvlet#1\endcsname\ekvd@set{#6}\ekvd@tmp}% }% }% @@ -1424,7 +1440,7 @@ and the derived files expkv-def.pdf {% \ekvd@if@not@already@choice{#1}% {% - \ekv@expB@unbraceA + \ekv@exparg {% \expandafter\ekvd@add@aux \csname\ekv@name\ekvd@set{#1}\endcsname{{##1}}{#1}% diff --git a/macros/generic/expkv-def/expkv-def.pdf b/macros/generic/expkv-def/expkv-def.pdf Binary files differindex 73ddc853c6..727d6c43d4 100644 --- a/macros/generic/expkv-def/expkv-def.pdf +++ b/macros/generic/expkv-def/expkv-def.pdf diff --git a/macros/generic/expkv/README.md b/macros/generic/expkv/README.md index 730b302b5a..beeba1ca09 100644 --- a/macros/generic/expkv/README.md +++ b/macros/generic/expkv/README.md @@ -1,7 +1,7 @@ ------------------------------------------------------------------------------- # expkv -- an expandable key=val implementation -Version 2020-10-10 v1.5 +Version 2020-12-28 v1.6 Released under the LaTeX Project Public License v1.3c or later See http://www.latex-project.org/lppl.txt diff --git a/macros/generic/expkv/expkv.dtx b/macros/generic/expkv/expkv.dtx index 3cd8479be5..d3fc414f39 100644 --- a/macros/generic/expkv/expkv.dtx +++ b/macros/generic/expkv/expkv.dtx @@ -423,29 +423,40 @@ and the derived files expkv.pdf % % \begin{function}{\ekvparse} % \begin{syntax} -% \cs{ekvparse}\meta{cs1}\meta{cs2}\{\kv,\ldots\} +% \cs{ekvparse}\marg{code1}\marg{code2}\{\kv,\ldots\} % \end{syntax} % This macro parses the \kv\ pairs and provides those list elements which are -% only keys as the argument to \meta{cs1}, and those which are a \kv\ pair to -% \meta{cs2} as two arguments. It is fully expandable as well and returns the -% parsed list in |\unexpanded|, which has no effect outside of an |\expanded| -% or |\edef| context\footnotemark. +% only keys as an argument to \meta{code1}, and those which are a \kv\ pair +% to \meta{code2} as two arguments. It is fully expandable as well and returns +% each element of the parsed list in |\unexpanded|, which has no effect +% outside of an |\expanded| or |\edef| context\footnotemark. % If you need control over the necessary steps of expansion you -% can use |\expanded| around it. +% can use |\expanded| around it. You can use multiple tokens in \meta{code1} +% and \meta{code2} or just a single control sequence name. In both cases the +% found \key\ and \val\ are provided as a brace group following them. % % |\ekvbreak|, |\ekvsneak|, and |\ekvchangeset| and their relatives don't work % in |\ekvparse|. It is analogue to \pkg{expl3}'s |\keyval_parse:NNn|, but % not with the same parsing rules -- |\keyval_parse:NNn| throws an error on % multiple equal signs per \kv\ pair and on empty \key\ names in a \kv\ pair, % both of which |\ekvparse| doesn't deal with. +% \end{function} +% \footnotetext +% {^^A +% This is a change in behaviour, previously (v0.3 and before) \cs{ekvparse} +% would expand in exactly two steps. This isn't always necessary, but makes +% the parsing considerably slower. If this is necessary for your application +% you can put an \cs[no-index]{expanded} around it and will still be faster +% since you need only a single \cs[no-index]{expandafter} this way.^^A +% } % % As a small example: % \begin{lstlisting} -% \ekvparse\handlekey\handlekeyval{foo = bar, key, baz={zzz}} +% \ekvparse{\handlekey{S}}{\handlekeyval{S}}{foo = bar, key, baz={zzz}} % \end{lstlisting} -% would expand to +% would be equivalent to % \begin{lstlisting} -% \handlekeyval{foo}{bar}\handlekey{key}\handlekeyval{baz}{zzz} +% \handlekeyval{S}{foo}{bar}\handlekey{S}{key}\handlekeyval{S}{baz}{zzz} % \end{lstlisting} % and afterwards |\handlekey| and |\handlekeyval| would have to further handle % the \key. There are no macros like these two contained in \expkv, you have @@ -460,15 +471,6 @@ and the derived files expkv.pdf % \begin{lstlisting} % \handle\kv{foo}{bar}\k{key}\kv{baz}{zzz} % \end{lstlisting} -% \end{function} -% \footnotetext -% {^^A -% This is a change in behaviour, previously (v0.3 and before) \cs{ekvparse} -% would expand in exactly two steps. This isn't always necessary, but makes -% the parsing considerably slower. If this is necessary for your application -% you can put an \cs[no-index]{expanded} around it and will still be faster -% since you need only a single \cs[no-index]{expandafter} this way.^^A -% }. % % \subsection{Miscellaneous} % @@ -1082,8 +1084,8 @@ and the derived files expkv.pdf % \begin{macro}{\ekvVersion,\ekvDate} % We're on our first input, so lets store the version and date in a macro. % \begin{macrocode} -\def\ekvVersion{1.5} -\def\ekvDate{2020-10-10} +\def\ekvVersion{1.6} +\def\ekvDate{2020-12-28} % \end{macrocode} % \end{macro} % @@ -1262,25 +1264,30 @@ and the derived files expkv.pdf ##1\ekv@nil \ekv@mark#1% #1\ekv@nil - \ekv@stop }% \long\def\ekv@strip@a##1\ekv@mark#1{\ekv@strip@b##1\ekv@mark}% - \long\def\ekv@strip@b##1#1\ekv@nil {\ekv@strip@c##1\ekv@nil}% } \ekv@strip{ } -\long\def\ekv@strip@c\ekv@mark#1\ekv@nil\ekv@mark#2\ekv@nil\ekv@stop#3{#3{#1}} +\long\def\ekv@strip@b#1 \ekv@nil{\ekv@strip@c#1\ekv@nil} +\long\def\ekv@strip@c\ekv@mark#1\ekv@nil\ekv@mark#2\ekv@nil#3{#3{#1}} % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\ekv@expB@unbraceA,\ekv@expB@unbraceA@} -% To reduce some code doublets while gaining some speed, it is often useful to -% expand the first token in a definition once. Let's define a wrapper for this. +% \begin{macro}[internal] +% {\ekv@exparg,\ekv@exparg@,\ekv@expargtwice,\ekv@expargtwice@,\ekv@zero} +% To reduce some code doublets while gaining some speed (and also as convenience +% for other packages in the family), it is often useful to expand the first +% token in a definition once. Let's define a wrapper for this. +% +% Also, to end a |\romannumeral| expansion, we want to use |\z@|, which is +% contained in both plain \TeX\ and \LaTeX, but we use a private name for it to +% make it easier to spot and hence easier to manage. % \begin{macrocode} -\long\def\ekv@expB@unbraceA#1#2% - {% - \expandafter\ekv@expB@unbraceA@\expandafter{#2}{#1}% - } -\long\def\ekv@expB@unbraceA@#1#2{#2{#1}}% +\let\ekv@zero\z@ +\long\def\ekv@exparg#1#2{\expandafter\ekv@exparg@\expandafter{#2}{#1}} +\long\def\ekv@exparg@#1#2{#2{#1}}% +\long\def\ekv@expargtwice#1#2{\expandafter\ekv@expargtwice@\expandafter{#2}{#1}} +\def\ekv@expargtwice@{\expandafter\ekv@exparg@\expandafter} % \end{macrocode} % \end{macro} % @@ -1294,7 +1301,7 @@ and the derived files expkv.pdf \unexpanded\expandafter{\ekv@name@set{#1}}% \unexpanded\expandafter{\ekv@name@key{\detokenize{#2}}}% } -\ekv@expB@unbraceA{\def\ekv@name#1#2}{\ekv@name} +\ekv@exparg{\def\ekv@name#1#2}{\ekv@name} % \end{macrocode} % \end{macro} % @@ -1340,16 +1347,16 @@ and the derived files expkv.pdf }% \unexpanded{\@gobble}% } -\ekv@expB@unbraceA{\protected\def\ekv@checkvalid#1#2}{\ekv@checkvalid}% +\ekv@exparg{\protected\def\ekv@checkvalid#1#2}{\ekv@checkvalid}% % \end{macrocode} % \end{macro} % % \begin{macro}{\ekvifdefined,\ekvifdefinedNoVal} % And provide user-level macros to test whether a key is defined. % \begin{macrocode} -\ekv@expB@unbraceA{\ekv@expB@unbraceA{\def\ekvifdefined#1#2}}% +\ekv@expargtwice{\def\ekvifdefined#1#2}% {\expandafter\ekv@ifdefined\expandafter{\ekv@name{#1}{#2}}} -\ekv@expB@unbraceA{\ekv@expB@unbraceA{\def\ekvifdefinedNoVal#1#2}}% +\ekv@expargtwice{\def\ekvifdefinedNoVal#1#2}% {\expandafter\ekv@ifdefined\expandafter{\ekv@name{#1}{#2}N}} % \end{macrocode} % \end{macro} @@ -1372,27 +1379,27 @@ and the derived files expkv.pdf {#1{\expandafter\let\csname#2\endcsname##3#3}}% \protected\def\ekvletNoVal##1##2##3% {#1{\expandafter\let\csname#2N\endcsname##3#3}}% - \ekv@expB@unbraceA{\ekv@expB@unbraceA{\ekv@expB@unbraceA{% - \protected\long\def\ekvdefunknown##1##2}}}% + \ekv@expargtwice{\protected\long\def\ekvdefunknown##1##2}% {% - \expandafter\ekv@expB@unbraceA@\expandafter + \romannumeral + \expandafter\ekv@exparg@\expandafter {% \expandafter\expandafter\expandafter \def\expandafter\csname\ekv@name{##1}{}u\endcsname####1####2{##2}% #3% }% - {\ekv@checkvalid{##1}.}% + {\ekv@zero\ekv@checkvalid{##1}.}% }% - \ekv@expB@unbraceA{\ekv@expB@unbraceA{\ekv@expB@unbraceA{% - \protected\long\def\ekvdefunknownNoVal##1##2}}}% + \ekv@expargtwice{\protected\long\def\ekvdefunknownNoVal##1##2}% {% - \expandafter\ekv@expB@unbraceA@\expandafter + \romannumeral + \expandafter\ekv@exparg@\expandafter {% \expandafter\expandafter\expandafter \def\expandafter\csname\ekv@name{##1}{}uN\endcsname####1{##2}% #3% }% - {\ekv@checkvalid{##1}.}% + {\ekv@zero\ekv@checkvalid{##1}.}% }% \protected\def\ekvletkv##1##2##3##4% {% @@ -1441,16 +1448,14 @@ and the derived files expkv.pdf }% \unexpanded{\fi}% } -\ekv@expB@unbraceA{\protected\def\ekv@defsetmacro#1#2}{\ekv@defsetmacro} +\ekv@exparg{\protected\def\ekv@defsetmacro#1#2}{\ekv@defsetmacro} % \end{macrocode} % \end{macro} % % \begin{macro}{\ekvifdefinedset} % \begin{macrocode} -\ekv@expB@unbraceA{\ekv@expB@unbraceA{\def\ekvifdefinedset#1}}% - {% - \expandafter\ekv@ifdefined\expandafter{\ekv@undefined@set{#1}}% - } +\ekv@expargtwice{\def\ekvifdefinedset#1}% + {\expandafter\ekv@ifdefined\expandafter{\ekv@undefined@set{#1}}} % \end{macrocode} % \end{macro} % @@ -1466,7 +1471,7 @@ and the derived files expkv.pdf \begingroup \def\ekvset#1#2{% \endgroup -\ekv@expB@unbraceA{\long\def\ekvset##1##2}% +\ekv@exparg{\long\def\ekvset##1##2}% {% \expandafter\expandafter\expandafter \ekv@set\expandafter\csname\ekv@undefined@set{##1}\endcsname @@ -1515,14 +1520,8 @@ and the derived files expkv.pdf % fast branching based on \TeX's argument grabbing rules and we don't have to % split after the branching if the equal sign was there. % \begin{macrocode} -\long\def\ekv@eq@other##1=##2\ekv@mark##3% - {% - ##3##1\ekv@stop\ekv@mark##2% - } -\long\def\ekv@eq@active##1#2##2\ekv@mark##3% - {% - ##3##1\ekv@stop\ekv@mark##2% - } +\long\def\ekv@eq@other##1=##2\ekv@mark##3{##3##1\ekv@stop\ekv@mark##2} +\long\def\ekv@eq@active##1#2##2\ekv@mark##3{##3##1\ekv@stop\ekv@mark##2} % \end{macrocode} % \end{macro} % @@ -1568,7 +1567,7 @@ and the derived files expkv.pdf % needed to delimit |\ekv@set@pair|'s argument anyway, so we just leave it % there. % \begin{macrocode} -\ekv@expB@unbraceA +\ekv@exparg {% \long\def\ekv@set@eq@other@b ##1\ekv@nil\ekv@mark\ekv@set@eq@other@active\ekv@stop\ekv@mark @@ -1585,7 +1584,7 @@ and the derived files expkv.pdf % |##2| everything that remains until the first found other equal sign. It has % to reinsert the equal sign and forward things to |\ekv@set@pair|. % \begin{macrocode} -\ekv@expB@unbraceA +\ekv@exparg {% \long\def\ekv@set@eq@other@active ##1\ekv@stop##2\ekv@nil#2\ekv@mark @@ -1610,11 +1609,9 @@ and the derived files expkv.pdf % If an active equal sign was found in |\ekv@set@eq@active| we'll have to pass % the now split \kv\ pair on to |\ekv@set@pair|. % \begin{macrocode} -\ekv@expB@unbraceA +\ekv@exparg {\long\def\ekv@set@eq@active@##1\ekv@stop##2\ekv@nil#2\ekv@mark\ekv@set@noeq}% - {% - \ekv@strip{##1}{\expandafter\ekv@set@pair\detokenize}\ekv@mark##2\ekv@nil - } + {\ekv@strip{##1}{\expandafter\ekv@set@pair\detokenize}\ekv@mark##2\ekv@nil} % \end{macrocode} % \end{macro} % @@ -1635,21 +1632,16 @@ and the derived files expkv.pdf \unexpanded\expandafter {\ekv@strip{##1}{\expandafter\ekv@set@key\detokenize}\ekv@mark}% } -\ekv@expB@unbraceA +\ekv@exparg {% \long\def\ekv@set@noeq ##1\ekv@nil\ekv@mark\ekv@set@eq@active@\ekv@stop\ekv@mark }% {\ekv@set@noeq} -\def\ekv@set@was@blank##1% - {% - \def\ekv@set@was@blank - \ekv@ifempty@A\ekv@ifempty@B - \ekv@strip@a\ekv@mark####1\ekv@nil\ekv@mark##1##1\ekv@nil\ekv@stop - ####2\ekv@mark - {\ekv@set@other}% - } -\ekv@set@was@blank{ } +\expandafter\def\expandafter\ekv@set@was@blank + \expandafter\ekv@ifempty@A\expandafter\ekv@ifempty@B + \ekv@strip{\ekv@mark##1}##2\ekv@mark + {\ekv@set@other} % \end{macrocode} % \end{macro} % @@ -1679,14 +1671,8 @@ and the derived files expkv.pdf % One last thing we want to do for |\ekvset| is to provide macros that just % smuggle stuff after |\ekvset|'s effects. % \begin{macrocode} -\long\def\ekvsneak##1##2\ekv@stop#1##3% - {% - ##2\ekv@stop#1{##3##1}% - } -\long\def\ekvsneakPre##1##2\ekv@stop#1##3% - {% - ##2\ekv@stop#1{##1##3}% - } +\long\def\ekvsneak##1##2\ekv@stop#1##3{##2\ekv@stop#1{##3##1}} +\long\def\ekvsneakPre##1##2\ekv@stop#1##3{##2\ekv@stop#1{##1##3}} % \end{macrocode} % \end{macro} % @@ -1697,10 +1683,7 @@ and the derived files expkv.pdf % |\unexpanded| here and there instead of other macros to stop the |\expanded| % on our output. % \begin{macrocode} -\long\def\ekvparse##1##2##3% - {% - \ekv@parse##1##2\ekv@mark##3#1\ekv@stop#1% - } +\long\def\ekvparse##1##2##3{\ekv@parse{##1}{##2}\ekv@mark##3#1\ekv@stop#1} % \end{macrocode} % \end{macro} % @@ -1709,7 +1692,7 @@ and the derived files expkv.pdf \long\def\ekv@parse##1##2##3#1% {% \ekv@gobble@from@mark@to@stop##3\ekv@endparse\ekv@stop - \ekv@parse@other##1##2##3,\ekv@stop,% + \ekv@parse@other{##1}{##2}##3,\ekv@stop,% } % \end{macrocode} % \end{macro} @@ -1729,7 +1712,7 @@ and the derived files expkv.pdf \ekv@gobble@from@mark@to@stop##3\ekv@endparse@other\ekv@stop \ekv@eq@other##3\ekv@nil\ekv@mark\ekv@parse@eq@other@a =\ekv@mark\ekv@parse@eq@active - ##1##2% + {##1}{##2}% \ekv@mark } % \end{macrocode} @@ -1742,7 +1725,7 @@ and the derived files expkv.pdf \ekv@eq@active##1\ekv@nil\ekv@mark\ekv@parse@eq@other@active #2\ekv@mark\ekv@parse@eq@other@b } -\ekv@expB@unbraceA +\ekv@exparg {% \long\def\ekv@parse@eq@other@b ##1\ekv@nil\ekv@mark\ekv@parse@eq@other@active\ekv@stop\ekv@mark @@ -1754,7 +1737,7 @@ and the derived files expkv.pdf % % \begin{macro}[internal]{\ekv@parse@eq@other@active} % \begin{macrocode} -\ekv@expB@unbraceA +\ekv@exparg {% \long\def\ekv@parse@eq@other@active ##1\ekv@stop##2\ekv@nil#2\ekv@mark @@ -1772,11 +1755,9 @@ and the derived files expkv.pdf \ekv@eq@active##1\ekv@nil\ekv@mark\ekv@parse@eq@active@ #2\ekv@mark\ekv@parse@noeq } -\ekv@expB@unbraceA +\ekv@exparg {\long\def\ekv@parse@eq@active@##1\ekv@stop##2#2\ekv@mark\ekv@parse@noeq}% - {% - \ekv@strip{##1}\ekv@parse@pair##2% - } + {\ekv@strip{##1}\ekv@parse@pair##2} % \end{macrocode} % \end{macro} % @@ -1791,21 +1772,16 @@ and the derived files expkv.pdf }% \unexpanded\expandafter{\ekv@strip{##1}\ekv@parse@key}% } -\ekv@expB@unbraceA +\ekv@exparg {% \long\def\ekv@parse@noeq ##1\ekv@nil\ekv@mark\ekv@parse@eq@active@\ekv@stop\ekv@mark }% {\ekv@parse@noeq} -\def\ekv@parse@was@blank##1% - {% - \def\ekv@parse@was@blank - \ekv@ifempty@A\ekv@ifempty@B - \ekv@strip@a\ekv@mark####1\ekv@nil\ekv@mark##1##1\ekv@nil\ekv@stop - \ekv@parse@key - {\ekv@parse@other}% - } -\ekv@parse@was@blank{ } +\expandafter\def\expandafter\ekv@parse@was@blank + \expandafter\ekv@ifempty@A\expandafter\ekv@ifempty@B + \ekv@strip{\ekv@mark##1}\ekv@parse@key + {\ekv@parse@other} % \end{macrocode} % \end{macro} % @@ -1821,24 +1797,22 @@ and the derived files expkv.pdf % % \begin{macro}[internal]{\ekv@parse@pair,\ekv@parse@pair@} % \begin{macrocode} -\ekv@expB@unbraceA{\long\def\ekv@parse@pair##1##2\ekv@nil}% - {% - \ekv@strip{##2}\ekv@parse@pair@{##1}% - } +\ekv@exparg{\long\def\ekv@parse@pair##1##2\ekv@nil}% + {\ekv@strip{##2}\ekv@parse@pair@{##1}} \long\def\ekv@parse@pair@##1##2##3##4% {% \unexpanded{##4{##2}{##1}}% - \ekv@parse@other##3##4% + \ekv@parse@other{##3}{##4}% } % \end{macrocode} % \end{macro} % % \begin{macro}[internal]{\ekv@parse@key} % \begin{macrocode} -\long\def\ekv@parse@key##1##2##3% +\long\def\ekv@parse@key##1##2% {% \unexpanded{##2{##1}}% - \ekv@parse@other##2##3% + \ekv@parse@other{##2}% } % \end{macrocode} % \end{macro} @@ -1861,8 +1835,7 @@ and the derived files expkv.pdf \unexpanded{\ekvsneak{#2}}% \unexpanded\expandafter{\ekvset{#1}{#3}}% } -\ekv@expB@unbraceA{\ekv@expB@unbraceA{\long\def\ekvsetSneaked#1#2#3}}% - {\ekvsetSneaked} +\ekv@expargtwice{\long\def\ekvsetSneaked#1#2#3}{\ekvsetSneaked} % \end{macrocode} % \end{macro} % @@ -1875,7 +1848,7 @@ and the derived files expkv.pdf % switch out the set expandably, so this works similar to the |\ekvsneak| macros % reading and reinserting the remainder of the \kv\ list. % \begin{macrocode} -\ekv@expB@unbraceA{\def\ekvchangeset#1}% +\ekv@exparg{\def\ekvchangeset#1}% {% \expandafter\expandafter\expandafter \ekv@changeset\expandafter\csname\ekv@undefined@set{#1}\endcsname\ekv@empty @@ -1888,10 +1861,7 @@ and the derived files expkv.pdf % leading |\ekv@empty| so that braces aren't stripped accidentally, but that % will not hurt and just expand to nothing in one step. % \begin{macrocode} -\long\def\ekv@changeset#1#2\ekv@set@other#3% - {% - #2\ekv@set@other#1% - } +\long\def\ekv@changeset#1#2\ekv@set@other#3{#2\ekv@set@other#1} % \end{macrocode} % \end{macro} % @@ -1964,7 +1934,7 @@ and the derived files expkv.pdf \fi \ekv@set@pair@d#1% } -\ekv@expB@unbraceA{\long\def\ekv@set@pair@d#1#2#3}{\ekv@strip{#2}#1} +\ekv@exparg{\long\def\ekv@set@pair@d#1#2#3}{\ekv@strip{#2}#1} \long\def\ekv@set@pair@e\fi\ekv@set@pair@d#1#2#3{\fi#3} % \end{macrocode} % \end{macro} @@ -2028,13 +1998,13 @@ and the derived files expkv.pdf % \begin{macro}{\ekvsetdef} % Provide a macro to define a shorthand to use |\ekvset| on a specified \set. % To gain the maximum speed |\ekvset| is expanded twice by -% |\ekv@expB@unbraceA| so that during runtime the macro storing the set name +% |\ekv@exparg| so that during runtime the macro storing the set name % is already built and one |\expandafter| doesn't have to be used. % \begin{macrocode} -\ekv@expB@unbraceA{\ekv@expB@unbraceA{\ekv@expB@unbraceA{\ekv@expB@unbraceA{% -\protected\def\ekvsetdef#1#2}}}}% +\ekv@expargtwice{\protected\def\ekvsetdef#1#2}% {% - \ekv@expB@unbraceA{\ekv@expB@unbraceA{\long\def#1##1}}% + \romannumeral + \ekv@exparg{\ekv@zero\ekv@exparg{\long\def#1##1}}% {\ekvset{#2}{##1}}% } % \end{macrocode} @@ -2044,16 +2014,16 @@ and the derived files expkv.pdf % And do the same for |\ekvsetSneaked| in the two possible ways, with a fixed % sneaked argument and with a flexible one. % \begin{macrocode} -\ekv@expB@unbraceA{\ekv@expB@unbraceA{\ekv@expB@unbraceA{\ekv@expB@unbraceA{% -\protected\def\ekvsetSneakeddef#1#2}}}}% +\ekv@expargtwice{\protected\def\ekvsetSneakeddef#1#2}% {% - \ekv@expB@unbraceA{\ekv@expB@unbraceA{\long\def#1##1##2}}% + \romannumeral + \ekv@exparg{\ekv@zero\ekv@exparg{\long\def#1##1##2}}% {\ekvsetSneaked{#2}{##1}{##2}}% } -\ekv@expB@unbraceA{\ekv@expB@unbraceA{\ekv@expB@unbraceA{\ekv@expB@unbraceA{% -\protected\def\ekvsetdefSneaked#1#2#3}}}}% +\ekv@expargtwice{\protected\def\ekvsetdefSneaked#1#2#3}% {% - \ekv@expB@unbraceA{\ekv@expB@unbraceA{\long\def#1##1}}% + \romannumeral + \ekv@exparg{\ekv@zero\ekv@exparg{\long\def#1##1}}% {\ekvsetSneaked{#2}{#3}{##1}}% } % \end{macrocode} @@ -2090,12 +2060,9 @@ and the derived files expkv.pdf % \begin{macrocode} \long\def\ekv@err@common #1#2{\expandafter\ekv@err@common@\string#2{#1}} \long\def\ekv@err@common@#1`#2' #3.#4#5{\ekv@err{#4 (`#5', set `#2')}} -\ekv@expB@unbraceA{\long\def\ekv@err@unknown#1}% - {\ekv@err@common{unknown key}{#1}} -\ekv@expB@unbraceA{\long\def\ekv@err@noarg #1}% - {\ekv@err@common{value forbidden}{#1}} -\ekv@expB@unbraceA{\long\def\ekv@err@reqval #1}% - {\ekv@err@common{value required}{#1}} +\ekv@exparg{\long\def\ekv@err@unknown#1}{\ekv@err@common{unknown key}{#1}} +\ekv@exparg{\long\def\ekv@err@noarg #1}{\ekv@err@common{value forbidden}{#1}} +\ekv@exparg{\long\def\ekv@err@reqval #1}{\ekv@err@common{value required}{#1}} % \end{macrocode} % \end{macro} % diff --git a/macros/generic/expkv/expkv.pdf b/macros/generic/expkv/expkv.pdf Binary files differindex 4396ddfee2..ba39085660 100644 --- a/macros/generic/expkv/expkv.pdf +++ b/macros/generic/expkv/expkv.pdf |