summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/l3packages/xparse.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/l3packages/xparse.dtx')
-rw-r--r--macros/latex/contrib/l3packages/xparse.dtx39
1 files changed, 32 insertions, 7 deletions
diff --git a/macros/latex/contrib/l3packages/xparse.dtx b/macros/latex/contrib/l3packages/xparse.dtx
index 6aee5f22f6..2a0b842fbb 100644
--- a/macros/latex/contrib/l3packages/xparse.dtx
+++ b/macros/latex/contrib/l3packages/xparse.dtx
@@ -67,7 +67,7 @@
% }^^A
% }
%
-% \date{Released 2019-05-28}
+% \date{Released 2019-10-11}
%
% \maketitle
%
@@ -340,6 +340,7 @@
% mailing list.
%
% \subsection{Default values of arguments}
+% \label{sec:defaultvaluesofarguments}
%
% Uppercase argument types (\texttt{O}, \texttt{D}, \ldots{}) allow to
% specify a default value to be used when the argument is missing; their
@@ -676,6 +677,23 @@
% followed by \cs{ProcessorB} to the tokens grabbed by the \texttt{m}
% argument.
%
+% It might sometimes be useful to use the value of another argument as
+% one of the arguments of a processor. For example, using the
+% \cs{SplitList} processor defined below,
+% \begin{verbatim}
+% \NewDocumentCommand \foo { O{,} >{\SplitList{#1}} m } { \foobar{#2} }
+% \foo{a,b;c,d}
+% \end{verbatim}
+% results in |\foobar| receiving the argument |{a}{b;c}{d}| because
+% \cs{SplitList} receives as its two arguments the optional one (whose
+% value here is the default, a comma) and the mandatory one. To
+% summarize, first the arguments are searched for in the input, then any
+% default argument is determined as explained in
+% Section~\ref{sec:defaultvaluesofarguments}, then these default
+% arguments are passed to any processor. When referring to arguments
+% (through |#1|, |#2| and so on) in a processor, the arguments used are
+% always those before applying any processor.
+%
% \begin{variable}{\ProcessedArgument}
% \pkg{xparse} defines a very small set of processor functions. In the
% main, it is anticipated that code writers will want to create their
@@ -898,7 +916,7 @@
% \end{macrocode}
%
% \begin{macrocode}
-\ProvidesExplPackage{xparse}{2019-05-28}{}
+\ProvidesExplPackage{xparse}{2019-10-11}{}
{L3 Experimental document command parser}
% \end{macrocode}
%
@@ -1552,11 +1570,13 @@
% \end{macro}
%
% \begin{macro}{\@@_args_process:}
-% \begin{macro}{\@@_args_process_loop:nn, \@@_args_process_aux:n, \@@_args_process_aux:nn}
+% \begin{macro}{\@@_args_process_loop:nn, \@@_args_process_aux:n}
% Loop through arguments (stored in \cs{l_@@_args_tl}) and the
% corresponding processors (in \cs{l_@@_process_all_tl})
% simultaneously, apply all processors for each argument and store the
-% result back into \cs{l_@@_args_tl}.
+% result back into \cs{l_@@_args_tl}. To allow processors to depend
+% on other arguments, for every processor define a temporary auxiliary
+% that receives all arguments \cs{l_@@_args_tl}.
% \begin{macrocode}
\cs_new_protected:Npn \@@_args_process:
{
@@ -1575,9 +1595,13 @@
\tl_put_right:No \l_@@_args_ii_tl
{ \exp_after:wN { \ProcessedArgument } }
}
-\cs_new_protected:Npn \@@_args_process_aux:n
- { \exp_args:No \@@_args_process_aux:nn { \ProcessedArgument } }
-\cs_new_protected:Npn \@@_args_process_aux:nn #1#2 { #2 {#1} }
+\cs_new_protected:Npn \@@_args_process_aux:n #1
+ {
+ \cs_generate_from_arg_count:NNnn \@@_tmp:w \cs_set:Npn
+ { \tl_count:N \l_@@_args_tl } {#1}
+ \exp_args:NNNo \exp_after:wN \@@_tmp:w \l_@@_args_tl
+ { \ProcessedArgument }
+ }
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -4336,6 +4360,7 @@
{ \@@_peek_nonspace_aux:nNNTF { #1 ~ } #2 #3 {#4} {#5} }
{ #2 #3 { #4 } { #5 #1 } }
}
+% \end{macrocode}
% \end{macro}
%
% \subsection{Messages}