texlive[70689] Master/texmf-dist: collargs (18mar24)

commits+karl at tug.org commits+karl at tug.org
Mon Mar 18 20:59:32 CET 2024


Revision: 70689
          https://tug.org/svn/texlive?view=revision&revision=70689
Author:   karl
Date:     2024-03-18 20:59:31 +0100 (Mon, 18 Mar 2024)
Log Message:
-----------
collargs (18mar24)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/generic/collargs/CHANGELOG.md
    trunk/Master/texmf-dist/doc/generic/collargs/README.md
    trunk/Master/texmf-dist/source/generic/collargs/collargs.edtx
    trunk/Master/texmf-dist/tex/context/third/collargs/t-collargs.tex
    trunk/Master/texmf-dist/tex/latex/collargs/collargs.sty
    trunk/Master/texmf-dist/tex/plain/collargs/collargs.tex

Modified: trunk/Master/texmf-dist/doc/generic/collargs/CHANGELOG.md
===================================================================
--- trunk/Master/texmf-dist/doc/generic/collargs/CHANGELOG.md	2024-03-18 19:59:21 UTC (rev 70688)
+++ trunk/Master/texmf-dist/doc/generic/collargs/CHANGELOG.md	2024-03-18 19:59:31 UTC (rev 70689)
@@ -14,6 +14,16 @@
 repository](https://github.com/sasozivanovic/memoize) for the recent
 development history.
 
+## 2024/03/15 v1.2.0
+* Argument processors:
+  * They now work without a formal argument, taking token register
+    `\collargsArg` as input. The processors taking a formal argument were
+    impossible (or at least too hard for me) to define.
+	* Remove `append/prepend pre/postwrap`, as they become useless with the above
+    change.
+* Implement keys `clear args` and `return`, and expose `\collargsArgs`.
+* Implement key `alias`.
+
 ## 2024/01/02 v1.1.0
 * Implement `brace collected`.
 

Modified: trunk/Master/texmf-dist/doc/generic/collargs/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/generic/collargs/README.md	2024-03-18 19:59:21 UTC (rev 70688)
+++ trunk/Master/texmf-dist/doc/generic/collargs/README.md	2024-03-18 19:59:31 UTC (rev 70689)
@@ -1,6 +1,6 @@
 Package CollArgs provides a command which can determine the argument scope of
-any command whose argument structure conforms to
-[xparse](https://ctan.org/pkg/xparse)'s argument specification.
+any command whose argument structure conforms to 
+[LaTeX3 argument specification](https://www.latex-project.org/help/documentation/usrguide.pdf).
 
 This package was developed as an auxiliary package of
 [Memoize](https://ctan.org/pkg/memoize).  This is why it is, somewhat
@@ -15,5 +15,5 @@
 https://www.latex-project.org/lppl.txt and version 1.3c or later is part of all
 distributions of LaTeX version 2008 or later.
 
-This work has the LPPL maintenance status `maintained'.  The Current Maintainer
-of this work is Sašo Živanović (saso.zivanovic at guest.arnes.si).
+This work has the LPPL maintenance status `maintained`.  The Current Maintainer
+of this work is Sašo Živanović (`saso.zivanovic at guest.arnes.si`).

Modified: trunk/Master/texmf-dist/source/generic/collargs/collargs.edtx
===================================================================
--- trunk/Master/texmf-dist/source/generic/collargs/collargs.edtx	2024-03-18 19:59:21 UTC (rev 70688)
+++ trunk/Master/texmf-dist/source/generic/collargs/collargs.edtx	2024-03-18 19:59:31 UTC (rev 70689)
@@ -46,14 +46,14 @@
 % 
 % 
 % \paragraph{Identification}
-%<latex>\ProvidesPackage{collargs}[2024/01/02 v1.1.0 Collect arguments of any command]
+%<latex>\ProvidesPackage{collargs}[2024/03/15 v1.2.0 Collect arguments of any command]
 %<context>%D \module[
 %<context>%D         file=t-collargs.tex,
-%<context>%D      version=1.1.0,
+%<context>%D      version=1.2.0,
 %<context>%D        title=CollArgs,
 %<context>%D     subtitle=Collect arguments of any command,
 %<context>%D       author=Saso Zivanovic,
-%<context>%D         date=2024-01-02,
+%<context>%D         date=2024-03-15,
 %<context>%D    copyright=Saso Zivanovic,
 %<context>%D      license=LPPL,
 %<context>%D ]
@@ -105,15 +105,14 @@
 % \end{macro}
 % 
 % \begin{macro}{\CollectArguments,\CollectArgumentsRaw}
-%   These are the only public commands provided by the
-%   package. |\CollectArguments| takes three arguments: the optional |#1| is
-%   the option list, processed by |pgfkeys| (given the grouping structure,
-%   these options will apply to all arguments); the mandatory |#2| is the
-%   |xparse|-style argument specification; the mandatory |#3| is the ``next''
-%   command (or a sequence of commands).  The argument list is expected to
-%   start immediately after the final argument; |\CollectArguments| parses it,
-%   effectively figuring out its extent, and then passes the entire argument
-%   list to the ``next'' command (as a single argument).
+%   |\CollectArguments| takes three arguments: the optional |#1| is the option
+%   list, processed by |pgfkeys| (given the grouping structure, these options
+%   will apply to all arguments); the mandatory |#2| is the |xparse|-style
+%   argument specification; the mandatory |#3| is the ``next'' command (or a
+%   sequence of commands).  The argument list is expected to start immediately
+%   after the final argument; |\CollectArguments| parses it, effectively
+%   figuring out its extent, and then passes the entire argument list to the
+%   ``next'' command (as a single argument).
 % 
 %   |\CollectArgumentsRaw| differs only in how it takes and processes the
 %   options.  For one, these should be given as a mandatory argument.
@@ -145,7 +144,9 @@
   % Remember the code to execute after collection.
   \def\collargs at next{#3}%
   % Initialize the token register holding the collected arguments.
-  \global\collargs at toks{}%
+  \ifcollargsClearArgs
+    \global\collargsArgs{}%
+  \fi
   % Execute the central loop macro, which expects the argument specification
   % |#2| to be delimited from the following argument tokens by a dot.
   \collargs@#2.%
@@ -162,7 +163,6 @@
 \def\collargsSet#1{\pgfqkeys{/collargs}{#1}}
 % \end{macro}
 %
-% 
 % \subsubsection{The keys}
 % \label{sec:code:collargs:keys}
 % 
@@ -409,24 +409,10 @@
   append postprocessor/.code={\collargsAppendPostprocessor{#1}},
   prepend postprocessor/.code={\collargsPrependPostprocessor{#1}},
 }
-\def\collargsAppendPreprocessor{%
-  \collargs at addprocessor\appto\collargs at preprocess@arg}
-\def\collargsPrependPreprocessor{%
-  \collargs at addprocessor\preto\collargs at preprocess@arg}
-\def\collargsAppendPostprocessor{%
-  \collargs at addprocessor\appto\collargs at postprocess@arg}
-\def\collargsPrependPostprocessor{%
-  \collargs at addprocessor\preto\collargs at postprocess@arg}
-% Here, |#1| will be either |\appto| or |\preto|, and |#2| will be either
-% |\collargs at preprocess@arg| or |\collargs at postprocess@arg|.  |#3| is the
-% processor code.
-\def\collargs at addprocessor#1#2#3{%
-  #1#2{%
-    \expanded{%
-      \unexpanded{#3}{\the\collargsArg}%
-    }%
-  }%
-}
+\def\collargsAppendPreprocessor#1{\appto\collargs at preprocess@arg{#1}}
+\def\collargsPrependPreprocessor#1{\preto\collargs at preprocess@arg{#1}}
+\def\collargsAppendPostprocessor#1{\appto\collargs at postprocess@arg{#1}}
+\def\collargsPrependPostprocessor#1{\preto\collargs at postprocess@arg{#1}}
 % \end{macro}
 % \end{collargskey}
 % \end{macro}
@@ -451,73 +437,40 @@
 % \end{collargskey}
 % \end{macro}
 % \end{collargskey}
-% 
+%
 % \begin{collargskey}[noindex]{(append/prepend) expandable (pre/post)processor}
 %   \begin{macro}[noindex]{\collargs(Append/Prepend)Expandable(Pre/Post)processor}
 %     \begin{collargskey}[noprint]{append expandable preprocessor, prepend expandable preprocessor, append expandable postprocessor, prepend expandable postprocessor}
 %       \begin{macro}[noprint]{\collargsAppendExpandablePreprocessor,\collargsPrependExpandablePreprocessor,\collargsAppendExpandablePostprocessor,\collargsPrependExpandablePostprocessor}
-%     These keys
-%     and macros simplify the definition of fully expandable processors.  Note
-%     that expandable processors are added to the same list as non-expandable
-%     processors.
+%         These keys and macros simplify the definition of expandable
+%         processors.  Note that expandable processors are added to the same
+%         list as non-expandable processors.
 \collargsSet{
-  append expandable preprocessor/.code={%
-    \collargsAppendExpandablePreprocessor{#1}},
-  prepend expandable preprocessor/.code={%
-    \collargsPrependExpandablePreprocessor{#1}},
-  append expandable postprocessor/.code={%
-    \collargsAppendExpandablePostprocessor{#1}},
-  prepend expandable postprocessor/.code={%
-    \collargsPrependExpandablePostprocessor{#1}},
+  append expandable preprocessor/.code={\collargsAppendExpandablePreprocessor{#1}},
+  prepend expandable preprocessor/.code={\collargsPrependExpandablePreprocessor{#1}},
+  append expandable postprocessor/.code={\collargsAppendExpandablePostprocessor{#1}},
+  prepend expandable postprocessor/.code={\collargsPrependExpandablePostprocessor{#1}},
 }
-\def\collargsAppendExpandablePreprocessor{%
-  \collargs at addeprocessor\appto\collargs at preprocess@arg}
-\def\collargsPrependExpandablePreprocessor{%
-  \collargs at addeprocessor\preto\collargs at preprocess@arg}
-\def\collargsAppendExpandablePostprocessor{%
-  \collargs at addeprocessor\appto\collargs at postprocess@arg}
-\def\collargsPrependExpandablePostprocessor{%
-  \collargs at addeprocessor\preto\collargs at postprocess@arg}
-\def\collargs at addeprocessor#1#2#3{%
-  #1#2{%
-    \expanded{%
-      \edef\noexpand\collargs at temp{\unexpanded{#3}{\the\collargsArg}}%
-      \unexpanded{\expandafter\collargsArg\expandafter{\collargs at temp}}%
-    }%
+\def\collargsAppendExpandablePreprocessor#1{%
+  \appto\collargs at preprocess@arg{%
+    \collargsArg\expandafter{\expanded{#1}}%
   }%
 }
-% \end{macro}
-% \end{collargskey}
-% \end{macro}
-% \end{collargskey}
-% 
-% \begin{collargskey}[noindex]{(append/prepend) (pre/post)wrap}
-%   \begin{macro}[noindex]{\collargs(Append/Prepend)(Pre/Post)wrap}
-%     \begin{collargskey}[noprint]{append prewrap, prepend prewrap, append postwrap, prepend postwrap}
-%       \begin{macro}[noprint]{\collargsAppendPrewrap,\collargsPrependPrewrap,\collargsAppendPostwrap,\collargsPrependPostwrap}
-%      These keys and macros
-%     simplify the definition of processors which yield the result after a
-%     single expansion.  Again, they are added to the same list as other
-%     processors.
-\collargsSet{
-  append prewrap/.code={\collargsAppendPrewrap{#1}},
-  prepend prewrap/.code={\collargsPrependPrewrap{#1}},
-  append postwrap/.code={\collargsAppendPostwrap{#1}},
-  prepend postwrap/.code={\collargsPrependPostwrap{#1}},
+\def\collargsPrependExpandablePreprocessor#1{%
+  \preto\collargs at preprocess@arg{%
+    \collargsArg\expandafter{\expanded{#1}}%
+  }%
 }
-\def\collargsAppendPrewrap{\collargs at addwrap\appto\collargs at preprocess@arg}
-\def\collargsPrependPrewrap{\collargs at addwrap\preto\collargs at preprocess@arg}
-\def\collargsAppendPostwrap{\collargs at addwrap\appto\collargs at postprocess@arg}
-\def\collargsPrependPostwrap{\collargs at addwrap\preto\collargs at postprocess@arg}
-\def\collargs at addwrap#1#2#3{%
-  #1#2{%
-    \long\def\collargs at temp##1{#3}%
-    \expandafter\expandafter\expandafter\collargsArg
-    \expandafter\expandafter\expandafter{%
-      \expandafter\collargs at temp\expandafter{\the\collargsArg}%
-    }%
+\def\collargsAppendExpandablePostprocessor#1{%
+  \appto\collargs at postprocess@arg{%
+    \collargsArg\expandafter{\expanded{#1}}%
   }%
 }
+\def\collargsPrependExpandablePostprocessor#1{%
+  \preto\collargs at postprocess@arg{%
+    \collargsArg\expandafter{\expanded{#1}}%
+  }%
+}
 % \end{macro}
 % \end{collargskey}
 % \end{macro}
@@ -535,19 +488,51 @@
 \newif\ifcollargsNoDelimiters
 %   \end{macro}
 % \end{collargskey}
-
-% \begin{collargskey}{brace collected}
-%   \begin{macro}{\ifcollargsBraceCollected}
-%       When this conditional is set to false, the collected arguments are not
-%       enclosed in braces when passed on to \meta{next-code}.
+%
+% \begin{collargskey}{clear args}
+%   \begin{macro}{\ifcollargsClearArgs}
+%       When this conditional is set to |false|, the global token register
+%       |\collargsArgs| receiving the collected arguments is not cleared prior
+%       to argument collection.
 \collargsSet{%
-  brace collected/.is if=collargsBraceCollected,
+  clear args/.is if=collargsClearArgs,
 }
-\newif\ifcollargsBraceCollected
-\collargsBraceCollectedtrue
+\newif\ifcollargsClearArgs
+\collargsClearArgstrue
+%     \end{macro}
+%   \end{collargskey}
+%
+% \begin{collargskey}{return}
+%   \begin{macro}{\collargsReturn}
+%     Exiting |\CollectArguments|, should the next-command be followed by the
+%     braced collected arguments, collected arguments as they are, or nothing?
+\collargsSet{%
+  return/.is choice,
+  return/braced/.code=\collargsReturnBraced,
+  return/plain/.code=\collargsReturnPlain,
+  return/no/.code=\collargsReturnNo,
+}
+\def\collargsReturnBraced{\def\collargsReturn{0}}
+\def\collargsReturnPlain{\def\collargsReturn{1}}
+\def\collargsReturnNo{\def\collargsReturn{2}}
+\collargsReturnBraced
+%   \end{macro}
+% \end{collargskey}
+% 
+% \begin{collargskey}{alias}
+%   \begin{macro}{\collargsAlias}
+%
+\collargsSet{%
+  alias/.code 2 args=\collargsAlias{#1}{#2}%
+}
+\def\collargsAlias#1#2{%
+  \csdef{collargs@#1}{\collargs@@@#2}%
+}
 % \end{macro}
 % \end{collargskey}
 % 
+% 
+% 
 % \subsubsection{The central loop}
 % \label{sec:code:collargs:central-loop}
 %
@@ -677,11 +662,11 @@
 }
 % \end{macro}
 % 
-% \begin{macro}{\collargs at toks}
+% \begin{macro}{\collargsArgs}
 %   This token register is where we store the collected argument tokens.  All
 %   assignments to this register are global, because it needs to survive the
 %   groups opened for individual arguments.
-\newtoks\collargs at toks
+\newtoks\collargsArgs
 % \end{macro}
 %
 % \begin{macro}{\collargsArg}
@@ -705,10 +690,10 @@
     \endgroup
     \noexpand\collargs at fix{%
       \expandonce\collargs at next
-        \ifcollargsBraceCollected
-          {\the\collargs at toks}%
-        \else
-          \the\collargs at toks
+        \ifcase\collargsReturn\space
+          {\the\collargsArgs}%
+        \or
+          \the\collargsArgs
         \fi
       \collargs at spaces
     }%
@@ -722,7 +707,7 @@
 % \begin{macro}{\collargs at appendarg}
 %   This macro is used by the argument type
 %   handlers to append the collected argument to the storage
-%   (|\collargs at toks|).
+%   (|\collargsArgs|).
 \long\def\collargs at appendarg#1{%
   % Temporarily store the collected argument into a token register.  The
   % processors will manipulate the contents of this register.
@@ -744,7 +729,7 @@
   \collargs at postprocess@arg
   % Append the processed argument, preceded by any grabbed spaces (in the
   % correct mode), to the storage.
-  \xtoksapp\collargs at toks{\collargs at grabbed@spaces\the\collargsArg}%
+  \xtoksapp\collargsArgs{\collargs at grabbed@spaces\the\collargsArg}%
   % Initialize the space-grabber.
   \collargs at init@grabspaces
   % Once the argument was appended to the list, we can close its group, opened
@@ -761,7 +746,15 @@
 %   defined by the argument type handler.  Note that this macro \emph{appends}
 %   a wrapper, so multiple wrappers are allowed --- this is used by type |e|
 %   handler.
-\def\collargs at wrap{\collargs at addwrap\appto\collargs at process@arg}
+\def\collargs at wrap#1{%
+  \appto\collargs at process@arg{%
+    \long\def\collargs at temp##1{#1}%
+    \expandafter\expandafter\expandafter\collargsArg
+    \expandafter\expandafter\expandafter{%
+      \expandafter\collargs at temp\expandafter{\the\collargsArg}%
+    }%
+  }%
+}
 \def\collargs at process@arg{}
 % \end{macro}
 %
@@ -1046,7 +1039,7 @@
   % which will put everything up to the first opening brace into the first
   % argument, looks funky, but that's all.
   \collargs at defusecollector##1##{%
-    % We append the collected argument, |##1|, to |\collargs at toks|, the token
+    % We append the collected argument, |##1|, to |\collargsArgs|, the token
     % register holding the collected argument tokens.
     \collargs at appendarg{##1}%
     % Back to the central loop, with the rest of the argument specification
@@ -1448,7 +1441,7 @@
   \collargs at readContent
 }
 % This macro appends the result given by the heavy machinery, waiting for us in
-% macro |\collargsArg|, to |\collargs at toks|, but not before dressing
+% macro |\collargsArg|, to |\collargsArgs|, but not before dressing
 % it up (via |\collargs at wrap|) in a pair of verbatim braces.
 \def\collargs at m@verb at group@i{%
   \edef\collargs at temp{%

Modified: trunk/Master/texmf-dist/tex/context/third/collargs/t-collargs.tex
===================================================================
--- trunk/Master/texmf-dist/tex/context/third/collargs/t-collargs.tex	2024-03-18 19:59:21 UTC (rev 70688)
+++ trunk/Master/texmf-dist/tex/context/third/collargs/t-collargs.tex	2024-03-18 19:59:31 UTC (rev 70689)
@@ -28,11 +28,11 @@
 %% (<texmf>/doc/generic/collargs/)FILES.
 %D \module[
 %D         file=t-collargs.tex,
-%D      version=1.1.0,
+%D      version=1.2.0,
 %D        title=CollArgs,
 %D     subtitle=Collect arguments of any command,
 %D       author=Saso Zivanovic,
-%D         date=2024-01-02,
+%D         date=2024-03-15,
 %D    copyright=Saso Zivanovic,
 %D      license=LPPL,
 %D ]
@@ -72,7 +72,9 @@
   \collargs at verbatim@wrap{#1}%
   \collargs at init@grabspaces
   \def\collargs at next{#3}%
-  \global\collargs at toks{}%
+  \ifcollargsClearArgs
+    \global\collargsArgs{}%
+  \fi
   \collargs@#2.%
 }
 \def\collargsSet#1{\pgfqkeys{/collargs}{#1}}
@@ -187,21 +189,10 @@
   append postprocessor/.code={\collargsAppendPostprocessor{#1}},
   prepend postprocessor/.code={\collargsPrependPostprocessor{#1}},
 }
-\def\collargsAppendPreprocessor{%
-  \collargs at addprocessor\appto\collargs at preprocess@arg}
-\def\collargsPrependPreprocessor{%
-  \collargs at addprocessor\preto\collargs at preprocess@arg}
-\def\collargsAppendPostprocessor{%
-  \collargs at addprocessor\appto\collargs at postprocess@arg}
-\def\collargsPrependPostprocessor{%
-  \collargs at addprocessor\preto\collargs at postprocess@arg}
-\def\collargs at addprocessor#1#2#3{%
-  #1#2{%
-    \normalexpanded{%
-      \normalunexpanded{#3}{\the\collargsArg}%
-    }%
-  }%
-}
+\def\collargsAppendPreprocessor#1{\appto\collargs at preprocess@arg{#1}}
+\def\collargsPrependPreprocessor#1{\preto\collargs at preprocess@arg{#1}}
+\def\collargsAppendPostprocessor#1{\appto\collargs at postprocess@arg{#1}}
+\def\collargsPrependPostprocessor#1{\preto\collargs at postprocess@arg{#1}}
 \def\collargs at preprocess@arg{}
 \def\collargs at postprocess@arg{}
 \collargsSet{
@@ -211,60 +202,56 @@
 \def\collargsClearPreprocessors{\def\collargs at preprocess@arg{}}%
 \def\collargsClearPostprocessors{\def\collargs at postprocess@arg{}}%
 \collargsSet{
-  append expandable preprocessor/.code={%
-    \collargsAppendExpandablePreprocessor{#1}},
-  prepend expandable preprocessor/.code={%
-    \collargsPrependExpandablePreprocessor{#1}},
-  append expandable postprocessor/.code={%
-    \collargsAppendExpandablePostprocessor{#1}},
-  prepend expandable postprocessor/.code={%
-    \collargsPrependExpandablePostprocessor{#1}},
+  append expandable preprocessor/.code={\collargsAppendExpandablePreprocessor{#1}},
+  prepend expandable preprocessor/.code={\collargsPrependExpandablePreprocessor{#1}},
+  append expandable postprocessor/.code={\collargsAppendExpandablePostprocessor{#1}},
+  prepend expandable postprocessor/.code={\collargsPrependExpandablePostprocessor{#1}},
 }
-\def\collargsAppendExpandablePreprocessor{%
-  \collargs at addeprocessor\appto\collargs at preprocess@arg}
-\def\collargsPrependExpandablePreprocessor{%
-  \collargs at addeprocessor\preto\collargs at preprocess@arg}
-\def\collargsAppendExpandablePostprocessor{%
-  \collargs at addeprocessor\appto\collargs at postprocess@arg}
-\def\collargsPrependExpandablePostprocessor{%
-  \collargs at addeprocessor\preto\collargs at postprocess@arg}
-\def\collargs at addeprocessor#1#2#3{%
-  #1#2{%
-    \normalexpanded{%
-      \edef\noexpand\collargs at temp{\normalunexpanded{#3}{\the\collargsArg}}%
-      \normalunexpanded{\expandafter\collargsArg\expandafter{\collargs at temp}}%
-    }%
+\def\collargsAppendExpandablePreprocessor#1{%
+  \appto\collargs at preprocess@arg{%
+    \collargsArg\expandafter{\normalexpanded{#1}}%
   }%
 }
-\collargsSet{
-  append prewrap/.code={\collargsAppendPrewrap{#1}},
-  prepend prewrap/.code={\collargsPrependPrewrap{#1}},
-  append postwrap/.code={\collargsAppendPostwrap{#1}},
-  prepend postwrap/.code={\collargsPrependPostwrap{#1}},
+\def\collargsPrependExpandablePreprocessor#1{%
+  \preto\collargs at preprocess@arg{%
+    \collargsArg\expandafter{\normalexpanded{#1}}%
+  }%
 }
-\def\collargsAppendPrewrap{\collargs at addwrap\appto\collargs at preprocess@arg}
-\def\collargsPrependPrewrap{\collargs at addwrap\preto\collargs at preprocess@arg}
-\def\collargsAppendPostwrap{\collargs at addwrap\appto\collargs at postprocess@arg}
-\def\collargsPrependPostwrap{\collargs at addwrap\preto\collargs at postprocess@arg}
-\def\collargs at addwrap#1#2#3{%
-  #1#2{%
-    \long\def\collargs at temp##1{#3}%
-    \expandafter\expandafter\expandafter\collargsArg
-    \expandafter\expandafter\expandafter{%
-      \expandafter\collargs at temp\expandafter{\the\collargsArg}%
-    }%
+\def\collargsAppendExpandablePostprocessor#1{%
+  \appto\collargs at postprocess@arg{%
+    \collargsArg\expandafter{\normalexpanded{#1}}%
   }%
 }
+\def\collargsPrependExpandablePostprocessor#1{%
+  \preto\collargs at postprocess@arg{%
+    \collargsArg\expandafter{\normalexpanded{#1}}%
+  }%
+}
 \collargsSet{%
   no delimiters/.is if=collargsNoDelimiters,
 }
 \newif\ifcollargsNoDelimiters
-
 \collargsSet{%
-  brace collected/.is if=collargsBraceCollected,
+  clear args/.is if=collargsClearArgs,
 }
-\newif\ifcollargsBraceCollected
-\collargsBraceCollectedtrue
+\newif\ifcollargsClearArgs
+\collargsClearArgstrue
+\collargsSet{%
+  return/.is choice,
+  return/braced/.code=\collargsReturnBraced,
+  return/plain/.code=\collargsReturnPlain,
+  return/no/.code=\collargsReturnNo,
+}
+\def\collargsReturnBraced{\def\collargsReturn{0}}
+\def\collargsReturnPlain{\def\collargsReturn{1}}
+\def\collargsReturnNo{\def\collargsReturn{2}}
+\collargsReturnBraced
+\collargsSet{%
+  alias/.code 2 args=\collargsAlias{#1}{#2}%
+}
+\def\collargsAlias#1#2{%
+  \csdef{collargs@#1}{\collargs@@@#2}%
+}
 \def\collargs@{%
   \begingroup
   \collargs@@@
@@ -327,7 +314,7 @@
   \collargs at grabspacesfalse
   \collargs@@@
 }
-\newtoks\collargs at toks
+\newtoks\collargsArgs
 \newtoks\collargsArg
 \csdef{collargs at .}{%
   \endgroup
@@ -335,10 +322,10 @@
     \endgroup
     \noexpand\collargs at fix{%
       \expandonce\collargs at next
-        \ifcollargsBraceCollected
-          {\the\collargs at toks}%
-        \else
-          \the\collargs at toks
+        \ifcase\collargsReturn\space
+          {\the\collargsArgs}%
+        \or
+          \the\collargsArgs
         \fi
       \collargs at spaces
     }%
@@ -355,11 +342,19 @@
     \collargs at process@arg
   \fi
   \collargs at postprocess@arg
-  \xtoksapp\collargs at toks{\collargs at grabbed@spaces\the\collargsArg}%
+  \xtoksapp\collargsArgs{\collargs at grabbed@spaces\the\collargsArg}%
   \collargs at init@grabspaces
   \endgroup
 }
-\def\collargs at wrap{\collargs at addwrap\appto\collargs at process@arg}
+\def\collargs at wrap#1{%
+  \appto\collargs at process@arg{%
+    \long\def\collargs at temp##1{#1}%
+    \expandafter\expandafter\expandafter\collargsArg
+    \expandafter\expandafter\expandafter{%
+      \expandafter\collargs at temp\expandafter{\the\collargsArg}%
+    }%
+  }%
+}
 \def\collargs at process@arg{}
 \def\collargs at defcollector#1#{%
   \ifcollargs at long\long\fi

Modified: trunk/Master/texmf-dist/tex/latex/collargs/collargs.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/collargs/collargs.sty	2024-03-18 19:59:21 UTC (rev 70688)
+++ trunk/Master/texmf-dist/tex/latex/collargs/collargs.sty	2024-03-18 19:59:31 UTC (rev 70689)
@@ -26,7 +26,7 @@
 %%
 %% The files belonging to this work and covered by LPPL are listed in
 %% (<texmf>/doc/generic/collargs/)FILES.
-\ProvidesPackage{collargs}[2024/01/02 v1.1.0 Collect arguments of any command]
+\ProvidesPackage{collargs}[2024/03/15 v1.2.0 Collect arguments of any command]
 \RequirePackage{pgfkeys}
 \RequirePackage{etoolbox}
 \ifdefined\luatexversion
@@ -60,7 +60,9 @@
   \collargs at verbatim@wrap{#1}%
   \collargs at init@grabspaces
   \def\collargs at next{#3}%
-  \global\collargs at toks{}%
+  \ifcollargsClearArgs
+    \global\collargsArgs{}%
+  \fi
   \collargs@#2.%
 }
 \def\collargsSet#1{\pgfqkeys{/collargs}{#1}}
@@ -176,21 +178,10 @@
   append postprocessor/.code={\collargsAppendPostprocessor{#1}},
   prepend postprocessor/.code={\collargsPrependPostprocessor{#1}},
 }
-\def\collargsAppendPreprocessor{%
-  \collargs at addprocessor\appto\collargs at preprocess@arg}
-\def\collargsPrependPreprocessor{%
-  \collargs at addprocessor\preto\collargs at preprocess@arg}
-\def\collargsAppendPostprocessor{%
-  \collargs at addprocessor\appto\collargs at postprocess@arg}
-\def\collargsPrependPostprocessor{%
-  \collargs at addprocessor\preto\collargs at postprocess@arg}
-\def\collargs at addprocessor#1#2#3{%
-  #1#2{%
-    \expanded{%
-      \unexpanded{#3}{\the\collargsArg}%
-    }%
-  }%
-}
+\def\collargsAppendPreprocessor#1{\appto\collargs at preprocess@arg{#1}}
+\def\collargsPrependPreprocessor#1{\preto\collargs at preprocess@arg{#1}}
+\def\collargsAppendPostprocessor#1{\appto\collargs at postprocess@arg{#1}}
+\def\collargsPrependPostprocessor#1{\preto\collargs at postprocess@arg{#1}}
 \def\collargs at preprocess@arg{}
 \def\collargs at postprocess@arg{}
 \collargsSet{
@@ -200,60 +191,56 @@
 \def\collargsClearPreprocessors{\def\collargs at preprocess@arg{}}%
 \def\collargsClearPostprocessors{\def\collargs at postprocess@arg{}}%
 \collargsSet{
-  append expandable preprocessor/.code={%
-    \collargsAppendExpandablePreprocessor{#1}},
-  prepend expandable preprocessor/.code={%
-    \collargsPrependExpandablePreprocessor{#1}},
-  append expandable postprocessor/.code={%
-    \collargsAppendExpandablePostprocessor{#1}},
-  prepend expandable postprocessor/.code={%
-    \collargsPrependExpandablePostprocessor{#1}},
+  append expandable preprocessor/.code={\collargsAppendExpandablePreprocessor{#1}},
+  prepend expandable preprocessor/.code={\collargsPrependExpandablePreprocessor{#1}},
+  append expandable postprocessor/.code={\collargsAppendExpandablePostprocessor{#1}},
+  prepend expandable postprocessor/.code={\collargsPrependExpandablePostprocessor{#1}},
 }
-\def\collargsAppendExpandablePreprocessor{%
-  \collargs at addeprocessor\appto\collargs at preprocess@arg}
-\def\collargsPrependExpandablePreprocessor{%
-  \collargs at addeprocessor\preto\collargs at preprocess@arg}
-\def\collargsAppendExpandablePostprocessor{%
-  \collargs at addeprocessor\appto\collargs at postprocess@arg}
-\def\collargsPrependExpandablePostprocessor{%
-  \collargs at addeprocessor\preto\collargs at postprocess@arg}
-\def\collargs at addeprocessor#1#2#3{%
-  #1#2{%
-    \expanded{%
-      \edef\noexpand\collargs at temp{\unexpanded{#3}{\the\collargsArg}}%
-      \unexpanded{\expandafter\collargsArg\expandafter{\collargs at temp}}%
-    }%
+\def\collargsAppendExpandablePreprocessor#1{%
+  \appto\collargs at preprocess@arg{%
+    \collargsArg\expandafter{\expanded{#1}}%
   }%
 }
-\collargsSet{
-  append prewrap/.code={\collargsAppendPrewrap{#1}},
-  prepend prewrap/.code={\collargsPrependPrewrap{#1}},
-  append postwrap/.code={\collargsAppendPostwrap{#1}},
-  prepend postwrap/.code={\collargsPrependPostwrap{#1}},
+\def\collargsPrependExpandablePreprocessor#1{%
+  \preto\collargs at preprocess@arg{%
+    \collargsArg\expandafter{\expanded{#1}}%
+  }%
 }
-\def\collargsAppendPrewrap{\collargs at addwrap\appto\collargs at preprocess@arg}
-\def\collargsPrependPrewrap{\collargs at addwrap\preto\collargs at preprocess@arg}
-\def\collargsAppendPostwrap{\collargs at addwrap\appto\collargs at postprocess@arg}
-\def\collargsPrependPostwrap{\collargs at addwrap\preto\collargs at postprocess@arg}
-\def\collargs at addwrap#1#2#3{%
-  #1#2{%
-    \long\def\collargs at temp##1{#3}%
-    \expandafter\expandafter\expandafter\collargsArg
-    \expandafter\expandafter\expandafter{%
-      \expandafter\collargs at temp\expandafter{\the\collargsArg}%
-    }%
+\def\collargsAppendExpandablePostprocessor#1{%
+  \appto\collargs at postprocess@arg{%
+    \collargsArg\expandafter{\expanded{#1}}%
   }%
 }
+\def\collargsPrependExpandablePostprocessor#1{%
+  \preto\collargs at postprocess@arg{%
+    \collargsArg\expandafter{\expanded{#1}}%
+  }%
+}
 \collargsSet{%
   no delimiters/.is if=collargsNoDelimiters,
 }
 \newif\ifcollargsNoDelimiters
-
 \collargsSet{%
-  brace collected/.is if=collargsBraceCollected,
+  clear args/.is if=collargsClearArgs,
 }
-\newif\ifcollargsBraceCollected
-\collargsBraceCollectedtrue
+\newif\ifcollargsClearArgs
+\collargsClearArgstrue
+\collargsSet{%
+  return/.is choice,
+  return/braced/.code=\collargsReturnBraced,
+  return/plain/.code=\collargsReturnPlain,
+  return/no/.code=\collargsReturnNo,
+}
+\def\collargsReturnBraced{\def\collargsReturn{0}}
+\def\collargsReturnPlain{\def\collargsReturn{1}}
+\def\collargsReturnNo{\def\collargsReturn{2}}
+\collargsReturnBraced
+\collargsSet{%
+  alias/.code 2 args=\collargsAlias{#1}{#2}%
+}
+\def\collargsAlias#1#2{%
+  \csdef{collargs@#1}{\collargs@@@#2}%
+}
 \def\collargs@{%
   \begingroup
   \collargs@@@
@@ -316,7 +303,7 @@
   \collargs at grabspacesfalse
   \collargs@@@
 }
-\newtoks\collargs at toks
+\newtoks\collargsArgs
 \newtoks\collargsArg
 \csdef{collargs at .}{%
   \endgroup
@@ -324,10 +311,10 @@
     \endgroup
     \noexpand\collargs at fix{%
       \expandonce\collargs at next
-        \ifcollargsBraceCollected
-          {\the\collargs at toks}%
-        \else
-          \the\collargs at toks
+        \ifcase\collargsReturn\space
+          {\the\collargsArgs}%
+        \or
+          \the\collargsArgs
         \fi
       \collargs at spaces
     }%
@@ -344,11 +331,19 @@
     \collargs at process@arg
   \fi
   \collargs at postprocess@arg
-  \xtoksapp\collargs at toks{\collargs at grabbed@spaces\the\collargsArg}%
+  \xtoksapp\collargsArgs{\collargs at grabbed@spaces\the\collargsArg}%
   \collargs at init@grabspaces
   \endgroup
 }
-\def\collargs at wrap{\collargs at addwrap\appto\collargs at process@arg}
+\def\collargs at wrap#1{%
+  \appto\collargs at process@arg{%
+    \long\def\collargs at temp##1{#1}%
+    \expandafter\expandafter\expandafter\collargsArg
+    \expandafter\expandafter\expandafter{%
+      \expandafter\collargs at temp\expandafter{\the\collargsArg}%
+    }%
+  }%
+}
 \def\collargs at process@arg{}
 \def\collargs at defcollector#1#{%
   \ifcollargs at long\long\fi

Modified: trunk/Master/texmf-dist/tex/plain/collargs/collargs.tex
===================================================================
--- trunk/Master/texmf-dist/tex/plain/collargs/collargs.tex	2024-03-18 19:59:21 UTC (rev 70688)
+++ trunk/Master/texmf-dist/tex/plain/collargs/collargs.tex	2024-03-18 19:59:31 UTC (rev 70689)
@@ -61,7 +61,9 @@
   \collargs at verbatim@wrap{#1}%
   \collargs at init@grabspaces
   \def\collargs at next{#3}%
-  \global\collargs at toks{}%
+  \ifcollargsClearArgs
+    \global\collargsArgs{}%
+  \fi
   \collargs@#2.%
 }
 \def\collargsSet#1{\pgfqkeys{/collargs}{#1}}
@@ -175,21 +177,10 @@
   append postprocessor/.code={\collargsAppendPostprocessor{#1}},
   prepend postprocessor/.code={\collargsPrependPostprocessor{#1}},
 }
-\def\collargsAppendPreprocessor{%
-  \collargs at addprocessor\appto\collargs at preprocess@arg}
-\def\collargsPrependPreprocessor{%
-  \collargs at addprocessor\preto\collargs at preprocess@arg}
-\def\collargsAppendPostprocessor{%
-  \collargs at addprocessor\appto\collargs at postprocess@arg}
-\def\collargsPrependPostprocessor{%
-  \collargs at addprocessor\preto\collargs at postprocess@arg}
-\def\collargs at addprocessor#1#2#3{%
-  #1#2{%
-    \expanded{%
-      \unexpanded{#3}{\the\collargsArg}%
-    }%
-  }%
-}
+\def\collargsAppendPreprocessor#1{\appto\collargs at preprocess@arg{#1}}
+\def\collargsPrependPreprocessor#1{\preto\collargs at preprocess@arg{#1}}
+\def\collargsAppendPostprocessor#1{\appto\collargs at postprocess@arg{#1}}
+\def\collargsPrependPostprocessor#1{\preto\collargs at postprocess@arg{#1}}
 \def\collargs at preprocess@arg{}
 \def\collargs at postprocess@arg{}
 \collargsSet{
@@ -199,60 +190,56 @@
 \def\collargsClearPreprocessors{\def\collargs at preprocess@arg{}}%
 \def\collargsClearPostprocessors{\def\collargs at postprocess@arg{}}%
 \collargsSet{
-  append expandable preprocessor/.code={%
-    \collargsAppendExpandablePreprocessor{#1}},
-  prepend expandable preprocessor/.code={%
-    \collargsPrependExpandablePreprocessor{#1}},
-  append expandable postprocessor/.code={%
-    \collargsAppendExpandablePostprocessor{#1}},
-  prepend expandable postprocessor/.code={%
-    \collargsPrependExpandablePostprocessor{#1}},
+  append expandable preprocessor/.code={\collargsAppendExpandablePreprocessor{#1}},
+  prepend expandable preprocessor/.code={\collargsPrependExpandablePreprocessor{#1}},
+  append expandable postprocessor/.code={\collargsAppendExpandablePostprocessor{#1}},
+  prepend expandable postprocessor/.code={\collargsPrependExpandablePostprocessor{#1}},
 }
-\def\collargsAppendExpandablePreprocessor{%
-  \collargs at addeprocessor\appto\collargs at preprocess@arg}
-\def\collargsPrependExpandablePreprocessor{%
-  \collargs at addeprocessor\preto\collargs at preprocess@arg}
-\def\collargsAppendExpandablePostprocessor{%
-  \collargs at addeprocessor\appto\collargs at postprocess@arg}
-\def\collargsPrependExpandablePostprocessor{%
-  \collargs at addeprocessor\preto\collargs at postprocess@arg}
-\def\collargs at addeprocessor#1#2#3{%
-  #1#2{%
-    \expanded{%
-      \edef\noexpand\collargs at temp{\unexpanded{#3}{\the\collargsArg}}%
-      \unexpanded{\expandafter\collargsArg\expandafter{\collargs at temp}}%
-    }%
+\def\collargsAppendExpandablePreprocessor#1{%
+  \appto\collargs at preprocess@arg{%
+    \collargsArg\expandafter{\expanded{#1}}%
   }%
 }
-\collargsSet{
-  append prewrap/.code={\collargsAppendPrewrap{#1}},
-  prepend prewrap/.code={\collargsPrependPrewrap{#1}},
-  append postwrap/.code={\collargsAppendPostwrap{#1}},
-  prepend postwrap/.code={\collargsPrependPostwrap{#1}},
+\def\collargsPrependExpandablePreprocessor#1{%
+  \preto\collargs at preprocess@arg{%
+    \collargsArg\expandafter{\expanded{#1}}%
+  }%
 }
-\def\collargsAppendPrewrap{\collargs at addwrap\appto\collargs at preprocess@arg}
-\def\collargsPrependPrewrap{\collargs at addwrap\preto\collargs at preprocess@arg}
-\def\collargsAppendPostwrap{\collargs at addwrap\appto\collargs at postprocess@arg}
-\def\collargsPrependPostwrap{\collargs at addwrap\preto\collargs at postprocess@arg}
-\def\collargs at addwrap#1#2#3{%
-  #1#2{%
-    \long\def\collargs at temp##1{#3}%
-    \expandafter\expandafter\expandafter\collargsArg
-    \expandafter\expandafter\expandafter{%
-      \expandafter\collargs at temp\expandafter{\the\collargsArg}%
-    }%
+\def\collargsAppendExpandablePostprocessor#1{%
+  \appto\collargs at postprocess@arg{%
+    \collargsArg\expandafter{\expanded{#1}}%
   }%
 }
+\def\collargsPrependExpandablePostprocessor#1{%
+  \preto\collargs at postprocess@arg{%
+    \collargsArg\expandafter{\expanded{#1}}%
+  }%
+}
 \collargsSet{%
   no delimiters/.is if=collargsNoDelimiters,
 }
 \newif\ifcollargsNoDelimiters
-
 \collargsSet{%
-  brace collected/.is if=collargsBraceCollected,
+  clear args/.is if=collargsClearArgs,
 }
-\newif\ifcollargsBraceCollected
-\collargsBraceCollectedtrue
+\newif\ifcollargsClearArgs
+\collargsClearArgstrue
+\collargsSet{%
+  return/.is choice,
+  return/braced/.code=\collargsReturnBraced,
+  return/plain/.code=\collargsReturnPlain,
+  return/no/.code=\collargsReturnNo,
+}
+\def\collargsReturnBraced{\def\collargsReturn{0}}
+\def\collargsReturnPlain{\def\collargsReturn{1}}
+\def\collargsReturnNo{\def\collargsReturn{2}}
+\collargsReturnBraced
+\collargsSet{%
+  alias/.code 2 args=\collargsAlias{#1}{#2}%
+}
+\def\collargsAlias#1#2{%
+  \csdef{collargs@#1}{\collargs@@@#2}%
+}
 \def\collargs@{%
   \begingroup
   \collargs@@@
@@ -315,7 +302,7 @@
   \collargs at grabspacesfalse
   \collargs@@@
 }
-\newtoks\collargs at toks
+\newtoks\collargsArgs
 \newtoks\collargsArg
 \csdef{collargs at .}{%
   \endgroup
@@ -323,10 +310,10 @@
     \endgroup
     \noexpand\collargs at fix{%
       \expandonce\collargs at next
-        \ifcollargsBraceCollected
-          {\the\collargs at toks}%
-        \else
-          \the\collargs at toks
+        \ifcase\collargsReturn\space
+          {\the\collargsArgs}%
+        \or
+          \the\collargsArgs
         \fi
       \collargs at spaces
     }%
@@ -343,11 +330,19 @@
     \collargs at process@arg
   \fi
   \collargs at postprocess@arg
-  \xtoksapp\collargs at toks{\collargs at grabbed@spaces\the\collargsArg}%
+  \xtoksapp\collargsArgs{\collargs at grabbed@spaces\the\collargsArg}%
   \collargs at init@grabspaces
   \endgroup
 }
-\def\collargs at wrap{\collargs at addwrap\appto\collargs at process@arg}
+\def\collargs at wrap#1{%
+  \appto\collargs at process@arg{%
+    \long\def\collargs at temp##1{#1}%
+    \expandafter\expandafter\expandafter\collargsArg
+    \expandafter\expandafter\expandafter{%
+      \expandafter\collargs at temp\expandafter{\the\collargsArg}%
+    }%
+  }%
+}
 \def\collargs at process@arg{}
 \def\collargs at defcollector#1#{%
   \ifcollargs at long\long\fi



More information about the tex-live-commits mailing list.