From df90ec06321940c2f066b05e12f1b5ab099105da Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 9 Jun 2009 23:30:47 +0000 Subject: xpackages 1407 (9jun09) git-svn-id: svn://tug.org/texlive/trunk@13685 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/xpackages/README | 91 ++++ Master/texmf-dist/doc/latex/xpackages/ldcsetup.pdf | Bin 101031 -> 100772 bytes .../texmf-dist/doc/latex/xpackages/readme-ctan.txt | 106 ----- Master/texmf-dist/doc/latex/xpackages/template.pdf | Bin 225476 -> 226030 bytes Master/texmf-dist/doc/latex/xpackages/xparse.pdf | Bin 467829 -> 468168 bytes Master/texmf-dist/doc/latex/xpackages/xtheorem.pdf | Bin 107930 -> 0 bytes .../texmf-dist/source/latex/xpackages/ldcsetup.dtx | 51 +-- .../texmf-dist/source/latex/xpackages/template.dtx | 468 +++++++++++---------- Master/texmf-dist/source/latex/xpackages/xbase.ins | 146 +++---- .../source/latex/xpackages/xparse-test.tex | 26 +- .../texmf-dist/source/latex/xpackages/xparse.dtx | 426 +++++++++---------- .../source/latex/xpackages/xtheorem-test.tex | 98 ----- .../texmf-dist/source/latex/xpackages/xtheorem.dtx | 416 ------------------ .../texmf-dist/source/latex/xpackages/xtheorem.ins | 58 --- Master/texmf-dist/tex/latex/xpackages/ldcsetup.sty | 51 +-- Master/texmf-dist/tex/latex/xpackages/template.sty | 400 +++++++++--------- Master/texmf-dist/tex/latex/xpackages/xparse.sty | 345 ++++++++------- Master/texmf-dist/tex/latex/xpackages/xtheorem.sty | 195 --------- Master/tlpkg/tlpsrc/asymptote.tlpsrc | 2 +- 19 files changed, 1041 insertions(+), 1838 deletions(-) create mode 100644 Master/texmf-dist/doc/latex/xpackages/README delete mode 100644 Master/texmf-dist/doc/latex/xpackages/readme-ctan.txt delete mode 100644 Master/texmf-dist/doc/latex/xpackages/xtheorem.pdf delete mode 100644 Master/texmf-dist/source/latex/xpackages/xtheorem-test.tex delete mode 100644 Master/texmf-dist/source/latex/xpackages/xtheorem.dtx delete mode 100644 Master/texmf-dist/source/latex/xpackages/xtheorem.ins delete mode 100644 Master/texmf-dist/tex/latex/xpackages/xtheorem.sty (limited to 'Master') diff --git a/Master/texmf-dist/doc/latex/xpackages/README b/Master/texmf-dist/doc/latex/xpackages/README new file mode 100644 index 00000000000..ccef2cc6007 --- /dev/null +++ b/Master/texmf-dist/doc/latex/xpackages/README @@ -0,0 +1,91 @@ + + Experimental Packages Demonstrating + Possible LaTeX3 High-Level Concepts + ==================================== + + 2009/06/09 + + +WHERE TO GET IT +--------------- + +The files in this distribution represent a snapshot of selected files +from the Subversion (SVN) repository of the LaTeX3 Project. + +To obtain current versions of the files, visit + which contains further +instructions. + +OVERVIEW +-------- + +The `xpackages' term is a designation used for proto-type +implementations of new concepts for a LaTeX Designer Interface. Some +work as standalone packages providing new functionality, such as the +packages in xbase; others go deeper and redefine LaTeX internals in +order to provide newer and better methods for managing certain +constructs. + +All xpackages require expl3 and, in addition to this, many require +functionality provided by the packages within the xbase bundle. + +Currently included in the CTAN release of xpackages are the following +bundles: + xbase + +xbase +----- + +The xbase bundle provides the packages xparse and template, and the +support package ldcsetup. + +The xparse package provides a high-level interface for declaring +document commands, e.g., a uniform way to define commands taking +optional arguments, optional stars (and others), mandatory arguments +and more. + +The template package provides an interface for defining generic +functions using a key=val syntax. + +The ldcsetup package used to establish prototype LaTeX3 coding conventions, +needed by xparse and xbase, but is now slowly being stripped in favor +of functionality added to expl3. + +Files included: + source: xbase.ins, xparse.dtx, template.dtx, ldcsetup.dtx + test: template-test.tex, template-test2.tex, tprestrict-test.tex, + xparse-test.tex + + + +DISCUSSION +---------- + +Discussion concerning the approach, suggestions for improvements, changes, +additions, etc. should be addressed to the list LATEX-L. + +You can subscribe to this list by sending mail to + + listserv@urz.uni-heidelberg.de + +with the body containing + + subscribe LATEX-L + + +BUGS +---- + +If you find a real bug that makes a package stop working you can +report it via the standard LaTeX bug reporting mechanism of the LaTeX +distribution (see bugs.txt there) using the category "Experimental +LaTeX kernel". However please do *not* use this method for +suggestions / comments / improvements / etc. For this the list LATEX-L +should be used instead. + +Also please don't expect these package to work with *any* code that +floats around in the LaTeX2e world. :-) + + +--- Copyright 1998 -- 2009 + The LaTeX3 Project. All rights reserved --- diff --git a/Master/texmf-dist/doc/latex/xpackages/ldcsetup.pdf b/Master/texmf-dist/doc/latex/xpackages/ldcsetup.pdf index 24395a21ca7..1db38a85a57 100644 Binary files a/Master/texmf-dist/doc/latex/xpackages/ldcsetup.pdf and b/Master/texmf-dist/doc/latex/xpackages/ldcsetup.pdf differ diff --git a/Master/texmf-dist/doc/latex/xpackages/readme-ctan.txt b/Master/texmf-dist/doc/latex/xpackages/readme-ctan.txt deleted file mode 100644 index 2ae5f214ab2..00000000000 --- a/Master/texmf-dist/doc/latex/xpackages/readme-ctan.txt +++ /dev/null @@ -1,106 +0,0 @@ - - Experimental Packages Demonstrating - Possible LaTeX3 High-Level Concepts - ==================================== - - 2008/08/05 - - -WHERE TO GET IT ---------------- - -The files in this distribution represent a snapshot of selected files -from the Subversion (SVN) repository of the LaTeX3 Project. - -To obtain current versions of the files, visit - which contains further -instructions. - -OVERVIEW --------- - -The `xpackages' term is a designation used for proto-type -implementations of new concepts for a LaTeX Designer Interface. Some -work as standalone packages providing new functionality, such as the -packages in xbase; others go deeper and redefine LaTeX internals in -order to provide newer and better methods for managing certain -constructs. - -All xpackages require expl3 and, in addition to this, many require -functionality provided by the packages within the xbase bundle. - -Currently included in the CTAN release of xpackages are the following -bundles: - xbase - xtheorem - - - -xbase ------ - -The xbase bundle provides the packages xparse and template, and the -support package ldcsetup. - -The xparse package provides a high-level interface for declaring -document commands, e.g., a uniform way to define commands taking -optional arguments, optional stars (and others), mandatory arguments -and more. - -The template package provides an interface for defining generic -functions using a key=val syntax. - -The ldcsetup package used to establish prototype LaTeX3 coding conventions, -needed by xparse and xbase, but is now slowly being stripped in favor -of functionality added to expl3. - -Files included: - source: xbase.ins, xparse.dtx, template.dtx, ldcsetup.dtx - test: template-test.tex, template-test2.tex, tprestrict-test.tex, - xparse-test.tex - - -xtheorem --------- - -The xtheorem package is a prototype reimplementation of the AMS-LaTeX -theorem environments using the template mechanism. It was originally -developed by Achim Blumensath. - -Files included: - source: xtheorem.dtx, xtheorem.ins - test: xtheorem-test.tex - - - -DISCUSSION ----------- - -Discussion concerning the approach, suggestions for improvements, changes, -additions, etc. should be addressed to the list LATEX-L. - -You can subscribe to this list by sending mail to - - listserv@urz.uni-heidelberg.de - -with the body containing - - subscribe LATEX-L - - -BUGS ----- - -If you find a real bug that makes a package stop working you can -report it via the standard LaTeX bug reporting mechanism of the LaTeX -distribution (see bugs.txt there) using the category "Experimental -LaTeX kernel". However please do *not* use this method for -suggestions / comments / improvements / etc. For this the list LATEX-L -should be used instead. - -Also please don't expect these package to work with *any* code that -floats around in the LaTeX2e world. :-) - - ---- Copyright 1998 -- 2008 - The LaTeX3 Project. All rights reserved --- diff --git a/Master/texmf-dist/doc/latex/xpackages/template.pdf b/Master/texmf-dist/doc/latex/xpackages/template.pdf index b0f7f0da7a9..c9b199bbda7 100644 Binary files a/Master/texmf-dist/doc/latex/xpackages/template.pdf and b/Master/texmf-dist/doc/latex/xpackages/template.pdf differ diff --git a/Master/texmf-dist/doc/latex/xpackages/xparse.pdf b/Master/texmf-dist/doc/latex/xpackages/xparse.pdf index 9e31ff8c9b0..bf63758c4aa 100644 Binary files a/Master/texmf-dist/doc/latex/xpackages/xparse.pdf and b/Master/texmf-dist/doc/latex/xpackages/xparse.pdf differ diff --git a/Master/texmf-dist/doc/latex/xpackages/xtheorem.pdf b/Master/texmf-dist/doc/latex/xpackages/xtheorem.pdf deleted file mode 100644 index 1d57036e271..00000000000 Binary files a/Master/texmf-dist/doc/latex/xpackages/xtheorem.pdf and /dev/null differ diff --git a/Master/texmf-dist/source/latex/xpackages/ldcsetup.dtx b/Master/texmf-dist/source/latex/xpackages/ldcsetup.dtx index 7d2d729d622..09e37c55cb3 100644 --- a/Master/texmf-dist/source/latex/xpackages/ldcsetup.dtx +++ b/Master/texmf-dist/source/latex/xpackages/ldcsetup.dtx @@ -1,6 +1,6 @@ % \iffalse %% File: ldcsetup.dtx (C) Copyright 1999 Frank Mittelbach, Chris Rowley, David Carlisle -%% (C) Copyright 2004-2007 Frank Mittelbach, LaTeX3 Project +%% (C) Copyright 2004-2009 Frank Mittelbach, LaTeX3 Project %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this @@ -34,10 +34,10 @@ %% ----------------------------------------------------------------------- %% %<*driver|package> -\RequirePackage{l3names} +\RequirePackage{expl3} % %\fi -\GetIdInfo$Id: ldcsetup.dtx 636 2007-09-12 20:03:06Z mittelba $ +\GetIdInfo$Id: ldcsetup.dtx 1295 2009-05-06 08:32:25Z will $ {coding conventions and stuff} %\iffalse %<*driver> @@ -73,7 +73,8 @@ {\filename}{\filedate}{\fileversion}{\filedescription} % \end{macrocode} % \begin{macrocode} -\RequirePackage{keyval,l3calc} +\RequirePackage{keyval} +\RequirePackage{expl3} \ExplSyntaxOff % \end{macrocode} % @@ -127,7 +128,7 @@ % this needs further work, don't think it is working \ifx\InternalSyntaxOff\relax \expandafter\def\expandafter\InternalSyntaxOff\expandafter - {\@tempa\let\InternalSyntaxOff\relax}% + {\@tempa\let\InternalSyntaxOff\relax}% \fi \ifx\@currname\@empty \expandafter\AtBeginDocument\expandafter{\@tempa}% @@ -155,12 +156,12 @@ % \section{KV fixes} % Allow\footnote{Not needed now?} key names to start with |\|. % \begin{macrocode} -\def\define@key#1#2{% +\cs_set_nopar:Npn \define@key#1#2{% \@ifnextchar[ {\KV@def{#1}{\string#2}} {\@namedef{KV@#1@\string#2}####1}} -\def\setkeys#1#2{% - \def\KV@prefix{KV@#1@\expandafter\string}% +\cs_set_nopar:Npn \setkeys#1#2{% + \cs_set_nopar:Npn \KV@prefix{KV@#1@\expandafter\string}% \KV@do#2,\relax,} % \end{macrocode} % @@ -173,7 +174,7 @@ % \end{macrocode} % % \begin{macrocode} -\def\KV@@sp@c#1\@nil#2\relax#3{\KV@toks{#1}\edef#3{\the\KV@toks}} +\cs_set_nopar:Npn \KV@@sp@c#1\@nil#2\relax#3{\KV@toks{#1}\cs_set_nopar:Npx #3{\the\KV@toks}} % \end{macrocode} % % Generate error messages on missing `,'. @@ -181,15 +182,15 @@ % More exactly if two `=' appear after a key generate an error. % The current KV just silently ignores everything after the second `='. % \begin{macrocode} -\def\KV@equal{=} +\cs_set_nopar:Npn \KV@equal{=} % \end{macrocode} % % \begin{macrocode} -\def\KV@split#1=#2=#3\relax{% +\cs_set_nopar:Npn \KV@split#1=#2=#3\relax{% \KV@@sp@def\@tempa{#1}% - \def\@tempd{#3}% + \cs_set_nopar:Npn \@tempd{#3}% \ifx\@tempa\@empty\else - \expandafter\let\expandafter\@tempc + \expandafter\cs_set_eq:NN \expandafter\@tempc \csname\KV@prefix\@tempa\endcsname \ifx\@tempc\relax \KV@error{\@tempa\space \expandafter\@gobbletwo\string\@undefined}\@eha @@ -209,18 +210,18 @@ % \end{macrocode} % % \begin{macrocode} -\def\KV@erry{\expandafter\KV@errx\meaning\@tempd\relax ignored\MessageBreak +\cs_set_nopar:Npn \KV@erry{\expandafter\KV@errx\meaning\@tempd\relax ignored\MessageBreak missing~comma~in~`\expandafter\strip@prefix\meaning\@tempb'~?} % \end{macrocode} % % \begin{macrocode} -\def\KV@errx#1>#2==\relax{% +\cs_set_nopar:Npn \KV@errx#1>#2==\relax{% `#2' } % \end{macrocode} % % \begin{macrocode} -\def\KV@default{% - \expandafter\let\expandafter\@tempb +\cs_set_nopar:Npn \KV@default{% + \expandafter\cs_set_eq:NN \expandafter\@tempb \csname\KV@prefix\@tempa @default\endcsname \ifx\@tempb\relax \KV@error{No value specified for \@tempa}\@eha @@ -231,7 +232,7 @@ % % \LaTeX\ style error message. % \begin{macrocode} -\def\KV@error#1#2{\PackageError{keyval}{#1}{#2}} +\cs_set_nopar:Npn \KV@error#1#2{\PackageError{keyval}{#1}{#2}} % \end{macrocode} % % Instead of doing a full KV parse, and evaluating all the keys, @@ -247,21 +248,21 @@ % up) the two |\KV|\ldots|@elt| commands must be defined as appropriate. % % \begin{macrocode} -\def\KV@parse#1{ +\cs_set_nopar:Npn \KV@parse#1{ \begingroup % \end{macrocode} % % Locally fudge |\KV@@def| to just add to a token register % rather than make a definition. % \begin{macrocode} -\def\KV@@sp@c##1\@nil##2\relax##3{\addto@hook##3{{##1}}} +\cs_set_nopar:Npn \KV@@sp@c##1\@nil##2\relax##3{\addto@hook##3{{##1}}} % \end{macrocode} % % Locally fudge |\KV@split| to just add to a token register % rather than execute the code for the found keys. % \begin{macrocode} -\def\KV@split##1=##2=##3\relax{% - \def\@tempd{##3}% +\cs_set_nopar:Npn \KV@split##1=##2=##3\relax{% + \cs_set_nopar:Npn \@tempd{##3}% \expandafter\ifx\expandafter=\@firstofone##1=\else \ifx\@tempd\@empty \addto@hook\KV@toks\KV@default@elt @@ -298,8 +299,8 @@ % Count Register assignments via calc. Here we also provide some % global versions since a normal global prefix won't have any effect. % \begin{macrocode} -\let:NN \SetInternalCounter \calc_int_set:Nn -\let:NN \GSetInternalCounter\calc_int_gset:Nn +\cs_set_eq:NN \SetInternalCounter \calc_int_set:Nn +\cs_set_eq:NN \GSetInternalCounter\calc_int_gset:Nn % \end{macrocode} % % @@ -314,7 +315,7 @@ % longer. Of course this doesn't free the hash table but at least % the space gets reclaimed. % \begin{macrocode} -\def\UndeclareRobustCommand#1{% +\cs_set_nopar:Npn \UndeclareRobustCommand#1{% \cs_gundefine:N #1 \exp_args:Nc \cs_gundefine:N {\cs_to_str:N #1~} } diff --git a/Master/texmf-dist/source/latex/xpackages/template.dtx b/Master/texmf-dist/source/latex/xpackages/template.dtx index c50a1c1f7dd..6c5fd2a686a 100644 --- a/Master/texmf-dist/source/latex/xpackages/template.dtx +++ b/Master/texmf-dist/source/latex/xpackages/template.dtx @@ -1,6 +1,6 @@ % \iffalse %% File: template.dtx (C) Copyright 1999-2001 David Carlisle, Frank Mittelbach -%% (C) Copyright 2004-2008 Frank Mittelbach, LaTeX3 Project +%% (C) Copyright 2004-2009 Frank Mittelbach, LaTeX3 Project %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this @@ -34,10 +34,10 @@ %% ----------------------------------------------------------------------- %% %<*driver|package> -\RequirePackage{l3names} +\RequirePackage{expl3} % %\fi -\GetIdInfo$Id: template.dtx 749 2008-08-03 19:01:36Z morten $ +\GetIdInfo$Id: template.dtx 1295 2009-05-06 08:32:25Z will $ {template} %\iffalse %<*driver> @@ -392,7 +392,7 @@ % As far as specifying instances the |l| and |L| type behave % identically. They differ only in the type of internal storage-bin % they need: |l| expects a length register while |L| expects an -% ordinary macro name and assigns its value via |\def:Npn |. +% ordinary macro name and assigns its value via |\cs_set_nopar:Npn |. %\begin{verbatim} % pre-sep =l \topsep, % post-sep =L \botsep, @@ -456,7 +456,7 @@ % run-time at the point where |\DoParameterAssignments| is seen. %\begin{verbatim} % item-implicit-boolean =s -% { \def:Npn \item@implicit@code{\item\relax} }{}, +% { \cs_set_nopar:Npn \item@implicit@code{\item\relax} }{}, % numbered-boolean =b [true] @heading@nums, %\end{verbatim} % @@ -654,8 +654,8 @@ %\begin{verbatim} % { % \IfNoValueTF{#2} -% { \def:Npn \caption@start{#1:~} } -% { \def:Npn \caption@start{#1~#2:~} } +% { \cs_set_nopar:Npn \caption@start{#1:~} } +% { \cs_set_nopar:Npn \caption@start{#1~#2:~} } %\end{verbatim} % Having dealt with the prelims we now run |\DoParameterAssigments| at % which point the keys of the template are made available, e.g., at @@ -861,8 +861,8 @@ %\begin{verbatim} % { % \IfNoValueTF{#2} -% { \def:Npn \caption@start{\caption@number@format{#1}{#2}} } -% { \def:Npn \caption@start{\caption@nonumber@format{#1}} } +% { \cs_set_nopar:Npn \caption@start{\caption@number@format{#1}{#2}} } +% { \cs_set_nopar:Npn \caption@start{\caption@nonumber@format{#1}} } % \DoParameterAssigments % \vskip \caption@above@skip \relax %\end{verbatim} @@ -1126,8 +1126,8 @@ % \end{macrocode} % % \begin{macrocode} +\RequirePackage{expl3} \RequirePackage{ldcsetup,xparse} -\RequirePackage{l3toks,l3tlp,l3skip,l3int,l3clist,l3token,l3calc} % \end{macrocode} % % @@ -1149,11 +1149,11 @@ % |#2| template type/template name\\ % |#3| key value assignments for parameters of |#2| % \begin{macrocode} -\def_new:NNn \TP_declare_instance:Nnn 3{ +\cs_new_nopar:Nn \TP_declare_instance:Nnn { \group_begin: \TP_instdecl_generate_assignments:nn {#2}{#3} - \gdef:Npx #1 { - \tlp_if_eq:cNTF { TP>/#2 } \c_TP_doparameterassignments_tlp + \cs_gset_nopar:Npx #1 { + \tl_if_eq:cNTF { TP>/#2 } \c_TP_doparameterassignments_tl % \end{macrocode} % If the body of the template consists only of the token % |\DoParameterAssignments|, then we insert the list of parameter @@ -1169,14 +1169,14 @@ } } \group_end:} -\def_new:Npn \TP_declare_instance:cnn{\exp_args:Nc\TP_declare_instance:Nnn} +\cs_generate_variant:Nn \TP_declare_instance:Nnn {cnn} % \end{macrocode} % \end{macro} % \end{macro} % -% \begin{macro}{\c_TP_doparameterassignments_tlp} +% \begin{macro}{\c_TP_doparameterassignments_tl} % \begin{macrocode} -\tlp_set:Nn \c_TP_doparameterassignments_tlp {\DoParameterAssignments} +\tl_set:Nn \c_TP_doparameterassignments_tl {\DoParameterAssignments} % \end{macrocode} % \end{macro} % @@ -1190,10 +1190,10 @@ % |#2| name of a template.\\ % |#3| key value assignments for parameters of |#1|. % \begin{macrocode} -\def_new:NNn \UseTemplate 3{ +\cs_new_nopar:Npn \UseTemplate #1#2#3{ \TP_instdecl_generate_assignments:nn {#1/#2}{#3} \TP_push_assignments: - \cs_use:c { TP>/#1/#2 } + \use:c { TP>/#1/#2 } } % \end{macrocode} % \end{macro} @@ -1203,8 +1203,8 @@ % |\l_TP_KV_assignments_toks| and then moved onto the % |\g_TP_assignments_stack_toks|. % \begin{macrocode} -\def_new:Npn \DoParameterAssignments{ - \exp_after:NN +\cs_new_nopar:Npn \DoParameterAssignments{ + \exp_after:wN \TP_pop_and_execute_assignments:nw \toks_use:N \g_TP_assignments_stack_toks \q_stop } @@ -1214,7 +1214,7 @@ % % \begin{macro}{\TP_pop_and_execute_assignments:nw} % \begin{macrocode} -\def_new:Npn \TP_pop_and_execute_assignments:nw#1#2\q_stop{ +\cs_new_nopar:Npn \TP_pop_and_execute_assignments:nw#1#2\q_stop{ \toks_gset:Nn \g_TP_assignments_stack_toks {#2} #1} % \end{macrocode} @@ -1235,13 +1235,13 @@ % registers |#|s need no doubling. |\TP_push_assignments:| expects % it to be |\l_TP_KV_assignments_toks| (needs fixing). % \begin{macrocode} -\def_long_new:Npn \TP_push_assignments:n#1{ +\cs_new:Npn \TP_push_assignments:n#1{ \toks_gput_left:Nn\g_TP_assignments_stack_toks{{#1}} } -\def_new:Npn \TP_push_assignments:{ +\cs_new_nopar:Npn \TP_push_assignments:{ \toks_gset:No \g_TP_assignments_stack_toks - {\exp_after:NN - {\toks_use:N\exp_after:NN\l_TP_KV_assignments_toks\exp_after:NN} + {\exp_after:wN + {\toks_use:N\exp_after:wN\l_TP_KV_assignments_toks\exp_after:wN} \toks_use:N\g_TP_assignments_stack_toks} } % \end{macrocode} @@ -1252,8 +1252,8 @@ % \begin{macro}{\DeclareTemplateType} % |{type}{nofarg}| % \begin{macrocode} -\def_new:NNn \DeclareTemplateType 2{ - \tlp_set:cn {TP@<#1>} {{}#2}} +\cs_new_nopar:Npn \DeclareTemplateType #1#2{ + \tl_set:cn {TP@<#1>} {{}#2}} % \end{macrocode} % \end{macro} % @@ -1262,9 +1262,9 @@ % |{type}| returns prefix for csnames for template type, % based on current collection. % \begin{macrocode} -\def_new:Npn \TP_get_csname_prefix:n#1{ - <\exp_after:NN\exp_after:NN\exp_after:NN - \use_arg_i:nn +\cs_new_nopar:Nn \TP_get_csname_prefix:n { + <\exp_after:wN\exp_after:wN\exp_after:wN + \use_i:nn \cs:w TP@<#1>\cs_end:>#1/ } % \end{macrocode} @@ -1274,9 +1274,9 @@ % \begin{macro}{\TP_get_arg_count:n} % |{type}| returns arg count for the template type. % \begin{macrocode} -\def_new:Npn \TP_get_arg_count:n#1{ - \exp_after:NN\exp_after:NN\exp_after:NN - \use_arg_ii:nn +\cs_new_nopar:Nn \TP_get_arg_count:n { + \exp_after:wN\exp_after:wN\exp_after:wN + \use_ii:nn \cs:w TP@<#1>\cs_end: } % \end{macrocode} @@ -1286,55 +1286,69 @@ % \begin{macro}{\DeclareTemplate} % |{type}{templatename}{nofarg}{keywordspec}{code}| % \begin{macrocode} -\def_long_new:NNn\DeclareTemplate 5{ +\cs_new:Npn\DeclareTemplate #1#2#3#4#5{ \cs_if_free:cTF{TP@<#1>} {\undefinedtype\DeclareTemplateType{#1}#3} { - \int_compare:nNnF{#3}={\TP_get_arg_count:n{#1}} + \intexpr_compare:nNnF{#3}={\TP_get_arg_count:n{#1}} { \BadArgCount } } % \end{macrocode} % Parse the key declaration, and execute the list with a suitable % definition of |\KV@elt|. % \begin{macrocode} - \let:NN \KV_elt:nn \TP_templdecl_process_KV:nn - \def:Npn \KV_default_elt:n##1{ + \cs_set_eq:NN \KV_elt:nn \TP_templdecl_process_KV:nn + \cs_set_nopar:Npn \KV_default_elt:n##1{ \PackageError{template}{Missing~ =~ after~ ##1}\@ehd} - \let:NN\KV@elt\KV_elt:nn - \let:NN\KV@default@elt\KV_default_elt:n - \tlp_set:Nn \l_TP_curr_name_tlp {#1/#2} + \cs_set_eq:NN\KV@elt\KV_elt:nn + \cs_set_eq:NN\KV@default@elt\KV_default_elt:n + \tl_set:Nn \l_TP_curr_name_tl {#1/#2} \toks_clear:N\l_TP_default_assignments_toks % \end{macrocode} % At this point there should be a test for which catcode regime we are % in. We just test if spaces are ignored. % \begin{macrocode} - %\int_compare:nNnTF{\char_value_catcode:n{`\ }}=\c_nine + %\intexpr_compare:nNnTF{\char_value_catcode:n{`\ }}=\c_nine %\KV_parse_picky_no_space_removal_no_sanitize:n %\KV_parse_picky_space_removal_no_sanitize:n \KV@parse{#4} % \end{macrocode} % -% Define the defaults: the setting for |TPD>/\l_TP_curr_name_tlp| is a +% Define the defaults: the setting for |TPD>/\l_TP_curr_name_tl| is a % tricky since |\l_TP_default_assignments_toks| may contain |#|. We % have to use an |x| expansion rather than % |o| since that will hide those during the assignment. +% FIX THIS (see below)! % \begin{macrocode} - \tlp_set:cx { TPD>/\l_TP_curr_name_tlp } + \cs_set_nopar:cpx { TPD>/\l_TP_curr_name_tl } {\toks_use:N\l_TP_default_assignments_toks} - \tlp_clear:c {TPR>/\l_TP_curr_name_tlp} + \tl_clear:c {TPR>/\l_TP_curr_name_tl} - \tlp_set_eq:cN {TPO>/\l_TP_curr_name_tlp}\l_TP_curr_name_tlp + \tl_set_eq:cN {TPO>/\l_TP_curr_name_tl}\l_TP_curr_name_tl % \end{macrocode} % -% Define the template (using |\def_new:Npn| means that one can't +% Define the template (using |\cs_new_nopar:Npn| means that one can't % redefine a template easily). % \begin{macrocode} - \def_long:cNn {TP>/\l_TP_curr_name_tlp}{#3}{#5} + \cs_generate_from_arg_count:cNnn {TP>/\l_TP_curr_name_tl} + \cs_set:Npn {#3}{#5} } % \end{macrocode} % \end{macro} % +% \begin{macro}{\tl_set:cx} +% FIX this: The code above only works because in the past |\tl_set:cx| was +% defined as follows: +% \begin{macrocode} +\cs_set:Npn \tl_set:cx {\exp_args:Nc \tl_set:Nx} +% \end{macrocode} +% i.e., expanding the second arg at the very end. +% This is no longer the case but for the moment I revert to the old +% definition until the template code is fixed to not rely on |\tl_set:cx| +% expanding the second arg at the very last minute. +% \end{macro} +% % \begin{macro}{\TP_templdecl_process_KV:nn} % The list of undefined keys and values is put in the list of the form\\ % |\KV_elt:nn|\marg{key1}\marg{val1}%^^A @@ -1343,18 +1357,20 @@ % to look at the first token of the value, to see what sort of key % it is, so call a helper function to split that off. % \begin{macrocode} -\def_new:Npn \TP_templdecl_process_KV:nn#1#2{% - \let:NN \TP_templdecl_add_global_or_nothing: \use_noop: +\cs_new_nopar:Nn \TP_templdecl_process_KV:nn {% + \cs_set_eq:NN \TP_templdecl_add_global_or_nothing: \prg_do_nothing: \bool_set_false:N\l_TP_global_assignment_bool - \tlp_set:Nn\l_TP_currkey_tlp{#1} + \tl_set:Nn\l_TP_currkey_tl{#1} \TP_templdecl_parse_KV:N#2\q_stop} % \end{macrocode} % \end{macro} % +% +% % \begin{macro}{\TP_templdecl_parse_KV:N} % Case switch on the possible key types. % \begin{macrocode} -\def_new:Npn \TP_templdecl_parse_KV:N#1{ +\cs_new_nopar:Nn \TP_templdecl_parse_KV:N { % \end{macrocode} % In |#1| we have key, in |#2| the first character after the equal % sign and in |#3| the remainder of the line. We now have to parse @@ -1374,8 +1390,8 @@ % removed (if present)). % \begin{macrocode} \cs_if_free:cTF{TP_use_arg_type_#1:w} - {\PackageError{template}{Unknown~key~type~ (#1)~for~\l_TP_currkey_tlp}\@eha} - {\cs_use:c{TP_use_arg_type_#1:w}} + {\PackageError{template}{Unknown~key~type~ (#1)~for~\l_TP_currkey_tl}\@eha} + {\use:c{TP_use_arg_type_#1:w}} % \end{macrocode} % The |f| and |i| keys are somewhat different since there we first % have to parse for an additional argument (a digit in case of |f| @@ -1386,7 +1402,7 @@ % so we change |\TP_templdecl_add_global_or_nothing:| to append a % |\pref_global:D| to the assignment toks and then reparse the rest. % \begin{macrocode} -% \def:Npn \TP_templdecl_add_global_or_nothing: +% \cs_set_nopar:Npn \TP_templdecl_add_global_or_nothing: % {\toks_put_right:Nn \l_TP_KV_assignments_toks {\pref_global:D} } % \TP_templdecl_parse_KV:nw{#1}#3\TP_templdecl_parse_KV:nnw } @@ -1409,9 +1425,9 @@ % again.\footnote{It should probably all be changed to not rely on % the prefix working}. % \begin{macrocode} -\def_new:cpn{TP_use_arg_type_+:w} { +\cs_new_nopar:cpn{TP_use_arg_type_+:w} { \bool_set_true:N\l_TP_global_assignment_bool - \def:Npn \TP_templdecl_add_global_or_nothing: + \cs_set_nopar:Npn \TP_templdecl_add_global_or_nothing: {\toks_put_right:Nn \l_TP_KV_assignments_toks {\pref_global:D} } \TP_templdecl_parse_KV:N } @@ -1423,10 +1439,10 @@ % either |\gsetlength| or |\setlength| depending on whether a |+| % was seen or not. % \begin{macrocode} -\def_new:Npn\TP_use_arg_type_l:w { +\cs_new_nopar:Npn\TP_use_arg_type_l:w { \TP_parse_optional_key_default:nw { - \let:NN \TP_templdecl_add_global_or_nothing: \use_noop: + \cs_set_eq:NN \TP_templdecl_add_global_or_nothing: \prg_do_nothing: \bool_if:NTF \l_TP_global_assignment_bool {\TP_templdecl_setup_register_key:Nn\gsetlength} {\TP_templdecl_setup_register_key:Nn\setlength} @@ -1438,7 +1454,7 @@ % \begin{macro}{\TP_use_arg_type_L:w} % The |L| sets a fake length register. % \begin{macrocode} -\def_new:Npn\TP_use_arg_type_L:w { +\cs_new_nopar:Npn\TP_use_arg_type_L:w { \TP_parse_optional_key_default:nw {\TP_templdecl_setup_fakeregister_key:NNn\setlength\l_tmpa_skip} } @@ -1448,10 +1464,10 @@ % \begin{macro}{\TP_use_arg_type_c:w} % The |c| sets a count register. % \begin{macrocode} -\def_new:Npn\TP_use_arg_type_c:w { +\cs_new_nopar:Npn\TP_use_arg_type_c:w { \TP_parse_optional_key_default:nw { - \let:NN\TP_templdecl_add_global_or_nothing:\use_noop: + \cs_set_eq:NN\TP_templdecl_add_global_or_nothing:\prg_do_nothing: \bool_if:NTF \l_TP_global_assignment_bool {\TP_templdecl_setup_register_key:Nn\GSetInternalCounter} {\TP_templdecl_setup_register_key:Nn\SetInternalCounter} @@ -1463,7 +1479,7 @@ % \begin{macro}{\TP_use_arg_type_C:w} % The |C| sets a fake count register. % \begin{macrocode} -\def_new:Npn\TP_use_arg_type_C:w { +\cs_new_nopar:Npn\TP_use_arg_type_C:w { \TP_parse_optional_key_default:nw {\TP_templdecl_setup_fakeregister_key:NNn \SetInternalCounter\l_tmpa_int} @@ -1472,9 +1488,9 @@ % \end{macro} % % \begin{macro}{\TP_use_arg_type_n:w} -% The |n| sets a token list pointer. +% The |n| sets a token list variable. % \begin{macrocode} -\def_new:Npn\TP_use_arg_type_n:w { +\cs_new_nopar:Npn\TP_use_arg_type_n:w { \TP_parse_optional_key_default:nw {\TP_templdecl_setup_n_key:N} } @@ -1485,14 +1501,14 @@ % \begin{macro}{\TP_templdecl_parse_f_arg:nw} % The |f| defines a command with between 0 and 9 arguments. % \begin{macrocode} -\def_new:Npn\TP_use_arg_type_f:w #1{ +\cs_new_nopar:Npn\TP_use_arg_type_f:w #1{ %\TP_templdecl_parse_f_arg:nw {#1} \TP_parse_optional_key_default:nw{\TP_templdecl_setup_f_key:Nn{#1}} } % \end{macrocode} % Helper for |\TP_templdecl_parse_KV:nnw|. % \begin{macrocode} -\def_new:Npn \TP_templdecl_parse_f_arg:nw#1#2{ +\cs_new_nopar:Npn \TP_templdecl_parse_f_arg:nw#1#2{ % \end{macrocode} % The third argument of |\TP_templdecl_setup_f_key:Nn|, i.e., the % macro name, is the remaining data up to |\q_stop| which is picked up @@ -1510,15 +1526,15 @@ % The |b| uses access to the |\if_true:| and |\if_false:| % primitives. Needed? % \begin{macrocode} -\def_new:Npn\TP_use_arg_type_b:w { +\cs_new_nopar:Npn\TP_use_arg_type_b:w { \TP_parse_optional_key_default:nw {\TP_templdecl_setup_b_key:n} } % \end{macrocode} % % \begin{macrocode} -\def_new:Npn \TP_templdecl_setup_b_key:n#1{ - \let:cN { if#1 } \if_true: +\cs_new_nopar:Npn \TP_templdecl_setup_b_key:n#1{ + \cs_set_eq:cN { if#1 } \if_true: \TP_templdecl_define_key:n { \TP_templdecl_eval_b_key_value:nn {#1}{##1} } } @@ -1530,12 +1546,12 @@ % Modify so the boolean does not need to have been % declared with |\newif| % \begin{macrocode} -\def_new:Npn \TP_templdecl_eval_b_key_value:nn#1#2{ +\cs_new_nopar:Npn \TP_templdecl_eval_b_key_value:nn#1#2{ \cs_if_free:cTF {if#2} { \PackageError{template}{Bad~boolean~setting~#1=#2}\@eha } - { \tlp_set_eq:cc {if_#1:}{if_#2:} + { \tl_set_eq:cc {if_#1:}{if_#2:} \toks_put_right:Nf \l_TP_KV_assignments_toks - { \tlp_set_eq:cc {if_#1:}{if_#2:} } + { \tl_set_eq:cc {if_#1:}{if_#2:} } } } % \end{macrocode} @@ -1546,13 +1562,13 @@ % \begin{macro}{\TP_templdecl_setup_s_key:n} % The |s| chooses between true and false. % \begin{macrocode} -\def_new:Npn\TP_use_arg_type_s:w { +\cs_new_nopar:Npn\TP_use_arg_type_s:w { \TP_parse_optional_key_default:nw {\TP_templdecl_setup_s_key:n} } % \end{macrocode} % \begin{macrocode} -\def_new:Npn \TP_templdecl_setup_s_key:n #1 { +\cs_new_nopar:Npn \TP_templdecl_setup_s_key:n #1 { \TP_templdecl_define_key:n { \TP_templdecl_eval_s_key_value:nnn{##1}#1 } } @@ -1569,7 +1585,7 @@ % \begin{macro}{\TP_use_arg_type_i:w} % The |i| expects an instance. % \begin{macrocode} -\def_new:Npn\TP_use_arg_type_i:w #1{ +\cs_new_nopar:Npn\TP_use_arg_type_i:w #1{ \TP_parse_optional_key_default:nw{\TP_templdecl_setup_i_key:nnn{#1}} } % \end{macrocode} @@ -1586,7 +1602,7 @@ % \begin{macro}{\TP_templdecl_setup_i_key:nnn} % MH change: do either local or global. % \begin{macrocode} -\def_new:Npn \TP_templdecl_setup_i_key:nnn#1#2{ +\cs_new_nopar:Npn \TP_templdecl_setup_i_key:nnn#1#2{ \TP_templdecl_define_key:n { \TP_templdecl_eval_i_key_value:Nnn #2 {#1}{##1} @@ -1598,10 +1614,10 @@ % \begin{macro}{\TP_templdecl_eval_i_key_value:Nnn} % MH change: Add extra argument for local or global. % \begin{macrocode} -\def_new:Npn \TP_templdecl_eval_i_key_value:Nnn #1#2#3 { - \tlist_if_head_eq_meaning:nNTF {#3.}\UseTemplate +\cs_new_nopar:Npn \TP_templdecl_eval_i_key_value:Nnn #1#2#3 { + \tl_if_head_eq_meaning:nNTF {#3.}\UseTemplate { - \io_put_term:x{\token_to_string:N\UseTemplate\space seen} + \iow_term:x{\token_to_str:N\UseTemplate\space seen} % \end{macrocode} % % Code below from |\TP_templdecl_setup_f_key:Nn| (should be @@ -1612,25 +1628,25 @@ % \begin{macrocode} {\TP_templdecl_declare_tmp_instance:nnnn #3 } \toks_put_right:No \l_TP_KV_assignments_toks - { \exp_after:NN \KV@toks \exp_after:NN {\g_tmpa_tlp} } + { \exp_after:wN \KV@toks \exp_after:wN {\g_tmpa_tl} } %\TP_templdecl_add_global_or_nothing: %\toks_put_right:Nn \l_TP_KV_assignments_toks - % { \def:Npx #1{ \toks_use:N \KV@toks} } + % { \cs_set_nopar:Npx #1{ \toks_use:N \KV@toks} } \bool_if:NTF \l_TP_global_assignment_bool {\toks_put_right:Nn \l_TP_KV_assignments_toks - {\gdef:Npx #1 { \toks_use:N \KV@toks}} + {\cs_gset_nopar:Npx #1 { \toks_use:N \KV@toks}} } {\toks_put_right:Nn \l_TP_KV_assignments_toks - {\def:Npx #1 { \toks_use:N \KV@toks}} + {\cs_set_nopar:Npx #1 { \toks_use:N \KV@toks}} } } { \TP_let_instance:Nnn#1{#2}{#3} % \end{macrocode} -% We want the |\let:Nc| hiding in |\TP_let_instance:Nnn| to expand +% We want the |\cs_set_eq:Nc| hiding in |\TP_let_instance:Nnn| to expand % fully to two csnames so we put a |\tex_romannumeral:D 0| (which in -% itself expands to nothing) in front. This expands the |\let:Nc| fully -% before finding out that |\let:NwN| is not expandable. +% itself expands to nothing) in front. This expands the |\cs_set_eq:Nc| fully +% before finding out that |\cs_set_eq:NwN| is not expandable. % \begin{macrocode} \toks_put_right:Nf \l_TP_KV_assignments_toks { \TP_let_instance:Nnn#1{#2}{#3} } @@ -1650,14 +1666,14 @@ % \begin{macro}{\TP_templdecl_setup_x_key:nn} % The |x| runs internal code. % \begin{macrocode} -\def_new:Npn\TP_use_arg_type_x:w { +\cs_new_nopar:Npn\TP_use_arg_type_x:w { \TP_parse_optional_key_default:nw {\TP_templdecl_setup_x_key:n} } % \end{macrocode} % % \begin{macrocode} -\def_new:Npn \TP_templdecl_setup_x_key:n#1{ +\cs_new_nopar:Npn \TP_templdecl_setup_x_key:n#1{ \TP_templdecl_define_key:n { \toks_put_right:Nn\l_TP_KV_assignments_toks{#1} } } @@ -1673,14 +1689,14 @@ % \begin{macro}{\TP_templdecl_setup_g_key:nn} % The |g| runs any code. % \begin{macrocode} -\def_new:Npn\TP_use_arg_type_g:w { +\cs_new_nopar:Npn\TP_use_arg_type_g:w { \TP_parse_optional_key_default:nw {\TP_templdecl_setup_g_key:n} } % \end{macrocode} % % \begin{macrocode} -\def_new:Npn \TP_templdecl_setup_g_key:n #1 { +\cs_new_nopar:Npn \TP_templdecl_setup_g_key:n #1 { \TP_templdecl_define_key:n{#1}} % \end{macrocode} % @@ -1691,16 +1707,21 @@ % % % \begin{macro}{\TP_templdecl_define_key:n} -% Here we define the key in the current template. -% \begin{macrocode} -\def_new:Npn \TP_templdecl_define_key:n#1{ - \tlp_set:Nx \l_tmpa_tlp { - \exp_not:N \TP_templdecl_remove_from_default_assignments:N - \exp_not:c{KV@\l_TP_curr_name_tlp @\l_TP_currkey_tlp} - \exp_not:o {\TP_templdecl_add_global_or_nothing: } - } - \exp_args:NcNo \def:NNn {KV@\l_TP_curr_name_tlp @\l_TP_currkey_tlp} 1 - { \l_tmpa_tlp #1 } +% Here we define the key in the current template. Original code from +% r522 is essentially unreadable but we keep it here until the +% internal structure is finally sorted out. +% \begin{macrocode} +\cs_new_nopar:Npn \TP_templdecl_define_key:n#1{ + \exp_after:wN \cs_set:Npn \cs:w + KV@\l_TP_curr_name_tl @\l_TP_currkey_tl + \exp_after:wN\cs_end: + \exp_after:wN##\exp_after:wN1\exp_after:wN{ + \exp_after:wN\TP_templdecl_remove_from_default_assignments:N + \cs:w KV@\l_TP_curr_name_tl @\l_TP_currkey_tl + \exp_after:wN \cs_end: + \TP_templdecl_add_global_or_nothing: + #1 + } } % \end{macrocode} % \end{macro} @@ -1720,11 +1741,11 @@ % set it to be a regular optional argument in brackets. |#1| is what % we are carrying over, |#2| the optional argument. % \begin{macrocode} -\def_long:Npn \TP_ignore_leading_space_in_arg_ii:nn#1#2{ +\cs_set:Npn \TP_ignore_leading_space_in_arg_ii:nn#1#2{ \exp_args:Nf\TP_ignore_leading_space_in_arg_ii_aux:nn {\exp_not:N #2}{#1} } -\def_long:Npn \TP_ignore_leading_space_in_arg_ii_aux:nn#1#2{#2{#1}} +\cs_set:Npn \TP_ignore_leading_space_in_arg_ii_aux:nn#1#2{#2{#1}} \DeclareArgumentType t[{meaning}{}{\NoValue}{#1[#2]}{#2} @@ -1744,7 +1765,7 @@ % executing the setup code (in |#1|) giving it |#2| (i.e., the % remainder of the line) as an argument. % \begin{macrocode} -\def_new:Npn \TP_templdecl_finish_key_setup:nw#1#2\q_stop{ +\cs_new_nopar:Npn \TP_templdecl_finish_key_setup:nw#1#2\q_stop{ \TP_ignore_leading_space_in_arg_ii:nn{#1}{#2} %%%#1{#2} } @@ -1759,7 +1780,7 @@ % % First set up the the key itself: % \begin{macrocode} -\def_new:Npn \TP_templdecl_finish_key_setup_with_default:nnw#1#2#3\q_stop{ +\cs_new_nopar:Npn \TP_templdecl_finish_key_setup_with_default:nnw#1#2#3\q_stop{ \TP_ignore_leading_space_in_arg_ii:nn{#1}{#3} %%% #1 {#3} % \end{macrocode} @@ -1774,25 +1795,25 @@ % \begin{macrocode} \group_begin: \toks_clear:N \l_TP_KV_assignments_toks - \let:NN \TP_templdecl_remove_from_default_assignments:N \use_none:n - \cs_use:c{KV@\l_TP_curr_name_tlp @\l_TP_currkey_tlp}{#2} + \cs_set_eq:NN \TP_templdecl_remove_from_default_assignments:N \use_none:n + \use:c{KV@\l_TP_curr_name_tl @\l_TP_currkey_tl}{#2} % \end{macrocode} % And now for a final trick: before closing the group again and losing -% our local changes we run |\exp_after:NN| several times to get the +% our local changes we run |\exp_after:wN| several times to get the % value of |\l_TP_KV_assignments_toks| into % |\l_TP_default_assignments_toks| outside that group! % \begin{macrocode} - \exp_after:NN + \exp_after:wN \group_end: - \exp_after:NN + \exp_after:wN \toks_set:Nn - \exp_after:NN + \exp_after:wN \l_TP_default_assignments_toks - \exp_after:NN - { \cs:w KV@\l_TP_curr_name_tlp @\l_TP_currkey_tlp \exp_after:NN \cs_end: - \exp_after:NN - { \toks_use:N \exp_after:NN \l_TP_KV_assignments_toks - \exp_after:NN + \exp_after:wN + { \cs:w KV@\l_TP_curr_name_tl @\l_TP_currkey_tl \exp_after:wN \cs_end: + \exp_after:wN + { \toks_use:N \exp_after:wN \l_TP_KV_assignments_toks + \exp_after:wN } \toks_use:N\l_TP_default_assignments_toks } @@ -1802,18 +1823,18 @@ % % % -% \begin{macro}{\c_TP_true_tlp} +% \begin{macro}{\c_TP_true_tl} % \begin{macrocode} -\tlp_new:Nn \c_TP_true_tlp {true} +\tl_new:Nn \c_TP_true_tl {true} % \end{macrocode} % \end{macro} % % \begin{macro}{\TP_templdecl_eval_s_key_value:nnn} % \begin{macrocode} -\def_new:Npn \TP_templdecl_eval_s_key_value:nnn#1#2#3 { +\cs_new_nopar:Npn \TP_templdecl_eval_s_key_value:nnn#1#2#3 { % no error check on this yet. - \tlp_set:Nn \l_tmpa_tlp {#1} - \tlp_if_eq:NNTF \l_tmpa_tlp \c_TP_true_tlp + \tl_set:Nn \l_tmpa_tl {#1} + \tl_if_eq:NNTF \l_tmpa_tl \c_TP_true_tl { \toks_put_right:Nn \l_TP_KV_assignments_toks {#2} } { \toks_put_right:Nn \l_TP_KV_assignments_toks {#3} } } @@ -1825,7 +1846,7 @@ % % Command for setting a template attribute whose name % corresponds directly to a \TeX{} count or length register\\ -% |#1| the function to set the value eg \setlength.\\ +% |#1| the function to set the value eg \cs{setlength}.\\ % |#2| key name.\\ % |#3| the register to set. % @@ -1838,16 +1859,16 @@ % just pass the whole assignment to the template. Remember to remove % the |\DelayEvaluation|. % \begin{macrocode} -\def_new:Npn \TP_templdecl_setup_register_key:Nn #1#2{ +\cs_new_nopar:Npn \TP_templdecl_setup_register_key:Nn #1#2{ \TP_templdecl_define_key:n{ - \tlist_if_head_eq_meaning:nNTF{##1}\DelayEvaluation + \tl_if_head_eq_meaning:nNTF{##1}\DelayEvaluation { % \end{macrocode} % Old line commented out. Remove |\DelayEvaluation| and also remove % the braces surrounding its argument. % \begin{macrocode} \toks_put_right:Nn \l_TP_KV_assignments_toks {#1#2{##1}} - %\toks_set:No\l_tmpa_toks{\use_arg_ii:nn ##1} + %\toks_set:No\l_tmpa_toks{\use_ii:nn ##1} %\toks_put_right:Nx \l_TP_KV_assignments_toks % {\exp_not:n{#1#2}{\toks_use:N \l_tmpa_toks}} } @@ -1864,7 +1885,7 @@ % % \begin{macrocode} { - \tlist_if_head_eq_meaning:nNTF{##1..}\MultiSelection + \tl_if_head_eq_meaning:nNTF{##1..}\MultiSelection { \group_begin: \TP_multiselection_add:nnnnnn #1#2##1 @@ -1875,19 +1896,19 @@ % there are probably better ways to do this (:-) % % \begin{macrocode} - \tlist_if_in:onTF{\toks_use:N\g_TP_multiselection_toks}\DelayEvaluation + \tl_if_in:onTF{\toks_use:N\g_TP_multiselection_toks}\DelayEvaluation { \toks_put_right:No\l_TP_KV_assignments_toks { - \exp_after:NN#1\exp_after:NN#2\exp_after:NN + \exp_after:wN#1\exp_after:wN#2\exp_after:wN {\toks_use:N\g_TP_multiselection_toks} } } { \toks_put_right:No\l_TP_KV_assignments_toks { - \exp_after:NN #2 - \exp_after:NN= \toks_use:N\g_TP_multiselection_toks\scan_stop: + \exp_after:wN #2 + \exp_after:wN= \toks_use:N\g_TP_multiselection_toks\scan_stop: } } % \end{macrocode} @@ -1900,7 +1921,7 @@ { #1#2{##1} \toks_put_right:No\l_TP_KV_assignments_toks { - \exp_after:NN #2 \exp_after:NN = \tex_the:D #2\scan_stop: + \exp_after:wN #2 \exp_after:wN = \tex_the:D #2\scan_stop: } } } @@ -1920,8 +1941,8 @@ % |\MultiSelection| a few places we better give them unique % meanings! % \begin{macrocode} -\def_new:NNn\DelayEvaluation 1{\use_none:n{\DelayEvaluation}#1} -\def_new:NNn\MultiSelection 1{\use_none:n{\MultiSelection}#1} +\cs_new_nopar:Npn\DelayEvaluation #1{\use_none:n{\DelayEvaluation}#1} +\cs_new_nopar:Npn\MultiSelection #1{\use_none:n{\MultiSelection}#1} % \end{macrocode} % \end{macro} % \end{macro} @@ -1931,11 +1952,11 @@ % perhaps be implemented as such as this would make far more % readable code. % \begin{macrocode} -\def_new:Npn \TP_templdecl_remove_from_default_assignments:N#1{ - \def:Npn \tmp:w ##1#1##2##3#1##4\q_stop{ +\cs_new_nopar:Npn \TP_templdecl_remove_from_default_assignments:N#1{ + \cs_set_nopar:Npn \TP_tmp:w ##1#1##2##3#1##4\q_stop{ \l_TP_default_assignments_toks{##1##3} } - \exp_after:NN \tmp:w + \exp_after:wN \TP_tmp:w \toks_use:N\l_TP_default_assignments_toks #1\scan_stop:#1\q_stop} % \end{macrocode} % \end{macro} @@ -1955,7 +1976,7 @@ % is responsible for picking up the requested number of % arguments. (This is \emph{not} checked.) % \begin{macrocode} -\def_new:Npn \TP_templdecl_setup_f_key:Nn#1#2{ +\cs_new_nopar:Npn \TP_templdecl_setup_f_key:Nn#1#2{ % \end{macrocode} % % |##1| can either be arbitrary inline code, in which case it will be @@ -1972,11 +1993,13 @@ % % % \begin{macro}{\TP_templdecl_define_function:NNn} -% |\def:Npn | setup with a latex style `number of arguments' argument. +% Use number of arguments to define function. % \begin{macrocode} -\def_new:Npn \TP_templdecl_define_function:NNn#1#2#3{ - \def:NNn #2 #1 {#3} - \toks_put_right:Nf \l_TP_KV_assignments_toks { \def:NNn #2 #1 {#3} } +\cs_new_nopar:Npn \TP_templdecl_define_function:NNn#1#2#3{ + \cs_generate_from_arg_count:NNnn #2 \cs_set:Npn {#1}{#3} + \toks_put_right:Nf \l_TP_KV_assignments_toks { + \cs_generate_from_arg_count:NNnn #2 \cs_set:Npn {#1}{#3} + } } % \end{macrocode} % \end{macro} @@ -1996,9 +2019,9 @@ % it is essentially doing the same. % % \begin{macrocode} -\def_new:Npn \TP_templdecl_setup_n_key:N#1{ +\cs_new_nopar:Npn \TP_templdecl_setup_n_key:N#1{ \TP_templdecl_define_key:n{ - \tlist_if_head_eq_meaning:nNTF{##1..}\MultiSelection + \tl_if_head_eq_meaning:nNTF{##1..}\MultiSelection { \group_begin: \TP_templdecl_multiselection:nnnn ##1 @@ -2009,17 +2032,17 @@ % number of times to get to the item but we also want to ensure we do % not have any unwanted leftover |\fi:|s or other junk which is bound % to cause errors later on. Therefore we start an |f| expansion (so we -% don't have to count |\exp_after:NN|s and then stop it again when we +% don't have to count |\exp_after:wN|s and then stop it again when we % want to. % \begin{macrocode} \toks_put_right:Nx\l_TP_KV_assignments_toks { - \exp_not:n{\tlp_set:Nf #1} { \toks_use:N \g_TP_multiselection_toks} + \exp_not:n{\tl_set:Nf #1} { \toks_use:N \g_TP_multiselection_toks} } } { - \def:Npn #1{##1} % setting it? + \cs_set_nopar:Npn #1{##1} % setting it? \toks_put_right:Nn \l_TP_KV_assignments_toks - { \tlp_set:Nn #1{##1} } + { \tl_set:Nn #1{##1} } } } } @@ -2031,13 +2054,13 @@ % type expansion we better stop it at the right place once we have % emerged on the other side of the conditional. % \begin{macrocode} -\def_new:Npn \TP_templdecl_multiselection:nnnn #1#2#3#4{ +\cs_new_nopar:Npn \TP_templdecl_multiselection:nnnn #1#2#3#4{ \toks_gset:Nn \g_TP_multiselection_toks {\if_case:w #2} \clist_map_inline:nn {#3}{ \TP_multiselection_add_or_case:n {\exp_stop_f:##1} } \toks_gput_right:Nn\g_TP_multiselection_toks { - \else: \use_arg_i_after_fi:nw { \exp_stop_f: #4} \fi: + \else: \use_i_after_fi:nw { \exp_stop_f: #4} \fi: } } % \end{macrocode} @@ -2053,7 +2076,7 @@ % \begin{macro}{\DeclareInstance} % |{type}{instname}{templatename}{keyval}| % \begin{macrocode} -\def_new:Npn \DeclareInstance { \DeclareCollectionInstance{} } +\cs_new_nopar:Npn \DeclareInstance { \DeclareCollectionInstance{} } % \end{macrocode} % \end{macro} % @@ -2061,7 +2084,7 @@ % |{collection}{type}{instname}{templatename}{keyval}| % The fifth argument is picked up implicitly. % \begin{macrocode} -\def_long_new:Npn \DeclareCollectionInstance#1#2#3#4{ +\cs_new:Npn \DeclareCollectionInstance#1#2#3#4{ \TP_declare_instance:cnn { <#1>#2/#3 }{ #2/#4 } } % \end{macrocode} @@ -2070,8 +2093,8 @@ % \begin{macro}{\UseCollection} % |{type}{collection}| % \begin{macrocode} -\def_new:Npn \UseCollection#1#2{ - \tlp_set:cx { TP@<#1> } +\cs_new_nopar:Npn \UseCollection#1#2{ + \tl_set:cx { TP@<#1> } { {#2} \TP_get_arg_count:n{#1} } } % \end{macrocode} @@ -2080,12 +2103,12 @@ % \begin{macro}{\TP_let_instance:Nnn} % |\internalcommand{type}{instname}| % -% The way this macro is used, it must result in |\let:NwN| || +% The way this macro is used, it must result in |\cs_set_eq:NwN| || % || after exactly two expansions as it is used this way % in |\TP_templdecl_eval_i_key_value:nnn|! % \begin{macrocode} -\def_new:Npn \TP_let_instance:Nnn#1#2#3{ - \let:Nc #1 +\cs_new_nopar:Npn \TP_let_instance:Nnn#1#2#3{ + \cs_set_eq:Nc #1 { \cs_if_free:cTF { \TP_get_csname_prefix:n{#2} #3 } { <>#2/ } @@ -2099,11 +2122,11 @@ % \begin{macro}{\UseInstance} % |{type}{instname}| % \begin{macrocode} -\def_new:Npn \UseInstance#1#2{ - \TP_let_instance:Nnn \l_tmpa_tlp {#1}{#2} - \tlp_if_eq:NNTF \l_tmpa_tlp \scan_stop: +\cs_new_nopar:Npn \UseInstance#1#2{ + \TP_let_instance:Nnn \l_tmpa_tl {#1}{#2} + \tl_if_eq:NNTF \l_tmpa_tl \scan_stop: \INSTANCEundefined - \l_tmpa_tlp + \l_tmpa_tl } % \end{macrocode} % \end{macro} @@ -2116,8 +2139,8 @@ % the template and the fourth argument will be implictly picked up % by |\TP_declare_instance:Nnn|. % \begin{macrocode} -\def_long_new:Npn \TP_templdecl_declare_tmp_instance:nnnn#1#2#3{% - \TP_declare_instance:Nnn \g_tmpa_tlp {#2/#3} } +\cs_new:Npn \TP_templdecl_declare_tmp_instance:nnnn#1#2#3{% + \TP_declare_instance:Nnn \g_tmpa_tl {#2/#3} } % \end{macrocode} % \end{macro} % @@ -2125,21 +2148,21 @@ % Some extension to |\ShowTemplate| so that we also get to see the % restrictions if any % \begin{macrocode} -\def_new:Npn \ShowTemplate#1#2{ - \io_put_term:x{*******~ Template:~ #1/#2~ *******} - \io_put_term:x{*} - \io_put_term:x{*~ Defaults:} - \io_put_term:x{*} - \io_put_term:x{\token_to_string:N\TPD>/#1/#2= +\cs_new_nopar:Npn \ShowTemplate#1#2{ + \iow_term:x{*******~ Template:~ #1/#2~ *******} + \iow_term:x{*} + \iow_term:x{*~ Defaults:} + \iow_term:x{*} + \iow_term:x{\token_to_str:N\TPD>/#1/#2= \cs_meaning:c{TPD>/#1/#2}} - \io_put_term:x{*} - \io_put_term:x{*~ Restrictions:} - \io_put_term:x{*} - \io_put_term:x{\token_to_string:N\TPR>/#1/#2= + \iow_term:x{*} + \iow_term:x{*~ Restrictions:} + \iow_term:x{*} + \iow_term:x{\token_to_str:N\TPR>/#1/#2= \cs_meaning:c{TPR>/#1/#2}} - \io_put_term:x{*} - \io_put_term:x{*~ Body:} - \io_put_term:x{*} + \iow_term:x{*} + \iow_term:x{*~ Body:} + \iow_term:x{*} \cs_show:c {TP>/#1/#2}} % \end{macrocode} % \end{macro} @@ -2147,39 +2170,39 @@ % % \begin{macro}{\ShowCollectionInstance} % \begin{macrocode} -\def_new:Npn \ShowCollectionInstance#1#2#3{ - \io_put_term:x{*******~ Instance:~ <#1>#2/#3~ *******} - \io_put_term:x{*} +\cs_new_nopar:Npn \ShowCollectionInstance#1#2#3{ + \iow_term:x{*******~ Instance:~ <#1>#2/#3~ *******} + \iow_term:x{*} \cs_show:c {<#1>#2/#3}} -\def_new:Npn \ShowInstance{\ShowCollectionInstance{}} +\cs_new_nopar:Npn \ShowInstance{\ShowCollectionInstance{}} % \end{macrocode} % \end{macro} % % \begin{macro}{\TP_templdecl_setup_fakeregister_key:NNn} % |{setcomand}{privateregister}{key}{internalcode}| % \begin{macrocode} -\def_new:Npn \TP_templdecl_setup_fakeregister_key:NNn#1#2#3{ +\cs_new_nopar:Npn \TP_templdecl_setup_fakeregister_key:NNn#1#2#3{ \TP_templdecl_define_key:n{ - \tlist_if_head_eq_meaning:nNTF{##1..}\DelayEvaluation + \tl_if_head_eq_meaning:nNTF{##1..}\DelayEvaluation { % \end{macrocode} % In the v0.08 version of \texttt{template.dtx} a % |\DelayEvaluation| for a faked register would simply be equiv to -% a |\def:Npn | (code is below commented out). The negative side effect +% a |\cs_set_nopar:Npn | (code is below commented out). The negative side effect % of this is that something like |=L| used with |\DelayEvaluation| % would not allow for calc syntax since it would end up as -% |\def:Npn |\allowbreak|\foo|\allowbreak|{a+b}|. The code below changes +% |\cs_set_nopar:Npn |\allowbreak|\foo|\allowbreak|{a+b}|. The code below changes % this to first assign to a scratch register (at runtime) and then % do an |\edef|. Could be coded differently to save space (at cost % of time) % \begin{macrocode} -% \toks_put_right:Nn \l_TP_KV_assignments_toks {\def:Npn #3{##1}} +% \toks_put_right:Nn \l_TP_KV_assignments_toks {\cs_set_nopar:Npn #3{##1}} % \toks_put_right:Nn \l_TP_KV_assignments_toks -% {#1#2{##1}\def:Npx #3{\toks_use:N#2}} - \toks_set:No \l_tmpa_toks {\use_arg_ii:nn ##1} +% {#1#2{##1}\cs_set_nopar:Npx #3{\toks_use:N#2}} + \toks_set:No \l_tmpa_toks {\use_ii:nn ##1} \toks_put_right:Nx \l_TP_KV_assignments_toks { \exp_not:n{#1#2}{\toks_use:N \l_tmpa_toks} - \exp_not:n{ \def:Npx #3{\toks_use:N#2} } + \exp_not:n{ \cs_set_nopar:Npx #3{\toks_use:N#2} } } } @@ -2198,18 +2221,18 @@ % % \begin{macrocode} { - \tlist_if_head_eq_meaning:nNTF{##1..}\MultiSelection + \tl_if_head_eq_meaning:nNTF{##1..}\MultiSelection { \group_begin: \TP_multiselection_add:nnnnnn#1#2##1 \group_end: \toks_put_right:Nx\l_TP_KV_assignments_toks - {\exp_not:n{\def:Npn #3} {\toks_use:N\g_TP_multiselection_toks}} + {\exp_not:n{\cs_set_nopar:Npn #3} {\toks_use:N\g_TP_multiselection_toks}} } { #1#2{##1} \toks_put_right:Nx\l_TP_KV_assignments_toks - {\exp_not:n{\def:Npn#3} {\toks_use:N#2}} + {\exp_not:n{\cs_set_nopar:Npn#3} {\toks_use:N#2}} } } } @@ -2236,10 +2259,10 @@ % outside. % % \begin{macrocode} -\def_new:Npn \TP_multiselection_add:nnnnnn #1#2#3#4#5#6{ +\cs_new_nopar:Npn \TP_multiselection_add:nnnnnn #1#2#3#4#5#6{ \toks_gset:Nn \g_TP_multiselection_toks {\if_case:w #4} \clist_map_inline:nn {#5}{ - \tlist_if_head_eq_meaning:nNTF{##1..}\DelayEvaluation + \tl_if_head_eq_meaning:nNTF{##1..}\DelayEvaluation { \TP_multiselection_add_or_case:n {##1} } @@ -2249,7 +2272,7 @@ } } \toks_gput_right:Nn \g_TP_multiselection_toks { - \else: \use_arg_i_after_fi:nw{#6}\fi: + \else: \use_i_after_fi:nw{#6}\fi: } } % \end{macrocode} @@ -2260,14 +2283,12 @@ % No need to worry about where |\or:| is allowed to be added since % all loops in \LaTeX3 process the item outside conditionals. % \begin{macrocode} -\def_new:Npn \TP_multiselection_add_or_case:n #1 { +\cs_new_nopar:Npn \TP_multiselection_add_or_case:n #1 { \toks_gput_right:Nn \g_TP_multiselection_toks { - \or: \use_arg_i_after_orelse:nw{#1} + \or: \use_i_after_orelse:nw{#1} } } -\def_new:Npn \TP_multiselection_add_or_case:o { - \exp_args:No \TP_multiselection_add_or_case:n -} +\cs_generate_variant:Nn \TP_multiselection_add_or_case:n {o} % \end{macrocode} % \end{macro} % @@ -2294,7 +2315,7 @@ % tests that there is a \emph{default} definition % taken from xinitials.dtx: % \begin{macrocode} -\def_new:Npn \IfExistsInstanceTF#1#2{ +\cs_new_nopar:Npn \IfExistsInstanceTF#1#2{ \cs_if_exist:cTF{<>#1/#2} } % \end{macrocode} @@ -2307,13 +2328,13 @@ % really should be. The code below is not better only different( and % slower).\footnote{fix semantics} % \begin{macrocode} -\def:Npn \IfExistsInstanceTF#1#2{ - \TP_let_instance:Nnn \l_tmpa_tlp {#1}{#2} -% next is not \tlp_if_eq:NNTF but ...FT so done manually - \if_meaning:NN\l_tmpa_tlp\scan_stop: - \exp_after:NN\use_arg_ii:nn +\cs_set_nopar:Npn \IfExistsInstanceTF#1#2{ + \TP_let_instance:Nnn \l_tmpa_tl {#1}{#2} +% next is not \tl_if_eq:NNTF but ...FT so done manually + \if_meaning:w\l_tmpa_tl\scan_stop: + \exp_after:wN\use_ii:nn \else: - \exp_after:NN\use_arg_i:nn + \exp_after:wN\use_i:nn \fi:} % \end{macrocode} % \end{macro} @@ -2327,22 +2348,19 @@ % This uses the same code as {T-type} {source-T-name} but adds % settings from {keyvals} % \begin{macrocode} -\def_new:Npn \DeclareRestrictedTemplate#1#2#3#4{ +\cs_new_nopar:Npn \DeclareRestrictedTemplate#1#2#3#4{ % CCC do we need a group here?? - \tlp_set_eq:cc { TPD>/#1/#2 } { TPD>/#1/#3 } - \tlp_set_eq:cc { TP>/#1/#2 } { TP>/#1/#3 } - - \toks_set:Nd \l_TP_KV_assignments_toks - {\cs:w TPR>/#1/#3\cs_end:} - + \tl_set_eq:cc { TPD>/#1/#2 } { TPD>/#1/#3 } + \tl_set_eq:cc { TP>/#1/#2 } { TP>/#1/#3 } + \toks_set:Nv \l_TP_KV_assignments_toks { TPR>/ #1 / #3 } % adds stuff to \l_TP_KV_assignments_toks \setkeys {\cs:w TPO>/#1/#3\cs_end:}{#4} - \tlp_set:cx { TPR>/#1/#2 } + \tl_set:cx { TPR>/#1/#2 } { \toks_use:N \l_TP_KV_assignments_toks } \cs_if_free:cTF { TPO>/#1/#3 } - { \tlp_set:cn {TPO>/#1/#2}{#1/#3} } - { \tlp_set_eq:cc {TPO>/#1/#2}{TPO>/#1/#3} } + { \tl_set:cn {TPO>/#1/#2}{#1/#3} } + { \tl_set_eq:cc {TPO>/#1/#2}{TPO>/#1/#3} } } % \end{macrocode} % \end{macro} @@ -2356,23 +2374,19 @@ % Assumption: setkeys fully expands its first argument. % % \begin{macrocode} -\def_new:Npn \TP_instdecl_generate_assignments:nn#1#2 { +\cs_new_nopar:Npn \TP_instdecl_generate_assignments:nn#1#2 { % Returns to \l_TP_KV_assignments_toks % the restrictions % stored in the TP-structure (at present % in YAM) of the template #1 - - \toks_set:Nd \l_TP_default_assignments_toks + \exp_args:NNo \toks_set:No \l_TP_default_assignments_toks {\cs:w TPD>/#1\cs_end:\scan_stop:\scan_stop:} - - \toks_set:Nd \l_TP_KV_assignments_toks - {\cs:w TPR>/#1\cs_end:} - + \toks_set:Nv \l_TP_KV_assignments_toks { TPR>/ #1 } \setkeys { \cs:w TPO>/#1 \cs_end: } { #2 } % adds stuff to \l_TP_KV_assignments_toks % prepends stuff to \l_TP_KV_assignments_toks : - \exp_after:NN\TP_instdecl_add_default_recurse:nn + \exp_after:wN\TP_instdecl_add_default_recurse:nn \toks_use:N\l_TP_default_assignments_toks } @@ -2383,16 +2397,16 @@ % \begin{macro}{\TP_instdecl_add_default_recurse:nn} % [ 2001/06/10 Think about doing this properly with explicit plists! --- but % this means that one has to think about whether or not plists should be -% implemented as token registers and not as tlps as they are now. ] +% implemented as token registers and not as tl vars as they are now. ] % \begin{macrocode} -\def_new:Npn \TP_instdecl_add_default_recurse:nn#1#2{ +\cs_new_nopar:Npn \TP_instdecl_add_default_recurse:nn#1#2{ \token_if_eq_meaning:NNF #1\scan_stop: { \l_tmpa_toks{#2} - \tlp_set:Nx \l_tmpa_tlp { + \tl_set:Nx \l_tmpa_tl { {\toks_use:N \l_tmpa_toks \toks_use:N \l_TP_KV_assignments_toks} } - \l_TP_KV_assignments_toks \l_tmpa_tlp + \l_TP_KV_assignments_toks \l_tmpa_tl \TP_instdecl_add_default_recurse:nn } } @@ -2422,7 +2436,7 @@ % key name, and the last two are the \meta{dimen} registers that % stores the stretch and shrink components. Assignments are global. % \begin{macrocode} -\def_new:Npn \TP_split_finite_skip_value:nnNN #1#2{ +\cs_new_nopar:Npn \TP_split_finite_skip_value:nnNN #1#2{ \skip_split_finite_else_action:nnNN {#1} { \PackageError{template}{Value~ for~ key~ #2~ contains~ `fil(ll)'} {Only~ finite~ minus~ or~ plus~ parts~ are~ allowed~ for~ this~ key.} diff --git a/Master/texmf-dist/source/latex/xpackages/xbase.ins b/Master/texmf-dist/source/latex/xpackages/xbase.ins index 742a1aa8dc3..9f6213a3fb2 100644 --- a/Master/texmf-dist/source/latex/xpackages/xbase.ins +++ b/Master/texmf-dist/source/latex/xpackages/xbase.ins @@ -1,73 +1,73 @@ -% \iffalse -%% -%% This file will generate fast loadable files and documentation -%% driver files from the dtx files in this package when run through -%% LaTeX or TeX. -%% -%% (C) Copyright 2000-2005 LaTeX3 Project -%% -%% It may be distributed and/or modified under the conditions of the -%% LaTeX Project Public License (LPPL), either version 1.3a of this -%% license or (at your option) any later version. The latest version -%% of this license is in the file -%% -%% http://www.latex-project.org/lppl.txt -%% -%% This file is part of the ``xbase bundle'' (The Work in LPPL) -%% and all files in that bundle must be distributed together. -%% -%% The released version of this bundle is available from CTAN. -%% -%% ----------------------------------------------------------------------- -%% -%% The development version of the bundle can be found at -%% -%% http://www.latex-project.org/cgi-bin/cvsweb.cgi/ -%% -%% for those people who are interested. -%% -%%%%%%%%%%% -%% NOTE: %% -%%%%%%%%%%% -%% -%% Snapshots taken from the repository represent work in progress and may -%% not work or may contain conflicting material! We therefore ask -%% people _not_ to put them into distributions, archives, etc. without -%% prior consultation with the LaTeX Project Team. -%% -%% ----------------------------------------------------------------------- -%% -%% $Id: xbase.ins 302 2005-03-01 22:49:14Z morten $ -%% -% \fi -% - -\input docstrip -\keepsilent -\askforoverwritefalse - -\preamble - -(C) Copyright The LaTeX3 Project and any individual authors -listed elsewhere in this file. - -This is a generated file. - -This file was generated from file(s) of the xbase bundle. ---------------------------------------------------------- - -This file may only be distributed together with a copy of this bundle. -You may however distribute the bundle without such generated files. - -====================================================================== - -\endpreamble - - -\generate{% - \file{ldcsetup.sty}{\from{ldcsetup.dtx}{package}} - \file{template.sty}{\from{template.dtx}{package,trace}} - \file{xparse.sty}{\from{xparse.dtx}{package}} -} - -\endbatchfile +% \iffalse +%% +%% This file will generate fast loadable files and documentation +%% driver files from the dtx files in this package when run through +%% LaTeX or TeX. +%% +%% (C) Copyright 2000-2005 LaTeX3 Project +%% +%% It may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License (LPPL), either version 1.3a of this +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the ``xbase bundle'' (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/cgi-bin/cvsweb.cgi/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX Project Team. +%% +%% ----------------------------------------------------------------------- +%% +%% $Id: xbase.ins 302 2005-03-01 22:49:14Z morten $ +%% +% \fi +% + +\input docstrip +\keepsilent +\askforoverwritefalse + +\preamble + +(C) Copyright The LaTeX3 Project and any individual authors +listed elsewhere in this file. + +This is a generated file. + +This file was generated from file(s) of the xbase bundle. +--------------------------------------------------------- + +This file may only be distributed together with a copy of this bundle. +You may however distribute the bundle without such generated files. + +====================================================================== + +\endpreamble + + +\generate{% + \file{ldcsetup.sty}{\from{ldcsetup.dtx}{package}} + \file{template.sty}{\from{template.dtx}{package,trace}} + \file{xparse.sty}{\from{xparse.dtx}{package}} +} + +\endbatchfile diff --git a/Master/texmf-dist/source/latex/xpackages/xparse-test.tex b/Master/texmf-dist/source/latex/xpackages/xparse-test.tex index 9c576bfae11..f0071b021ab 100644 --- a/Master/texmf-dist/source/latex/xpackages/xparse-test.tex +++ b/Master/texmf-dist/source/latex/xpackages/xparse-test.tex @@ -1,5 +1,5 @@ % \iffalse -%% (C) Copyright 2000-2008 LaTeX3 Project +%% (C) Copyright 2000-2009 LaTeX3 Project %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3a of this @@ -32,7 +32,7 @@ %% %% ----------------------------------------------------------------------- %% -%% $Id: xparse-test.tex 752 2008-08-03 19:16:44Z morten $ +%% $Id: xparse-test.tex 1194 2009-04-19 15:07:07Z will $ %% % \fi % @@ -50,13 +50,13 @@ \ExplSyntaxOn \makeatletter % Let's just take the error messages for a ride: -\def:Npn \makebox{} +\cs_set_nopar:Npn \makebox{} % Here should be an error because it is defined \NewDocumentCommand \makebox {m}{Gobbledygook} \cs_gundefine:N \makebox % And now one for being undefined \RenewDocumentCommand \makebox {m}{More~gobbledygook} -\let:NN \makebox \scan_stop: +\cs_set_eq:NN \makebox \scan_stop: % Another one for being undefined \RenewDocumentCommand \makebox {m}{Even~more~gobbledygook} % Now it should work @@ -81,7 +81,7 @@ \leavevmode \@begin@tempboxa\hbox{#3} \setlength\@tempdima{#1} - \if_meaning:NN #4\fbox + \if_meaning:w #4\fbox \setbox\@tempboxa\hb@xt@\@tempdima{ \kern\fboxsep \use:c{bm@#2} @@ -99,15 +99,15 @@ #5 { \vbox to#2\unitlength { - \let:NN \mb@b\vss \let:NN \mb@l\hss - \let:NN \mb@r\hss \let:NN \mb@t\vss + \cs_set_eq:NN \mb@b\vss \cs_set_eq:NN \mb@l\hss + \cs_set_eq:NN \mb@r\hss \cs_set_eq:NN \mb@t\vss \IfNoValueF{#3}{ - \tlist_map_variable:nNn {#3}\l_tmpa_tlp { - \if:w s\l_tmpa_tlp - \let:NN \mb@l \scan_stop: - \let:NN \mb@r \scan_stop: + \tl_map_variable:nNn {#3}\l_tmpa_tl { + \if:w s\l_tmpa_tl + \cs_set_eq:NN \mb@l \scan_stop: + \cs_set_eq:NN \mb@r \scan_stop: \else: - \let:cN {mb@\l_tmpa_tlp}\scan_stop: + \cs_set_eq:cN {mb@\l_tmpa_tl}\scan_stop: \fi: } } @@ -129,7 +129,7 @@ } -\def:Npn \showgrabbedargs{\showthe\l_xparse_grabbed_args_toks} +\cs_set_nopar:Npn \showgrabbedargs{\showthe\l_xparse_grabbed_args_toks} \makeatother \ExplSyntaxOff diff --git a/Master/texmf-dist/source/latex/xpackages/xparse.dtx b/Master/texmf-dist/source/latex/xpackages/xparse.dtx index c2dd6796327..8b63e346a6a 100644 --- a/Master/texmf-dist/source/latex/xpackages/xparse.dtx +++ b/Master/texmf-dist/source/latex/xpackages/xparse.dtx @@ -34,10 +34,10 @@ %% ----------------------------------------------------------------------- %% %<*driver|package> -\RequirePackage{l3names} +\RequirePackage{expl3} % %\fi -\GetIdInfo$Id: xparse.dtx 748 2008-08-03 19:00:50Z morten $ +\GetIdInfo$Id: xparse.dtx 1365 2009-05-31 17:26:17Z mittelba $ {generic document command parser} %\iffalse %<*driver> @@ -126,10 +126,10 @@ % \item[O\{default\}] will return the parsed argument surrounded by a % brace pair if present. Otherwise it will return the |{default}| % as specified above. -% \item[S\{\meta{symbol}\}] will return either the token |\c_true| or -% |\c_false| depending on whether or not the next token is +% \item[S\{\meta{symbol}\}] will return either the token |\c_true_bool| or +% |\c_false_bool| depending on whether or not the next token is % \meta{symbol}. -% \item[s] will return either the token |\c_true| or |\c_false| +% \item[s] will return either the token |\c_true_bool| or |\c_false_bool| % depending on whether or not a star was parsed. This is just a % shorthand for |S{*}|. % \item[c] will parse the syntax |(|\meta{x}|,|\meta{y}|)|, i.e., a @@ -144,7 +144,7 @@ % \end{description} % For example, given the spec |soomO{default}| the input % |*[Foo]{Bar}| would be parsed as -% |\c_true{Foo}\NoValue{Bar}{default}|. In other words there will be +% |\c_true_bool{Foo}\NoValue{Bar}{default}|. In other words there will be % always exactly the same number of brace groups or tokens as the % number of letters in the argument spec. % @@ -316,14 +316,14 @@ % However this makes testing for this token slightly complicated as in % that case the test % \begin{verbatim} -% \tlp_set:Nn \l_seen_tlp {#1} -% \tlp_set:Nn \l_hidden_novalue_tlp {\NoValue} -% \tlp_if_eq:NNTF \l_seen_tlp \l_hidden_novalue_tlp +% \tl_set:Nn \l_seen_tl {#1} +% \tl_set:Nn \l_hidden_novalue_tl {\NoValue} +% \tl_if_eq:NNTF \l_seen_tl \l_hidden_novalue_tl % \end{verbatim} % will be true if |#1| was |\NoValue| but false if |#1| itself % contains a macro which contains |\NoValue|; a case that happens % unfortunately very often in practice. Using an unguarded |x| type -% expansion to define |\l_seen_tlp| is out of the question as |#1| is +% expansion to define |\l_seen_tl| is out of the question as |#1| is % typically either |\NoValue| or arbitrary user input for which we % can't properly guard it unless we are sure people only use robust % commands. When running a pure \LaTeX3 format where all document @@ -372,10 +372,10 @@ % \DescribeMacro\IfBooleanT % \DescribeMacro\IfBooleanF % As mentioned earlier, the parsing result for a symbol argument like -% |s| or |S{+}| is represented as the one of the tokens |\c_true| or -% |\c_false| respectively. To test for these values the macro +% |s| or |S{+}| is represented as the one of the tokens |\c_true_bool| or +% |\c_false_bool| respectively. To test for these values the macro % |\IfBooleanTF| can be used. It expects as its first argument either -% |\c_true| or |\c_false| and executes its second or third argument +% |\c_true_bool| or |\c_false_bool| and executes its second or third argument % depending on this value. |\IfBooleanT| and |\IfBooleanF| are % obvious shortcuts. % @@ -804,7 +804,7 @@ % \begin{verbatim} % \DeclarePseudoArgument{boxtest}{1} % {Before:~`#1',\hbox_set_inline_begin:N \l_tmpa_box } -% {\hbox_set_inline_end: \text_put_sp: the~ box:~ +% {\hbox_set_inline_end: \iow_space: the~ box:~ % \hbox_unpack_and_clear:N\l_tmpa_box ,~ % After:~`#1'} % \end{verbatim} @@ -839,7 +839,7 @@ %<*package> \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} -\RequirePackage{l3tlp,l3num,l3toks,l3prg,l3int,l3seq,l3token} +\RequirePackage{expl3} % \end{macrocode} % % @@ -856,20 +856,20 @@ % \begin{macro}{\xparse_no_command_implementation_warning:n} % The names should give the function's purpose away. % \begin{macrocode} -\def_new:NNn \xparse_already_defined_error_msg:N 1 { +\cs_new_nopar:Nn \xparse_already_defined_error_msg:N { \xparse_error:x { - Command~name~`\token_to_string:N #1'~ already~defined! + Command~name~`\token_to_str:N #1'~ already~defined! } } -\def_new:NNn \xparse_not_yet_defined_error_msg:N 1 { +\cs_new_nopar:Nn \xparse_not_yet_defined_error_msg:N { \xparse_error:x { - Command~`\token_to_string:N #1'~ not~ yet~defined! + Command~`\token_to_str:N #1'~ not~ yet~defined! } } -\def_new:NNn \xparse_begins_with_end_error_msg:N 1 { +\cs_new_nopar:Nn \xparse_begins_with_end_error_msg:N { \xparse_error:x { - Command~`\token_to_string:N #1'~begins~with~ - `\token_to_string:N \end'! + Command~`\token_to_str:N #1'~begins~with~ + `\token_to_str:N \end'! } } % \end{macrocode} @@ -877,7 +877,7 @@ % the argument specification. We can try to recover by putting in an % |m| type instead and hope for the best. % \begin{macrocode} -\def_new:NNn \xparse_unknown_arg_type_error_msg:N 1{ +\cs_new_nopar:Nn \xparse_unknown_arg_type_error_msg:N { \xparse_error:x { Unknown~ argument~ type~ `#1'~ I'll~ substitute~ it~ with~ `m'~ for~ now.~ Fingers~ crossed... @@ -886,7 +886,7 @@ % \end{macrocode} % A message for people using the wrong number of arguments. % \begin{macrocode} -\def_new:NNn \xparse_no_command_implementation_warning:n 1 { +\cs_new_nopar:Nn \xparse_no_command_implementation_warning:n { \xparse_warning:x {No~ implementation~ for~ `#1'~ defined} } % \end{macrocode} @@ -902,8 +902,8 @@ % Here's how we produce the error messages and warnings currently. % This awaits a proper error message module! % \begin{macrocode} -\def_new:NNn \xparse_error:x 1{\tex_errmessage:D {xparse~error:~#1}} -\def_new:NNn \xparse_warning:x 1{\io_put_term:x{xparse~warning:~#1}} +\cs_new_nopar:Nn \xparse_error:x {\tex_errmessage:D {xparse~error:~#1}} +\cs_new_nopar:Nn \xparse_warning:x {\iow_term:x{xparse~warning:~#1}} % \end{macrocode} % \end{macro} % \end{macro} @@ -915,32 +915,30 @@ % % \begin{macro}{\xparse_if_definable:NT} % \begin{macro}{\xparse_if_definable:cT} -% A definable command is either |\c_undefined| or |\scan_stop:| and +% An undefinable command is either |\c_undefined| or |\scan_stop:| and % furthermore we won't allow it to start with |\end|. % If the command is definable we do what was asked for otherwise % we give an appropriate error message. % \begin{macrocode} -\def_new:NNn \xparse_if_definable:NTF 1 { +\cs_new_nopar:Npn \xparse_if_definable:NTF #1 { % \end{macrocode} % First check if the control sequence is free. % \begin{macrocode} - \cs_free:NTF #1 + \cs_if_free:NTF #1 % \end{macrocode} % If free check if it begins with |\end|. % \begin{macrocode} { \xparse_begins_with_end:NTF #1 - { \xparse_begins_with_end_error_msg:N #1 \use_arg_ii:nn } - \use_arg_i:nn + { \xparse_begins_with_end_error_msg:N #1 \use_ii:nn } + \use_i:nn } % \end{macrocode} % If not free give an error message. % \begin{macrocode} - { \xparse_already_defined_error_msg:N #1 \use_arg_ii:nn } -} -\def_new:NNn \xparse_if_definable:cTF 0 { - \exp_args:Nc \xparse_if_definable:NTF + { \xparse_already_defined_error_msg:N #1 \use_ii:nn } } +\cs_generate_variant:Nn \xparse_if_definable:NTF {c} % \end{macrocode} % \end{macro} % \end{macro} @@ -949,18 +947,16 @@ % A re-definable command is almost the same as above but here we % demand that it already exists. % \begin{macrocode} -\def_new:NNn \xparse_if_redefinable:NTF 1 { - \cs_free:NTF #1 - { \xparse_not_yet_defined_error_msg:N #1 \use_arg_ii:nn } +\cs_new_nopar:Npn \xparse_if_redefinable:NTF #1 { + \cs_if_free:NTF #1 + { \xparse_not_yet_defined_error_msg:N #1 \use_ii:nn } { \xparse_begins_with_end:NTF #1 - { \xparse_begins_with_end_error_msg:N #1 \use_arg_ii:nn } - \use_arg_i:nn + { \xparse_begins_with_end_error_msg:N #1 \use_ii:nn } + \use_i:nn } } -\def_new:NNn \xparse_if_redefinable:cTF 0 { - \exp_args:Nc \xparse_if_redefinable:NTF -} +\cs_generate_variant:Nn \xparse_if_redefinable:NTF {c} % \end{macrocode} % \end{macro} % \end{macro} @@ -980,27 +976,27 @@ % we turn these three letters into a control sequence with a simple % expansion which is then tested with |\xparse_begins_with_end_aux:N|. % \begin{macrocode} -\def_new:NNn \xparse_begins_with_end:NTF 1 { +\cs_new_nopar:Npn \xparse_begins_with_end:NTF #1 { % \end{macrocode} % We do it all in a group as there is no need to fill up the hash % table with weird three letter control sequences. % \begin{macrocode} \group_begin: \exp_args:Nc \xparse_begins_with_end_aux:N { - \tlist_head_iii:f { \cs_to_str:N #1 ??} + \tl_head_iii:f { \cs_to_str:N #1 ??} } } % \end{macrocode} % After the above expansion tricks we now have a real control sequence % to test against |\end|. We end the group again. % \begin{macrocode} -\def_new:NNn \xparse_begins_with_end_aux:N 1 { - \if:w \cs_if_eq_name_p:NN #1 \end +\cs_new_nopar:Nn \xparse_begins_with_end_aux:N { + \if_predicate:w \cs_if_eq_name_p:NN #1 \end \group_end: - \exp_after:NN \use_arg_i:nn + \exp_after:wN \use_i:nn \else: \group_end: - \exp_after:NN \use_arg_ii:nn + \exp_after:wN \use_ii:nn \fi: } % \end{macrocode} @@ -1044,7 +1040,7 @@ % for every such user level command to be robust which is done using % the \eTeX{} protection feature. % \begin{macrocode} -\def_long:NNn \xparse_declare_document_command:Nnn 3{ +\cs_set:Nn \xparse_declare_document_command:Nnn { % \end{macrocode} % First we prepare the signature. % \begin{macrocode} @@ -1053,9 +1049,9 @@ % Now for the document command. Make it robust and make sure it starts % with |\toks_set:Nn \l_xparse_grabbed_args_toks {\\|\meta{cmd}|}|. % \begin{macrocode} - \def_protected:Npx #1 { + \cs_set_protected_nopar:Npx #1 { \exp_not:n { \toks_set:Nn \l_xparse_grabbed_args_toks } - {\exp_not:c {\token_to_string:N #1}} + {\exp_not:c {\token_to_str:N #1}} % \end{macrocode} % Then add the argument grabbers which contain code gathered when % preparing the signature. @@ -1074,11 +1070,10 @@ % given by |#3|. Even though this internal macro allows |\par| in its % argument the decision is left to the individual argument grabbers. % \begin{macrocode} - \def_long:cNn {\token_to_string:N #1}\l_xparse_total_args_int{#3} -} -\def_new:Npn \xparse_declare_document_command:cnn { - \exp_args:Nc \xparse_declare_document_command:Nnn + \cs_generate_from_arg_count:cNnn {\token_to_str:N #1}\cs_set:Npn + \l_xparse_total_args_int{#3} } +\cs_generate_variant:Nn \xparse_declare_document_command:Nnn {cnn} % \end{macrocode} % \end{macro} % \end{macro} @@ -1090,7 +1085,7 @@ % also insert a |\group_begin:| as it will otherwise fail miserably % in case a user tries to use it without |\begin ... \end|. % \begin{macrocode} -\def_long_new:NNn \xparse_declare_document_environment:nnnn 4 { +\cs_new:Nn \xparse_declare_document_environment:nnnn { \xparse_declare_document_command:cnn {#1}{#2} { \group_begin: \toks_set_eq:NN \l_xparse_end_environment_args_toks @@ -1101,12 +1096,12 @@ % We let |\end|\meta{envir} equal to a standard version which will do % all the work. % \begin{macrocode} - \let:cN {end #1} \xparse_parsed_end_environment: + \cs_set_eq:cN {end #1} \xparse_parsed_end_environment: % \end{macrocode} % Now define |\end\\|\meta{envir}. % \begin{macrocode} - \def_long:cNn {end \token_to_string:N \\ #1} - \l_xparse_total_args_int{#4} + \cs_generate_from_arg_count:cNnn {end \token_to_str:N \\ #1}\cs_set:Npn + \l_xparse_total_args_int{#4} } % \end{macrocode} % \end{macro} @@ -1118,13 +1113,13 @@ % from the argument grabbing. The remainder of the token list is the % grabbed arguments. We better make this robust as well. % \begin{macrocode} -\def_protected_new:NNn \xparse_parsed_end_environment: 0{ - \exp_after:NN \xparse_parsed_end_environment_aux:N +\cs_new_protected_nopar:Nn \xparse_parsed_end_environment: { + \exp_after:wN \xparse_parsed_end_environment_aux:N \toks_use:N \l_xparse_end_environment_args_toks \group_end: } -\def_new:NNn \xparse_parsed_end_environment_aux:N 1{ - \cs_use:c {end \token_to_string:N #1 } +\cs_new_nopar:Nn \xparse_parsed_end_environment_aux:N { + \use:c {end \token_to_str:N #1 } } % \end{macrocode} % \end{macro} @@ -1145,13 +1140,13 @@ % arguments from the input stream. For commands there are two % arguments waiting. % \begin{macrocode} -\let_new:NN \DeclareDocumentCommand \xparse_declare_document_command:Nnn -\def_new:NNn \NewDocumentCommand 1 { +\cs_new_eq:NN \DeclareDocumentCommand \xparse_declare_document_command:Nnn +\cs_new_nopar:Npn \NewDocumentCommand #1 { \xparse_if_definable:NTF #1 { \xparse_declare_document_command:Nnn #1 } \use_none:nn } -\def_new:NNn \RenewDocumentCommand 1 { +\cs_new_nopar:Npn \RenewDocumentCommand #1 { \xparse_if_redefinable:NTF #1 { \xparse_declare_document_command:Nnn #1 } \use_none:nn @@ -1166,14 +1161,14 @@ % \begin{macro}{\RenewDocumentEnvironment} % Three arguments for environments. % \begin{macrocode} -\let_new:NN \DeclareDocumentEnvironment +\cs_new_eq:NN \DeclareDocumentEnvironment \xparse_declare_document_environment:nnnn -\def_new:NNn \NewDocumentEnvironment 1 { +\cs_new_nopar:Npn \NewDocumentEnvironment #1 { \xparse_if_definable:cTF {#1} { \xparse_declare_document_environment:nnnn {#1} } \use_none:nnn } -\def_new:NNn \RenewDocumentEnvironment 1 { +\cs_new_nopar:Npn \RenewDocumentEnvironment #1 { \xparse_if_redefinable:cTF {#1} { \xparse_declare_document_environment:nnnn {#1} } \use_none:nnn @@ -1189,13 +1184,13 @@ % free. If it is let |\DeclareDocument...| do the rest, otherwise % gobble the next arguments. % \begin{macrocode} -\def_new:NNn \ProvideDocumentCommand 1{ - \cs_free:NTF #1 +\cs_new_nopar:Npn \ProvideDocumentCommand #1{ + \cs_if_free:NTF #1 { \DeclareDocumentCommand #1} \use_none:nn } -\def_new:NNn \ProvideDocumentEnvironment 1{ - \cs_free:cTF {#1} +\cs_new_nopar:Npn \ProvideDocumentEnvironment #1{ + \cs_if_free:cTF {#1} { \DeclareDocumentEnvironment {#1} } \use_none:nnn } @@ -1215,9 +1210,9 @@ % signature |#3| which does the argument grabbing. The arguments are % passed on to the internal command |\impl-#2|. % \begin{macrocode} -\def_long_new:NNn \DeclareDocumentCommandInterface 3{ +\cs_new:Npn \DeclareDocumentCommandInterface #1#2#3{ \xparse_prepare_signature:n {#3} - \def_protected:Npx #1 { + \cs_set_protected_nopar:Npx #1 { \exp_not:n { \toks_set:Nn \l_xparse_grabbed_args_toks } {\exp_not:c {impl-#2}} \toks_use:N\l_xparse_grabbed_args_toks @@ -1228,7 +1223,8 @@ % for |\DeclareDocumentCommand| but give it just a default definition % instead (usually an error message). % \begin{macrocode} - \def_long:cNn {impl-#2} \l_xparse_total_args_int + \cs_generate_from_arg_count:cNnn {impl-#2} \cs_set:Npn + \l_xparse_total_args_int {\xparse_undefined_command_implementation:n{#2}} } % \end{macrocode} @@ -1238,7 +1234,7 @@ % called. Let's just typeset the name in quotes indicating that % something is wrong. % \begin{macrocode} -\def_new:NNn \xparse_undefined_command_implementation:n 1{ +\cs_new_nopar:Nn \xparse_undefined_command_implementation:n { ``#1'' % \ensuremath{\langle\textit{#1}\rangle} \xparse_no_command_implementation_warning:n {#1} @@ -1250,8 +1246,8 @@ % Defines the internal command |\impl-#1| with |#2| arguments % and definition |#3|. % \begin{macrocode} -\def_long_new:NNn \DeclareDocumentCommandImplementation 3{ - \def_long:cNn {impl-#1}#2{#3} +\cs_new:Npn \DeclareDocumentCommandImplementation #1#2#3{ + \cs_generate_from_arg_count:cNnn {impl-#1}\cs_set:Npn {#2}{#3} } % \end{macrocode} % \end{macro} @@ -1265,7 +1261,7 @@ % have different ways of handling it afterwards, so we make it a % separate function. % \begin{macrocode} -\def_new:NNn \xparse_prepare_signature:n 1 { +\cs_new_nopar:Nn \xparse_prepare_signature:n { % \end{macrocode} % Initialize the counter taking care of the number of arguments. In % case we reach more than nine we will give an error message later on. @@ -1280,8 +1276,8 @@ \int_zero:N \l_xparse_mandatory_args_int \bool_gset_false:N \g_xparse_insert_marker_bool \bool_gset_false:N \g_xparse_allow_par_bool - \tlp_gset_eq:NN \g_xparse_ignore_marker_tlp - \g_xparse_ignore_spaces_marker_tlp + \tl_gset_eq:NN \g_xparse_ignore_marker_tl + \g_xparse_ignore_spaces_marker_tl % \end{macrocode} % Then call |\xparse_parse_signature:n|. % \begin{macrocode} @@ -1313,10 +1309,10 @@ % Since there are different markers that may be used at the same % time, we use the a special ``insert'' marker |>| to do this. % -% \begin{macro}{\g_xparse_ignore_marker_tlp} +% \begin{macro}{\g_xparse_ignore_marker_tl} % The current ignore marker is contained in this string. % \begin{macrocode} -\tlp_new:Nn \g_xparse_ignore_marker_tlp {} +\tl_new:Nn \g_xparse_ignore_marker_tl {} % \end{macrocode} % \end{macro} % @@ -1341,7 +1337,7 @@ % definition but it works. |#1| is some test in the loop function % and |#2| is the list of markers. % \begin{macrocode} -\def_new:cpn {xparse_add_arg_type_>:} #1 +\cs_new_nopar:cpn {xparse_add_arg_type_>:} #1 \xparse_read_arg_type_or_grab_default:n #2{ % \end{macrocode} % Insert pending |m| args first. @@ -1356,7 +1352,7 @@ % \end{macrocode} % Then go through the list and call each subtype if it exists. % \begin{macrocode} - \tlist_map_inline:nn{#2}{ + \tl_map_inline:nn{#2}{ \xparse_check_and_add_argument_type:N ##1 } % \end{macrocode} @@ -1370,11 +1366,11 @@ % \begin{macro}{\xparse_add_ignore_marker:Nnn} % A small function for adding a new ignore type marker. % \begin{macrocode} -\def_new:NNn \xparse_add_ignore_marker:Nnn 3{ - \tlp_new:cn {g_xparse #2 _marker_tlp}{#3} - \seq_gpush:NC \g_xparse_ignore_marker_seq {g_xparse #2 _marker_tlp} - \def_new:cpn {xparse_add_arg_type_#1:}{ - \tlp_gset_eq:Nc \g_xparse_ignore_marker_tlp {g_xparse #2 _marker_tlp} +\cs_new_nopar:Nn \xparse_add_ignore_marker:Nnn { + \tl_new:cn {g_xparse #2 _marker_tl}{#3} + \seq_gpush:Nv \g_xparse_ignore_marker_seq {g_xparse #2 _marker_tl} + \cs_new_nopar:cpn {xparse_add_arg_type_#1:}{ + \tl_gset_eq:Nc \g_xparse_ignore_marker_tl {g_xparse #2 _marker_tl} } } % \end{macrocode} @@ -1389,7 +1385,7 @@ % \begin{macro}{\xparse_add_arg_type_P:} % This is simple, just set a boolean. % \begin{macrocode} -\def_new:NNn \xparse_add_arg_type_P: 0{ +\cs_new_nopar:Nn \xparse_add_arg_type_P: { \bool_gset_true:N \g_xparse_allow_par_bool } % \end{macrocode} @@ -1409,7 +1405,7 @@ % stored in |\l_xparse_grabbed_args_toks|. The function is recursive % which is why we use a quark to delimit it. % \begin{macrocode} -\def_new:NNn \xparse_parse_signature:n 1{ +\cs_new_nopar:Nn \xparse_parse_signature:n { % \end{macrocode} % Check if we reached the end of the signature. % \begin{macrocode} @@ -1437,8 +1433,8 @@ { \bool_gset_false:N \g_xparse_insert_marker_bool \bool_gset_false:N \g_xparse_allow_par_bool - \tlp_gset_eq:NN \g_xparse_ignore_marker_tlp - \g_xparse_ignore_spaces_marker_tlp + \tl_gset_eq:NN \g_xparse_ignore_marker_tl + \g_xparse_ignore_spaces_marker_tl } % \end{macrocode} % After adding arguments we better set the boolean false in case we @@ -1461,15 +1457,15 @@ % This function checks if the argument type actually exists and gives % an error if it doesn't. % \begin{macrocode} -\def_new:NNn \xparse_check_and_add_argument_type:N 1 { - \cs_free:cTF {xparse_add_arg_type_#1:} +\cs_new_nopar:Nn \xparse_check_and_add_argument_type:N { + \cs_if_free:cTF {xparse_add_arg_type_#1:} { \xparse_unknown_arg_type_error_msg:N #1 \int_incr:N \l_xparse_mandatory_args_int } % \end{macrocode} % Otherwise we just add it with its dedicated function. % \begin{macrocode} - { \cs_use:c {xparse_add_arg_type_#1:} } + { \use:c {xparse_add_arg_type_#1:} } } % \end{macrocode} % \end{macro} @@ -1483,17 +1479,17 @@ % just to tun the loop again. However, some argument types need to % add a default argument so we add these as well. % \begin{macrocode} -\let_new:NN \xparse_read_arg_type_or_grab_default:n +\cs_new_eq:NN \xparse_read_arg_type_or_grab_default:n \xparse_parse_signature:n -\def_new:NNn \xparse_grab_default_arg:n 1{ +\cs_new_nopar:Nn \xparse_grab_default_arg:n { \toks_put_right:Nn \l_xparse_grabbed_args_toks {{#1}} - \let:NN \xparse_read_arg_type_or_grab_default:n + \cs_set_eq:NN \xparse_read_arg_type_or_grab_default:n \xparse_parse_signature:n \xparse_parse_signature:n } -\def_long_new:NNn \xparse_grab_default_arg_allow_par:n 1{ +\cs_new:Nn \xparse_grab_default_arg_allow_par:n { \toks_put_right:Nn \l_xparse_grabbed_args_toks {{#1}} - \let:NN \xparse_read_arg_type_or_grab_default:n + \cs_set_eq:NN \xparse_read_arg_type_or_grab_default:n \xparse_parse_signature:n \xparse_parse_signature:n } @@ -1532,7 +1528,7 @@ % tokens and insert it. Otherwise increment the number of % non-|\long| argument grabbers. % \begin{macrocode} -\def_new:Npn \xparse_add_arg_type_m: { +\cs_new_nopar:Nn \xparse_add_arg_type_m: { \bool_if:NTF \g_xparse_allow_par_bool { \toks_put_right:Nn \l_xparse_grabbed_args_toks {\xparse_allow_par_m:w} @@ -1547,8 +1543,8 @@ % arguments. There is little point in adding any arguments if none % are required. % \begin{macrocode} -\def_new:Npn \xparse_add_remaining_m_args: { - \int_compare:nNnF \l_xparse_mandatory_args_int = \c_zero +\cs_new_nopar:Nn \xparse_add_remaining_m_args: { + \intexpr_compare:nNnF \l_xparse_mandatory_args_int = \c_zero { \toks_put_right:Nx \l_xparse_grabbed_args_toks { \exp_not:c{xparse_m @@ -1576,43 +1572,43 @@ % |\toks_use:N \l_xparse_grabbed_args_toks| anyway so we avoid % problems with that one. % \begin{macrocode} -\def_new:cpn {xparse_m1:w} #1 \l_xparse_grabbed_args_toks#2{ +\cs_new_nopar:cpn {xparse_m1:w} #1 \l_xparse_grabbed_args_toks#2{ \toks_put_right:Nn \l_xparse_grabbed_args_toks{{#2}} #1 \l_xparse_grabbed_args_toks } -\def_new:cpn {xparse_m2:w} #1 \l_xparse_grabbed_args_toks #2#3{ +\cs_new_nopar:cpn {xparse_m2:w} #1 \l_xparse_grabbed_args_toks #2#3{ \toks_put_right:Nn \l_xparse_grabbed_args_toks{{#2}{#3}} #1 \l_xparse_grabbed_args_toks } -\def_new:cpn {xparse_m3:w} #1 \l_xparse_grabbed_args_toks #2#3#4{ +\cs_new_nopar:cpn {xparse_m3:w} #1 \l_xparse_grabbed_args_toks #2#3#4{ \toks_put_right:Nn \l_xparse_grabbed_args_toks{{#2}{#3}{#4}} #1 \l_xparse_grabbed_args_toks } -\def_new:cpn {xparse_m4:w} #1 \l_xparse_grabbed_args_toks #2#3#4#5{ +\cs_new_nopar:cpn {xparse_m4:w} #1 \l_xparse_grabbed_args_toks #2#3#4#5{ \toks_put_right:Nn \l_xparse_grabbed_args_toks{{#2}{#3}{#4}{#5}} #1 \l_xparse_grabbed_args_toks } -\def_new:cpn {xparse_m5:w} #1 \l_xparse_grabbed_args_toks #2#3#4#5#6{ +\cs_new_nopar:cpn {xparse_m5:w} #1 \l_xparse_grabbed_args_toks #2#3#4#5#6{ \toks_put_right:Nn \l_xparse_grabbed_args_toks{{#2}{#3}{#4}{#5}{#6}} #1 \l_xparse_grabbed_args_toks } -\def_new:cpn {xparse_m6:w} #1 \l_xparse_grabbed_args_toks #2#3#4#5#6#7{ +\cs_new_nopar:cpn {xparse_m6:w} #1 \l_xparse_grabbed_args_toks #2#3#4#5#6#7{ \toks_put_right:Nn \l_xparse_grabbed_args_toks {{#2}{#3}{#4}{#5}{#6}{#7}} #1 \l_xparse_grabbed_args_toks } -\def_new:cpn {xparse_m7:w} #1 \l_xparse_grabbed_args_toks#2#3#4#5#6#7#8{ +\cs_new_nopar:cpn {xparse_m7:w} #1 \l_xparse_grabbed_args_toks#2#3#4#5#6#7#8{ \toks_put_right:Nn \l_xparse_grabbed_args_toks {{#2}{#3}{#4}{#5}{#6}{#7}{#8}} #1 \l_xparse_grabbed_args_toks } -\def_new:cpn {xparse_m8:w} #1\l_xparse_grabbed_args_toks +\cs_new_nopar:cpn {xparse_m8:w} #1\l_xparse_grabbed_args_toks #2#3#4#5#6#7#8#9{ \toks_put_right:Nn \l_xparse_grabbed_args_toks {{#2}{#3}{#4}{#5}{#6}{#7}{#8}{#9}} #1 \l_xparse_grabbed_args_toks } -\def_new:cpn {xparse_m9:w} \toks_use:N \l_xparse_grabbed_args_toks +\cs_new_nopar:cpn {xparse_m9:w} \toks_use:N \l_xparse_grabbed_args_toks #1#2#3#4#5#6#7#8#9{ \toks_put_right:Nn \l_xparse_grabbed_args_toks {{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}{#9}} @@ -1633,7 +1629,7 @@ % The |m| type allowing |\par| tokens. We only define one of them as % two in a row would be quite rare. % \begin{macrocode} -\def_long_new:Npn \xparse_allow_par_m:w #1 \l_xparse_grabbed_args_toks#2{ +\cs_new:Npn \xparse_allow_par_m:w #1 \l_xparse_grabbed_args_toks#2{ \toks_put_right:Nn \l_xparse_grabbed_args_toks{{#2}} #1 \l_xparse_grabbed_args_toks } @@ -1648,7 +1644,7 @@ % This is almost exactly the same as the |m| type except we read % everything up to the first left brace. % \begin{macrocode} -\def_new:Npn \xparse_add_arg_type_l: { +\cs_new_nopar:Nn \xparse_add_arg_type_l: { \xparse_add_remaining_m_args: \bool_if:NTF \g_xparse_allow_par_bool { @@ -1656,11 +1652,11 @@ } { \toks_put_right:Nn \l_xparse_grabbed_args_toks {\xparse_l:w} } } -\def_new:Npn \xparse_l:w #1 \l_xparse_grabbed_args_toks#2#{ +\cs_new_nopar:Npn \xparse_l:w #1 \l_xparse_grabbed_args_toks#2#{ \toks_put_right:Nn \l_xparse_grabbed_args_toks{{#2}} #1 \l_xparse_grabbed_args_toks } -\def_long_new:Npn \xparse_allow_par_l:w #1 \l_xparse_grabbed_args_toks#2#{ +\cs_new:Npn \xparse_allow_par_l:w #1 \l_xparse_grabbed_args_toks#2#{ \toks_put_right:Nn \l_xparse_grabbed_args_toks{{#2}} #1 \l_xparse_grabbed_args_toks } @@ -1674,21 +1670,22 @@ % % \begin{macro}{\DeclareSymbolArgument} % The actual grabber functions just issue a |\peek_meaning_remove:NTF| -% or similar on the symbol chosen. If found, we put a |\c_true| on the -% argument stack and |\c_false| otherwise. -% \begin{macrocode} -\def_new:NNn \DeclareSymbolArgument 2{ - \seq_map_variable:NNn \g_xparse_ignore_marker_seq \l_tmpa_tlp { - \def:cpx {xparse \l_tmpa_tlp _#1:w}##1##2\l_xparse_grabbed_args_toks{ - \exp_not:c{peek_ #2 _remove \l_tmpa_tlp :NTF} ##1 +% or similar on the symbol chosen. If found, we put a |\c_true_bool| on the +% argument stack and |\c_false_bool| otherwise. +% \begin{macrocode} +\cs_new_nopar:Npn \DeclareSymbolArgument #1#2{ + \seq_map_variable:NNn \g_xparse_ignore_marker_seq \l_tmpa_tl { + \cs_set_nopar:cpx {xparse \l_tmpa_tl _#1:w}##1##2 + \l_xparse_grabbed_args_toks{ + \exp_not:c{peek_ #2 _remove \l_tmpa_tl :NTF} ##1 { \exp_not:N \toks_put_right:Nn \exp_not:N - \l_xparse_grabbed_args_toks \exp_not:N \c_true + \l_xparse_grabbed_args_toks \exp_not:N \c_true_bool ##2 \exp_not:N\l_xparse_grabbed_args_toks } { \exp_not:N \toks_put_right:Nn \exp_not:N - \l_xparse_grabbed_args_toks \exp_not:N \c_false + \l_xparse_grabbed_args_toks \exp_not:N \c_false_bool ##2 \exp_not:N\l_xparse_grabbed_args_toks } } @@ -1698,15 +1695,16 @@ % grab a default argument. First we must clear out any pending |m| % arguments. % \begin{macrocode} - \def:cpn {xparse_add_arg_type_#1:} { + \cs_set_nopar:cpn {xparse_add_arg_type_#1:} { \xparse_add_remaining_m_args: \toks_put_right:Nx \l_xparse_grabbed_args_toks - { \exp_not:c {xparse \g_xparse_ignore_marker_tlp _#1:w } } + { \exp_not:c {xparse \g_xparse_ignore_marker_tl _#1:w } } % \end{macrocode} % Nothing special when building the signature: We always grab a single % default argument. % \begin{macrocode} - \let:NN \xparse_read_arg_type_or_grab_default:n \xparse_grab_default_arg:n + \cs_set_eq:NN \xparse_read_arg_type_or_grab_default:n + \xparse_grab_default_arg:n } } % \end{macrocode} @@ -1730,7 +1728,7 @@ % optional argument is missing. The last two arguments control how % the arguments are picked up and parsed on to the inner parsing. % \begin{macrocode} -\def_new:NNn \DeclareArgumentType 7{ +\cs_new_nopar:Npn \DeclareArgumentType #1#2#3#4#5#6#7{ % \end{macrocode} % For instance, we want |\DeclareArgumentType a{charcode}[...| to % define the function |\xparse_ignore_spaces_a:w| with meaning @@ -1742,9 +1740,9 @@ % |\g_xparse_ignore_marker_seq| so we go through that when doing the % definitions. % \begin{macrocode} - \seq_map_variable:NNn \g_xparse_ignore_marker_seq \l_tmpa_tlp { - \def:cpx {xparse \l_tmpa_tlp _#1:w}##1\l_xparse_grabbed_args_toks{ - \exp_not:c{peek_#3 \l_tmpa_tlp :NTF} \exp_not:N #2 + \seq_map_variable:NNn \g_xparse_ignore_marker_seq \l_tmpa_tl { + \cs_set_nopar:cpx {xparse \l_tmpa_tl _#1:w}##1\l_xparse_grabbed_args_toks{ + \exp_not:c{peek_#3 \l_tmpa_tl :NTF} \exp_not:N #2 { \exp_not:c{xparse_#1_#3_help:nw}{##1} } { \exp_not:n { @@ -1756,9 +1754,9 @@ % \end{macrocode} % And now an almost identical version which allows the |\par| token. % \begin{macrocode} - \def_long:cpx {xparse_allow_par \l_tmpa_tlp _#1:w}##1 + \cs_set:cpx {xparse_allow_par \l_tmpa_tl _#1:w}##1 \l_xparse_grabbed_args_toks{ - \exp_not:c{peek_#3 \l_tmpa_tlp :NTF} \exp_not:N #2 + \exp_not:c{peek_#3 \l_tmpa_tl :NTF} \exp_not:N #2 { \exp_not:c{xparse_allow_par_#1_#3_help:nw}{##1} } { \exp_not:n { @@ -1772,7 +1770,7 @@ % Here is the function for building the argument grabbing. We clear % out the remaining |m| arguments first. % \begin{macrocode} - \def:cpn {xparse_add_arg_type_#1:} { + \cs_set_nopar:cpn {xparse_add_arg_type_#1:} { \xparse_add_remaining_m_args: \toks_put_right:Nx \l_xparse_grabbed_args_toks { \exp_not:c {xparse @@ -1782,11 +1780,11 @@ % default). % \begin{macrocode} \bool_if:NT \g_xparse_allow_par_bool {_allow_par} - \g_xparse_ignore_marker_tlp + \g_xparse_ignore_marker_tl _#1:w } } - \let:NN \xparse_read_arg_type_or_grab_default:n \xparse_parse_signature:n + \cs_set_eq:NN \xparse_read_arg_type_or_grab_default:n \xparse_parse_signature:n } % \end{macrocode} % Now all we need to do is to define the helper functions. @@ -1801,10 +1799,10 @@ % Therefore it doesn't have the arguments of the default value and % what to do if it is missing like the above. % \begin{macrocode} -\def_new:NNn \DeclareArgumentTypeDefaultValue 5{ - \seq_map_variable:NNn \g_xparse_ignore_marker_seq \l_tmpa_tlp { - \def:cpx {xparse \l_tmpa_tlp _#1:w}##1##2\l_xparse_grabbed_args_toks{ - \exp_not:c{peek_#3 \l_tmpa_tlp :NTF} \exp_not:N #2 +\cs_new_nopar:Npn \DeclareArgumentTypeDefaultValue #1#2#3#4#5{ + \seq_map_variable:NNn \g_xparse_ignore_marker_seq \l_tmpa_tl { + \cs_set_nopar:cpx {xparse \l_tmpa_tl _#1:w}##1##2\l_xparse_grabbed_args_toks{ + \exp_not:c{peek_#3 \l_tmpa_tl :NTF} \exp_not:N #2 { \exp_not:c{xparse_#1_#3_help:nw}{##2} } { \exp_not:N \toks_put_right:Nn @@ -1815,9 +1813,9 @@ % \end{macrocode} % And now an almost identical version which allows the |\par| token. % \begin{macrocode} - \def_long:cpx {xparse_allow_par \l_tmpa_tlp _#1:w}##1##2 + \cs_set:cpx {xparse_allow_par \l_tmpa_tl _#1:w}##1##2 \l_xparse_grabbed_args_toks{ - \exp_not:c{peek_#3 \l_tmpa_tlp :NTF} \exp_not:N #2 + \exp_not:c{peek_#3 \l_tmpa_tl :NTF} \exp_not:N #2 { \exp_not:c{xparse_allow_par_#1_#3_help:nw}{##2} } { \exp_not:N \toks_put_right:Nn @@ -1830,7 +1828,7 @@ % Here is the function for building the argument grabbing. We clear % out the remaining |m| arguments first. % \begin{macrocode} - \def:cpn {xparse_add_arg_type_#1:} { + \cs_set_nopar:cpn {xparse_add_arg_type_#1:} { \xparse_add_remaining_m_args: \toks_put_right:Nx \l_xparse_grabbed_args_toks { \exp_not:c {xparse @@ -1840,11 +1838,11 @@ % default). % \begin{macrocode} \bool_if:NT \g_xparse_allow_par_bool {_allow_par} - \g_xparse_ignore_marker_tlp + \g_xparse_ignore_marker_tl _#1:w } } - \let:Nc \xparse_read_arg_type_or_grab_default:n + \cs_set_eq:Nc \xparse_read_arg_type_or_grab_default:n {xparse_grab_default_arg \bool_if:NT \g_xparse_allow_par_bool {_allow_par} :n @@ -1862,7 +1860,7 @@ % All we need now is the helper functions. We define a generic % interface that should be fairly easy to use. % \begin{macrocode} -\def_new:NNn \xparse_define_helper:Nnnn 4{ +\cs_new_nopar:Nn \xparse_define_helper:Nnnn { \toks_set:Nn \l_tmpa_toks { #3 @@ -1878,9 +1876,9 @@ % The next bit looks a little ugly but that's life. % \begin{macrocode} \toks_set:Nx \l_tmpa_toks { - \exp_not:n {\def:cpn{xparse_#1_#2_help:nw}} + \exp_not:n {\cs_set_nopar:cpn{xparse_#1_#2_help:nw}} \toks_use:N \l_tmpa_toks - \exp_not:n {\def:cpn{xparse_allow_par_#1_#2_help:nw}} + \exp_not:n {\cs_set_nopar:cpn{xparse_allow_par_#1_#2_help:nw}} \toks_use:N\l_tmpa_toks } \toks_use:N \l_tmpa_toks @@ -1933,8 +1931,8 @@ % and give it the wrong name as it should have a |w| argument % specification but I hope you can forgive this little white lie. % \begin{macrocode} -\def_new:NNn \DeclareArgumentTypeShorthand 2{ - \def_new:cpn {xparse_add_arg_type_#1:} +\cs_new_nopar:Npn \DeclareArgumentTypeShorthand #1#2{ + \cs_new_nopar:cpn {xparse_add_arg_type_#1:} ##1 \xparse_read_arg_type_or_grab_default:n { \int_decr:N \l_xparse_total_args_int \xparse_read_arg_type_or_grab_default:n #2 @@ -1957,42 +1955,42 @@ % \begin{macro}{\IfBooleanT} % \begin{macro}{\IfBooleanF} % The logical \meta{true} and \meta{false} statements are just our -% normal |\c_true| and |\c_false| so testing for them is done with +% normal |\c_true_bool| and |\c_false_bool| so testing for them is done with % our usual |\bool_if:NTF| functions from \textsf{l3prg}. % \begin{macrocode} -\let_new:NN \IfBooleanTF \bool_if:NTF -\let_new:NN \IfBooleanT \bool_if:NT -\let_new:NN \IfBooleanF \bool_if:NF +\cs_new_eq:NN \IfBooleanTF \bool_if:NTF +\cs_new_eq:NN \IfBooleanT \bool_if:NT +\cs_new_eq:NN \IfBooleanF \bool_if:NF % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\NoValue} -% \begin{macro}{\c_xparse_hidden_no_value_tlp} +% \begin{macro}{\c_xparse_hidden_no_value_tl} % |\NoValue| is just a text string and we define it as a token list -% pointer. However we will actually test for token list pointers +% variable. However we will actually test for token list variables % with \emph{meaning} |\NoValue|. Hence if an argument is really % |-NoValue-| it will not be detected but that shouldn't happen. % \begin{macrocode} -\tlp_new:Nn \NoValue {-NoValue-} -\tlp_new:Nn \c_xparse_hidden_no_value_tlp {\NoValue} +\tl_new:Nn \NoValue {-NoValue-} +\tl_new:Nn \c_xparse_hidden_no_value_tl {\NoValue} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\xparse_if_no_value:nTF} -% The test start by making a token list pointer out of the first +% The test start by making a token list variable out of the first % argument and then check if it is equal to -% |\c_xparse_hidden_no_value_tlp| which contains |\NoValue|. +% |\c_xparse_hidden_no_value_tl| which contains |\NoValue|. % \begin{macrocode} -\def_long_new:Npn \xparse_if_no_value:nTF #1{ - \tlp_set:Nx \l_tmpa_tlp{\exp_not:n{#1}} - \tlp_if_eq:NNTF \l_tmpa_tlp \c_xparse_hidden_no_value_tlp +\cs_new:Npn \xparse_if_no_value:nTF #1{ + \tl_set:Nx \l_tmpa_tl{\exp_not:n{#1}} + \tl_if_eq:NNTF \l_tmpa_tl \c_xparse_hidden_no_value_tl % \end{macrocode} % If they are equal we just exit and execute the \meta{true} code. % \begin{macrocode} - { \use_arg_i:nn } + { \use_i:nn } % \end{macrocode} % If not, take a closer look at |#1|. Peek ahead at the first token in % |#1| and then call the function |\xparse_if_no_value_aux:| but only @@ -2001,8 +1999,8 @@ % point otherwise the macros for checking tokens will break since the % argument may be empty. % \begin{macrocode} - { \tlist_if_blank:nTF {#1} - { \use_arg_ii:nn } + { \tl_if_blank:nTF {#1} + { \use_ii:nn } {\peek_after:NN \xparse_if_no_value_aux: #1 \q_nil {#1} } } } @@ -2014,18 +2012,18 @@ % it is not a macro the function |\token_get_arg_spec:N| returns % |\scan_stop:|. % \begin{macrocode} -\def_long_new:Npn \xparse_if_no_value_aux: { - \tlp_set:Nx \l_tmpa_tlp{\token_get_arg_spec:N \l_peek_token } +\cs_new:Nn \xparse_if_no_value_aux: { + \tl_set:Nx \l_tmpa_tl{\token_get_arg_spec:N \l_peek_token } % \end{macrocode} -% Then check if |\l_tmpa_tlp| is empty, because this means we have a +% Then check if |\l_tmpa_tl| is empty, because this means we have a % macro taking zero arguments and we can expand it once % safely. Otherwise we just exit and execute the false code. Remember % that we have the sequence |{#1}| waiting after the |\q_nil| in % |\xparse_if_no_value:nTF| above. % \begin{macrocode} - \tlp_if_empty:NTF \l_tmpa_tlp - {\use_arg_i_delimit_by_q_nil:nw {\exp_args:No\xparse_if_no_value:nTF}} - {\use_arg_i_delimit_by_q_nil:nw {\use_arg_iii:nnn}} + \tl_if_empty:NTF \l_tmpa_tl + {\use_i_delimit_by_q_nil:nw {\exp_args:No\xparse_if_no_value:nTF}} + {\use_i_delimit_by_q_nil:nw {\use_iii:nnn}} } % \end{macrocode} % \end{macro} @@ -2040,15 +2038,15 @@ % |\IfNoValueTF| and its varieties are implemented as subcases of % |\xparse_if_no_value:nTF|. % \begin{macrocode} -\let_new:NN \IfNoValueTF \xparse_if_no_value:nTF -\def_long_new:NNn \IfNoValueT 2 {\xparse_if_no_value:nTF{#1}{#2}{}} -\def_long_new:NNn \IfNoValueF 1 {\xparse_if_no_value:nTF {#1}{}} +\cs_new_eq:NN \IfNoValueTF \xparse_if_no_value:nTF +\cs_new:Npn \IfNoValueT #1#2 {\xparse_if_no_value:nTF{#1}{#2}{}} +\cs_new:Npn \IfNoValueF #1 {\xparse_if_no_value:nTF {#1}{}} % \end{macrocode} % For |\IfValueTF| we just reverse the arguments. % \begin{macrocode} -\def_long_new:NNn \IfValueTF 3{\xparse_if_no_value:nTF {#1}{#3}{#2}} -\let_new:NN \IfValueT \IfNoValueF -\let_new:NN \IfValueF \IfNoValueT +\cs_new:Npn \IfValueTF #1#2#3{\xparse_if_no_value:nTF {#1}{#3}{#2}} +\cs_new_eq:NN \IfValueT \IfNoValueF +\cs_new_eq:NN \IfValueF \IfNoValueT % \end{macrocode} % \end{macro} % \end{macro} @@ -2060,10 +2058,10 @@ % % \subsection{Pseudo arguments} % -% \begin{macro}{\l_xparse_pseudo_post_arg_tlp} -% A temporary token list pointer to store the post-arguments. +% \begin{macro}{\l_xparse_pseudo_post_arg_tl} +% A temporary token list variable to store the post-arguments. % \begin{macrocode} -\tlp_new:Nn \l_xparse_pseudo_post_arg_tlp {} +\tl_new:Nn \l_xparse_pseudo_post_arg_tl {} % \end{macrocode} % \end{macro} % \begin{macro}{\DeclarePseudoArgument} @@ -2076,28 +2074,28 @@ % functions with |#2| arguments and definitions |#3| and |#4| % respectively. % \begin{macrocode} -\def_long_new:NNn \DeclarePseudoArgument 4{ - \def_long:cNn {xparse_pseudo_pre_arg_#1:\prg_replicate:nn{#2}{n}}#2{#3} - \def_long:cNn {xparse_pseudo_post_arg_#1:\prg_replicate:nn{#2}{n}}#2{#4} +\cs_new:Npn \DeclarePseudoArgument #1#2#3#4{ + \cs_set:cn {xparse_pseudo_pre_arg_#1:\prg_replicate:nn{#2}{n}} {#3} + \cs_set:cn {xparse_pseudo_post_arg_#1:\prg_replicate:nn{#2}{n}} {#4} % \end{macrocode} % In case the user doesn't put the argument in braces, it must be a % single token which we just grab and then execute the % post-argument. Surely it won't be a |\par| token! % \begin{macrocode} - \def:cNn {xparse_pseudo_nobrace_arg_#1:N} 1 { - ##1 \l_xparse_pseudo_post_arg_tlp + \cs_set_nopar:cn {xparse_pseudo_nobrace_arg_#1:N} { + ##1 \l_xparse_pseudo_post_arg_tl } % \end{macrocode} % The regular version of the command is then this: % \begin{enumerate} % \item Execute the pre-code at level $n$. -% \item Store the post-code in a token list pointer at level $n$. +% \item Store the post-code in a token list variable at level $n$. % \item Look for a begin-group token. % \item[4a] If found, remove it, start a group (level $n+1$) and make -% sure the token list pointer from 2) is executed after the group +% sure the token list variable from 2) is executed after the group % has ended (at level $n$). % \item[4b] If not found, call the |nobrace_arg| version which also -% executes the token list pointer from 2) at level $n$. +% executes the token list variable from 2) at level $n$. % \end{enumerate} % This scheme enables these commands to be nested since they all % appear at different grouping levels. @@ -2105,16 +2103,17 @@ % Next we define the function. Also make sure that it gets all the % arguments carried over to the post-argument. % \begin{macrocode} - \def_long:cNx {xparse_pseudo_arg_#1:w} #2 + \cs_generate_from_arg_count:cNnn {xparse_pseudo_arg_#1:w} + \cs_set:Npx {#2} { \exp_not:c { xparse_pseudo_pre_arg_#1: \prg_replicate:nn{#2}{n} } - \cs_use:c{def_aux_use_\int_use:N \int_eval:n{#2}_parameter:} - \exp_not:n {\tlp_set:Nn \l_xparse_pseudo_post_arg_tlp} + \use:c{use_ \intexpr_eval:n{#2} _parameter:} + \exp_not:n {\tl_set:Nn \l_xparse_pseudo_post_arg_tl} { \exp_not:c {xparse_pseudo_post_arg_#1:\prg_replicate:nn{#2}{n}} - \cs_use:c{def_aux_use_\int_use:N \int_eval:n{#2}_parameter:} + \use:c{use_ \intexpr_eval:n{#2}_parameter:} } \exp_not:n{ \peek_catcode_remove_ignore_spaces:NTF \c_group_begin_token } { @@ -2127,7 +2126,7 @@ % \begin{macrocode} \exp_not:n { \c_group_begin_token - \group_execute_after:N \l_xparse_pseudo_post_arg_tlp + \group_execute_after:N \l_xparse_pseudo_post_arg_tl } } { @@ -2140,7 +2139,7 @@ % \begin{macro}{\UsePseudoArgument} % Just a nice wrapper for calling such an argument. % \begin{macrocode} -\def_new:NNn \UsePseudoArgument 1{\cs_use:c{xparse_pseudo_arg_#1:w}} +\cs_new_nopar:Npn \UsePseudoArgument #1{\use:c{xparse_pseudo_arg_#1:w}} % \end{macrocode} % \end{macro} % @@ -2150,30 +2149,3 @@ % \Finale % \endinput -% -% $Log$ -% Revision 1.25 2006/07/17 22:25:53 morten -% Minor change to reflect change in l3basics.dtx -% -% Revision 1.24 2006/07/08 22:44:29 morten -% Fixed two lurking problems in \xparse_if_no_value:nTF. -% -% Revision 1.23 2006/07/06 14:56:04 morten -% Change to use new \def:NNn syntax -% -% Revision 1.22 2006/01/17 23:04:08 morten -% Added `l' type argument for reading up to a left brace. -% -% Revision 1.21 2006/01/04 02:42:35 morten -% Changed RCS information retrieval. Rewrote \DeclareArgumentType and -% its relatives in order for them to work properly with the new \peek_ -% functions. Changed how special markers are inserted into the -% signature. Added `pseudo arguments'. Updated documentation to reflect -% all these changes. And more which I can't remember right now :-) -% -% Revision 1.20 2005/04/06 21:24:47 morten -% Total rewrite - there is only one implementation in the package -% now. Documentation updated to match the changes. -% -% -% diff --git a/Master/texmf-dist/source/latex/xpackages/xtheorem-test.tex b/Master/texmf-dist/source/latex/xpackages/xtheorem-test.tex deleted file mode 100644 index 48c28658d3b..00000000000 --- a/Master/texmf-dist/source/latex/xpackages/xtheorem-test.tex +++ /dev/null @@ -1,98 +0,0 @@ -% \iffalse -%% File xo-balance.tex -%% (C) Copyright 1999 Achim Blumensath -%% (C) Copyright 2004 LaTeX3 Project -%% -%% It may be distributed and/or modified under the conditions of the -%% LaTeX Project Public License (LPPL), either version 1.3a of this -%% license or (at your option) any later version. The latest version -%% of this license is in the file -%% -%% http://www.latex-project.org/lppl.txt -%% -%% This file is part of the ``xtheorem bundle'' (The Work in LPPL) -%% and all files in that bundle must be distributed together. -%% -%% The released version of this bundle is available from CTAN. -%% -%% ----------------------------------------------------------------------- -%% -%% The development version of the bundle can be found at -%% -%% http://www.latex-project.org/cgi-bin/cvsweb.cgi/ -%% -%% for those people who are interested. -%% -%%%%%%%%%%% -%% NOTE: %% -%%%%%%%%%%% -%% -%% Snapshots taken from the repository represent work in progress and may -%% not work or may contain conflicting material! We therefore ask -%% people _not_ to put them into distributions, archives, etc. without -%% prior consultation with the LaTeX Project Team. -%% -%% ----------------------------------------------------------------------- -%% -%% $Id: xtheorem-test.tex 274 2004-11-29 19:51:15Z mittelba $ -%% -% \fi -% -\documentclass{article} - -\usepackage{xtheorem} - -\DeclareInstance{theoremstyle}{example}{std} -{ - pre-skip = 1cm, - post-skip = 1cm, - body-style = \ttfamily, - head-style = \sffamily, - post-head-action = \newline, -} - - -\newtheorem{plain}{Thm}{Theorem}[section] -\newtheorem{plain}{Prop}[Thm]{Proposition} -\newtheorem{plain}{Lem}[Thm]{Lemma} -\newtheorem{plain}{Cor}[Thm]{Corollary} -\newtheorem{definition}{Def}[Thm]{Definition} -\newtheorem*{remark}{Rem}{Remark} -\newtheorem*{example}{Exam}{Example} - -\begin{document} - -\section{First Section} - -\begin{Def} -\emph{My package} is the \textsf{xtheorem} package. -\end{Def} -\begin{Thm} -My package works as advertised. -\end{Thm} -\begin{Cor}[Achim] -It can be used. -\end{Cor} -\begin{Rem} -This is good. -\end{Rem} - -\section{Second Section} - -\begin{Def} -\emph{My package} is the \textsf{xtheorem} package. -\end{Def} -\begin{Thm} -My package works as advertised. -\end{Thm} -\begin{Cor}[Achim] -It can be used. -\end{Cor} -\begin{Exam}[Frank] -An this shows a new style. -\end{Exam} -\begin{Rem} -This is good. -\end{Rem} - -\stop diff --git a/Master/texmf-dist/source/latex/xpackages/xtheorem.dtx b/Master/texmf-dist/source/latex/xpackages/xtheorem.dtx deleted file mode 100644 index c7b8ab8803d..00000000000 --- a/Master/texmf-dist/source/latex/xpackages/xtheorem.dtx +++ /dev/null @@ -1,416 +0,0 @@ -% \iffalse -%% File xtheorem.dtx -%% (C) Copyright 1999 Achim Blumensath -%% (C) Copyright 2004 2006 2008 LaTeX3 Project -%% -%% It may be distributed and/or modified under the conditions of the -%% LaTeX Project Public License (LPPL), either version 1.3c of this -%% license or (at your option) any later version. The latest version -%% of this license is in the file -%% -%% http://www.latex-project.org/lppl.txt -%% -%% This file is part of the ``xtheorem bundle'' (The Work in LPPL) -%% and all files in that bundle must be distributed together. -%% -%% The released version of this bundle is available from CTAN. -%% -%% ----------------------------------------------------------------------- -%% -%% The development version of the bundle can be found at -%% -%% http://www.latex-project.org/cgi-bin/cvsweb.cgi/ -%% -%% for those people who are interested. -%% -%%%%%%%%%%% -%% NOTE: %% -%%%%%%%%%%% -%% -%% Snapshots taken from the repository represent work in progress and may -%% not work or may contain conflicting material! We therefore ask -%% people _not_ to put them into distributions, archives, etc. without -%% prior consultation with the LaTeX Project Team. -%% -%% ----------------------------------------------------------------------- -%<*driver|package> -\RequirePackage{l3names} -% -%\fi -\GetIdInfo$Id: xtheorem.dtx 754 2008-08-03 19:30:38Z morten $ - {Experimental theorem package} -%\iffalse -%<*driver> -%\fi -\ProvidesFile{\filename.\filenameext} - [\filedate\space v\fileversion\space\filedescription] -%\iffalse - \documentclass{ltxdoc} - \usepackage{textcomp} - -% \usepackage{xparse,xlists,xlists-samples} -% \usepackage{ldcdoc} - -% next three definitions are big hacks to run the file -% without the above packages -% -\newcommand\NoValue{\texttt{\textbackslash NoValue}} - -\newenvironment{TemplateInterfaceDescription}[1] - {\subsection{The Template Type `#1'}% - \begingroup\description - \def\TemplateArgument##1##2{\item[Arg: ##1]##2\par}% - \def\TemplateSemantics{\enddescription\endgroup - \subsubsection*{Semantics:}}% - } - {\par\bigskip} - -\newenvironment{TemplateDescription}[2] - {\subsection{The Template `#2' (type #1)}% - \subsubsection*{Attributes:}% - \begingroup\description - \def\TemplateKey##1##2##3##4{\item[##1 (##2)]##3% - \ifx\TemplateKey##4\TemplateKey\else -% \hskip0ptplus3em\penalty-500\hskip 0pt plus 1filll Default:~##4% - \hfill\penalty500\hbox{}\hfill Default:~##4% - \nobreak\hskip-\parfillskip\hskip0pt\relax - \fi - \par}% - \def\TemplateSemantics{\enddescription\endgroup - \subsubsection*{Semantics \& Comments:}}% - } - {\par\bigskip} - - \begin{document} - \DocInput{xtheorem.dtx} - \end{document} -% -% \fi -% -% -% -% \title{The \textsf{xtheorem} package\thanks{This file -% has version number \fileversion, last -% revised \filedate.}} -% \author{AB} -% \date{\filedate} -% -% \maketitle -% -% \tableofcontents -% -% \begin{abstract} -% This is a conversion of the AMS theorem classes to the template -% system. Only the interface was changed, the internals still use -% \LaTeXe\ commands. -% \end{abstract} -% -% \section{Interfaces} -% -% \begin{TemplateInterfaceDescription}{theoremstyle} -% -% \TemplateArgument{1} -% {Text of the number of the theorem (e.g., \verb|A.1|), or -% \NoValue\ to indicate that the theorem is unnumbered.} -% -% \TemplateArgument{2} -% {Name of the theorem (e.g. \verb|Theorem|, \verb|Lemma|).} -% -% \TemplateArgument{3} -% {Additional note (e.g. \verb|see [12]|), or \NoValue.} -% -% \TemplateSemantics -% -% This template starts a new environment, typesets the head of a -% theorem, and sets fonts for the body of the theorem. The -% environment is ended by an \verb|\@endtheorem| command. -% -% If the first argument is given, it is printed as the number part. -% The second argument contains the name of the theorem, and the -% third one may contain an additional note. -% -% For instance, the arguments \verb|2.1|, \verb|Lemma|, and -% \verb|Rabin~1960| could produce the output -% -% \medskip -% \noindent\textbf{Lemma 2.1 }(Rabin 1960)\textbf. -% -% \medskip\noindent -% where the following text is set in italic. -% -% \end{TemplateInterfaceDescription} -% -% -% \begin{TemplateDescription}{theoremstyle}{std} -% -% \TemplateKey{pre-skip}{l} -% {Skip above the theorem.} -% {|topsep|} -% \TemplateKey{post-skip}{l} -% {Skip below the theorem.} -% {|topsep|} -% \TemplateKey{body-style}{f0} -% {Commands to be executed before the body of the theorem in -% order to set fonts, etc.} -% {italic} -% \TemplateKey{head-style}{f0} -% {Commands to set the font of the head.} -% {bold} -% \TemplateKey{note-style}{f0} -% {Commands to set the font of the note.} -% {medium upright font} -% \TemplateKey{head-punct}{f0} -% {Text after the head.} -% {|.|} -% \TemplateKey{head-format}{f3} -% {Format of the head.} -% {Name Number (Note)} -% \TemplateKey{head-indent}{l} -% {Indent of the head.} -% {none} -% \TemplateKey{head-sep}{l} -% {Space after the head.} -% {5pt $\pm$ 1pt} -% \TemplateKey{post-head-action}{f0} -% {Command to be executed after the head (e.g., a line break).} -% {none} -% -% \TemplateSemantics -% This are all parameters provided by the AMS package, except `swaphead' -% which can be simulated by \verb|head-format|. -% -% \end{TemplateDescription} -% -% \paragraph{Problem.} -% The current solution for `head-format' is very clumsy. Perhaps it would -% be better to pass just the name of a template which does the layout -% instead of the actual code. -% -% \medskip -% \DescribeMacro\newtheorem -% The \verb|\newtheorem| command defines a new type of theorem. It takes -% the following arguments: -% -% \medskip -% \verb|\newtheorem|[|*|]$\langle$style$\rangle$\relax -% $\langle$name$\rangle$[share counter]$\langle$label$\rangle$\relax -% [count relative] -% -% \medskip\noindent -% and defines an environment named `name'. The arguments have the -% following meanings: -% \begin{description} -% \item[|*|] If present the theorem is unnumbered, otherwise it is -% numbered. -% \item[style] The name of an instace of the `theoremstyle' template -% which is used to typeset the theorem. -% \item[name] The name of the new environment. -% \item[share counter] (optional) The label of another defined theorem. -% If present both kinds of theorem share a common counter. -% \item[label] The name of the theorem which should appear in its head. -% \item[count relative] If present the counter is reset to 1 everything -% the counter with this name is changed (e.g., |section| or |chapter|). -% \end{description} -% -% For instance, the following definitions create environments named -% |Thm|, |Prop|, |Lem|, |Cor|, |Def|, |Rem|, and |Exam|. The first -% five share a common counter which is relative to the current -% section, the last two are unnumbered. -% \begin{verbatim} -% \newtheorem{plain}{Thm}{Theorem}[section] -% \newtheorem{plain}{Prop}[Thm]{Proposition} -% \newtheorem{plain}{Lem}[Thm]{Lemma} -% \newtheorem{plain}{Cor}[Thm]{Corollary} -% \newtheorem{definition}{Def}[Thm]{Definition} -% \newtheorem*{remark}{Rem}{Remark} -% \newtheorem*{remark}{Exam}{Example} -% \end{verbatim} -% -% \section{Implementation} -% -% \begin{macrocode} -%<*package> -\ProvidesExplPackage - {\filename}{\filedate}{\fileversion}{\filedescription} -\RequirePackage{xparse} -\RequirePackage{template} -% \end{macrocode} -% -% \begin{macrocode} -\DeclareTemplateType{theoremstyle}{3} - -\skip_new:N \TS_pre_skip -\skip_new:N \TS_post_skip -\dim_new:N \TS_head_indent_dim -\skip_new:N \TS_head_sep_skip - -\DeclareTemplate{theoremstyle}{std}{3} -{ - pre-skip =l [\DelayEvaluation{\topsep}] \TS_pre_skip, - post-skip =l [\DelayEvaluation{\topsep}] \TS_post_skip, - body-style =f0 [\itshape] \TS_body_style_tlp, - head-style =f0 [\bfseries] \TS_head_style_tlp, - note-style =f0 [\fontseries\mddefault\upshape] \TS_note_style_tlp, - head-punct =f0 [.] \TS_head_punct_tlp, - head-format =f3 [\IfNoValueF{#1}{#1\IfNoValueF{#2}{\space}} - \IfNoValueF{#2}{\textup{#2}} - \IfNoValueF{#3}{\space{\TS_note_style_tlp(#3)}}] - \TS_head_format:nnn, - head-indent =l [0pt] \TS_head_indent_dim, - head-sep =l [5pt plus 1pt minus 1pt] \TS_head_sep_skip, - post-head-action =f0 [] \TS_post_head_action_tlp -} -{ - \DoParameterAssignments - \if_mode_horizontal: - \prg_whiledo:nT{ - \int_compare:nNnT \etex_lastnodetype:D = \c_eleven - }{\tex_unskip:D} - \par - \fi: - \normalfont - \trivlist - \let:NN\thmheadnl\scan_stop: - \@topsep\TS_pre_skip - \@topsepadd\TS_post_skip - \IfNoValueF{#1} - {\refstepcounter{#1}} - \deferred@thm@head{ - \TS_head_style_tlp - \skip_horizontal:N \TS_head_indent_dim - \IfNoValueTF{#1} - {\TS_head_format:nnn{#2}{#1}{#3}} - {\TS_head_format:nnn{#2}{\cs_use:c{the#1}}{#3}} - \TS_head_punct_tlp - \TS_post_head_action_tlp - \skip_horizontal:N\TS_head_sep_skip - } - \TS_body_style_tlp - \ignorespaces -} -% \end{macrocode} -% These functions are used by the template above. They are copied -% straight away from amsclass.dtx. -% \begin{macrocode} -\let:NN\adjust@parskip@nobreak \@nbitem -% \end{macrocode} -% -% \begin{macrocode} -\toks_new:N\dth@everypar -\toks_set:Nn \dth@everypar{ - \@minipagefalse - \global\@newlistfalse - \if@inlabel - \global\@inlabelfalse - \begingroup - \setbox\z@\lastbox - \ifvoid\z@ \kern-\itemindent \fi - \endgroup - \unhbox\@labels - \fi - \if@nobreak - \@nobreakfalse - \clubpenalty\@M - \else - \clubpenalty\@clubpenalty - \everypar{} - \fi -} -% \end{macrocode} -% -% \begin{macrocode} -\def\deferred@thm@head#1{% - \if@inlabel \indent \par \fi % eject a section head if one is pending - \if@nobreak - \adjust@parskip@nobreak - \else - \addpenalty\@beginparpenalty - \addvspace\@topsep - \addvspace{-\parskip}% - \fi - \global\@inlabeltrue - \everypar\dth@everypar - \sbox\@labels{\normalfont#1}% - \ignorespaces -} -% \end{macrocode} -% The usual styles `plain', `definition', and `remark'. -% \begin{macrocode} -\DeclareInstance{theoremstyle}{plain}{std}{} - -\DeclareInstance{theoremstyle}{definition}{std} -{ - body-style = \normalfont -} - -\DeclareInstance{theoremstyle}{remark}{std} -{ - pre-skip = \DelayEvaluation{0.5\topsep}, - post-skip = \DelayEvaluation{0.5\topsep}, - body-style = \normalfont, - head-style = \itshape -} -% \end{macrocode} -% The command to end a theorem. -% \begin{macrocode} -\def:Npn\@endtheorem{\endtrivlist\@endpefalse } -% \end{macrocode} -% -% |newtheorem| just checks all cases and defines the appropriate -% environment. -% \begin{macrocode} -\DeclareDocumentCommand{\newtheorem}{smmomo} -{ - \exp_args:Nc\@ifdefinable{#3} - { - \IfBooleanTF{#1} - { - \DeclareDocumentEnvironment{#3}{o} - {\UseInstance{theoremstyle}{#2}{\NoValue}{#5}{##1}} - {\@endtheorem} - } - { - \IfNoValueTF{#4} - { - \IfNoValueTF{#6} - { - \newcounter{#3} - } - { - \newcounter{#3}[#6] - \gdef:cpx{the#3}{\exp_not:c{the#6} - \@thmcountersep\@thmcounter{#3}} - } - \DeclareDocumentEnvironment{#3}{o} - {\UseInstance{theoremstyle}{#2}{#3}{#5}{##1}} - {\@endtheorem} - } - { - \cs_if_free:cTF{c@#4} - { - \@nocounterr{#4} - } - { - \gdef:cpx{the#3}{\exp_not:c{the#4}} - \DeclareDocumentEnvironment{#3}{o} - {\UseInstance{theoremstyle}{#2}{#4}{#5}{##1}} - {\@endtheorem} - } - } - } - } -} -% \end{macrocode} -% -% \begin{macrocode} -\endinput -% \end{macrocode} -% -% \begin{macrocode} -% -% \end{macrocode} -% -% -% \Finale -% -\endinput diff --git a/Master/texmf-dist/source/latex/xpackages/xtheorem.ins b/Master/texmf-dist/source/latex/xpackages/xtheorem.ins deleted file mode 100644 index 990b28c066c..00000000000 --- a/Master/texmf-dist/source/latex/xpackages/xtheorem.ins +++ /dev/null @@ -1,58 +0,0 @@ -% \iffalse -%% -%% This file will generate fast loadable files and documentation -%% driver files from the dtx files in this package when run through -%% LaTeX or TeX. -%% -%% (C) Copyright 2000-2004 LaTeX3 Project -%% -%% It may be distributed and/or modified under the conditions of the -%% LaTeX Project Public License (LPPL), either version 1.3a of this -%% license or (at your option) any later version. The latest version -%% of this license is in the file -%% -%% http://www.latex-project.org/lppl.txt -%% -%% This file is part of the ``xtheorem bundle'' (The Work in LPPL) -%% and all files in that bundle must be distributed together. -%% -%% The released version of this bundle is available from CTAN. -%% -%% ----------------------------------------------------------------------- -%% -%% The development version of the bundle can be found at -%% -%% http://www.latex-project.org/cgi-bin/cvsweb.cgi/ -%% -%% for those people who are interested. -%% -%%%%%%%%%%% -%% NOTE: %% -%%%%%%%%%%% -%% -%% Snapshots taken from the repository represent work in progress and may -%% not work or may contain conflicting material! We therefore ask -%% people _not_ to put them into distributions, archives, etc. without -%% prior consultation with the LaTeX Project Team. -%% -%% ----------------------------------------------------------------------- -%% -%% $Id: xtheorem.ins 274 2004-11-29 19:51:15Z mittelba $ -%% -% \fi -% -% -\input docstrip -\keepsilent -\askforoverwritefalse - -\preamble - -Not for distribution -\endpreamble - -\generate{ - \file{xtheorem.sty}{\from{xtheorem.dtx}{package,trace}} - } - -\endbatchfile diff --git a/Master/texmf-dist/tex/latex/xpackages/ldcsetup.sty b/Master/texmf-dist/tex/latex/xpackages/ldcsetup.sty index 57d5e448d17..7f26ce16cbb 100644 --- a/Master/texmf-dist/tex/latex/xpackages/ldcsetup.sty +++ b/Master/texmf-dist/tex/latex/xpackages/ldcsetup.sty @@ -20,7 +20,7 @@ %% ====================================================================== %% %% File: ldcsetup.dtx (C) Copyright 1999 Frank Mittelbach, Chris Rowley, David Carlisle -%% (C) Copyright 2004-2007 Frank Mittelbach, LaTeX3 Project +%% (C) Copyright 2004-2009 Frank Mittelbach, LaTeX3 Project %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this @@ -53,12 +53,13 @@ %% %% ----------------------------------------------------------------------- %% -\RequirePackage{l3names} -\GetIdInfo$Id: ldcsetup.dtx 636 2007-09-12 20:03:06Z mittelba $ +\RequirePackage{expl3} +\GetIdInfo$Id: ldcsetup.dtx 1295 2009-05-06 08:32:25Z will $ {coding conventions and stuff} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} -\RequirePackage{keyval,l3calc} +\RequirePackage{keyval} +\RequirePackage{expl3} \ExplSyntaxOff %% Puts an ignored space at the end of the line, so `|\ |' does the right \def\IgnoreWhiteSpace{% @@ -95,7 +96,7 @@ %%% ???? \ifx\InternalSyntaxOff\relax \expandafter\def\expandafter\InternalSyntaxOff\expandafter -{\@tempa\let\InternalSyntaxOff\relax}% + {\@tempa\let\InternalSyntaxOff\relax}% \fi \ifx\@currname\@empty \expandafter\AtBeginDocument\expandafter{\@tempa}% @@ -113,21 +114,21 @@ } \let\InternalSyntaxOff\relax \ExplSyntaxOn -\def\define@key#1#2{% +\cs_set_nopar:Npn \define@key#1#2{% \@ifnextchar[ {\KV@def{#1}{\string#2}} {\@namedef{KV@#1@\string#2}####1}} -\def\setkeys#1#2{% - \def\KV@prefix{KV@#1@\expandafter\string}% +\cs_set_nopar:Npn \setkeys#1#2{% + \cs_set_nopar:Npn \KV@prefix{KV@#1@\expandafter\string}% \KV@do#2,\relax,} \newtoks\KV@toks -\def\KV@@sp@c#1\@nil#2\relax#3{\KV@toks{#1}\edef#3{\the\KV@toks}} -\def\KV@equal{=} -\def\KV@split#1=#2=#3\relax{% +\cs_set_nopar:Npn \KV@@sp@c#1\@nil#2\relax#3{\KV@toks{#1}\cs_set_nopar:Npx #3{\the\KV@toks}} +\cs_set_nopar:Npn \KV@equal{=} +\cs_set_nopar:Npn \KV@split#1=#2=#3\relax{% \KV@@sp@def\@tempa{#1}% - \def\@tempd{#3}% + \cs_set_nopar:Npn \@tempd{#3}% \ifx\@tempa\@empty\else - \expandafter\let\expandafter\@tempc + \expandafter\cs_set_eq:NN \expandafter\@tempc \csname\KV@prefix\@tempa\endcsname \ifx\@tempc\relax \KV@error{\@tempa\space \expandafter\@gobbletwo\string\@undefined}\@eha @@ -144,24 +145,24 @@ \fi \fi \fi} -\def\KV@erry{\expandafter\KV@errx\meaning\@tempd\relax ignored\MessageBreak +\cs_set_nopar:Npn \KV@erry{\expandafter\KV@errx\meaning\@tempd\relax ignored\MessageBreak missing~comma~in~`\expandafter\strip@prefix\meaning\@tempb'~?} -\def\KV@errx#1>#2==\relax{% +\cs_set_nopar:Npn \KV@errx#1>#2==\relax{% `#2' } -\def\KV@default{% - \expandafter\let\expandafter\@tempb +\cs_set_nopar:Npn \KV@default{% + \expandafter\cs_set_eq:NN \expandafter\@tempb \csname\KV@prefix\@tempa @default\endcsname \ifx\@tempb\relax \KV@error{No value specified for \@tempa}\@eha \else \@tempb\relax \fi} -\def\KV@error#1#2{\PackageError{keyval}{#1}{#2}} -\def\KV@parse#1{ +\cs_set_nopar:Npn \KV@error#1#2{\PackageError{keyval}{#1}{#2}} +\cs_set_nopar:Npn \KV@parse#1{ \begingroup -\def\KV@@sp@c##1\@nil##2\relax##3{\addto@hook##3{{##1}}} -\def\KV@split##1=##2=##3\relax{% - \def\@tempd{##3}% +\cs_set_nopar:Npn \KV@@sp@c##1\@nil##2\relax##3{\addto@hook##3{{##1}}} +\cs_set_nopar:Npn \KV@split##1=##2=##3\relax{% + \cs_set_nopar:Npn \@tempd{##3}% \expandafter\ifx\expandafter=\@firstofone##1=\else \ifx\@tempd\@empty \addto@hook\KV@toks\KV@default@elt @@ -181,9 +182,9 @@ \expandafter \endgroup \the\KV@toks} -\let:NN \SetInternalCounter \calc_int_set:Nn -\let:NN \GSetInternalCounter\calc_int_gset:Nn -\def\UndeclareRobustCommand#1{% +\cs_set_eq:NN \SetInternalCounter \calc_int_set:Nn +\cs_set_eq:NN \GSetInternalCounter\calc_int_gset:Nn +\cs_set_nopar:Npn \UndeclareRobustCommand#1{% \cs_gundefine:N #1 \exp_args:Nc \cs_gundefine:N {\cs_to_str:N #1~} } diff --git a/Master/texmf-dist/tex/latex/xpackages/template.sty b/Master/texmf-dist/tex/latex/xpackages/template.sty index 354eee4abd0..a64a9cf4cc9 100644 --- a/Master/texmf-dist/tex/latex/xpackages/template.sty +++ b/Master/texmf-dist/tex/latex/xpackages/template.sty @@ -20,7 +20,7 @@ %% ====================================================================== %% %% File: template.dtx (C) Copyright 1999-2001 David Carlisle, Frank Mittelbach -%% (C) Copyright 2004-2008 Frank Mittelbach, LaTeX3 Project +%% (C) Copyright 2004-2009 Frank Mittelbach, LaTeX3 Project %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this @@ -53,20 +53,20 @@ %% %% ----------------------------------------------------------------------- %% -\RequirePackage{l3names} -\GetIdInfo$Id: template.dtx 749 2008-08-03 19:01:36Z morten $ +\RequirePackage{expl3} +\GetIdInfo$Id: template.dtx 1295 2009-05-06 08:32:25Z will $ {template} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} +\RequirePackage{expl3} \RequirePackage{ldcsetup,xparse} -\RequirePackage{l3toks,l3tlp,l3skip,l3int,l3clist,l3token,l3calc} \toks_new:N\l_TP_KV_assignments_toks \toks_new:N\l_TP_default_assignments_toks -\def_new:NNn \TP_declare_instance:Nnn 3{ +\cs_new_nopar:Nn \TP_declare_instance:Nnn { \group_begin: \TP_instdecl_generate_assignments:nn {#2}{#3} - \gdef:Npx #1 { - \tlp_if_eq:cNTF { TP>/#2 } \c_TP_doparameterassignments_tlp + \cs_gset_nopar:Npx #1 { + \tl_if_eq:cNTF { TP>/#2 } \c_TP_doparameterassignments_tl { \toks_use:N \l_TP_KV_assignments_toks } { \exp_not:N \TP_push_assignments:n @@ -75,175 +75,177 @@ } } \group_end:} -\def_new:Npn \TP_declare_instance:cnn{\exp_args:Nc\TP_declare_instance:Nnn} -\tlp_set:Nn \c_TP_doparameterassignments_tlp {\DoParameterAssignments} -\def_new:NNn \UseTemplate 3{ +\cs_generate_variant:Nn \TP_declare_instance:Nnn {cnn} +\tl_set:Nn \c_TP_doparameterassignments_tl {\DoParameterAssignments} +\cs_new_nopar:Npn \UseTemplate #1#2#3{ \TP_instdecl_generate_assignments:nn {#1/#2}{#3} \TP_push_assignments: - \cs_use:c { TP>/#1/#2 } + \use:c { TP>/#1/#2 } } -\def_new:Npn \DoParameterAssignments{ - \exp_after:NN +\cs_new_nopar:Npn \DoParameterAssignments{ + \exp_after:wN \TP_pop_and_execute_assignments:nw \toks_use:N \g_TP_assignments_stack_toks \q_stop } -\def_new:Npn \TP_pop_and_execute_assignments:nw#1#2\q_stop{ +\cs_new_nopar:Npn \TP_pop_and_execute_assignments:nw#1#2\q_stop{ \toks_gset:Nn \g_TP_assignments_stack_toks {#2} #1} \toks_new:N \g_TP_assignments_stack_toks \toks_gset:Nn \g_TP_assignments_stack_toks {\scan_stop:}% avoid brace loss -\def_long_new:Npn \TP_push_assignments:n#1{ +\cs_new:Npn \TP_push_assignments:n#1{ \toks_gput_left:Nn\g_TP_assignments_stack_toks{{#1}} } -\def_new:Npn \TP_push_assignments:{ +\cs_new_nopar:Npn \TP_push_assignments:{ \toks_gset:No \g_TP_assignments_stack_toks - {\exp_after:NN - {\toks_use:N\exp_after:NN\l_TP_KV_assignments_toks\exp_after:NN} + {\exp_after:wN + {\toks_use:N\exp_after:wN\l_TP_KV_assignments_toks\exp_after:wN} \toks_use:N\g_TP_assignments_stack_toks} } -\def_new:NNn \DeclareTemplateType 2{ - \tlp_set:cn {TP@<#1>} {{}#2}} -\def_new:Npn \TP_get_csname_prefix:n#1{ - <\exp_after:NN\exp_after:NN\exp_after:NN - \use_arg_i:nn +\cs_new_nopar:Npn \DeclareTemplateType #1#2{ + \tl_set:cn {TP@<#1>} {{}#2}} +\cs_new_nopar:Nn \TP_get_csname_prefix:n { + <\exp_after:wN\exp_after:wN\exp_after:wN + \use_i:nn \cs:w TP@<#1>\cs_end:>#1/ } -\def_new:Npn \TP_get_arg_count:n#1{ - \exp_after:NN\exp_after:NN\exp_after:NN - \use_arg_ii:nn +\cs_new_nopar:Nn \TP_get_arg_count:n { + \exp_after:wN\exp_after:wN\exp_after:wN + \use_ii:nn \cs:w TP@<#1>\cs_end: } -\def_long_new:NNn\DeclareTemplate 5{ +\cs_new:Npn\DeclareTemplate #1#2#3#4#5{ \cs_if_free:cTF{TP@<#1>} {\undefinedtype\DeclareTemplateType{#1}#3} { - \int_compare:nNnF{#3}={\TP_get_arg_count:n{#1}} + \intexpr_compare:nNnF{#3}={\TP_get_arg_count:n{#1}} { \BadArgCount } } - \let:NN \KV_elt:nn \TP_templdecl_process_KV:nn - \def:Npn \KV_default_elt:n##1{ + \cs_set_eq:NN \KV_elt:nn \TP_templdecl_process_KV:nn + \cs_set_nopar:Npn \KV_default_elt:n##1{ \PackageError{template}{Missing~ =~ after~ ##1}\@ehd} - \let:NN\KV@elt\KV_elt:nn - \let:NN\KV@default@elt\KV_default_elt:n - \tlp_set:Nn \l_TP_curr_name_tlp {#1/#2} + \cs_set_eq:NN\KV@elt\KV_elt:nn + \cs_set_eq:NN\KV@default@elt\KV_default_elt:n + \tl_set:Nn \l_TP_curr_name_tl {#1/#2} \toks_clear:N\l_TP_default_assignments_toks - %\int_compare:nNnTF{\char_value_catcode:n{`\ }}=\c_nine + %\intexpr_compare:nNnTF{\char_value_catcode:n{`\ }}=\c_nine %\KV_parse_picky_no_space_removal_no_sanitize:n %\KV_parse_picky_space_removal_no_sanitize:n \KV@parse{#4} - \tlp_set:cx { TPD>/\l_TP_curr_name_tlp } + \cs_set_nopar:cpx { TPD>/\l_TP_curr_name_tl } {\toks_use:N\l_TP_default_assignments_toks} - \tlp_clear:c {TPR>/\l_TP_curr_name_tlp} + \tl_clear:c {TPR>/\l_TP_curr_name_tl} - \tlp_set_eq:cN {TPO>/\l_TP_curr_name_tlp}\l_TP_curr_name_tlp - \def_long:cNn {TP>/\l_TP_curr_name_tlp}{#3}{#5} + \tl_set_eq:cN {TPO>/\l_TP_curr_name_tl}\l_TP_curr_name_tl + \cs_generate_from_arg_count:cNnn {TP>/\l_TP_curr_name_tl} + \cs_set:Npn {#3}{#5} } -\def_new:Npn \TP_templdecl_process_KV:nn#1#2{% - \let:NN \TP_templdecl_add_global_or_nothing: \use_noop: +\cs_set:Npn \tl_set:cx {\exp_args:Nc \tl_set:Nx} +\cs_new_nopar:Nn \TP_templdecl_process_KV:nn {% + \cs_set_eq:NN \TP_templdecl_add_global_or_nothing: \prg_do_nothing: \bool_set_false:N\l_TP_global_assignment_bool - \tlp_set:Nn\l_TP_currkey_tlp{#1} + \tl_set:Nn\l_TP_currkey_tl{#1} \TP_templdecl_parse_KV:N#2\q_stop} -\def_new:Npn \TP_templdecl_parse_KV:N#1{ +\cs_new_nopar:Nn \TP_templdecl_parse_KV:N { \cs_if_free:cTF{TP_use_arg_type_#1:w} - {\PackageError{template}{Unknown~key~type~ (#1)~for~\l_TP_currkey_tlp}\@eha} - {\cs_use:c{TP_use_arg_type_#1:w}} + {\PackageError{template}{Unknown~key~type~ (#1)~for~\l_TP_currkey_tl}\@eha} + {\use:c{TP_use_arg_type_#1:w}} } \bool_new:N \l_TP_global_assignment_bool -\def_new:cpn{TP_use_arg_type_+:w} { +\cs_new_nopar:cpn{TP_use_arg_type_+:w} { \bool_set_true:N\l_TP_global_assignment_bool - \def:Npn \TP_templdecl_add_global_or_nothing: + \cs_set_nopar:Npn \TP_templdecl_add_global_or_nothing: {\toks_put_right:Nn \l_TP_KV_assignments_toks {\pref_global:D} } \TP_templdecl_parse_KV:N } -\def_new:Npn\TP_use_arg_type_l:w { +\cs_new_nopar:Npn\TP_use_arg_type_l:w { \TP_parse_optional_key_default:nw { - \let:NN \TP_templdecl_add_global_or_nothing: \use_noop: + \cs_set_eq:NN \TP_templdecl_add_global_or_nothing: \prg_do_nothing: \bool_if:NTF \l_TP_global_assignment_bool {\TP_templdecl_setup_register_key:Nn\gsetlength} {\TP_templdecl_setup_register_key:Nn\setlength} } } -\def_new:Npn\TP_use_arg_type_L:w { +\cs_new_nopar:Npn\TP_use_arg_type_L:w { \TP_parse_optional_key_default:nw {\TP_templdecl_setup_fakeregister_key:NNn\setlength\l_tmpa_skip} } -\def_new:Npn\TP_use_arg_type_c:w { +\cs_new_nopar:Npn\TP_use_arg_type_c:w { \TP_parse_optional_key_default:nw { - \let:NN\TP_templdecl_add_global_or_nothing:\use_noop: + \cs_set_eq:NN\TP_templdecl_add_global_or_nothing:\prg_do_nothing: \bool_if:NTF \l_TP_global_assignment_bool {\TP_templdecl_setup_register_key:Nn\GSetInternalCounter} {\TP_templdecl_setup_register_key:Nn\SetInternalCounter} } } -\def_new:Npn\TP_use_arg_type_C:w { +\cs_new_nopar:Npn\TP_use_arg_type_C:w { \TP_parse_optional_key_default:nw {\TP_templdecl_setup_fakeregister_key:NNn \SetInternalCounter\l_tmpa_int} } -\def_new:Npn\TP_use_arg_type_n:w { +\cs_new_nopar:Npn\TP_use_arg_type_n:w { \TP_parse_optional_key_default:nw {\TP_templdecl_setup_n_key:N} } -\def_new:Npn\TP_use_arg_type_f:w #1{ +\cs_new_nopar:Npn\TP_use_arg_type_f:w #1{ %\TP_templdecl_parse_f_arg:nw {#1} \TP_parse_optional_key_default:nw{\TP_templdecl_setup_f_key:Nn{#1}} } -\def_new:Npn \TP_templdecl_parse_f_arg:nw#1#2{ +\cs_new_nopar:Npn \TP_templdecl_parse_f_arg:nw#1#2{ \TP_parse_optional_key_default:nw{\TP_templdecl_setup_f_key:Nn{#1}{#2}} } -\def_new:Npn\TP_use_arg_type_b:w { +\cs_new_nopar:Npn\TP_use_arg_type_b:w { \TP_parse_optional_key_default:nw {\TP_templdecl_setup_b_key:n} } -\def_new:Npn \TP_templdecl_setup_b_key:n#1{ - \let:cN { if#1 } \if_true: +\cs_new_nopar:Npn \TP_templdecl_setup_b_key:n#1{ + \cs_set_eq:cN { if#1 } \if_true: \TP_templdecl_define_key:n { \TP_templdecl_eval_b_key_value:nn {#1}{##1} } } -\def_new:Npn \TP_templdecl_eval_b_key_value:nn#1#2{ +\cs_new_nopar:Npn \TP_templdecl_eval_b_key_value:nn#1#2{ \cs_if_free:cTF {if#2} { \PackageError{template}{Bad~boolean~setting~#1=#2}\@eha } - { \tlp_set_eq:cc {if_#1:}{if_#2:} + { \tl_set_eq:cc {if_#1:}{if_#2:} \toks_put_right:Nf \l_TP_KV_assignments_toks - { \tlp_set_eq:cc {if_#1:}{if_#2:} } + { \tl_set_eq:cc {if_#1:}{if_#2:} } } } -\def_new:Npn\TP_use_arg_type_s:w { +\cs_new_nopar:Npn\TP_use_arg_type_s:w { \TP_parse_optional_key_default:nw {\TP_templdecl_setup_s_key:n} } -\def_new:Npn \TP_templdecl_setup_s_key:n #1 { +\cs_new_nopar:Npn \TP_templdecl_setup_s_key:n #1 { \TP_templdecl_define_key:n { \TP_templdecl_eval_s_key_value:nnn{##1}#1 } } -\def_new:Npn\TP_use_arg_type_i:w #1{ +\cs_new_nopar:Npn\TP_use_arg_type_i:w #1{ \TP_parse_optional_key_default:nw{\TP_templdecl_setup_i_key:nnn{#1}} } -\def_new:Npn \TP_templdecl_setup_i_key:nnn#1#2{ +\cs_new_nopar:Npn \TP_templdecl_setup_i_key:nnn#1#2{ \TP_templdecl_define_key:n { \TP_templdecl_eval_i_key_value:Nnn #2 {#1}{##1} } } -\def_new:Npn \TP_templdecl_eval_i_key_value:Nnn #1#2#3 { - \tlist_if_head_eq_meaning:nNTF {#3.}\UseTemplate +\cs_new_nopar:Npn \TP_templdecl_eval_i_key_value:Nnn #1#2#3 { + \tl_if_head_eq_meaning:nNTF {#3.}\UseTemplate { - \io_put_term:x{\token_to_string:N\UseTemplate\space seen} + \iow_term:x{\token_to_str:N\UseTemplate\space seen} {\TP_templdecl_declare_tmp_instance:nnnn #3 } \toks_put_right:No \l_TP_KV_assignments_toks - { \exp_after:NN \KV@toks \exp_after:NN {\g_tmpa_tlp} } + { \exp_after:wN \KV@toks \exp_after:wN {\g_tmpa_tl} } %\TP_templdecl_add_global_or_nothing: %\toks_put_right:Nn \l_TP_KV_assignments_toks - % { \def:Npx #1{ \toks_use:N \KV@toks} } + % { \cs_set_nopar:Npx #1{ \toks_use:N \KV@toks} } \bool_if:NTF \l_TP_global_assignment_bool {\toks_put_right:Nn \l_TP_KV_assignments_toks - {\gdef:Npx #1 { \toks_use:N \KV@toks}} + {\cs_gset_nopar:Npx #1 { \toks_use:N \KV@toks}} } {\toks_put_right:Nn \l_TP_KV_assignments_toks - {\def:Npx #1 { \toks_use:N \KV@toks}} + {\cs_set_nopar:Npx #1 { \toks_use:N \KV@toks}} } } { @@ -252,34 +254,37 @@ { \TP_let_instance:Nnn#1{#2}{#3} } } } -\def_new:Npn\TP_use_arg_type_x:w { +\cs_new_nopar:Npn\TP_use_arg_type_x:w { \TP_parse_optional_key_default:nw {\TP_templdecl_setup_x_key:n} } -\def_new:Npn \TP_templdecl_setup_x_key:n#1{ +\cs_new_nopar:Npn \TP_templdecl_setup_x_key:n#1{ \TP_templdecl_define_key:n { \toks_put_right:Nn\l_TP_KV_assignments_toks{#1} } } -\def_new:Npn\TP_use_arg_type_g:w { +\cs_new_nopar:Npn\TP_use_arg_type_g:w { \TP_parse_optional_key_default:nw {\TP_templdecl_setup_g_key:n} } -\def_new:Npn \TP_templdecl_setup_g_key:n #1 { +\cs_new_nopar:Npn \TP_templdecl_setup_g_key:n #1 { \TP_templdecl_define_key:n{#1}} -\def_new:Npn \TP_templdecl_define_key:n#1{ - \tlp_set:Nx \l_tmpa_tlp { - \exp_not:N \TP_templdecl_remove_from_default_assignments:N - \exp_not:c{KV@\l_TP_curr_name_tlp @\l_TP_currkey_tlp} - \exp_not:o {\TP_templdecl_add_global_or_nothing: } - } - \exp_args:NcNo \def:NNn {KV@\l_TP_curr_name_tlp @\l_TP_currkey_tlp} 1 - { \l_tmpa_tlp #1 } -} -\def_long:Npn \TP_ignore_leading_space_in_arg_ii:nn#1#2{ +\cs_new_nopar:Npn \TP_templdecl_define_key:n#1{ + \exp_after:wN \cs_set:Npn \cs:w + KV@\l_TP_curr_name_tl @\l_TP_currkey_tl + \exp_after:wN\cs_end: + \exp_after:wN##\exp_after:wN1\exp_after:wN{ + \exp_after:wN\TP_templdecl_remove_from_default_assignments:N + \cs:w KV@\l_TP_curr_name_tl @\l_TP_currkey_tl + \exp_after:wN \cs_end: + \TP_templdecl_add_global_or_nothing: + #1 + } +} +\cs_set:Npn \TP_ignore_leading_space_in_arg_ii:nn#1#2{ \exp_args:Nf\TP_ignore_leading_space_in_arg_ii_aux:nn {\exp_not:N #2}{#1} } -\def_long:Npn \TP_ignore_leading_space_in_arg_ii_aux:nn#1#2{#2{#1}} +\cs_set:Npn \TP_ignore_leading_space_in_arg_ii_aux:nn#1#2{#2{#1}} \DeclareArgumentType t[{meaning}{}{\NoValue}{#1[#2]}{#2} \DeclareDocumentCommand\TP_parse_optional_key_default:nw{mt}{ @@ -287,132 +292,134 @@ {\TP_templdecl_finish_key_setup:nw{#1}} {\TP_templdecl_finish_key_setup_with_default:nnw{#1}{#2}} } -\def_new:Npn \TP_templdecl_finish_key_setup:nw#1#2\q_stop{ +\cs_new_nopar:Npn \TP_templdecl_finish_key_setup:nw#1#2\q_stop{ \TP_ignore_leading_space_in_arg_ii:nn{#1}{#2} %%%#1{#2} } -\def_new:Npn \TP_templdecl_finish_key_setup_with_default:nnw#1#2#3\q_stop{ +\cs_new_nopar:Npn \TP_templdecl_finish_key_setup_with_default:nnw#1#2#3\q_stop{ \TP_ignore_leading_space_in_arg_ii:nn{#1}{#3} %%% #1 {#3} \group_begin: \toks_clear:N \l_TP_KV_assignments_toks - \let:NN \TP_templdecl_remove_from_default_assignments:N \use_none:n - \cs_use:c{KV@\l_TP_curr_name_tlp @\l_TP_currkey_tlp}{#2} - \exp_after:NN + \cs_set_eq:NN \TP_templdecl_remove_from_default_assignments:N \use_none:n + \use:c{KV@\l_TP_curr_name_tl @\l_TP_currkey_tl}{#2} + \exp_after:wN \group_end: - \exp_after:NN + \exp_after:wN \toks_set:Nn - \exp_after:NN + \exp_after:wN \l_TP_default_assignments_toks - \exp_after:NN - { \cs:w KV@\l_TP_curr_name_tlp @\l_TP_currkey_tlp \exp_after:NN \cs_end: - \exp_after:NN - { \toks_use:N \exp_after:NN \l_TP_KV_assignments_toks - \exp_after:NN + \exp_after:wN + { \cs:w KV@\l_TP_curr_name_tl @\l_TP_currkey_tl \exp_after:wN \cs_end: + \exp_after:wN + { \toks_use:N \exp_after:wN \l_TP_KV_assignments_toks + \exp_after:wN } \toks_use:N\l_TP_default_assignments_toks } } -\tlp_new:Nn \c_TP_true_tlp {true} -\def_new:Npn \TP_templdecl_eval_s_key_value:nnn#1#2#3 { - \tlp_set:Nn \l_tmpa_tlp {#1} - \tlp_if_eq:NNTF \l_tmpa_tlp \c_TP_true_tlp +\tl_new:Nn \c_TP_true_tl {true} +\cs_new_nopar:Npn \TP_templdecl_eval_s_key_value:nnn#1#2#3 { + \tl_set:Nn \l_tmpa_tl {#1} + \tl_if_eq:NNTF \l_tmpa_tl \c_TP_true_tl { \toks_put_right:Nn \l_TP_KV_assignments_toks {#2} } { \toks_put_right:Nn \l_TP_KV_assignments_toks {#3} } } -\def_new:Npn \TP_templdecl_setup_register_key:Nn #1#2{ +\cs_new_nopar:Npn \TP_templdecl_setup_register_key:Nn #1#2{ \TP_templdecl_define_key:n{ - \tlist_if_head_eq_meaning:nNTF{##1}\DelayEvaluation + \tl_if_head_eq_meaning:nNTF{##1}\DelayEvaluation { \toks_put_right:Nn \l_TP_KV_assignments_toks {#1#2{##1}} - %\toks_set:No\l_tmpa_toks{\use_arg_ii:nn ##1} + %\toks_set:No\l_tmpa_toks{\use_ii:nn ##1} %\toks_put_right:Nx \l_TP_KV_assignments_toks % {\exp_not:n{#1#2}{\toks_use:N \l_tmpa_toks}} } { - \tlist_if_head_eq_meaning:nNTF{##1..}\MultiSelection + \tl_if_head_eq_meaning:nNTF{##1..}\MultiSelection { \group_begin: \TP_multiselection_add:nnnnnn #1#2##1 \group_end: - \tlist_if_in:onTF{\toks_use:N\g_TP_multiselection_toks}\DelayEvaluation + \tl_if_in:onTF{\toks_use:N\g_TP_multiselection_toks}\DelayEvaluation { \toks_put_right:No\l_TP_KV_assignments_toks { - \exp_after:NN#1\exp_after:NN#2\exp_after:NN + \exp_after:wN#1\exp_after:wN#2\exp_after:wN {\toks_use:N\g_TP_multiselection_toks} } } { \toks_put_right:No\l_TP_KV_assignments_toks { - \exp_after:NN #2 - \exp_after:NN= \toks_use:N\g_TP_multiselection_toks\scan_stop: + \exp_after:wN #2 + \exp_after:wN= \toks_use:N\g_TP_multiselection_toks\scan_stop: } } } { #1#2{##1} \toks_put_right:No\l_TP_KV_assignments_toks { - \exp_after:NN #2 \exp_after:NN = \tex_the:D #2\scan_stop: + \exp_after:wN #2 \exp_after:wN = \tex_the:D #2\scan_stop: } } } } } -\def_new:NNn\DelayEvaluation 1{\use_none:n{\DelayEvaluation}#1} -\def_new:NNn\MultiSelection 1{\use_none:n{\MultiSelection}#1} -\def_new:Npn \TP_templdecl_remove_from_default_assignments:N#1{ - \def:Npn \tmp:w ##1#1##2##3#1##4\q_stop{ +\cs_new_nopar:Npn\DelayEvaluation #1{\use_none:n{\DelayEvaluation}#1} +\cs_new_nopar:Npn\MultiSelection #1{\use_none:n{\MultiSelection}#1} +\cs_new_nopar:Npn \TP_templdecl_remove_from_default_assignments:N#1{ + \cs_set_nopar:Npn \TP_tmp:w ##1#1##2##3#1##4\q_stop{ \l_TP_default_assignments_toks{##1##3} } - \exp_after:NN \tmp:w + \exp_after:wN \TP_tmp:w \toks_use:N\l_TP_default_assignments_toks #1\scan_stop:#1\q_stop} -\def_new:Npn \TP_templdecl_setup_f_key:Nn#1#2{ +\cs_new_nopar:Npn \TP_templdecl_setup_f_key:Nn#1#2{ \TP_templdecl_define_key:n { \TP_templdecl_define_function:NNn#1#2{##1} } } -\def_new:Npn \TP_templdecl_define_function:NNn#1#2#3{ - \def:NNn #2 #1 {#3} - \toks_put_right:Nf \l_TP_KV_assignments_toks { \def:NNn #2 #1 {#3} } +\cs_new_nopar:Npn \TP_templdecl_define_function:NNn#1#2#3{ + \cs_generate_from_arg_count:NNnn #2 \cs_set:Npn {#1}{#3} + \toks_put_right:Nf \l_TP_KV_assignments_toks { + \cs_generate_from_arg_count:NNnn #2 \cs_set:Npn {#1}{#3} + } } -\def_new:Npn \TP_templdecl_setup_n_key:N#1{ +\cs_new_nopar:Npn \TP_templdecl_setup_n_key:N#1{ \TP_templdecl_define_key:n{ - \tlist_if_head_eq_meaning:nNTF{##1..}\MultiSelection + \tl_if_head_eq_meaning:nNTF{##1..}\MultiSelection { \group_begin: \TP_templdecl_multiselection:nnnn ##1 \group_end: \toks_put_right:Nx\l_TP_KV_assignments_toks { - \exp_not:n{\tlp_set:Nf #1} { \toks_use:N \g_TP_multiselection_toks} + \exp_not:n{\tl_set:Nf #1} { \toks_use:N \g_TP_multiselection_toks} } } { - \def:Npn #1{##1} % setting it? + \cs_set_nopar:Npn #1{##1} % setting it? \toks_put_right:Nn \l_TP_KV_assignments_toks - { \tlp_set:Nn #1{##1} } + { \tl_set:Nn #1{##1} } } } } -\def_new:Npn \TP_templdecl_multiselection:nnnn #1#2#3#4{ +\cs_new_nopar:Npn \TP_templdecl_multiselection:nnnn #1#2#3#4{ \toks_gset:Nn \g_TP_multiselection_toks {\if_case:w #2} \clist_map_inline:nn {#3}{ \TP_multiselection_add_or_case:n {\exp_stop_f:##1} } \toks_gput_right:Nn\g_TP_multiselection_toks { - \else: \use_arg_i_after_fi:nw { \exp_stop_f: #4} \fi: + \else: \use_i_after_fi:nw { \exp_stop_f: #4} \fi: } } -\def_new:Npn \DeclareInstance { \DeclareCollectionInstance{} } -\def_long_new:Npn \DeclareCollectionInstance#1#2#3#4{ +\cs_new_nopar:Npn \DeclareInstance { \DeclareCollectionInstance{} } +\cs_new:Npn \DeclareCollectionInstance#1#2#3#4{ \TP_declare_instance:cnn { <#1>#2/#3 }{ #2/#4 } } -\def_new:Npn \UseCollection#1#2{ - \tlp_set:cx { TP@<#1> } +\cs_new_nopar:Npn \UseCollection#1#2{ + \tl_set:cx { TP@<#1> } { {#2} \TP_get_arg_count:n{#1} } } -\def_new:Npn \TP_let_instance:Nnn#1#2#3{ - \let:Nc #1 +\cs_new_nopar:Npn \TP_let_instance:Nnn#1#2#3{ + \cs_set_eq:Nc #1 { \cs_if_free:cTF { \TP_get_csname_prefix:n{#2} #3 } { <>#2/ } @@ -420,68 +427,68 @@ #3 } } -\def_new:Npn \UseInstance#1#2{ - \TP_let_instance:Nnn \l_tmpa_tlp {#1}{#2} - \tlp_if_eq:NNTF \l_tmpa_tlp \scan_stop: +\cs_new_nopar:Npn \UseInstance#1#2{ + \TP_let_instance:Nnn \l_tmpa_tl {#1}{#2} + \tl_if_eq:NNTF \l_tmpa_tl \scan_stop: \INSTANCEundefined - \l_tmpa_tlp -} -\def_long_new:Npn \TP_templdecl_declare_tmp_instance:nnnn#1#2#3{% - \TP_declare_instance:Nnn \g_tmpa_tlp {#2/#3} } -\def_new:Npn \ShowTemplate#1#2{ - \io_put_term:x{*******~ Template:~ #1/#2~ *******} - \io_put_term:x{*} - \io_put_term:x{*~ Defaults:} - \io_put_term:x{*} - \io_put_term:x{\token_to_string:N\TPD>/#1/#2= + \l_tmpa_tl +} +\cs_new:Npn \TP_templdecl_declare_tmp_instance:nnnn#1#2#3{% + \TP_declare_instance:Nnn \g_tmpa_tl {#2/#3} } +\cs_new_nopar:Npn \ShowTemplate#1#2{ + \iow_term:x{*******~ Template:~ #1/#2~ *******} + \iow_term:x{*} + \iow_term:x{*~ Defaults:} + \iow_term:x{*} + \iow_term:x{\token_to_str:N\TPD>/#1/#2= \cs_meaning:c{TPD>/#1/#2}} - \io_put_term:x{*} - \io_put_term:x{*~ Restrictions:} - \io_put_term:x{*} - \io_put_term:x{\token_to_string:N\TPR>/#1/#2= + \iow_term:x{*} + \iow_term:x{*~ Restrictions:} + \iow_term:x{*} + \iow_term:x{\token_to_str:N\TPR>/#1/#2= \cs_meaning:c{TPR>/#1/#2}} - \io_put_term:x{*} - \io_put_term:x{*~ Body:} - \io_put_term:x{*} + \iow_term:x{*} + \iow_term:x{*~ Body:} + \iow_term:x{*} \cs_show:c {TP>/#1/#2}} -\def_new:Npn \ShowCollectionInstance#1#2#3{ - \io_put_term:x{*******~ Instance:~ <#1>#2/#3~ *******} - \io_put_term:x{*} +\cs_new_nopar:Npn \ShowCollectionInstance#1#2#3{ + \iow_term:x{*******~ Instance:~ <#1>#2/#3~ *******} + \iow_term:x{*} \cs_show:c {<#1>#2/#3}} -\def_new:Npn \ShowInstance{\ShowCollectionInstance{}} -\def_new:Npn \TP_templdecl_setup_fakeregister_key:NNn#1#2#3{ +\cs_new_nopar:Npn \ShowInstance{\ShowCollectionInstance{}} +\cs_new_nopar:Npn \TP_templdecl_setup_fakeregister_key:NNn#1#2#3{ \TP_templdecl_define_key:n{ - \tlist_if_head_eq_meaning:nNTF{##1..}\DelayEvaluation + \tl_if_head_eq_meaning:nNTF{##1..}\DelayEvaluation { - \toks_set:No \l_tmpa_toks {\use_arg_ii:nn ##1} + \toks_set:No \l_tmpa_toks {\use_ii:nn ##1} \toks_put_right:Nx \l_TP_KV_assignments_toks { \exp_not:n{#1#2}{\toks_use:N \l_tmpa_toks} - \exp_not:n{ \def:Npx #3{\toks_use:N#2} } + \exp_not:n{ \cs_set_nopar:Npx #3{\toks_use:N#2} } } } { - \tlist_if_head_eq_meaning:nNTF{##1..}\MultiSelection + \tl_if_head_eq_meaning:nNTF{##1..}\MultiSelection { \group_begin: \TP_multiselection_add:nnnnnn#1#2##1 \group_end: \toks_put_right:Nx\l_TP_KV_assignments_toks - {\exp_not:n{\def:Npn #3} {\toks_use:N\g_TP_multiselection_toks}} + {\exp_not:n{\cs_set_nopar:Npn #3} {\toks_use:N\g_TP_multiselection_toks}} } { #1#2{##1} \toks_put_right:Nx\l_TP_KV_assignments_toks - {\exp_not:n{\def:Npn#3} {\toks_use:N#2}} + {\exp_not:n{\cs_set_nopar:Npn#3} {\toks_use:N#2}} } } } } \toks_new:N \g_TP_multiselection_toks -\def_new:Npn \TP_multiselection_add:nnnnnn #1#2#3#4#5#6{ +\cs_new_nopar:Npn \TP_multiselection_add:nnnnnn #1#2#3#4#5#6{ \toks_gset:Nn \g_TP_multiselection_toks {\if_case:w #4} \clist_map_inline:nn {#5}{ - \tlist_if_head_eq_meaning:nNTF{##1..}\DelayEvaluation + \tl_if_head_eq_meaning:nNTF{##1..}\DelayEvaluation { \TP_multiselection_add_or_case:n {##1} } @@ -491,74 +498,65 @@ } } \toks_gput_right:Nn \g_TP_multiselection_toks { - \else: \use_arg_i_after_fi:nw{#6}\fi: + \else: \use_i_after_fi:nw{#6}\fi: } } -\def_new:Npn \TP_multiselection_add_or_case:n #1 { +\cs_new_nopar:Npn \TP_multiselection_add_or_case:n #1 { \toks_gput_right:Nn \g_TP_multiselection_toks { - \or: \use_arg_i_after_orelse:nw{#1} + \or: \use_i_after_orelse:nw{#1} } } -\def_new:Npn \TP_multiselection_add_or_case:o { - \exp_args:No \TP_multiselection_add_or_case:n -} -\def_new:Npn \IfExistsInstanceTF#1#2{ +\cs_generate_variant:Nn \TP_multiselection_add_or_case:n {o} +\cs_new_nopar:Npn \IfExistsInstanceTF#1#2{ \cs_if_exist:cTF{<>#1/#2} } -\def:Npn \IfExistsInstanceTF#1#2{ - \TP_let_instance:Nnn \l_tmpa_tlp {#1}{#2} - \if_meaning:NN\l_tmpa_tlp\scan_stop: - \exp_after:NN\use_arg_ii:nn +\cs_set_nopar:Npn \IfExistsInstanceTF#1#2{ + \TP_let_instance:Nnn \l_tmpa_tl {#1}{#2} + \if_meaning:w\l_tmpa_tl\scan_stop: + \exp_after:wN\use_ii:nn \else: - \exp_after:NN\use_arg_i:nn + \exp_after:wN\use_i:nn \fi:} -\def_new:Npn \DeclareRestrictedTemplate#1#2#3#4{ +\cs_new_nopar:Npn \DeclareRestrictedTemplate#1#2#3#4{ % CCC do we need a group here?? - \tlp_set_eq:cc { TPD>/#1/#2 } { TPD>/#1/#3 } - \tlp_set_eq:cc { TP>/#1/#2 } { TP>/#1/#3 } - - \toks_set:Nd \l_TP_KV_assignments_toks - {\cs:w TPR>/#1/#3\cs_end:} - + \tl_set_eq:cc { TPD>/#1/#2 } { TPD>/#1/#3 } + \tl_set_eq:cc { TP>/#1/#2 } { TP>/#1/#3 } + \toks_set:Nv \l_TP_KV_assignments_toks { TPR>/ #1 / #3 } \setkeys {\cs:w TPO>/#1/#3\cs_end:}{#4} - \tlp_set:cx { TPR>/#1/#2 } + \tl_set:cx { TPR>/#1/#2 } { \toks_use:N \l_TP_KV_assignments_toks } \cs_if_free:cTF { TPO>/#1/#3 } - { \tlp_set:cn {TPO>/#1/#2}{#1/#3} } - { \tlp_set_eq:cc {TPO>/#1/#2}{TPO>/#1/#3} } + { \tl_set:cn {TPO>/#1/#2}{#1/#3} } + { \tl_set_eq:cc {TPO>/#1/#2}{TPO>/#1/#3} } } -\def_new:Npn \TP_instdecl_generate_assignments:nn#1#2 { +\cs_new_nopar:Npn \TP_instdecl_generate_assignments:nn#1#2 { % Returns to \l_TP_KV_assignments_toks % the restrictions % stored in the TP-structure (at present % in YAM) of the template #1 - - \toks_set:Nd \l_TP_default_assignments_toks + \exp_args:NNo \toks_set:No \l_TP_default_assignments_toks {\cs:w TPD>/#1\cs_end:\scan_stop:\scan_stop:} - - \toks_set:Nd \l_TP_KV_assignments_toks - {\cs:w TPR>/#1\cs_end:} - + \toks_set:Nv \l_TP_KV_assignments_toks { TPR>/ #1 } \setkeys { \cs:w TPO>/#1 \cs_end: } { #2 } % adds stuff to \l_TP_KV_assignments_toks - \exp_after:NN\TP_instdecl_add_default_recurse:nn + \exp_after:wN\TP_instdecl_add_default_recurse:nn \toks_use:N\l_TP_default_assignments_toks } -\def_new:Npn \TP_instdecl_add_default_recurse:nn#1#2{ +\cs_new_nopar:Npn \TP_instdecl_add_default_recurse:nn#1#2{ \token_if_eq_meaning:NNF #1\scan_stop: { \l_tmpa_toks{#2} - \tlp_set:Nx \l_tmpa_tlp { + \tl_set:Nx \l_tmpa_tl { {\toks_use:N \l_tmpa_toks \toks_use:N \l_TP_KV_assignments_toks} } - \l_TP_KV_assignments_toks \l_tmpa_tlp + \l_TP_KV_assignments_toks \l_tmpa_tl \TP_instdecl_add_default_recurse:nn } } -\def_new:Npn \TP_split_finite_skip_value:nnNN #1#2{ +\cs_new_nopar:Npn \TP_split_finite_skip_value:nnNN #1#2{ \skip_split_finite_else_action:nnNN {#1} { \PackageError{template}{Value~ for~ key~ #2~ contains~ `fil(ll)'} {Only~ finite~ minus~ or~ plus~ parts~ are~ allowed~ for~ this~ key.} diff --git a/Master/texmf-dist/tex/latex/xpackages/xparse.sty b/Master/texmf-dist/tex/latex/xpackages/xparse.sty index c2a3e0785ab..b268d7b0957 100644 --- a/Master/texmf-dist/tex/latex/xpackages/xparse.sty +++ b/Master/texmf-dist/tex/latex/xpackages/xparse.sty @@ -53,203 +53,199 @@ %% %% ----------------------------------------------------------------------- %% -\RequirePackage{l3names} -\GetIdInfo$Id: xparse.dtx 748 2008-08-03 19:00:50Z morten $ +\RequirePackage{expl3} +\GetIdInfo$Id: xparse.dtx 1365 2009-05-31 17:26:17Z mittelba $ {generic document command parser} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} -\RequirePackage{l3tlp,l3num,l3toks,l3prg,l3int,l3seq,l3token} -\def_new:NNn \xparse_already_defined_error_msg:N 1 { +\RequirePackage{expl3} +\cs_new_nopar:Nn \xparse_already_defined_error_msg:N { \xparse_error:x { - Command~name~`\token_to_string:N #1'~ already~defined! + Command~name~`\token_to_str:N #1'~ already~defined! } } -\def_new:NNn \xparse_not_yet_defined_error_msg:N 1 { +\cs_new_nopar:Nn \xparse_not_yet_defined_error_msg:N { \xparse_error:x { - Command~`\token_to_string:N #1'~ not~ yet~defined! + Command~`\token_to_str:N #1'~ not~ yet~defined! } } -\def_new:NNn \xparse_begins_with_end_error_msg:N 1 { +\cs_new_nopar:Nn \xparse_begins_with_end_error_msg:N { \xparse_error:x { - Command~`\token_to_string:N #1'~begins~with~ - `\token_to_string:N \end'! + Command~`\token_to_str:N #1'~begins~with~ + `\token_to_str:N \end'! } } -\def_new:NNn \xparse_unknown_arg_type_error_msg:N 1{ +\cs_new_nopar:Nn \xparse_unknown_arg_type_error_msg:N { \xparse_error:x { Unknown~ argument~ type~ `#1'~ I'll~ substitute~ it~ with~ `m'~ for~ now.~ Fingers~ crossed... } } -\def_new:NNn \xparse_no_command_implementation_warning:n 1 { +\cs_new_nopar:Nn \xparse_no_command_implementation_warning:n { \xparse_warning:x {No~ implementation~ for~ `#1'~ defined} } -\def_new:NNn \xparse_error:x 1{\tex_errmessage:D {xparse~error:~#1}} -\def_new:NNn \xparse_warning:x 1{\io_put_term:x{xparse~warning:~#1}} -\def_new:NNn \xparse_if_definable:NTF 1 { - \cs_free:NTF #1 +\cs_new_nopar:Nn \xparse_error:x {\tex_errmessage:D {xparse~error:~#1}} +\cs_new_nopar:Nn \xparse_warning:x {\iow_term:x{xparse~warning:~#1}} +\cs_new_nopar:Npn \xparse_if_definable:NTF #1 { + \cs_if_free:NTF #1 { \xparse_begins_with_end:NTF #1 - { \xparse_begins_with_end_error_msg:N #1 \use_arg_ii:nn } - \use_arg_i:nn + { \xparse_begins_with_end_error_msg:N #1 \use_ii:nn } + \use_i:nn } - { \xparse_already_defined_error_msg:N #1 \use_arg_ii:nn } + { \xparse_already_defined_error_msg:N #1 \use_ii:nn } } -\def_new:NNn \xparse_if_definable:cTF 0 { - \exp_args:Nc \xparse_if_definable:NTF -} -\def_new:NNn \xparse_if_redefinable:NTF 1 { - \cs_free:NTF #1 - { \xparse_not_yet_defined_error_msg:N #1 \use_arg_ii:nn } +\cs_generate_variant:Nn \xparse_if_definable:NTF {c} +\cs_new_nopar:Npn \xparse_if_redefinable:NTF #1 { + \cs_if_free:NTF #1 + { \xparse_not_yet_defined_error_msg:N #1 \use_ii:nn } { \xparse_begins_with_end:NTF #1 - { \xparse_begins_with_end_error_msg:N #1 \use_arg_ii:nn } - \use_arg_i:nn + { \xparse_begins_with_end_error_msg:N #1 \use_ii:nn } + \use_i:nn } } -\def_new:NNn \xparse_if_redefinable:cTF 0 { - \exp_args:Nc \xparse_if_redefinable:NTF -} -\def_new:NNn \xparse_begins_with_end:NTF 1 { +\cs_generate_variant:Nn \xparse_if_redefinable:NTF {c} +\cs_new_nopar:Npn \xparse_begins_with_end:NTF #1 { \group_begin: \exp_args:Nc \xparse_begins_with_end_aux:N { - \tlist_head_iii:f { \cs_to_str:N #1 ??} + \tl_head_iii:f { \cs_to_str:N #1 ??} } } -\def_new:NNn \xparse_begins_with_end_aux:N 1 { - \if:w \cs_if_eq_name_p:NN #1 \end +\cs_new_nopar:Nn \xparse_begins_with_end_aux:N { + \if_predicate:w \cs_if_eq_name_p:NN #1 \end \group_end: - \exp_after:NN \use_arg_i:nn + \exp_after:wN \use_i:nn \else: \group_end: - \exp_after:NN \use_arg_ii:nn + \exp_after:wN \use_ii:nn \fi: } \toks_new:N \l_xparse_grabbed_args_toks \toks_new:N \l_xparse_end_environment_args_toks \int_new:N \l_xparse_mandatory_args_int \int_new:N \l_xparse_total_args_int -\def_long:NNn \xparse_declare_document_command:Nnn 3{ +\cs_set:Nn \xparse_declare_document_command:Nnn { \xparse_prepare_signature:n {#2} - \def_protected:Npx #1 { + \cs_set_protected_nopar:Npx #1 { \exp_not:n { \toks_set:Nn \l_xparse_grabbed_args_toks } - {\exp_not:c {\token_to_string:N #1}} + {\exp_not:c {\token_to_str:N #1}} \toks_use:N \l_xparse_grabbed_args_toks \exp_not:n{ \toks_use:N \l_xparse_grabbed_args_toks} } - \def_long:cNn {\token_to_string:N #1}\l_xparse_total_args_int{#3} -} -\def_new:Npn \xparse_declare_document_command:cnn { - \exp_args:Nc \xparse_declare_document_command:Nnn + \cs_generate_from_arg_count:cNnn {\token_to_str:N #1}\cs_set:Npn + \l_xparse_total_args_int{#3} } -\def_long_new:NNn \xparse_declare_document_environment:nnnn 4 { +\cs_generate_variant:Nn \xparse_declare_document_command:Nnn {cnn} +\cs_new:Nn \xparse_declare_document_environment:nnnn { \xparse_declare_document_command:cnn {#1}{#2} { \group_begin: \toks_set_eq:NN \l_xparse_end_environment_args_toks \l_xparse_grabbed_args_toks #3 } - \let:cN {end #1} \xparse_parsed_end_environment: - \def_long:cNn {end \token_to_string:N \\ #1} - \l_xparse_total_args_int{#4} + \cs_set_eq:cN {end #1} \xparse_parsed_end_environment: + \cs_generate_from_arg_count:cNnn {end \token_to_str:N \\ #1}\cs_set:Npn + \l_xparse_total_args_int{#4} } -\def_protected_new:NNn \xparse_parsed_end_environment: 0{ - \exp_after:NN \xparse_parsed_end_environment_aux:N +\cs_new_protected_nopar:Nn \xparse_parsed_end_environment: { + \exp_after:wN \xparse_parsed_end_environment_aux:N \toks_use:N \l_xparse_end_environment_args_toks \group_end: } -\def_new:NNn \xparse_parsed_end_environment_aux:N 1{ - \cs_use:c {end \token_to_string:N #1 } +\cs_new_nopar:Nn \xparse_parsed_end_environment_aux:N { + \use:c {end \token_to_str:N #1 } } -\let_new:NN \DeclareDocumentCommand \xparse_declare_document_command:Nnn -\def_new:NNn \NewDocumentCommand 1 { +\cs_new_eq:NN \DeclareDocumentCommand \xparse_declare_document_command:Nnn +\cs_new_nopar:Npn \NewDocumentCommand #1 { \xparse_if_definable:NTF #1 { \xparse_declare_document_command:Nnn #1 } \use_none:nn } -\def_new:NNn \RenewDocumentCommand 1 { +\cs_new_nopar:Npn \RenewDocumentCommand #1 { \xparse_if_redefinable:NTF #1 { \xparse_declare_document_command:Nnn #1 } \use_none:nn } -\let_new:NN \DeclareDocumentEnvironment +\cs_new_eq:NN \DeclareDocumentEnvironment \xparse_declare_document_environment:nnnn -\def_new:NNn \NewDocumentEnvironment 1 { +\cs_new_nopar:Npn \NewDocumentEnvironment #1 { \xparse_if_definable:cTF {#1} { \xparse_declare_document_environment:nnnn {#1} } \use_none:nnn } -\def_new:NNn \RenewDocumentEnvironment 1 { +\cs_new_nopar:Npn \RenewDocumentEnvironment #1 { \xparse_if_redefinable:cTF {#1} { \xparse_declare_document_environment:nnnn {#1} } \use_none:nnn } -\def_new:NNn \ProvideDocumentCommand 1{ - \cs_free:NTF #1 +\cs_new_nopar:Npn \ProvideDocumentCommand #1{ + \cs_if_free:NTF #1 { \DeclareDocumentCommand #1} \use_none:nn } -\def_new:NNn \ProvideDocumentEnvironment 1{ - \cs_free:cTF {#1} +\cs_new_nopar:Npn \ProvideDocumentEnvironment #1{ + \cs_if_free:cTF {#1} { \DeclareDocumentEnvironment {#1} } \use_none:nnn } -\def_long_new:NNn \DeclareDocumentCommandInterface 3{ +\cs_new:Npn \DeclareDocumentCommandInterface #1#2#3{ \xparse_prepare_signature:n {#3} - \def_protected:Npx #1 { + \cs_set_protected_nopar:Npx #1 { \exp_not:n { \toks_set:Nn \l_xparse_grabbed_args_toks } {\exp_not:c {impl-#2}} \toks_use:N\l_xparse_grabbed_args_toks \exp_not:n{ \toks_use:N \l_xparse_grabbed_args_toks} } - \def_long:cNn {impl-#2} \l_xparse_total_args_int + \cs_generate_from_arg_count:cNnn {impl-#2} \cs_set:Npn + \l_xparse_total_args_int {\xparse_undefined_command_implementation:n{#2}} } -\def_new:NNn \xparse_undefined_command_implementation:n 1{ +\cs_new_nopar:Nn \xparse_undefined_command_implementation:n { ``#1'' \xparse_no_command_implementation_warning:n {#1} } -\def_long_new:NNn \DeclareDocumentCommandImplementation 3{ - \def_long:cNn {impl-#1}#2{#3} +\cs_new:Npn \DeclareDocumentCommandImplementation #1#2#3{ + \cs_generate_from_arg_count:cNnn {impl-#1}\cs_set:Npn {#2}{#3} } -\def_new:NNn \xparse_prepare_signature:n 1 { +\cs_new_nopar:Nn \xparse_prepare_signature:n { \int_zero:N \l_xparse_total_args_int \toks_clear:N \l_xparse_grabbed_args_toks \int_zero:N \l_xparse_mandatory_args_int \bool_gset_false:N \g_xparse_insert_marker_bool \bool_gset_false:N \g_xparse_allow_par_bool - \tlp_gset_eq:NN \g_xparse_ignore_marker_tlp - \g_xparse_ignore_spaces_marker_tlp + \tl_gset_eq:NN \g_xparse_ignore_marker_tl + \g_xparse_ignore_spaces_marker_tl \xparse_parse_signature:n #1 \q_nil } -\tlp_new:Nn \g_xparse_ignore_marker_tlp {} +\tl_new:Nn \g_xparse_ignore_marker_tl {} \seq_new:N \g_xparse_ignore_marker_seq \bool_new:N \g_xparse_insert_marker_bool -\def_new:cpn {xparse_add_arg_type_>:} #1 +\cs_new_nopar:cpn {xparse_add_arg_type_>:} #1 \xparse_read_arg_type_or_grab_default:n #2{ \xparse_add_remaining_m_args: \bool_gset_true:N \g_xparse_insert_marker_bool \int_decr:N \l_xparse_total_args_int - \tlist_map_inline:nn{#2}{ + \tl_map_inline:nn{#2}{ \xparse_check_and_add_argument_type:N ##1 } \xparse_parse_signature:n } -\def_new:NNn \xparse_add_ignore_marker:Nnn 3{ - \tlp_new:cn {g_xparse #2 _marker_tlp}{#3} - \seq_gpush:NC \g_xparse_ignore_marker_seq {g_xparse #2 _marker_tlp} - \def_new:cpn {xparse_add_arg_type_#1:}{ - \tlp_gset_eq:Nc \g_xparse_ignore_marker_tlp {g_xparse #2 _marker_tlp} +\cs_new_nopar:Nn \xparse_add_ignore_marker:Nnn { + \tl_new:cn {g_xparse #2 _marker_tl}{#3} + \seq_gpush:Nv \g_xparse_ignore_marker_seq {g_xparse #2 _marker_tl} + \cs_new_nopar:cpn {xparse_add_arg_type_#1:}{ + \tl_gset_eq:Nc \g_xparse_ignore_marker_tl {g_xparse #2 _marker_tl} } } \xparse_add_ignore_marker:Nnn W{_ignore_nothing}{} \xparse_add_ignore_marker:Nnn i{_ignore_spaces}{_ignore_spaces} \xparse_add_ignore_marker:Nnn I{_ignore_pars}{_ignore_pars} -\def_new:NNn \xparse_add_arg_type_P: 0{ +\cs_new_nopar:Nn \xparse_add_arg_type_P: { \bool_gset_true:N \g_xparse_allow_par_bool } \bool_new:N \g_xparse_allow_par_bool -\def_new:NNn \xparse_parse_signature:n 1{ +\cs_new_nopar:Nn \xparse_parse_signature:n { \quark_if_nil:NTF #1 { \xparse_add_remaining_m_args: @@ -261,42 +257,42 @@ { \bool_gset_false:N \g_xparse_insert_marker_bool \bool_gset_false:N \g_xparse_allow_par_bool - \tlp_gset_eq:NN \g_xparse_ignore_marker_tlp - \g_xparse_ignore_spaces_marker_tlp + \tl_gset_eq:NN \g_xparse_ignore_marker_tl + \g_xparse_ignore_spaces_marker_tl } \xparse_read_arg_type_or_grab_default:n } } -\def_new:NNn \xparse_check_and_add_argument_type:N 1 { - \cs_free:cTF {xparse_add_arg_type_#1:} +\cs_new_nopar:Nn \xparse_check_and_add_argument_type:N { + \cs_if_free:cTF {xparse_add_arg_type_#1:} { \xparse_unknown_arg_type_error_msg:N #1 \int_incr:N \l_xparse_mandatory_args_int } - { \cs_use:c {xparse_add_arg_type_#1:} } + { \use:c {xparse_add_arg_type_#1:} } } -\let_new:NN \xparse_read_arg_type_or_grab_default:n +\cs_new_eq:NN \xparse_read_arg_type_or_grab_default:n \xparse_parse_signature:n -\def_new:NNn \xparse_grab_default_arg:n 1{ +\cs_new_nopar:Nn \xparse_grab_default_arg:n { \toks_put_right:Nn \l_xparse_grabbed_args_toks {{#1}} - \let:NN \xparse_read_arg_type_or_grab_default:n + \cs_set_eq:NN \xparse_read_arg_type_or_grab_default:n \xparse_parse_signature:n \xparse_parse_signature:n } -\def_long_new:NNn \xparse_grab_default_arg_allow_par:n 1{ +\cs_new:Nn \xparse_grab_default_arg_allow_par:n { \toks_put_right:Nn \l_xparse_grabbed_args_toks {{#1}} - \let:NN \xparse_read_arg_type_or_grab_default:n + \cs_set_eq:NN \xparse_read_arg_type_or_grab_default:n \xparse_parse_signature:n \xparse_parse_signature:n } -\def_new:Npn \xparse_add_arg_type_m: { +\cs_new_nopar:Nn \xparse_add_arg_type_m: { \bool_if:NTF \g_xparse_allow_par_bool { \toks_put_right:Nn \l_xparse_grabbed_args_toks {\xparse_allow_par_m:w} } { \int_incr:N \l_xparse_mandatory_args_int } } -\def_new:Npn \xparse_add_remaining_m_args: { - \int_compare:nNnF \l_xparse_mandatory_args_int = \c_zero +\cs_new_nopar:Nn \xparse_add_remaining_m_args: { + \intexpr_compare:nNnF \l_xparse_mandatory_args_int = \c_zero { \toks_put_right:Nx \l_xparse_grabbed_args_toks { \exp_not:c{xparse_m @@ -306,53 +302,53 @@ \int_zero:N \l_xparse_mandatory_args_int } } -\def_new:cpn {xparse_m1:w} #1 \l_xparse_grabbed_args_toks#2{ +\cs_new_nopar:cpn {xparse_m1:w} #1 \l_xparse_grabbed_args_toks#2{ \toks_put_right:Nn \l_xparse_grabbed_args_toks{{#2}} #1 \l_xparse_grabbed_args_toks } -\def_new:cpn {xparse_m2:w} #1 \l_xparse_grabbed_args_toks #2#3{ +\cs_new_nopar:cpn {xparse_m2:w} #1 \l_xparse_grabbed_args_toks #2#3{ \toks_put_right:Nn \l_xparse_grabbed_args_toks{{#2}{#3}} #1 \l_xparse_grabbed_args_toks } -\def_new:cpn {xparse_m3:w} #1 \l_xparse_grabbed_args_toks #2#3#4{ +\cs_new_nopar:cpn {xparse_m3:w} #1 \l_xparse_grabbed_args_toks #2#3#4{ \toks_put_right:Nn \l_xparse_grabbed_args_toks{{#2}{#3}{#4}} #1 \l_xparse_grabbed_args_toks } -\def_new:cpn {xparse_m4:w} #1 \l_xparse_grabbed_args_toks #2#3#4#5{ +\cs_new_nopar:cpn {xparse_m4:w} #1 \l_xparse_grabbed_args_toks #2#3#4#5{ \toks_put_right:Nn \l_xparse_grabbed_args_toks{{#2}{#3}{#4}{#5}} #1 \l_xparse_grabbed_args_toks } -\def_new:cpn {xparse_m5:w} #1 \l_xparse_grabbed_args_toks #2#3#4#5#6{ +\cs_new_nopar:cpn {xparse_m5:w} #1 \l_xparse_grabbed_args_toks #2#3#4#5#6{ \toks_put_right:Nn \l_xparse_grabbed_args_toks{{#2}{#3}{#4}{#5}{#6}} #1 \l_xparse_grabbed_args_toks } -\def_new:cpn {xparse_m6:w} #1 \l_xparse_grabbed_args_toks #2#3#4#5#6#7{ +\cs_new_nopar:cpn {xparse_m6:w} #1 \l_xparse_grabbed_args_toks #2#3#4#5#6#7{ \toks_put_right:Nn \l_xparse_grabbed_args_toks {{#2}{#3}{#4}{#5}{#6}{#7}} #1 \l_xparse_grabbed_args_toks } -\def_new:cpn {xparse_m7:w} #1 \l_xparse_grabbed_args_toks#2#3#4#5#6#7#8{ +\cs_new_nopar:cpn {xparse_m7:w} #1 \l_xparse_grabbed_args_toks#2#3#4#5#6#7#8{ \toks_put_right:Nn \l_xparse_grabbed_args_toks {{#2}{#3}{#4}{#5}{#6}{#7}{#8}} #1 \l_xparse_grabbed_args_toks } -\def_new:cpn {xparse_m8:w} #1\l_xparse_grabbed_args_toks +\cs_new_nopar:cpn {xparse_m8:w} #1\l_xparse_grabbed_args_toks #2#3#4#5#6#7#8#9{ \toks_put_right:Nn \l_xparse_grabbed_args_toks {{#2}{#3}{#4}{#5}{#6}{#7}{#8}{#9}} #1 \l_xparse_grabbed_args_toks } -\def_new:cpn {xparse_m9:w} \toks_use:N \l_xparse_grabbed_args_toks +\cs_new_nopar:cpn {xparse_m9:w} \toks_use:N \l_xparse_grabbed_args_toks #1#2#3#4#5#6#7#8#9{ \toks_put_right:Nn \l_xparse_grabbed_args_toks {{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}{#9}} \toks_use:N \l_xparse_grabbed_args_toks } -\def_long_new:Npn \xparse_allow_par_m:w #1 \l_xparse_grabbed_args_toks#2{ +\cs_new:Npn \xparse_allow_par_m:w #1 \l_xparse_grabbed_args_toks#2{ \toks_put_right:Nn \l_xparse_grabbed_args_toks{{#2}} #1 \l_xparse_grabbed_args_toks } -\def_new:Npn \xparse_add_arg_type_l: { +\cs_new_nopar:Nn \xparse_add_arg_type_l: { \xparse_add_remaining_m_args: \bool_if:NTF \g_xparse_allow_par_bool { @@ -360,42 +356,44 @@ } { \toks_put_right:Nn \l_xparse_grabbed_args_toks {\xparse_l:w} } } -\def_new:Npn \xparse_l:w #1 \l_xparse_grabbed_args_toks#2#{ +\cs_new_nopar:Npn \xparse_l:w #1 \l_xparse_grabbed_args_toks#2#{ \toks_put_right:Nn \l_xparse_grabbed_args_toks{{#2}} #1 \l_xparse_grabbed_args_toks } -\def_long_new:Npn \xparse_allow_par_l:w #1 \l_xparse_grabbed_args_toks#2#{ +\cs_new:Npn \xparse_allow_par_l:w #1 \l_xparse_grabbed_args_toks#2#{ \toks_put_right:Nn \l_xparse_grabbed_args_toks{{#2}} #1 \l_xparse_grabbed_args_toks } -\def_new:NNn \DeclareSymbolArgument 2{ - \seq_map_variable:NNn \g_xparse_ignore_marker_seq \l_tmpa_tlp { - \def:cpx {xparse \l_tmpa_tlp _#1:w}##1##2\l_xparse_grabbed_args_toks{ - \exp_not:c{peek_ #2 _remove \l_tmpa_tlp :NTF} ##1 +\cs_new_nopar:Npn \DeclareSymbolArgument #1#2{ + \seq_map_variable:NNn \g_xparse_ignore_marker_seq \l_tmpa_tl { + \cs_set_nopar:cpx {xparse \l_tmpa_tl _#1:w}##1##2 + \l_xparse_grabbed_args_toks{ + \exp_not:c{peek_ #2 _remove \l_tmpa_tl :NTF} ##1 { \exp_not:N \toks_put_right:Nn \exp_not:N - \l_xparse_grabbed_args_toks \exp_not:N \c_true + \l_xparse_grabbed_args_toks \exp_not:N \c_true_bool ##2 \exp_not:N\l_xparse_grabbed_args_toks } { \exp_not:N \toks_put_right:Nn \exp_not:N - \l_xparse_grabbed_args_toks \exp_not:N \c_false + \l_xparse_grabbed_args_toks \exp_not:N \c_false_bool ##2 \exp_not:N\l_xparse_grabbed_args_toks } } } - \def:cpn {xparse_add_arg_type_#1:} { + \cs_set_nopar:cpn {xparse_add_arg_type_#1:} { \xparse_add_remaining_m_args: \toks_put_right:Nx \l_xparse_grabbed_args_toks - { \exp_not:c {xparse \g_xparse_ignore_marker_tlp _#1:w } } - \let:NN \xparse_read_arg_type_or_grab_default:n \xparse_grab_default_arg:n + { \exp_not:c {xparse \g_xparse_ignore_marker_tl _#1:w } } + \cs_set_eq:NN \xparse_read_arg_type_or_grab_default:n + \xparse_grab_default_arg:n } } \DeclareSymbolArgument S{meaning} -\def_new:NNn \DeclareArgumentType 7{ - \seq_map_variable:NNn \g_xparse_ignore_marker_seq \l_tmpa_tlp { - \def:cpx {xparse \l_tmpa_tlp _#1:w}##1\l_xparse_grabbed_args_toks{ - \exp_not:c{peek_#3 \l_tmpa_tlp :NTF} \exp_not:N #2 +\cs_new_nopar:Npn \DeclareArgumentType #1#2#3#4#5#6#7{ + \seq_map_variable:NNn \g_xparse_ignore_marker_seq \l_tmpa_tl { + \cs_set_nopar:cpx {xparse \l_tmpa_tl _#1:w}##1\l_xparse_grabbed_args_toks{ + \exp_not:c{peek_#3 \l_tmpa_tl :NTF} \exp_not:N #2 { \exp_not:c{xparse_#1_#3_help:nw}{##1} } { \exp_not:n { @@ -404,9 +402,9 @@ ##1 \exp_not:N\l_xparse_grabbed_args_toks } } - \def_long:cpx {xparse_allow_par \l_tmpa_tlp _#1:w}##1 + \cs_set:cpx {xparse_allow_par \l_tmpa_tl _#1:w}##1 \l_xparse_grabbed_args_toks{ - \exp_not:c{peek_#3 \l_tmpa_tlp :NTF} \exp_not:N #2 + \exp_not:c{peek_#3 \l_tmpa_tl :NTF} \exp_not:N #2 { \exp_not:c{xparse_allow_par_#1_#3_help:nw}{##1} } { \exp_not:n { @@ -416,23 +414,23 @@ } } } - \def:cpn {xparse_add_arg_type_#1:} { + \cs_set_nopar:cpn {xparse_add_arg_type_#1:} { \xparse_add_remaining_m_args: \toks_put_right:Nx \l_xparse_grabbed_args_toks { \exp_not:c {xparse \bool_if:NT \g_xparse_allow_par_bool {_allow_par} - \g_xparse_ignore_marker_tlp + \g_xparse_ignore_marker_tl _#1:w } } - \let:NN \xparse_read_arg_type_or_grab_default:n \xparse_parse_signature:n + \cs_set_eq:NN \xparse_read_arg_type_or_grab_default:n \xparse_parse_signature:n } \xparse_define_helper:Nnnn #1{#3}{#6}{#7} } -\def_new:NNn \DeclareArgumentTypeDefaultValue 5{ - \seq_map_variable:NNn \g_xparse_ignore_marker_seq \l_tmpa_tlp { - \def:cpx {xparse \l_tmpa_tlp _#1:w}##1##2\l_xparse_grabbed_args_toks{ - \exp_not:c{peek_#3 \l_tmpa_tlp :NTF} \exp_not:N #2 +\cs_new_nopar:Npn \DeclareArgumentTypeDefaultValue #1#2#3#4#5{ + \seq_map_variable:NNn \g_xparse_ignore_marker_seq \l_tmpa_tl { + \cs_set_nopar:cpx {xparse \l_tmpa_tl _#1:w}##1##2\l_xparse_grabbed_args_toks{ + \exp_not:c{peek_#3 \l_tmpa_tl :NTF} \exp_not:N #2 { \exp_not:c{xparse_#1_#3_help:nw}{##2} } { \exp_not:N \toks_put_right:Nn @@ -440,9 +438,9 @@ ##2 \exp_not:N \l_xparse_grabbed_args_toks } } - \def_long:cpx {xparse_allow_par \l_tmpa_tlp _#1:w}##1##2 + \cs_set:cpx {xparse_allow_par \l_tmpa_tl _#1:w}##1##2 \l_xparse_grabbed_args_toks{ - \exp_not:c{peek_#3 \l_tmpa_tlp :NTF} \exp_not:N #2 + \exp_not:c{peek_#3 \l_tmpa_tl :NTF} \exp_not:N #2 { \exp_not:c{xparse_allow_par_#1_#3_help:nw}{##2} } { \exp_not:N \toks_put_right:Nn @@ -451,16 +449,16 @@ } } } - \def:cpn {xparse_add_arg_type_#1:} { + \cs_set_nopar:cpn {xparse_add_arg_type_#1:} { \xparse_add_remaining_m_args: \toks_put_right:Nx \l_xparse_grabbed_args_toks { \exp_not:c {xparse \bool_if:NT \g_xparse_allow_par_bool {_allow_par} - \g_xparse_ignore_marker_tlp + \g_xparse_ignore_marker_tl _#1:w } } - \let:Nc \xparse_read_arg_type_or_grab_default:n + \cs_set_eq:Nc \xparse_read_arg_type_or_grab_default:n {xparse_grab_default_arg \bool_if:NT \g_xparse_allow_par_bool {_allow_par} :n @@ -468,7 +466,7 @@ } \xparse_define_helper:Nnnn #1{#3}{#4}{#5} } -\def_new:NNn \xparse_define_helper:Nnnn 4{ +\cs_new_nopar:Nn \xparse_define_helper:Nnnn { \toks_set:Nn \l_tmpa_toks { #3 @@ -478,9 +476,9 @@ } } \toks_set:Nx \l_tmpa_toks { - \exp_not:n {\def:cpn{xparse_#1_#2_help:nw}} + \exp_not:n {\cs_set_nopar:cpn{xparse_#1_#2_help:nw}} \toks_use:N \l_tmpa_toks - \exp_not:n {\def:cpn{xparse_allow_par_#1_#2_help:nw}} + \exp_not:n {\cs_set_nopar:cpn{xparse_allow_par_#1_#2_help:nw}} \toks_use:N\l_tmpa_toks } \toks_use:N \l_tmpa_toks @@ -494,63 +492,64 @@ {#1(#2,#3)}{{#2}{#3}} \DeclareArgumentTypeDefaultValue O[{meaning}{#1[#2]}{#2} \DeclareArgumentTypeDefaultValue C({meaning}{#1(#2,#3)}{{#2}{#3}} -\def_new:NNn \DeclareArgumentTypeShorthand 2{ - \def_new:cpn {xparse_add_arg_type_#1:} +\cs_new_nopar:Npn \DeclareArgumentTypeShorthand #1#2{ + \cs_new_nopar:cpn {xparse_add_arg_type_#1:} ##1 \xparse_read_arg_type_or_grab_default:n { \int_decr:N \l_xparse_total_args_int \xparse_read_arg_type_or_grab_default:n #2 } } \DeclareArgumentTypeShorthand s {S{*}} -\let_new:NN \IfBooleanTF \bool_if:NTF -\let_new:NN \IfBooleanT \bool_if:NT -\let_new:NN \IfBooleanF \bool_if:NF -\tlp_new:Nn \NoValue {-NoValue-} -\tlp_new:Nn \c_xparse_hidden_no_value_tlp {\NoValue} -\def_long_new:Npn \xparse_if_no_value:nTF #1{ - \tlp_set:Nx \l_tmpa_tlp{\exp_not:n{#1}} - \tlp_if_eq:NNTF \l_tmpa_tlp \c_xparse_hidden_no_value_tlp - { \use_arg_i:nn } - { \tlist_if_blank:nTF {#1} - { \use_arg_ii:nn } +\cs_new_eq:NN \IfBooleanTF \bool_if:NTF +\cs_new_eq:NN \IfBooleanT \bool_if:NT +\cs_new_eq:NN \IfBooleanF \bool_if:NF +\tl_new:Nn \NoValue {-NoValue-} +\tl_new:Nn \c_xparse_hidden_no_value_tl {\NoValue} +\cs_new:Npn \xparse_if_no_value:nTF #1{ + \tl_set:Nx \l_tmpa_tl{\exp_not:n{#1}} + \tl_if_eq:NNTF \l_tmpa_tl \c_xparse_hidden_no_value_tl + { \use_i:nn } + { \tl_if_blank:nTF {#1} + { \use_ii:nn } {\peek_after:NN \xparse_if_no_value_aux: #1 \q_nil {#1} } } } -\def_long_new:Npn \xparse_if_no_value_aux: { - \tlp_set:Nx \l_tmpa_tlp{\token_get_arg_spec:N \l_peek_token } - \tlp_if_empty:NTF \l_tmpa_tlp - {\use_arg_i_delimit_by_q_nil:nw {\exp_args:No\xparse_if_no_value:nTF}} - {\use_arg_i_delimit_by_q_nil:nw {\use_arg_iii:nnn}} -} -\let_new:NN \IfNoValueTF \xparse_if_no_value:nTF -\def_long_new:NNn \IfNoValueT 2 {\xparse_if_no_value:nTF{#1}{#2}{}} -\def_long_new:NNn \IfNoValueF 1 {\xparse_if_no_value:nTF {#1}{}} -\def_long_new:NNn \IfValueTF 3{\xparse_if_no_value:nTF {#1}{#3}{#2}} -\let_new:NN \IfValueT \IfNoValueF -\let_new:NN \IfValueF \IfNoValueT -\tlp_new:Nn \l_xparse_pseudo_post_arg_tlp {} -\def_long_new:NNn \DeclarePseudoArgument 4{ - \def_long:cNn {xparse_pseudo_pre_arg_#1:\prg_replicate:nn{#2}{n}}#2{#3} - \def_long:cNn {xparse_pseudo_post_arg_#1:\prg_replicate:nn{#2}{n}}#2{#4} - \def:cNn {xparse_pseudo_nobrace_arg_#1:N} 1 { - ##1 \l_xparse_pseudo_post_arg_tlp +\cs_new:Nn \xparse_if_no_value_aux: { + \tl_set:Nx \l_tmpa_tl{\token_get_arg_spec:N \l_peek_token } + \tl_if_empty:NTF \l_tmpa_tl + {\use_i_delimit_by_q_nil:nw {\exp_args:No\xparse_if_no_value:nTF}} + {\use_i_delimit_by_q_nil:nw {\use_iii:nnn}} +} +\cs_new_eq:NN \IfNoValueTF \xparse_if_no_value:nTF +\cs_new:Npn \IfNoValueT #1#2 {\xparse_if_no_value:nTF{#1}{#2}{}} +\cs_new:Npn \IfNoValueF #1 {\xparse_if_no_value:nTF {#1}{}} +\cs_new:Npn \IfValueTF #1#2#3{\xparse_if_no_value:nTF {#1}{#3}{#2}} +\cs_new_eq:NN \IfValueT \IfNoValueF +\cs_new_eq:NN \IfValueF \IfNoValueT +\tl_new:Nn \l_xparse_pseudo_post_arg_tl {} +\cs_new:Npn \DeclarePseudoArgument #1#2#3#4{ + \cs_set:cn {xparse_pseudo_pre_arg_#1:\prg_replicate:nn{#2}{n}} {#3} + \cs_set:cn {xparse_pseudo_post_arg_#1:\prg_replicate:nn{#2}{n}} {#4} + \cs_set_nopar:cn {xparse_pseudo_nobrace_arg_#1:N} { + ##1 \l_xparse_pseudo_post_arg_tl } - \def_long:cNx {xparse_pseudo_arg_#1:w} #2 + \cs_generate_from_arg_count:cNnn {xparse_pseudo_arg_#1:w} + \cs_set:Npx {#2} { \exp_not:c { xparse_pseudo_pre_arg_#1: \prg_replicate:nn{#2}{n} } - \cs_use:c{def_aux_use_\int_use:N \int_eval:n{#2}_parameter:} - \exp_not:n {\tlp_set:Nn \l_xparse_pseudo_post_arg_tlp} + \use:c{use_ \intexpr_eval:n{#2} _parameter:} + \exp_not:n {\tl_set:Nn \l_xparse_pseudo_post_arg_tl} { \exp_not:c {xparse_pseudo_post_arg_#1:\prg_replicate:nn{#2}{n}} - \cs_use:c{def_aux_use_\int_use:N \int_eval:n{#2}_parameter:} + \use:c{use_ \intexpr_eval:n{#2}_parameter:} } \exp_not:n{ \peek_catcode_remove_ignore_spaces:NTF \c_group_begin_token } { \exp_not:n { \c_group_begin_token - \group_execute_after:N \l_xparse_pseudo_post_arg_tlp + \group_execute_after:N \l_xparse_pseudo_post_arg_tl } } { @@ -558,7 +557,7 @@ } } } -\def_new:NNn \UsePseudoArgument 1{\cs_use:c{xparse_pseudo_arg_#1:w}} +\cs_new_nopar:Npn \UsePseudoArgument #1{\use:c{xparse_pseudo_arg_#1:w}} \endinput %% %% End of file `xparse.sty'. diff --git a/Master/texmf-dist/tex/latex/xpackages/xtheorem.sty b/Master/texmf-dist/tex/latex/xpackages/xtheorem.sty deleted file mode 100644 index f165ef2e5f6..00000000000 --- a/Master/texmf-dist/tex/latex/xpackages/xtheorem.sty +++ /dev/null @@ -1,195 +0,0 @@ -%% -%% This is file `xtheorem.sty', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% xtheorem.dtx (with options: `package,trace') -%% -%% Not for distribution -%% File xtheorem.dtx -%% (C) Copyright 1999 Achim Blumensath -%% (C) Copyright 2004 2006 2008 LaTeX3 Project -%% -%% It may be distributed and/or modified under the conditions of the -%% LaTeX Project Public License (LPPL), either version 1.3c of this -%% license or (at your option) any later version. The latest version -%% of this license is in the file -%% -%% http://www.latex-project.org/lppl.txt -%% -%% This file is part of the ``xtheorem bundle'' (The Work in LPPL) -%% and all files in that bundle must be distributed together. -%% -%% The released version of this bundle is available from CTAN. -%% -%% ----------------------------------------------------------------------- -%% -%% The development version of the bundle can be found at -%% -%% http://www.latex-project.org/cgi-bin/cvsweb.cgi/ -%% -%% for those people who are interested. -%% -%%%%%%%%%%% -%% NOTE: %% -%%%%%%%%%%% -%% -%% Snapshots taken from the repository represent work in progress and may -%% not work or may contain conflicting material! We therefore ask -%% people _not_ to put them into distributions, archives, etc. without -%% prior consultation with the LaTeX Project Team. -%% -%% ----------------------------------------------------------------------- -\RequirePackage{l3names} -\GetIdInfo$Id: xtheorem.dtx 754 2008-08-03 19:30:38Z morten $ - {Experimental theorem package} -\ProvidesExplPackage - {\filename}{\filedate}{\fileversion}{\filedescription} -\RequirePackage{xparse} -\RequirePackage{template} -\DeclareTemplateType{theoremstyle}{3} - -\skip_new:N \TS_pre_skip -\skip_new:N \TS_post_skip -\dim_new:N \TS_head_indent_dim -\skip_new:N \TS_head_sep_skip - -\DeclareTemplate{theoremstyle}{std}{3} -{ - pre-skip =l [\DelayEvaluation{\topsep}] \TS_pre_skip, - post-skip =l [\DelayEvaluation{\topsep}] \TS_post_skip, - body-style =f0 [\itshape] \TS_body_style_tlp, - head-style =f0 [\bfseries] \TS_head_style_tlp, - note-style =f0 [\fontseries\mddefault\upshape] \TS_note_style_tlp, - head-punct =f0 [.] \TS_head_punct_tlp, - head-format =f3 [\IfNoValueF{#1}{#1\IfNoValueF{#2}{\space}} - \IfNoValueF{#2}{\textup{#2}} - \IfNoValueF{#3}{\space{\TS_note_style_tlp(#3)}}] - \TS_head_format:nnn, - head-indent =l [0pt] \TS_head_indent_dim, - head-sep =l [5pt plus 1pt minus 1pt] \TS_head_sep_skip, - post-head-action =f0 [] \TS_post_head_action_tlp -} -{ - \DoParameterAssignments - \if_mode_horizontal: - \prg_whiledo:nT{ - \int_compare:nNnT \etex_lastnodetype:D = \c_eleven - }{\tex_unskip:D} - \par - \fi: - \normalfont - \trivlist - \let:NN\thmheadnl\scan_stop: - \@topsep\TS_pre_skip - \@topsepadd\TS_post_skip - \IfNoValueF{#1} - {\refstepcounter{#1}} - \deferred@thm@head{ - \TS_head_style_tlp - \skip_horizontal:N \TS_head_indent_dim - \IfNoValueTF{#1} - {\TS_head_format:nnn{#2}{#1}{#3}} - {\TS_head_format:nnn{#2}{\cs_use:c{the#1}}{#3}} - \TS_head_punct_tlp - \TS_post_head_action_tlp - \skip_horizontal:N\TS_head_sep_skip - } - \TS_body_style_tlp - \ignorespaces -} -\let:NN\adjust@parskip@nobreak \@nbitem -\toks_new:N\dth@everypar -\toks_set:Nn \dth@everypar{ - \@minipagefalse - \global\@newlistfalse - \if@inlabel - \global\@inlabelfalse - \begingroup - \setbox\z@\lastbox - \ifvoid\z@ \kern-\itemindent \fi - \endgroup - \unhbox\@labels - \fi - \if@nobreak - \@nobreakfalse - \clubpenalty\@M - \else - \clubpenalty\@clubpenalty - \everypar{} - \fi -} -\def\deferred@thm@head#1{% - \if@inlabel \indent \par \fi % eject a section head if one is pending - \if@nobreak - \adjust@parskip@nobreak - \else - \addpenalty\@beginparpenalty - \addvspace\@topsep - \addvspace{-\parskip}% - \fi - \global\@inlabeltrue - \everypar\dth@everypar - \sbox\@labels{\normalfont#1}% - \ignorespaces -} -\DeclareInstance{theoremstyle}{plain}{std}{} - -\DeclareInstance{theoremstyle}{definition}{std} -{ - body-style = \normalfont -} - -\DeclareInstance{theoremstyle}{remark}{std} -{ - pre-skip = \DelayEvaluation{0.5\topsep}, - post-skip = \DelayEvaluation{0.5\topsep}, - body-style = \normalfont, - head-style = \itshape -} -\def:Npn\@endtheorem{\endtrivlist\@endpefalse } -\DeclareDocumentCommand{\newtheorem}{smmomo} -{ - \exp_args:Nc\@ifdefinable{#3} - { - \IfBooleanTF{#1} - { - \DeclareDocumentEnvironment{#3}{o} - {\UseInstance{theoremstyle}{#2}{\NoValue}{#5}{##1}} - {\@endtheorem} - } - { - \IfNoValueTF{#4} - { - \IfNoValueTF{#6} - { - \newcounter{#3} - } - { - \newcounter{#3}[#6] - \gdef:cpx{the#3}{\exp_not:c{the#6} - \@thmcountersep\@thmcounter{#3}} - } - \DeclareDocumentEnvironment{#3}{o} - {\UseInstance{theoremstyle}{#2}{#3}{#5}{##1}} - {\@endtheorem} - } - { - \cs_if_free:cTF{c@#4} - { - \@nocounterr{#4} - } - { - \gdef:cpx{the#3}{\exp_not:c{the#4}} - \DeclareDocumentEnvironment{#3}{o} - {\UseInstance{theoremstyle}{#2}{#4}{#5}{##1}} - {\@endtheorem} - } - } - } - } -} -\endinput -%% -%% End of file `xtheorem.sty'. diff --git a/Master/tlpkg/tlpsrc/asymptote.tlpsrc b/Master/tlpkg/tlpsrc/asymptote.tlpsrc index de3761b9de0..7df2b3bf398 100644 --- a/Master/tlpkg/tlpsrc/asymptote.tlpsrc +++ b/Master/tlpkg/tlpsrc/asymptote.tlpsrc @@ -4,5 +4,5 @@ binpattern f/win32 bin/win32/cygwin1.dll binpattern f/win32 bin/win32/glu32.dll binpattern f/win32 bin/win32/freeglut.dll docpattern f texmf/doc/info/asy*.info -docpattern f texmf/man/man1/*asy.* +docpattern f texmf/doc/man/man1/*asy.* runpattern d texmf/asymptote -- cgit v1.2.3