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/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 ---------- 4 files changed, 397 insertions(+), 594 deletions(-) delete mode 100644 Master/texmf-dist/tex/latex/xpackages/xtheorem.sty (limited to 'Master/texmf-dist/tex/latex') 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'. -- cgit v1.2.3