diff options
-rw-r--r-- | Master/texmf-dist/doc/latex/expkv/README.md | 2 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/expkv/expkv.pdf | bin | 481077 -> 480586 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/expkv/expkv.dtx | 68 | ||||
-rw-r--r-- | Master/texmf-dist/tex/generic/expkv/expkv.tex | 25 |
4 files changed, 50 insertions, 45 deletions
diff --git a/Master/texmf-dist/doc/latex/expkv/README.md b/Master/texmf-dist/doc/latex/expkv/README.md index adc545fd808..a402daa7743 100644 --- a/Master/texmf-dist/doc/latex/expkv/README.md +++ b/Master/texmf-dist/doc/latex/expkv/README.md @@ -1,7 +1,7 @@ ------------------------------------------------------------------------------- # expkv -- an expandable key=val implementation -Version 2021-05-24 v1.8 +Version 2021-06-03 v1.8a Released under the LaTeX Project Public License v1.3c or later See http://www.latex-project.org/lppl.txt diff --git a/Master/texmf-dist/doc/latex/expkv/expkv.pdf b/Master/texmf-dist/doc/latex/expkv/expkv.pdf Binary files differindex 1f9248c9ec5..c72c22153a4 100644 --- a/Master/texmf-dist/doc/latex/expkv/expkv.pdf +++ b/Master/texmf-dist/doc/latex/expkv/expkv.pdf diff --git a/Master/texmf-dist/source/latex/expkv/expkv.dtx b/Master/texmf-dist/source/latex/expkv/expkv.dtx index 37a67fc7812..283cd0353db 100644 --- a/Master/texmf-dist/source/latex/expkv/expkv.dtx +++ b/Master/texmf-dist/source/latex/expkv/expkv.dtx @@ -529,7 +529,7 @@ and the derived files expkv.pdf % sets are discarded, if the \key\ isn't found in any set an error will be % thrown eventually. Note that the error messages are affected by the use of % this macro, in particular, it isn't checked whether a |NoVal| key of the -% same name is defined in order to throw a |value forbidden| error. +% same name is defined in order to throw an |unwanted value| error. % |\ekvdefunknown| and |\ekvredirectunknown| are mutually exclusive, % you can't use both. % \end{function} @@ -547,7 +547,7 @@ and the derived files expkv.pdf % |NoVal| keys. Again no prefixes are supported. Note that the error messages % are affected by the use of this macro, in particular, it isn't checked % whether a normal key of the same name is defined in order to throw a -% |value forbidden| error. +% |missing value| error. % |\ekvdefunknownNoVal| and |\ekvredirectunknownNoVal| are mutually exclusive, % you can't use both. % \end{function} @@ -694,12 +694,17 @@ and the derived files expkv.pdf % the \key. There are no macros like these two contained in \expkv, you have % to set them up yourself if you want to use |\ekvparse| (of course the names % might differ). If you need the results of |\ekvparse| as the argument for -% another macro, you should use |\expanded| as only then the input stream will -% contain the output above: +% another macro, you should use |\expanded|, or expand |\ekvparse| twice, as +% only then the input stream will contain the output above: % \begin{lstlisting} % \expandafter\parse\expanded{\ekvparse\k\kv{foo = bar, key, baz={zzz}}} % \end{lstlisting} -% would expand to +% or +% \begin{lstlisting} +% \expandafter\expandafter\expandafter +% \parse\ekvparse\k\kv{foo = bar, key, baz={zzz}} +% \end{lstlisting} +% would both expand to % \begin{lstlisting} % \parse\kv{foo}{bar}\k{key}\kv{baz}{zzz} % \end{lstlisting} @@ -808,11 +813,12 @@ and the derived files expkv.pdf % \meta{next}\marg{default}\marg{mandatory} (so the default will be used and % the mandatory argument will be wrapped in braces). % \end{function} -% |\ekvoptarg| expands in exactly two steps and is alignment safe. It has its -% limitations however. It can't tell the difference between |[| and |{[}|, so it -% doesn't work if the mandatory argument is a single bracket. Also if the -% optional argument should contain a nested closing bracket, the optional -% argument has to use nested braces like so: |[{arg]ument}]|. +% |\ekvoptarg| expands in exactly two steps, grabs all the arguments only at the +% second expansion step, and is alignment safe. It has its limitations however. +% It can't tell the difference between |[| and |{[}|, so it doesn't work if the +% mandatory argument is a single bracket. Also if the optional argument should +% contain a nested closing bracket, the optional argument has to use nested +% braces like so: |[{arg]ument}]|. % \example Say we have a macro that should take an optional argument defaulting % to 1: % \begin{lstlisting}[aboveskip=0pt,belowskip=0pt] @@ -828,8 +834,9 @@ and the derived files expkv.pdf % \meta{true}\marg{optional}\meta{mandatory} or \meta{false}\marg{mandatory} % instead of placing a default value. % \end{function} -% |\ekvoptargTF| expands in exactly two steps and is alignment safe. It has the -% same limitations as |\ekvoptarg|. +% |\ekvoptargTF| expands in exactly two steps, grabs all the arguments only at +% the second expansion step, and is alignment safe. It has the same limitations +% as |\ekvoptarg|. % \example Say we have a macro that should behave differently depending on % whether there was an optional argument or not. This could be done with: % \begin{lstlisting}[aboveskip=0pt,belowskip=0pt] @@ -1207,7 +1214,7 @@ and the derived files expkv.pdf % \file{expkv.tex} checks whether \eTeX\ and the |\expanded| primitive are % available. If it isn't, an error will be thrown using |\errmessage|: % \begin{lstlisting} -% ! expkv Error: e-TeX required. +% ! expkv Error: e-TeX and \expanded required. % \end{lstlisting} % % \subsubsection{Defining Keys} @@ -1547,8 +1554,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.8} -\def\ekvDate{2021-05-24} +\def\ekvVersion{1.8a} +\def\ekvDate{2021-06-03} % \end{macrocode} % \end{macro} % @@ -2689,30 +2696,28 @@ and the derived files expkv.pdf \def\ekvoptarg#1#2{% \endgroup % \end{macrocode} -% The real definition starts an expansion context after grabbing the arguments. -% |#1| will be the next step, |#2| the default value, and |#3| might be an -% opening bracket, or the mandatory argument. We check for the opening bracket, -% if it is found grab the optional argument, else leave |#1{#2}| in the input -% stream after ending the expansion context. +% The real definition starts an expansion context and afterwards grabs the +% arguments. |#1| will be the next step, |#2| the default value, and |#3| might +% be an opening bracket, or the mandatory argument. We check for the opening +% bracket, if it is found grab the optional argument, else leave |#1{#2}| in the +% input stream after ending the expansion context. % \begin{macrocode} -\long\def\ekvoptarg##1##2##3% +\def\ekvoptarg{\romannumeral#1\ekv@optarg@a} +\long\def\ekv@optarg@a##1##2##3% {% - \romannumeral - #1% - \ekv@optarg@if\ekv@mark##3\ekv@mark\ekv@optarg\ekv@mark[\ekv@mark + \ekv@optarg@if\ekv@mark##3\ekv@mark\ekv@optarg@b\ekv@mark[\ekv@mark #2% \@firstofone{\ekv@zero##1}{##2}{##3}% - } + }% % \end{macrocode} % The other variant of this will do roughly the same. Here, |#1| will be the % next step if an optional argument is found, |#2| the next step else, and |#3| % might be the opening bracket or mandatory argument. % \begin{macrocode} -\long\def\ekvoptargTF##1##2##3% +\def\ekvoptargTF{\romannumeral#1\ekv@optargTF@a} +\long\def\ekv@optargTF@a##1##2##3% {% - \romannumeral - #1% - \ekv@optarg@if\ekv@mark##3\ekv@mark\ekv@optargTF{##1}\ekv@mark[\ekv@mark + \ekv@optarg@if\ekv@mark##3\ekv@mark\ekv@optargTF@b{##1}\ekv@mark[\ekv@mark #2% \@firstofone{\ekv@zero##2}{##3}% } @@ -2720,9 +2725,10 @@ and the derived files expkv.pdf % The two macros to grab the optional argument have to remove the remainder of % the test and the wrong next step as well as grabbing the argument. % \begin{macrocode} -\long\def\ekv@optarg\ekv@mark[\ekv@mark\ifnum`##1\fi\@firstofone##2##3##4##5]% +\long\def\ekv@optarg@b\ekv@mark[\ekv@mark\ifnum`##1\fi\@firstofone##2##3##4##5]% {#2##2{##5}} -\long\def\ekv@optargTF##1\ekv@mark[\ekv@mark\ifnum`##2\fi\@firstofone##3##4##5]% +\long\def\ekv@optargTF@b + ##1\ekv@mark[\ekv@mark\ifnum`##2\fi\@firstofone##3##4##5]% {#2\ekv@zero##1{##5}} } % \end{macrocode} diff --git a/Master/texmf-dist/tex/generic/expkv/expkv.tex b/Master/texmf-dist/tex/generic/expkv/expkv.tex index 7e99c8897a8..f1c4719476b 100644 --- a/Master/texmf-dist/tex/generic/expkv/expkv.tex +++ b/Master/texmf-dist/tex/generic/expkv/expkv.tex @@ -44,8 +44,8 @@ \errmessage{expkv Error: e-TeX and \noexpand\expanded required} \expandafter\endinput \fi -\def\ekvVersion{1.8} -\def\ekvDate{2021-05-24} +\def\ekvVersion{1.8a} +\def\ekvDate{2021-06-03} \csname ekv@tmp\endcsname \expandafter\chardef\csname ekv@tmp\endcsname=\catcode`\@ \catcode`\@=11 @@ -658,25 +658,24 @@ \begingroup \def\ekvoptarg#1#2{% \endgroup -\long\def\ekvoptarg##1##2##3% +\def\ekvoptarg{\romannumeral#1\ekv@optarg@a} +\long\def\ekv@optarg@a##1##2##3% {% - \romannumeral - #1% - \ekv@optarg@if\ekv@mark##3\ekv@mark\ekv@optarg\ekv@mark[\ekv@mark + \ekv@optarg@if\ekv@mark##3\ekv@mark\ekv@optarg@b\ekv@mark[\ekv@mark #2% \@firstofone{\ekv@zero##1}{##2}{##3}% - } -\long\def\ekvoptargTF##1##2##3% + }% +\def\ekvoptargTF{\romannumeral#1\ekv@optargTF@a} +\long\def\ekv@optargTF@a##1##2##3% {% - \romannumeral - #1% - \ekv@optarg@if\ekv@mark##3\ekv@mark\ekv@optargTF{##1}\ekv@mark[\ekv@mark + \ekv@optarg@if\ekv@mark##3\ekv@mark\ekv@optargTF@b{##1}\ekv@mark[\ekv@mark #2% \@firstofone{\ekv@zero##2}{##3}% } -\long\def\ekv@optarg\ekv@mark[\ekv@mark\ifnum`##1\fi\@firstofone##2##3##4##5]% +\long\def\ekv@optarg@b\ekv@mark[\ekv@mark\ifnum`##1\fi\@firstofone##2##3##4##5]% {#2##2{##5}} -\long\def\ekv@optargTF##1\ekv@mark[\ekv@mark\ifnum`##2\fi\@firstofone##3##4##5]% +\long\def\ekv@optargTF@b + ##1\ekv@mark[\ekv@mark\ifnum`##2\fi\@firstofone##3##4##5]% {#2\ekv@zero##1{##5}} } \ekv@exparg{\expandafter\ekvoptarg\expandafter{\ekv@alignsafe}}\ekv@endalignsafe |