summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-08-18 23:13:18 +0000
committerKarl Berry <karl@freefriends.org>2011-08-18 23:13:18 +0000
commit6cff5abeab9bf94a6cabb2cbdba9d458c9727b73 (patch)
tree63ae3a16468aeb265f4b95d5eacb1deec963ee64
parenteae5d19d439ded67f5535d315a8983939733b548 (diff)
l3packages 2607 (17aug11)
git-svn-id: svn://tug.org/texlive/trunk@23597 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/l3packages/l3keys2e/l3keys2e.pdfbin462632 -> 462705 bytes
-rw-r--r--Master/texmf-dist/doc/latex/l3packages/xfrac/xfrac.pdfbin612417 -> 409533 bytes
-rw-r--r--Master/texmf-dist/doc/latex/l3packages/xparse/xparse.pdfbin395744 -> 399515 bytes
-rw-r--r--Master/texmf-dist/doc/latex/l3packages/xtemplate/xtemplate.pdfbin392759 -> 392445 bytes
-rw-r--r--Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e-demo.tex43
-rw-r--r--Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx6
-rw-r--r--Master/texmf-dist/source/latex/l3packages/xparse/xparse.dtx332
-rw-r--r--Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.dtx114
-rw-r--r--Master/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty6
-rw-r--r--Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty180
-rw-r--r--Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty89
11 files changed, 592 insertions, 178 deletions
diff --git a/Master/texmf-dist/doc/latex/l3packages/l3keys2e/l3keys2e.pdf b/Master/texmf-dist/doc/latex/l3packages/l3keys2e/l3keys2e.pdf
index 57b9d08e55d..7d381a90b7c 100644
--- a/Master/texmf-dist/doc/latex/l3packages/l3keys2e/l3keys2e.pdf
+++ b/Master/texmf-dist/doc/latex/l3packages/l3keys2e/l3keys2e.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/l3packages/xfrac/xfrac.pdf b/Master/texmf-dist/doc/latex/l3packages/xfrac/xfrac.pdf
index d53194650b1..45d6e870f96 100644
--- a/Master/texmf-dist/doc/latex/l3packages/xfrac/xfrac.pdf
+++ b/Master/texmf-dist/doc/latex/l3packages/xfrac/xfrac.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/l3packages/xparse/xparse.pdf b/Master/texmf-dist/doc/latex/l3packages/xparse/xparse.pdf
index ce319da7032..643478facf1 100644
--- a/Master/texmf-dist/doc/latex/l3packages/xparse/xparse.pdf
+++ b/Master/texmf-dist/doc/latex/l3packages/xparse/xparse.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/l3packages/xtemplate/xtemplate.pdf b/Master/texmf-dist/doc/latex/l3packages/xtemplate/xtemplate.pdf
index 52364aff067..a6746d58b0e 100644
--- a/Master/texmf-dist/doc/latex/l3packages/xtemplate/xtemplate.pdf
+++ b/Master/texmf-dist/doc/latex/l3packages/xtemplate/xtemplate.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e-demo.tex b/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e-demo.tex
new file mode 100644
index 00000000000..96d007999ac
--- /dev/null
+++ b/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e-demo.tex
@@ -0,0 +1,43 @@
+% This file demonstrates the use of the l3keys2e module to allow
+% LaTeX3 keyvals (created using l3keys) to be used as LaTeX2e
+% package or class options.
+%
+
+% First, create a class
+\begin{filecontents}{l3keys2e-class.cls}
+ \LoadClass{article}
+ \RequirePackage{l3keys2e}
+ \ProvidesExplClass{l3keys2e-class}{0000/00/00}{0.0}{test}
+ \keys_define:nn { test1 } {
+ option1 .code:n = {\wlog{You~gave~`#1'~for~option1}}
+ }
+ \ProcessKeysOptions { test1 }
+\end{filecontents}
+
+% Load the class with some options.
+% The class itself recognises `option1', leaving `option2' and
+% `option3' as global optons which are not yet used.
+\documentclass[option1=check,option2=more stuff,option3=unused]
+ {l3keys2e-class}
+
+%Now create a package
+\begin{filecontents}{l3keys2e-package.sty}
+ \RequirePackage{l3keys2e}
+ \ProvidesExplPackage{l3keys2e-package}{0000/00/00}{0.0}{test}
+ \keys_define:nn { test2 } {
+ option1 .code:n = {\wlog{You~gave~`#1'~for~option1~(again)}},
+ option2 .code:n = {\wlog{You~gave~`#1'~for~option2}},
+ option4 .code:n = {\wlog{You~gave~`#1'~for~option4}},
+ }
+ \ProcessKeysOptions { test2 }
+\end{filecontents}
+
+% Load the package.
+\usepackage[option4={extra stuff},option5=undefined!]
+ {l3keys2e-package}
+
+\begin{document}
+% The log should show that option3 is an unused global option, and that
+% option5 is not known by the l3keys2e-demo package. Everything else
+% should simply be listed in the log.
+\end{document}
diff --git a/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx b/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx
index b00d7f91819..c94a16b0d96 100644
--- a/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx
+++ b/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx
@@ -36,7 +36,7 @@
%
%<*driver|package>
\RequirePackage{xparse}
-\GetIdInfo$Id: l3keys2e.dtx 2535 2011-08-10 18:26:57Z joseph $
+\GetIdInfo$Id: l3keys2e.dtx 2607 2011-08-17 16:43:25Z joseph $
{LaTeX2e option processing using LaTeX3 keys}
%</driver|package>
%<*driver>
@@ -137,7 +137,7 @@
%
% A check to make sure that \pkg{expl3} is not too old
% \begin{macrocode}
-\@ifpackagelater { expl3 } { 2011/08/13 }
+\@ifpackagelater { expl3 } { 2011/08/17 }
{ }
{
\PackageError { l3keys2e } { Support~package~l3kernel~too~old. }
@@ -254,7 +254,7 @@
\keys_if_exist:nnT {#1} { \keys_latexe_remove_equals:n {##1} }
{
\clist_put_right:Nn \keys_latexe_options_clist {##1}
- \clist_remove_element:Nn \@unusedoptionlist {##1}
+ \clist_remove_all:Nn \@unusedoptionlist {##1}
}
}
}
diff --git a/Master/texmf-dist/source/latex/l3packages/xparse/xparse.dtx b/Master/texmf-dist/source/latex/l3packages/xparse/xparse.dtx
index 483406a126b..4965ca1fd41 100644
--- a/Master/texmf-dist/source/latex/l3packages/xparse/xparse.dtx
+++ b/Master/texmf-dist/source/latex/l3packages/xparse/xparse.dtx
@@ -1,5 +1,5 @@
% \iffalse meta-comment
-%
+%
%% File: xparse.dtx (C) Copyright 1999 Frank Mittelbach, Chris Rowley,
%% David Carlisle
%% (C) Copyright 2004-2008 Frank Mittelbach,
@@ -40,7 +40,7 @@
%
%<*driver|package>
\RequirePackage{expl3}
-\GetIdInfo$Id: xparse.dtx 2535 2011-08-10 18:26:57Z joseph $
+\GetIdInfo$Id: xparse.dtx 2607 2011-08-17 16:43:25Z joseph $
{L3 Experimental document command parser}
%</driver|package>
%<*driver>
@@ -51,17 +51,17 @@
\end{document}
%</driver>
% \fi
-%
+%
% \providecommand\acro[1]{\textsc{\MakeLowercase{#1}}}
% \newenvironment{arg-description}{%
% \begin{itemize}\def\makelabel##1{\hss\llap{\bfseries##1}}}{\end{itemize}}
-%
+%
% \title{^^A
% The \textsf{xparse} package\\ Document command parser^^A
% \thanks{This file describes v\ExplFileVersion,
% last revised \ExplFileDate.}^^A
% }
-%
+%
% \author{^^A
% The \LaTeX3 Project\thanks
% {^^A
@@ -129,12 +129,20 @@
% token alone or multiple tokens surrounded by curly braces.
% Regardless of the input, the argument will be passed to the
% internal code surrounded by a brace pair. This is the \pkg{xparse}
-% type specifier for a normal \TeX\ argument.
+% type specifier for a normal \TeX{} argument.
% \item[l] An argument which reads everything up to the first
-% open group token: in standard \LaTeX\ this is a left brace.
+% open group token: in standard \LaTeX{} this is a left brace.
% \item[u] Reads an argument `until' \meta{tokens} are encountered,
% where the desired \meta{tokens} are given as an argument to the
% specifier: \texttt{u}\marg{tokens}.
+% \item[v] Reads an argument \enquote{verbatim}, between the following
+% character and its next occurrence, in a way similar to the argument
+% of the \LaTeXe{} command \cs{verb}. Thus a \texttt{v}-type argument
+% is read between two matching tokens, which cannot be any of |%|, |\|,
+% |#|, |{|, |}|, |^| or \verb*| |.
+% A command with a verbatim
+% argument will not work when it appears within an argument of
+% another function.
% \end{itemize}
% The types which define optional arguments are:
% \begin{itemize}[font=\ttfamily]
@@ -201,6 +209,11 @@
% argument processors is a somewhat advanced topic, (or at least a less
% commonly used feature) and is covered in Section~\ref{sec:processors}.
%
+% By default, an argument of type \texttt{v} must be at most one line.
+% Prefixing with \texttt{+} allows line breaks within the argument.
+% The argument is given as a string of characters with category code~$12$,
+% except spaces, which have category code~$10$ (see \cs{tl_to_str:n}).
+%
% \subsection{Spacing and optional arguments}
%
% \TeX{} will find the first argument after a function name irrespective
@@ -222,6 +235,23 @@
% |\foo{arg1}[arg2]| will find an optional argument but
% \verb*|\foo{arg1} [arg2]| will not. This is so that trailing optional
% arguments are not picked up \enquote{by accident} in input.
+%
+% \subsection{Verbatim arguments}
+%
+% Arguments of type \enquote{\texttt{v}} are read in verbatim mode, which will
+% result in the grabbed argument consisting of tokens of category code
+% $12$~(\enquote{other}), except spaces, which are given category code
+% $10$~(\enquote{space}). The argument will be
+% delimited in a similar manner to the \LaTeXe{} \cs{verb} function.
+%
+% Functions containing verbatim arguments cannot appear in the arguments
+% of other functions. The \texttt{v}~argument specifier includes code to check
+% this, and will raise an error if the grabbed argument has already been
+% tokenized by \TeX{}.
+%
+% Users should note that support for verbatim arguments is somewhat
+% experimental. Feedback is therefore very welcome on the \texttt{LaTeX-L}
+% mailing list.
%
% \subsection{Declaring commands and environments}
%
@@ -248,7 +278,7 @@
% \meta{function}. The argument specification for the function is
% given by \meta{arg spec}, and expanding
% to be replaced by the \meta{code}.
-%
+%
% As an example:
% \begin{verbatim}
% \DeclareDocumentCommand \chapter { s o m }
@@ -519,6 +549,7 @@
% to mix short and long argument types.
% \item The `optional group' argument types \texttt{g} and
% \texttt{G} are not available.
+% \item The `verbatim' argument type \texttt{v} is not available.
% \item It is not possible to differentiate between, for example
% |\foo[| and |\foo{[}|: in both cases the \texttt{[} will be
% interpreted as the start of an optional argument. As a result
@@ -560,9 +591,9 @@
% the \meta{function} or \meta{environment} has no known argument
% specification then an error is issued.
% \end{function}
-%
+%
% \section{Load-time options}
-%
+%
% \DescribeOption{log-declarations}
% The package recognises the load-time option \texttt{log-declarations},
% which is a key--value option taking the value \texttt{true} and
@@ -589,10 +620,10 @@
{\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
\RequirePackage{expl3}
% \end{macrocode}
-%
+%
% A check to make sure that \pkg{expl3} is not too old
% \begin{macrocode}
-\@ifpackagelater { expl3 } { 2011/08/13 }
+\@ifpackagelater { expl3 } { 2011/08/17 }
{ }
{
\PackageError { xparse } { Support~package~l3kernel~too~old. }
@@ -616,7 +647,18 @@
\prop_put:Nnn \c_xparse_shorthands_prop { O } { D[] }
\prop_put:Nnn \c_xparse_shorthands_prop { s } { t* }
% \end{macrocode}
- %\end{variable}
+% \end{variable}
+%
+% \begin{variable}{\c_xparse_special_chars_seq}
+% In \IniTeX{} mode, we store special characters in a sequence.
+% Maybe |$| or |&| will have to be added later.
+% \begin{macrocode}
+%<*initex>
+\seq_set_from_clist:Nn \c_xparse_special_chars_seq
+ { \ , \\ , \{ , \} , \# , \^ , \_ , \% , \~ }
+%</initex>
+% \end{macrocode}
+% \end{variable}
%
% \begin{variable}{\l_xparse_arg_tl}
% Token list variable for single grabbed argument when post-processing.
@@ -931,6 +973,18 @@
% \end{macrocode}
%\end{macro}
%
+% \begin{macro}{\xparse_add_type_v:w}
+% At this stage, the \texttt{v} argument is identical to \texttt{l}.
+% \begin{macrocode}
+\cs_new_protected_nopar:Npn \xparse_add_type_v:w
+ {
+ \xparse_flush_m_args:
+ \xparse_add_grabber_mandatory:N v
+ \xparse_prepare_signature:N
+ }
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}{\xparse_check_and_add:N}
% This function checks if the argument type actually exists and gives
% an error if it doesn't.
@@ -967,11 +1021,8 @@
{
\quark_if_nil:NF #1
{
- \prop_if_in:NnTF \c_xparse_shorthands_prop {#1}
- {
- \prop_get:NnN \c_xparse_shorthands_prop {#1} \l_xparse_tmp_tl
- \exp_last_unbraced:NV \xparse_count_mandatory:N \l_xparse_tmp_tl
- }
+ \prop_get:NnNTF \c_xparse_shorthands_prop {#1} \l_xparse_tmp_tl
+ { \exp_last_unbraced:NV \xparse_count_mandatory:N \l_xparse_tmp_tl }
{ \xparse_count_mandatory_aux:N #1 }
}
}
@@ -996,6 +1047,7 @@
% \begin{macro}{\xparse_count_type_m:w}
% \begin{macro}{\xparse_count_type_t:w}
% \begin{macro}{\xparse_count_type_u:w}
+% \begin{macro}{\xparse_count_type_v:w}
% For counting the mandatory arguments, a function is provided for
% each argument type that will mop any extra arguments and call the
% loop function. Only the counting functions for mandatory arguments
@@ -1031,6 +1083,11 @@
\int_incr:N \l_xparse_mandatory_args_int
\xparse_count_mandatory:N
}
+\cs_new_protected_nopar:Npn \xparse_count_type_v:w
+ {
+ \int_incr:N \l_xparse_mandatory_args_int
+ \xparse_count_mandatory:N
+ }
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -1042,6 +1099,7 @@
% \end{macro}
% \end{macro}
% \end{macro}
+% \end{macro}
%
% \begin{macro}{\xparse_declare_cmd:Nnn}
% \begin{macro}[aux]{\xparse_declare_cmd_aux:Nnn}
@@ -1281,11 +1339,8 @@
\quark_if_nil:NTF #1
{ \bool_if:NF \l_xparse_m_only_bool { \xparse_flush_m_args: } }
{
- \prop_if_in:NnTF \c_xparse_shorthands_prop {#1}
- {
- \prop_get:NnN \c_xparse_shorthands_prop {#1} \l_xparse_tmp_tl
- \exp_after:wN \xparse_prepare_signature:N \l_xparse_tmp_tl
- }
+ \prop_get:NnNTF \c_xparse_shorthands_prop {#1} \l_xparse_tmp_tl
+ { \exp_after:wN \xparse_prepare_signature:N \l_xparse_tmp_tl }
{
\int_incr:N \l_xparse_total_args_int
\xparse_check_and_add:N #1
@@ -1734,15 +1789,15 @@
%
% \begin{macro}{\xparse_grab_u:w}
% \begin{macro}{\xparse_grab_u_long:w}
-% \begin{macro}[aux]{\xparse_grab_u_aux:NnN}
+% \begin{macro}[aux]{\xparse_grab_u_aux:nnN}
% Grabbing up to a list of tokens is quite easy: define the grabber,
% and then collect.
% \begin{macrocode}
\cs_new_protected:Npn \xparse_grab_u:w #1#2 \l_xparse_args_tl
- { \xparse_grab_u_aux:NnN {#1} {#2} \cs_set_protected_nopar:Npn }
+ { \xparse_grab_u_aux:nnN {#1} {#2} \cs_set_protected_nopar:Npn }
\cs_new_protected:Npn \xparse_grab_u_long:w #1#2 \l_xparse_args_tl
- { \xparse_grab_u_aux:NnN {#1} {#2} \cs_set_protected:Npn }
-\cs_new_protected:Npn \xparse_grab_u_aux:NnN #1#2#3
+ { \xparse_grab_u_aux:nnN {#1} {#2} \cs_set_protected:Npn }
+\cs_new_protected:Npn \xparse_grab_u_aux:nnN #1#2#3
{
#3 \xparse_grab_arg:w ##1 #1
{
@@ -1756,6 +1811,184 @@
% \end{macro}
% \end{macro}
%
+% \begin{macro}{\xparse_grab_v:w}
+% \begin{macro}{\xparse_grab_v_long:w}
+% \begin{variable}{\l_xparse_v_rest_of_signature_tl}
+% \begin{variable}{\l_xparse_v_arg_tl}
+% \begin{macro}{\xparse_grab_v_aux:nw, \xparse_grab_v_aux_test:nN}
+% \begin{macro}
+% {
+% \xparse_grab_v_aux_loop:N,
+% \xparse_grab_v_aux_loop_ii:NN,
+% \xparse_grab_v_aux_loop_end:,
+% \xparse_grab_v_group_end:
+% }
+% \begin{macro}{\xparse_grab_v_aux_abort:, \xparse_grab_v_aux_abort_ii:w}
+% The opening delimiter is never read verbatim: if the preceeding
+% argument was optional and absent, then \TeX{} has already read
+% that token when looking for the optional argument. The first thing
+% to check is that this delimiter is a character.
+% Then change category codes, and start reading tokens one by one.
+% If the verbatim was not nested, we will be grabbing one character
+% at each step. Unfortunately, it can happen that what follows the
+% verbatim argument is already tokenized. Thus, we check at each step
+% that the next token is indeed a \enquote{nice}
+% character, \emph{i.e.}, is not a character with
+% category code $1$ (begin-group), $2$ (end-group)
+% or $6$ (macro parameter), nor the space character,
+% with category code~$10$ and character code~$32$,
+% nor a control sequence.
+% The partially built argument is stored in \cs{g_xparse_v_arg_tl}.
+% If we ever meet a token which we cannot grab (non-N-type),
+% or which is not a character according to
+% \cs{xparse_grab_v_token_if_char:NTF}, then we bail out with
+% \cs{xparse_grab_v_aux_abort:}. Otherwise, we stop at the first
+% character matching the delimiter.
+%
+% The group keep catcode changes local, and
+% \cs{group_align_safe_begin/end:} allow to use a character
+% with category code $4$ (normally |&|) as the delimiter.
+%
+% The approach for short verbatim arguments is to make the end-line
+% character a macro parameter character: this is forbidden by the
+% rest of the code. Then the error branch can check what caused the
+% bail out and give the appropriate error message.
+% \begin{macrocode}
+\tl_new:N \l_xparse_v_rest_of_signature_tl
+\tl_new:N \l_xparse_v_arg_tl
+\cs_new_protected_nopar:Npn \xparse_grab_v:w
+ {
+ \bool_set_false:N \l_xparse_long_bool
+ \xparse_grab_v_aux:w
+ }
+\cs_new_protected_nopar:Npn \xparse_grab_v_long:w
+ {
+ \bool_set_true:N \l_xparse_long_bool
+ \xparse_grab_v_aux:w
+ }
+\cs_new_protected:Npn \xparse_grab_v_aux:w #1 \l_xparse_args_tl
+ {
+ \group_begin:
+ \group_align_safe_begin:
+ \tex_escapechar:D = 92 \scan_stop:
+ \tl_set:Nn \l_xparse_v_rest_of_signature_tl {#1}
+ \tl_clear:N \l_xparse_v_arg_tl
+ \peek_N_type:TF
+ { \xparse_grab_v_aux_test:N }
+ { \xparse_grab_v_aux_abort: }
+ }
+\cs_new_protected:Npn \xparse_grab_v_aux_test:N #1
+ {
+ \tl_put_right:Nn \l_xparse_v_arg_tl {#1}
+ \xparse_grab_v_token_if_char:NTF #1
+ {
+%<*initex>
+ \seq_map_function:NN
+ \c_xparse_special_chars_seq
+ \char_set_catcode_other:N
+%</initex>
+%<*package>
+ \cs_set_eq:NN \do \char_set_catcode_other:N
+ \dospecials
+%</package>
+ \tex_endlinechar:D = `\^^M \scan_stop:
+ \bool_if:NTF \l_xparse_long_bool
+ { \char_set_catcode_other:n { \tex_endlinechar:D } }
+ { \char_set_catcode_parameter:n { \tex_endlinechar:D } }
+ \xparse_grab_v_aux_loop:N #1
+ }
+ { \xparse_grab_v_aux_abort: }
+ }
+\cs_new_protected:Npn \xparse_grab_v_aux_loop:N #1
+ {
+ \peek_N_type:TF
+ { \xparse_grab_v_aux_loop_ii:NN #1 }
+ { \xparse_grab_v_aux_abort: }
+ }
+\cs_new_protected:Npn \xparse_grab_v_aux_loop_ii:NN #1 #2
+ {
+ \xparse_grab_v_token_if_char:NTF #2
+ {
+ \token_if_eq_charcode:NNTF #1 #2
+ { \xparse_grab_v_aux_loop_end: }
+ {
+ \tl_put_right:Nn \l_xparse_v_arg_tl { #2 }
+ \xparse_grab_v_aux_loop:N #1
+ }
+ }
+ { \xparse_grab_v_aux_abort: #2 }
+ }
+\cs_new_protected_nopar:Npn \xparse_grab_v_aux_loop_end:
+ {
+ \xparse_grab_v_group_end:
+ \exp_args:Nx \xparse_add_arg:n
+ { \exp_args:No \str_tail:n { \l_xparse_v_arg_tl } }
+ \l_xparse_v_rest_of_signature_tl \l_xparse_args_tl
+ }
+\cs_new_protected_nopar:Npn \xparse_grab_v_aux_abort:
+ {
+ \xparse_grab_v_group_end:
+ \xparse_add_arg:n { \NoValue }
+ \exp_after:wN \xparse_grab_v_aux_abort_ii:w \l_xparse_args_tl \q_stop
+ }
+\cs_new_protected:Npn \xparse_grab_v_aux_abort_ii:w #1 #2 \q_stop
+ {
+ \group_begin:
+ \char_set_lccode:nn { `\# } { \tex_endlinechar:D }
+ \tl_to_lowercase:n
+ { \group_end: \peek_meaning_remove:NTF ## }
+ {
+ \msg_error:nnxx { xparse } { verbatim-newline }
+ { \cs_to_str:N #1 }
+ { \tl_to_str:N \l_xparse_v_arg_tl }
+ \l_xparse_v_rest_of_signature_tl \l_xparse_args_tl
+ }
+ {
+ \msg_error:nnxx { xparse } { verbatim-already-tokenized }
+ { \cs_to_str:N #1 }
+ { \tl_to_str:N \l_xparse_v_arg_tl }
+ \l_xparse_v_rest_of_signature_tl \l_xparse_args_tl
+ }
+ }
+% \end{macrocode}
+% Two items need to be smuggled out of the group used by the code.
+% \begin{macrocode}
+\cs_new_protected_nopar:Npn \xparse_grab_v_group_end:
+ {
+ \tl_set:Nx \l_xparse_tmp_tl
+ {
+ \tl_set:Nn \exp_not:N \l_xparse_v_rest_of_signature_tl
+ { \exp_not:o \l_xparse_v_rest_of_signature_tl }
+ \tl_set:Nn \exp_not:N \l_xparse_v_arg_tl
+ { \exp_not:o \l_xparse_v_arg_tl }
+ }
+ \exp_after:wN \group_align_safe_end:
+ \exp_after:wN \group_end:
+ \l_xparse_tmp_tl
+ }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{variable}
+% \end{variable}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\xparse_grab_v_token_if_char:NTF}
+% This function assumes that the escape character is printable.
+% Then the string representation of control sequences is at least
+% two characters, and \cs{str_tail:n} only removes the escape
+% character. Macro parameter characters are doubled by
+% \cs{tl_to_str:n}, and will also yield a non-empty result,
+% hence are not considered as characters.
+% \begin{macrocode}
+\cs_new_protected:Npn \xparse_grab_v_token_if_char:NTF #1
+ { \str_if_eq:xxTF { } { \str_tail:n {#1} } }
+% \end{macrocode}
+% \end{macro}
+%
% \subsection{Argument processors}
%
% \begin{macro}{\xparse_process_to_str:n}
@@ -1797,7 +2030,7 @@
\tl_to_lowercase:n
{
\group_end:
- \tl_replace_all_in:Nnn \l_xparse_split_argument_tl { @ } {#2}
+ \tl_replace_all:Nnn \l_xparse_split_argument_tl { @ } {#2}
}
\cs_set_protected:Npn \xparse_split_argument_aux_i:w
##1 \q_mark ##2 #2 ##3 \q_stop
@@ -1861,7 +2094,7 @@
\tl_to_lowercase:n
{
\group_end:
- \tl_replace_all_in:Nnn \l_xparse_split_list_tl { @ } {#1}
+ \tl_replace_all:Nnn \l_xparse_split_list_tl { @ } {#1}
}
\cs_set:Npn \xparse_split_list_aux:w ##1 #1
{
@@ -2153,30 +2386,35 @@
% \begin{macro}{\xparse_exp_prepare_function:n}
% \begin{macro}[aux]{\xparse_exp_prepare_function_aux:n}
% A couple of early validation tests. Processors are forbidden, as are
-% \texttt{g}, \texttt{l} and \texttt{u} arguments (the later more for
-% ease than any technical reason).
+% \texttt{g}, \texttt{l}, \texttt{u} and \texttt{v} arguments.
% \begin{macrocode}
\cs_new_protected:Npn \xparse_exp_prepare_function:n #1
{
\bool_set_false:N \l_xparse_error_bool
\tl_if_in:nnT {#1} { > }
{
- \msg_error:nnx { xparse } { processor-in-expandable }
+ \msg_error:nnxx { xparse } { processor-in-expandable }
{ \tl_to_str:n {#1} }
\bool_set_true:N \l_xparse_error_bool
}
\tl_if_in:nnT {#1} { g }
{
- \msg_error:nnx { xparse } { grouped-in-expandable }
+ \msg_error:nnxx { xparse } { grouped-in-expandable }
{ g } { \tl_to_str:n {#1} }
\bool_set_true:N \l_xparse_error_bool
}
\tl_if_in:nnT {#1} { G }
{
- \msg_error:nnx { xparse } { grouped-in-expandable }
+ \msg_error:nnxx { xparse } { grouped-in-expandable }
{ G } { \tl_to_str:n {#1} }
\bool_set_true:N \l_xparse_error_bool
}
+ \tl_if_in:nnT {#1} { v }
+ {
+ \msg_error:nnxx { xparse } { verbatim-in-expandable }
+ { v } { \tl_to_str:n {#1} }
+ \bool_set_true:N \l_xparse_error_bool
+ }
\bool_if:NF \l_xparse_error_bool
{ \xparse_exp_prepare_function_aux:n {#1} }
}
@@ -2229,9 +2467,8 @@
{
\quark_if_nil:NF #1
{
- \prop_if_in:NnTF \c_xparse_shorthands_prop {#1}
+ \prop_get:NnNTF \c_xparse_shorthands_prop {#1} \l_xparse_tmp_tl
{
- \prop_get:NnN \c_xparse_shorthands_prop {#1} \l_xparse_tmp_tl
\bool_if:NT \l_xparse_long_bool
{ \tl_put_left:Nn \l_xparse_tmp_tl { + } }
\exp_after:wN \xparse_exp_prepare_function:N \l_xparse_tmp_tl
@@ -2424,6 +2661,27 @@
You~have~asked~for~the~argument~specification~for~a~command~'#1',~
but~this~is~not~a~document~environment.
}
+\msg_new:nnnn { xparse } { verbatim-newline }
+ { Verbatim~argument~of~#1~ended~by~end~of~line. }
+ {
+ Short~verbatim~arguments~cannot~contain~newlines.~
+ I~suspect~you've~forgotten~the~closing~delimiter~of~#1.
+ I~will~ignore~'#2'.
+ }
+\msg_new:nnnn { xparse } { verbatim-already-tokenized }
+ { Verbatim~command~#1~illegal~in~command~argument. }
+ {
+ The~command~#1~takes~a~verbatim~argument.~It~may~not~appear~within~
+ the~argument~of~another~function.~I~will~ignore~'#2'.
+ }
+
+\msg_new:nnnn { xparse } { verbatim-in-expandable }
+ { Argument~specifier~'#1'~forbidden~in~expandable~commands. }
+ {
+ \c_msg_coding_error_text_tl
+ Argument~specification~'#2'~contains~the~verbatim~argument~'#1':~
+ this~is only~supported~for~standard~robust~functions.
+ }
% \end{macrocode}
%
% Intended more for information.
@@ -2625,7 +2883,7 @@
% \end{macro}
% \end{macro}
% \end{macro}
-%
+%
% \subsection{Package options}
%
% A faked key--value option to keep the log clean. Not yet perfect, but
diff --git a/Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.dtx b/Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.dtx
index 3d2380d28aa..a75943d993f 100644
--- a/Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.dtx
+++ b/Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.dtx
@@ -40,7 +40,7 @@
%
%<*driver|package>
\RequirePackage{expl3}
-\GetIdInfo$Id: xtemplate.dtx 2535 2011-08-10 18:26:57Z joseph $
+\GetIdInfo$Id: xtemplate.dtx 2607 2011-08-17 16:43:25Z joseph $
{L3 Experimental prototype document functions}
%</driver|package>
%<*driver>
@@ -112,12 +112,6 @@
% \pkg{xtemplate} also makes it easier for \LaTeX{} programmers to provide
% their own customisations on top of a pre-existing class.
%
-% The idea behind the template module is to cleanly separate the three
-% layers, so that document authors who are not programmers can easily
-% change the design of their documents. Templates also make it easier
-% for \LaTeX{} programmers to provide their own customisations on top of
-% a pre-existing class.
-%
% \section{What is a document?}
%
% Besides the textual content of the words themselves, the source file
@@ -158,7 +152,7 @@
% By formally declaring documents to be composed of mark-up elements
% grouped into objects, which are interpreted and typeset with a set of
% templates, each of which has one or more instances with which to
-% compose each and every semantic unit of the text, there can be clean
+% compose each and every semantic unit of the text, we can cleanly
% separate the components of document construction.
%
% All of the structures provided by the template system are global,
@@ -234,7 +228,7 @@
% with the exception of |,|, |=| and \verb*| |. The recommended form
% for key names is to use lower case letters, with dashes to separate
% out different parts. Spaces are ignored in key names, so they can be
-% included are missed out at will. Each \meta{key} must have a
+% included or missed out at will. Each \meta{key} must have a
% \meta{key type}, which defined the type of input that the \meta{key}
% requires. A full list of key types is given in
% Table~\ref{tab:key-types}. Each key may have a \meta{default}
@@ -253,7 +247,7 @@
% & A list of pre-defined \meta{choices} \\
% code
% & Generalised key type: use |#1| as the input to the key \\
-% commalist & A comma-separated \\
+% commalist & A comma-separated list \\
% function\Arg{$N$}
% & A function definition with $N$ arguments
% ($N$ from $0$ to $9$) \\
@@ -664,7 +658,7 @@
%
% A check to make sure that \pkg{expl3} is not too old
% \begin{macrocode}
-\@ifpackagelater { expl3 } { 2011/08/13 }
+\@ifpackagelater { expl3 } { 2011/08/17 }
{ }
{
\PackageError { xtemplate } { Support~package~l3kernel~too~old. }
@@ -850,6 +844,18 @@
% \end{macrocode}
% \end{variable}
%
+% \subsection{Variant of prop functions}
+%
+% \begin{macro}[TF]{\prop_get:NoN}
+% In some cases, we need to expand the key, and get the corresponding
+% value in a property list if it exists.
+% \begin{macrocode}
+\cs_generate_variant:Nn \prop_get:NnNTF { No }
+\cs_generate_variant:Nn \prop_get:NnNT { No }
+\cs_generate_variant:Nn \prop_get:NnNF { No }
+% \end{macrocode}
+% \end{macro}
+%
% \subsection{Testing existence and validity}
%
% There are a number of checks needed for either the existence of
@@ -1506,13 +1512,10 @@
\xtemplate_store_vars:n { #1 / #2 }
\clist_clear:N \l_xtemplate_restrict_clist
\xtemplate_store_restrictions:n { #1 / #2 }
- \prop_if_empty:NF \l_xtemplate_keytypes_prop
+ \prop_map_inline:Nn \l_xtemplate_keytypes_prop
{
- \prop_map_inline:Nn \l_xtemplate_keytypes_prop
- {
- \msg_error:nnxxx { xtemplate } { key-not-implemented }
- {##1} {#2} {#1}
- }
+ \msg_error:nnxxx { xtemplate } { key-not-implemented }
+ {##1} {#2} {#1}
}
}
% \end{macrocode}
@@ -1537,10 +1540,11 @@
{
\tl_set:Nx \l_xtemplate_key_name_tl { \tl_to_str:n {#1} }
\tl_remove_all:Nn \l_xtemplate_key_name_tl { ~ }
- \prop_if_in:NoTF \l_xtemplate_keytypes_prop \l_xtemplate_key_name_tl
+ \prop_get:NoNTF
+ \l_xtemplate_keytypes_prop
+ \l_xtemplate_key_name_tl
+ \l_xtemplate_keytype_tl
{
- \prop_get:NoN \l_xtemplate_keytypes_prop \l_xtemplate_key_name_tl
- \l_xtemplate_keytype_tl
\xtemplate_split_keytype_arg:o \l_xtemplate_keytype_tl
\xtemplate_parse_vars_elt_aux:n {#2}
\prop_del:NV \l_xtemplate_keytypes_prop \l_xtemplate_key_name_tl
@@ -1634,7 +1638,8 @@
\keyval_parse:NNn
\xtemplate_implement_choice_elt:n \xtemplate_implement_choice_elt:nn
{#1}
- \prop_if_in:NoT \l_xtemplate_values_prop \l_xtemplate_key_name_tl
+ \prop_get:NoNT \l_xtemplate_values_prop \l_xtemplate_key_name_tl
+ \l_xtemplate_tmp_tl
{ \xtemplate_implement_choices_default: }
\clist_if_empty:NF \l_xtemplate_tmp_clist
{
@@ -1651,8 +1656,6 @@
% \begin{macrocode}
\cs_new_protected_nopar:Npn \xtemplate_implement_choices_default:
{
- \prop_get:NoN \l_xtemplate_values_prop \l_xtemplate_key_name_tl
- \l_xtemplate_tmp_tl
\tl_set:Nx \l_xtemplate_tmp_tl
{ \l_xtemplate_key_name_tl \c_space_tl \l_xtemplate_tmp_tl }
\prop_if_in:NoF \l_xtemplate_vars_prop \l_xtemplate_tmp_tl
@@ -1700,7 +1703,7 @@
}
{
\clist_if_in:NnTF \l_xtemplate_tmp_clist {#1}
- { \clist_remove_element:Nn \l_xtemplate_tmp_clist {#1} }
+ { \clist_remove_all:Nn \l_xtemplate_tmp_clist {#1} }
{
\prop_get:NoN \l_xtemplate_keytypes_prop \l_xtemplate_key_name_tl
\l_xtemplate_tmp_tl
@@ -1799,8 +1802,7 @@
% \end{macro}
%
% \begin{macro}{\xtemplate_parse_values_elt:nn}
-% \begin{macro}[aux]{\xtemplate_parse_values_elt_aux:nn}
-% \begin{macro}[aux]{\xtemplate_parse_values_elt_aux:on}
+% \begin{macro}[aux]{\xtemplate_parse_values_elt_aux:n}
% To store the value, find the keytype then call the saving function.
% These need the current key name saved as \cs{l_xtemplate_key_name_tl}.
% When a template is being restricted, the setting code will be
@@ -1810,36 +1812,31 @@
{
\tl_set:Nx \l_xtemplate_key_name_tl { \tl_to_str:n {#1} }
\tl_remove_all:Nn \l_xtemplate_key_name_tl { ~ }
- \prop_if_in:NoTF \l_xtemplate_keytypes_prop \l_xtemplate_key_name_tl
+ \prop_get:NoNTF \l_xtemplate_keytypes_prop \l_xtemplate_key_name_tl
+ \l_xtemplate_tmp_tl
{
\bool_if:NTF \l_xtemplate_restrict_bool
{
\clist_if_in:NoF \l_xtemplate_restrict_clist
\l_xtemplate_key_name_tl
- {
- \xtemplate_parse_values_elt_aux:on
- \l_xtemplate_key_name_tl {#2}
- }
+ { \xtemplate_parse_values_elt_aux:n {#2} }
}
- { \xtemplate_parse_values_elt_aux:on \l_xtemplate_key_name_tl {#2} }
+ { \xtemplate_parse_values_elt_aux:n {#2} }
}
{
\msg_error:nnx { xtemplate } { unknown-key }
{ \l_xtemplate_key_name_tl }
}
}
-\cs_new_protected:Npn \xtemplate_parse_values_elt_aux:nn #1#2
+\cs_new_protected:Npn \xtemplate_parse_values_elt_aux:n #1
{
- \clist_put_right:Nn \l_xtemplate_restrict_clist {#1}
- \prop_get:NnN \l_xtemplate_keytypes_prop {#1} \l_xtemplate_tmp_tl
+ \clist_put_right:No \l_xtemplate_restrict_clist \l_xtemplate_key_name_tl
\xtemplate_split_keytype_arg:o \l_xtemplate_tmp_tl
- \use:c { xtemplate_store_value_ \l_xtemplate_keytype_tl :n } {#2}
+ \use:c { xtemplate_store_value_ \l_xtemplate_keytype_tl :n } {#1}
}
-\cs_generate_variant:Nn \xtemplate_parse_values_elt_aux:nn { o }
% \end{macrocode}
% \end{macro}
% \end{macro}
-% \end{macro}
%
% \begin{macro}{\xtemplate_set_template_eq:nn}
% To copy a template, each of the lists plus the code has to be copied
@@ -1972,12 +1969,10 @@
% \begin{macrocode}
\cs_new_protected:Npn \xtemplate_convert_to_assignments_aux:nn #1#2
{
- \prop_if_in:NnT \l_xtemplate_values_prop {#1}
+ \prop_get:NnNT \l_xtemplate_values_prop {#1} \l_xtemplate_value_tl
{
- \prop_if_in:NnTF \l_xtemplate_vars_prop {#1}
+ \prop_get:NnNTF \l_xtemplate_vars_prop {#1} \l_xtemplate_var_tl
{
- \prop_get:NnN \l_xtemplate_values_prop {#1} \l_xtemplate_value_tl
- \prop_get:NnN \l_xtemplate_vars_prop {#1} \l_xtemplate_var_tl
\xtemplate_split_keytype_arg:n {#2}
\str_if_eq:onF \l_xtemplate_keytype_tl { choice }
{
@@ -2078,15 +2073,11 @@
% \begin{macrocode}
\cs_new_protected_nopar:Npn \xtemplate_assign_choice:
{
- \tl_set:Nx \l_xtemplate_tmp_tl
+ \xtemplate_assign_choice_aux:xF
{ \l_xtemplate_key_name_tl \c_space_tl \l_xtemplate_value_tl }
- \prop_if_in:NoTF \l_xtemplate_vars_prop \l_xtemplate_tmp_tl
- { \xtemplate_assign_choice_aux:o \l_xtemplate_tmp_tl }
{
- \tl_set:Nx \l_xtemplate_tmp_tl
+ \xtemplate_assign_choice_aux:xF
{ \l_xtemplate_key_name_tl \c_space_tl unknown }
- \prop_if_in:NoTF \l_xtemplate_vars_prop \l_xtemplate_tmp_tl
- { \xtemplate_assign_choice_aux:o \l_xtemplate_tmp_tl }
{
\prop_get:NoN \l_xtemplate_keytypes_prop \l_xtemplate_key_name_tl
\l_xtemplate_tmp_tl
@@ -2097,12 +2088,15 @@
}
}
}
-\cs_new_protected:Npn \xtemplate_assign_choice_aux:n #1
+\cs_new_protected_nopar:Npn \xtemplate_assign_choice_aux:nF #1
{
- \prop_get:NnN \l_xtemplate_vars_prop {#1} \l_xtemplate_tmp_tl
- \tl_put_right:No \l_xtemplate_assignments_tl \l_xtemplate_tmp_tl
+ \prop_get:NnNTF
+ \l_xtemplate_vars_prop
+ {#1}
+ \l_xtemplate_tmp_tl
+ { \tl_put_right:No \l_xtemplate_assignments_tl \l_xtemplate_tmp_tl }
}
-\cs_generate_variant:Nn \xtemplate_assign_choice_aux:n { o }
+\cs_generate_variant:Nn \xtemplate_assign_choice_aux:nF { x }
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -2287,11 +2281,10 @@
{
\tl_set:Nx \l_xtemplate_tmp_tl { \tl_to_str:n {#1} }
\tl_remove_all:Nn \l_xtemplate_key_name_tl { ~ }
- \prop_if_in:NoTF \l_xtemplate_vars_prop \l_xtemplate_tmp_tl
- {
- \prop_get:NoN \l_xtemplate_vars_prop \l_xtemplate_tmp_tl
- \l_xtemplate_value_tl
- }
+ \prop_get:NoNF
+ \l_xtemplate_vars_prop
+ \l_xtemplate_tmp_tl
+ \l_xtemplate_value_tl
{
\msg_error:nnx { xtemplate } { unknown-attribute }
{ \l_xtemplate_tmp_tl }
@@ -2367,11 +2360,8 @@
% \begin{macrocode}
\cs_new_protected:Npn \xtemplate_get_collection:n #1
{
- \prop_if_in:NnTF \l_xtemplate_collections_prop {#1}
- {
- \prop_get:NnN \l_xtemplate_collections_prop {#1}
- \l_xtemplate_collection_tl
- }
+ \prop_get:NnNF \l_xtemplate_collections_prop {#1}
+ \l_xtemplate_collection_tl
{ \tl_clear:N \l_xtemplate_collection_tl }
}
% \end{macrocode}
diff --git a/Master/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty b/Master/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty
index 816facd6c01..0d5afd9ef36 100644
--- a/Master/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty
+++ b/Master/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty
@@ -47,11 +47,11 @@
%% -----------------------------------------------------------------------
%%
\RequirePackage{xparse}
-\GetIdInfo$Id: l3keys2e.dtx 2535 2011-08-10 18:26:57Z joseph $
+\GetIdInfo$Id: l3keys2e.dtx 2607 2011-08-17 16:43:25Z joseph $
{LaTeX2e option processing using LaTeX3 keys}
\ProvidesExplPackage
{\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
-\@ifpackagelater { expl3 } { 2011/08/13 }
+\@ifpackagelater { expl3 } { 2011/08/17 }
{ }
{
\PackageError { l3keys2e } { Support~package~l3kernel~too~old. }
@@ -115,7 +115,7 @@
\keys_if_exist:nnT {#1} { \keys_latexe_remove_equals:n {##1} }
{
\clist_put_right:Nn \keys_latexe_options_clist {##1}
- \clist_remove_element:Nn \@unusedoptionlist {##1}
+ \clist_remove_all:Nn \@unusedoptionlist {##1}
}
}
}
diff --git a/Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty b/Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty
index d76b157392b..22172e020c6 100644
--- a/Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty
+++ b/Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty
@@ -51,12 +51,12 @@
%% -----------------------------------------------------------------------
%%
\RequirePackage{expl3}
-\GetIdInfo$Id: xparse.dtx 2535 2011-08-10 18:26:57Z joseph $
+\GetIdInfo$Id: xparse.dtx 2607 2011-08-17 16:43:25Z joseph $
{L3 Experimental document command parser}
\ProvidesExplPackage
{\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
\RequirePackage{expl3}
-\@ifpackagelater { expl3 } { 2011/08/13 }
+\@ifpackagelater { expl3 } { 2011/08/17 }
{ }
{
\PackageError { xparse } { Support~package~l3kernel~too~old. }
@@ -71,7 +71,6 @@
\prop_put:Nnn \c_xparse_shorthands_prop { o } { d[] }
\prop_put:Nnn \c_xparse_shorthands_prop { O } { D[] }
\prop_put:Nnn \c_xparse_shorthands_prop { s } { t* }
- %\end{variable}
\tl_new:N \l_xparse_arg_tl
\tl_new:N \l_xparse_args_tl
\bool_new:N \l_xparse_environment_bool
@@ -176,6 +175,12 @@
\tl_put_right:Nn \l_xparse_signature_tl { {#1} }
\xparse_prepare_signature:N
}
+\cs_new_protected_nopar:Npn \xparse_add_type_v:w
+ {
+ \xparse_flush_m_args:
+ \xparse_add_grabber_mandatory:N v
+ \xparse_prepare_signature:N
+ }
\cs_new_protected_nopar:Npn \xparse_check_and_add:N #1
{
\cs_if_free:cTF { xparse_add_type_ #1 :w }
@@ -195,11 +200,8 @@
{
\quark_if_nil:NF #1
{
- \prop_if_in:NnTF \c_xparse_shorthands_prop {#1}
- {
- \prop_get:NnN \c_xparse_shorthands_prop {#1} \l_xparse_tmp_tl
- \exp_last_unbraced:NV \xparse_count_mandatory:N \l_xparse_tmp_tl
- }
+ \prop_get:NnNTF \c_xparse_shorthands_prop {#1} \l_xparse_tmp_tl
+ { \exp_last_unbraced:NV \xparse_count_mandatory:N \l_xparse_tmp_tl }
{ \xparse_count_mandatory_aux:N #1 }
}
}
@@ -238,6 +240,11 @@
\int_incr:N \l_xparse_mandatory_args_int
\xparse_count_mandatory:N
}
+\cs_new_protected_nopar:Npn \xparse_count_type_v:w
+ {
+ \int_incr:N \l_xparse_mandatory_args_int
+ \xparse_count_mandatory:N
+ }
\cs_new_protected:Npn \xparse_declare_cmd:Nnn #1#2
{
\cs_if_exist:NTF #1
@@ -395,11 +402,8 @@
\quark_if_nil:NTF #1
{ \bool_if:NF \l_xparse_m_only_bool { \xparse_flush_m_args: } }
{
- \prop_if_in:NnTF \c_xparse_shorthands_prop {#1}
- {
- \prop_get:NnN \c_xparse_shorthands_prop {#1} \l_xparse_tmp_tl
- \exp_after:wN \xparse_prepare_signature:N \l_xparse_tmp_tl
- }
+ \prop_get:NnNTF \c_xparse_shorthands_prop {#1} \l_xparse_tmp_tl
+ { \exp_after:wN \xparse_prepare_signature:N \l_xparse_tmp_tl }
{
\int_incr:N \l_xparse_total_args_int
\xparse_check_and_add:N #1
@@ -678,10 +682,10 @@
\xparse_grab_arg:w
}
\cs_new_protected:Npn \xparse_grab_u:w #1#2 \l_xparse_args_tl
- { \xparse_grab_u_aux:NnN {#1} {#2} \cs_set_protected_nopar:Npn }
+ { \xparse_grab_u_aux:nnN {#1} {#2} \cs_set_protected_nopar:Npn }
\cs_new_protected:Npn \xparse_grab_u_long:w #1#2 \l_xparse_args_tl
- { \xparse_grab_u_aux:NnN {#1} {#2} \cs_set_protected:Npn }
-\cs_new_protected:Npn \xparse_grab_u_aux:NnN #1#2#3
+ { \xparse_grab_u_aux:nnN {#1} {#2} \cs_set_protected:Npn }
+\cs_new_protected:Npn \xparse_grab_u_aux:nnN #1#2#3
{
#3 \xparse_grab_arg:w ##1 #1
{
@@ -690,6 +694,110 @@
}
\xparse_grab_arg:w
}
+\tl_new:N \l_xparse_v_rest_of_signature_tl
+\tl_new:N \l_xparse_v_arg_tl
+\cs_new_protected_nopar:Npn \xparse_grab_v:w
+ {
+ \bool_set_false:N \l_xparse_long_bool
+ \xparse_grab_v_aux:w
+ }
+\cs_new_protected_nopar:Npn \xparse_grab_v_long:w
+ {
+ \bool_set_true:N \l_xparse_long_bool
+ \xparse_grab_v_aux:w
+ }
+\cs_new_protected:Npn \xparse_grab_v_aux:w #1 \l_xparse_args_tl
+ {
+ \group_begin:
+ \group_align_safe_begin:
+ \tex_escapechar:D = 92 \scan_stop:
+ \tl_set:Nn \l_xparse_v_rest_of_signature_tl {#1}
+ \tl_clear:N \l_xparse_v_arg_tl
+ \peek_N_type:TF
+ { \xparse_grab_v_aux_test:N }
+ { \xparse_grab_v_aux_abort: }
+ }
+\cs_new_protected:Npn \xparse_grab_v_aux_test:N #1
+ {
+ \tl_put_right:Nn \l_xparse_v_arg_tl {#1}
+ \xparse_grab_v_token_if_char:NTF #1
+ {
+ \cs_set_eq:NN \do \char_set_catcode_other:N
+ \dospecials
+ \tex_endlinechar:D = `\^^M \scan_stop:
+ \bool_if:NTF \l_xparse_long_bool
+ { \char_set_catcode_other:n { \tex_endlinechar:D } }
+ { \char_set_catcode_parameter:n { \tex_endlinechar:D } }
+ \xparse_grab_v_aux_loop:N #1
+ }
+ { \xparse_grab_v_aux_abort: }
+ }
+\cs_new_protected:Npn \xparse_grab_v_aux_loop:N #1
+ {
+ \peek_N_type:TF
+ { \xparse_grab_v_aux_loop_ii:NN #1 }
+ { \xparse_grab_v_aux_abort: }
+ }
+\cs_new_protected:Npn \xparse_grab_v_aux_loop_ii:NN #1 #2
+ {
+ \xparse_grab_v_token_if_char:NTF #2
+ {
+ \token_if_eq_charcode:NNTF #1 #2
+ { \xparse_grab_v_aux_loop_end: }
+ {
+ \tl_put_right:Nn \l_xparse_v_arg_tl { #2 }
+ \xparse_grab_v_aux_loop:N #1
+ }
+ }
+ { \xparse_grab_v_aux_abort: #2 }
+ }
+\cs_new_protected_nopar:Npn \xparse_grab_v_aux_loop_end:
+ {
+ \xparse_grab_v_group_end:
+ \exp_args:Nx \xparse_add_arg:n
+ { \exp_args:No \str_tail:n { \l_xparse_v_arg_tl } }
+ \l_xparse_v_rest_of_signature_tl \l_xparse_args_tl
+ }
+\cs_new_protected_nopar:Npn \xparse_grab_v_aux_abort:
+ {
+ \xparse_grab_v_group_end:
+ \xparse_add_arg:n { \NoValue }
+ \exp_after:wN \xparse_grab_v_aux_abort_ii:w \l_xparse_args_tl \q_stop
+ }
+\cs_new_protected:Npn \xparse_grab_v_aux_abort_ii:w #1 #2 \q_stop
+ {
+ \group_begin:
+ \char_set_lccode:nn { `\# } { \tex_endlinechar:D }
+ \tl_to_lowercase:n
+ { \group_end: \peek_meaning_remove:NTF ## }
+ {
+ \msg_error:nnxx { xparse } { verbatim-newline }
+ { \cs_to_str:N #1 }
+ { \tl_to_str:N \l_xparse_v_arg_tl }
+ \l_xparse_v_rest_of_signature_tl \l_xparse_args_tl
+ }
+ {
+ \msg_error:nnxx { xparse } { verbatim-already-tokenized }
+ { \cs_to_str:N #1 }
+ { \tl_to_str:N \l_xparse_v_arg_tl }
+ \l_xparse_v_rest_of_signature_tl \l_xparse_args_tl
+ }
+ }
+\cs_new_protected_nopar:Npn \xparse_grab_v_group_end:
+ {
+ \tl_set:Nx \l_xparse_tmp_tl
+ {
+ \tl_set:Nn \exp_not:N \l_xparse_v_rest_of_signature_tl
+ { \exp_not:o \l_xparse_v_rest_of_signature_tl }
+ \tl_set:Nn \exp_not:N \l_xparse_v_arg_tl
+ { \exp_not:o \l_xparse_v_arg_tl }
+ }
+ \exp_after:wN \group_align_safe_end:
+ \exp_after:wN \group_end:
+ \l_xparse_tmp_tl
+ }
+\cs_new_protected:Npn \xparse_grab_v_token_if_char:NTF #1
+ { \str_if_eq:xxTF { } { \str_tail:n {#1} } }
\cs_new_protected:Npn \xparse_process_to_str:n #1
{ \tl_set:Nx \ProcessedArgument { \tl_to_str:n {#1} } }
\cs_new_protected:Npn \xparse_bool_reverse:N #1
@@ -709,7 +817,7 @@
\tl_to_lowercase:n
{
\group_end:
- \tl_replace_all_in:Nnn \l_xparse_split_argument_tl { @ } {#2}
+ \tl_replace_all:Nnn \l_xparse_split_argument_tl { @ } {#2}
}
\cs_set_protected:Npn \xparse_split_argument_aux_i:w
##1 \q_mark ##2 #2 ##3 \q_stop
@@ -759,7 +867,7 @@
\tl_to_lowercase:n
{
\group_end:
- \tl_replace_all_in:Nnn \l_xparse_split_list_tl { @ } {#1}
+ \tl_replace_all:Nnn \l_xparse_split_list_tl { @ } {#1}
}
\cs_set:Npn \xparse_split_list_aux:w ##1 #1
{
@@ -960,22 +1068,28 @@
\bool_set_false:N \l_xparse_error_bool
\tl_if_in:nnT {#1} { > }
{
- \msg_error:nnx { xparse } { processor-in-expandable }
+ \msg_error:nnxx { xparse } { processor-in-expandable }
{ \tl_to_str:n {#1} }
\bool_set_true:N \l_xparse_error_bool
}
\tl_if_in:nnT {#1} { g }
{
- \msg_error:nnx { xparse } { grouped-in-expandable }
+ \msg_error:nnxx { xparse } { grouped-in-expandable }
{ g } { \tl_to_str:n {#1} }
\bool_set_true:N \l_xparse_error_bool
}
\tl_if_in:nnT {#1} { G }
{
- \msg_error:nnx { xparse } { grouped-in-expandable }
+ \msg_error:nnxx { xparse } { grouped-in-expandable }
{ G } { \tl_to_str:n {#1} }
\bool_set_true:N \l_xparse_error_bool
}
+ \tl_if_in:nnT {#1} { v }
+ {
+ \msg_error:nnxx { xparse } { verbatim-in-expandable }
+ { v } { \tl_to_str:n {#1} }
+ \bool_set_true:N \l_xparse_error_bool
+ }
\bool_if:NF \l_xparse_error_bool
{ \xparse_exp_prepare_function_aux:n {#1} }
}
@@ -1015,9 +1129,8 @@
{
\quark_if_nil:NF #1
{
- \prop_if_in:NnTF \c_xparse_shorthands_prop {#1}
+ \prop_get:NnNTF \c_xparse_shorthands_prop {#1} \l_xparse_tmp_tl
{
- \prop_get:NnN \c_xparse_shorthands_prop {#1} \l_xparse_tmp_tl
\bool_if:NT \l_xparse_long_bool
{ \tl_put_left:Nn \l_xparse_tmp_tl { + } }
\exp_after:wN \xparse_exp_prepare_function:N \l_xparse_tmp_tl
@@ -1173,6 +1286,27 @@
You~have~asked~for~the~argument~specification~for~a~command~'#1',~
but~this~is~not~a~document~environment.
}
+\msg_new:nnnn { xparse } { verbatim-newline }
+ { Verbatim~argument~of~#1~ended~by~end~of~line. }
+ {
+ Short~verbatim~arguments~cannot~contain~newlines.~
+ I~suspect~you've~forgotten~the~closing~delimiter~of~#1.
+ I~will~ignore~'#2'.
+ }
+\msg_new:nnnn { xparse } { verbatim-already-tokenized }
+ { Verbatim~command~#1~illegal~in~command~argument. }
+ {
+ The~command~#1~takes~a~verbatim~argument.~It~may~not~appear~within~
+ the~argument~of~another~function.~I~will~ignore~'#2'.
+ }
+
+\msg_new:nnnn { xparse } { verbatim-in-expandable }
+ { Argument~specifier~'#1'~forbidden~in~expandable~commands. }
+ {
+ \c_msg_coding_error_text_tl
+ Argument~specification~'#2'~contains~the~verbatim~argument~'#1':~
+ this~is only~supported~for~standard~robust~functions.
+ }
\msg_new:nnn { xparse } { define-command }
{
Defining~document~command~#1~
diff --git a/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty b/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty
index cae62519790..4c6b140fd4a 100644
--- a/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty
+++ b/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty
@@ -51,11 +51,11 @@
%% -----------------------------------------------------------------------
%%
\RequirePackage{expl3}
-\GetIdInfo$Id: xtemplate.dtx 2535 2011-08-10 18:26:57Z joseph $
+\GetIdInfo$Id: xtemplate.dtx 2607 2011-08-17 16:43:25Z joseph $
{L3 Experimental prototype document functions}
\ProvidesExplPackage
{\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
-\@ifpackagelater { expl3 } { 2011/08/13 }
+\@ifpackagelater { expl3 } { 2011/08/17 }
{ }
{
\PackageError { xtemplate } { Support~package~l3kernel~too~old. }
@@ -102,6 +102,9 @@
\muskip_new:N \l_xtemplate_tmp_muskip
\skip_new:N \l_xtemplate_tmp_skip
\tl_new:N \l_xtemplate_tmp_tl
+\cs_generate_variant:Nn \prop_get:NnNTF { No }
+\cs_generate_variant:Nn \prop_get:NnNT { No }
+\cs_generate_variant:Nn \prop_get:NnNF { No }
\cs_new_protected:Npn \xtemplate_execute_if_arg_agree:nnT #1#2#3
{
\prop_get:NnN \g_xtemplate_object_type_prop {#1} \l_xtemplate_tmp_tl
@@ -487,13 +490,10 @@
\xtemplate_store_vars:n { #1 / #2 }
\clist_clear:N \l_xtemplate_restrict_clist
\xtemplate_store_restrictions:n { #1 / #2 }
- \prop_if_empty:NF \l_xtemplate_keytypes_prop
+ \prop_map_inline:Nn \l_xtemplate_keytypes_prop
{
- \prop_map_inline:Nn \l_xtemplate_keytypes_prop
- {
- \msg_error:nnxxx { xtemplate } { key-not-implemented }
- {##1} {#2} {#1}
- }
+ \msg_error:nnxxx { xtemplate } { key-not-implemented }
+ {##1} {#2} {#1}
}
}
\cs_new_protected:Npn \xtemplate_parse_vars_elt:n #1
@@ -502,10 +502,11 @@
{
\tl_set:Nx \l_xtemplate_key_name_tl { \tl_to_str:n {#1} }
\tl_remove_all:Nn \l_xtemplate_key_name_tl { ~ }
- \prop_if_in:NoTF \l_xtemplate_keytypes_prop \l_xtemplate_key_name_tl
+ \prop_get:NoNTF
+ \l_xtemplate_keytypes_prop
+ \l_xtemplate_key_name_tl
+ \l_xtemplate_keytype_tl
{
- \prop_get:NoN \l_xtemplate_keytypes_prop \l_xtemplate_key_name_tl
- \l_xtemplate_keytype_tl
\xtemplate_split_keytype_arg:o \l_xtemplate_keytype_tl
\xtemplate_parse_vars_elt_aux:n {#2}
\prop_del:NV \l_xtemplate_keytypes_prop \l_xtemplate_key_name_tl
@@ -580,7 +581,8 @@
\keyval_parse:NNn
\xtemplate_implement_choice_elt:n \xtemplate_implement_choice_elt:nn
{#1}
- \prop_if_in:NoT \l_xtemplate_values_prop \l_xtemplate_key_name_tl
+ \prop_get:NoNT \l_xtemplate_values_prop \l_xtemplate_key_name_tl
+ \l_xtemplate_tmp_tl
{ \xtemplate_implement_choices_default: }
\clist_if_empty:NF \l_xtemplate_tmp_clist
{
@@ -593,8 +595,6 @@
}
\cs_new_protected_nopar:Npn \xtemplate_implement_choices_default:
{
- \prop_get:NoN \l_xtemplate_values_prop \l_xtemplate_key_name_tl
- \l_xtemplate_tmp_tl
\tl_set:Nx \l_xtemplate_tmp_tl
{ \l_xtemplate_key_name_tl \c_space_tl \l_xtemplate_tmp_tl }
\prop_if_in:NoF \l_xtemplate_vars_prop \l_xtemplate_tmp_tl
@@ -630,7 +630,7 @@
}
{
\clist_if_in:NnTF \l_xtemplate_tmp_clist {#1}
- { \clist_remove_element:Nn \l_xtemplate_tmp_clist {#1} }
+ { \clist_remove_all:Nn \l_xtemplate_tmp_clist {#1} }
{
\prop_get:NoN \l_xtemplate_keytypes_prop \l_xtemplate_key_name_tl
\l_xtemplate_tmp_tl
@@ -689,32 +689,28 @@
{
\tl_set:Nx \l_xtemplate_key_name_tl { \tl_to_str:n {#1} }
\tl_remove_all:Nn \l_xtemplate_key_name_tl { ~ }
- \prop_if_in:NoTF \l_xtemplate_keytypes_prop \l_xtemplate_key_name_tl
+ \prop_get:NoNTF \l_xtemplate_keytypes_prop \l_xtemplate_key_name_tl
+ \l_xtemplate_tmp_tl
{
\bool_if:NTF \l_xtemplate_restrict_bool
{
\clist_if_in:NoF \l_xtemplate_restrict_clist
\l_xtemplate_key_name_tl
- {
- \xtemplate_parse_values_elt_aux:on
- \l_xtemplate_key_name_tl {#2}
- }
+ { \xtemplate_parse_values_elt_aux:n {#2} }
}
- { \xtemplate_parse_values_elt_aux:on \l_xtemplate_key_name_tl {#2} }
+ { \xtemplate_parse_values_elt_aux:n {#2} }
}
{
\msg_error:nnx { xtemplate } { unknown-key }
{ \l_xtemplate_key_name_tl }
}
}
-\cs_new_protected:Npn \xtemplate_parse_values_elt_aux:nn #1#2
+\cs_new_protected:Npn \xtemplate_parse_values_elt_aux:n #1
{
- \clist_put_right:Nn \l_xtemplate_restrict_clist {#1}
- \prop_get:NnN \l_xtemplate_keytypes_prop {#1} \l_xtemplate_tmp_tl
+ \clist_put_right:No \l_xtemplate_restrict_clist \l_xtemplate_key_name_tl
\xtemplate_split_keytype_arg:o \l_xtemplate_tmp_tl
- \use:c { xtemplate_store_value_ \l_xtemplate_keytype_tl :n } {#2}
+ \use:c { xtemplate_store_value_ \l_xtemplate_keytype_tl :n } {#1}
}
-\cs_generate_variant:Nn \xtemplate_parse_values_elt_aux:nn { o }
\cs_new_protected:Npn \xtemplate_set_template_eq:nn #1#2
{
\xtemplate_recover_defaults:n {#2}
@@ -792,12 +788,10 @@
}
\cs_new_protected:Npn \xtemplate_convert_to_assignments_aux:nn #1#2
{
- \prop_if_in:NnT \l_xtemplate_values_prop {#1}
+ \prop_get:NnNT \l_xtemplate_values_prop {#1} \l_xtemplate_value_tl
{
- \prop_if_in:NnTF \l_xtemplate_vars_prop {#1}
+ \prop_get:NnNTF \l_xtemplate_vars_prop {#1} \l_xtemplate_var_tl
{
- \prop_get:NnN \l_xtemplate_values_prop {#1} \l_xtemplate_value_tl
- \prop_get:NnN \l_xtemplate_vars_prop {#1} \l_xtemplate_var_tl
\xtemplate_split_keytype_arg:n {#2}
\str_if_eq:onF \l_xtemplate_keytype_tl { choice }
{
@@ -853,15 +847,11 @@
}
\cs_new_protected_nopar:Npn \xtemplate_assign_choice:
{
- \tl_set:Nx \l_xtemplate_tmp_tl
+ \xtemplate_assign_choice_aux:xF
{ \l_xtemplate_key_name_tl \c_space_tl \l_xtemplate_value_tl }
- \prop_if_in:NoTF \l_xtemplate_vars_prop \l_xtemplate_tmp_tl
- { \xtemplate_assign_choice_aux:o \l_xtemplate_tmp_tl }
{
- \tl_set:Nx \l_xtemplate_tmp_tl
+ \xtemplate_assign_choice_aux:xF
{ \l_xtemplate_key_name_tl \c_space_tl unknown }
- \prop_if_in:NoTF \l_xtemplate_vars_prop \l_xtemplate_tmp_tl
- { \xtemplate_assign_choice_aux:o \l_xtemplate_tmp_tl }
{
\prop_get:NoN \l_xtemplate_keytypes_prop \l_xtemplate_key_name_tl
\l_xtemplate_tmp_tl
@@ -872,12 +862,15 @@
}
}
}
-\cs_new_protected:Npn \xtemplate_assign_choice_aux:n #1
+\cs_new_protected_nopar:Npn \xtemplate_assign_choice_aux:nF #1
{
- \prop_get:NnN \l_xtemplate_vars_prop {#1} \l_xtemplate_tmp_tl
- \tl_put_right:No \l_xtemplate_assignments_tl \l_xtemplate_tmp_tl
+ \prop_get:NnNTF
+ \l_xtemplate_vars_prop
+ {#1}
+ \l_xtemplate_tmp_tl
+ { \tl_put_right:No \l_xtemplate_assignments_tl \l_xtemplate_tmp_tl }
}
-\cs_generate_variant:Nn \xtemplate_assign_choice_aux:n { o }
+\cs_generate_variant:Nn \xtemplate_assign_choice_aux:nF { x }
\cs_new_protected_nopar:Npn \xtemplate_assign_code:
{
\tl_put_left:Nx \l_xtemplate_assignments_tl
@@ -986,11 +979,10 @@
{
\tl_set:Nx \l_xtemplate_tmp_tl { \tl_to_str:n {#1} }
\tl_remove_all:Nn \l_xtemplate_key_name_tl { ~ }
- \prop_if_in:NoTF \l_xtemplate_vars_prop \l_xtemplate_tmp_tl
- {
- \prop_get:NoN \l_xtemplate_vars_prop \l_xtemplate_tmp_tl
- \l_xtemplate_value_tl
- }
+ \prop_get:NoNF
+ \l_xtemplate_vars_prop
+ \l_xtemplate_tmp_tl
+ \l_xtemplate_value_tl
{
\msg_error:nnx { xtemplate } { unknown-attribute }
{ \l_xtemplate_tmp_tl }
@@ -1033,11 +1025,8 @@
{ \prop_put:Nnn \l_xtemplate_collections_prop {#1} {#2} }
\cs_new_protected:Npn \xtemplate_get_collection:n #1
{
- \prop_if_in:NnTF \l_xtemplate_collections_prop {#1}
- {
- \prop_get:NnN \l_xtemplate_collections_prop {#1}
- \l_xtemplate_collection_tl
- }
+ \prop_get:NnNF \l_xtemplate_collections_prop {#1}
+ \l_xtemplate_collection_tl
{ \tl_clear:N \l_xtemplate_collection_tl }
}
\cs_new_nopar:Npn \xtemplate_assignments_pop: { \l_xtemplate_assignments_tl }