diff options
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/xpackages/ldcsetup.sty | 192 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/xpackages/template.sty | 569 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/xpackages/xparse.sty | 564 |
3 files changed, 1325 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/xpackages/ldcsetup.sty b/Master/texmf-dist/tex/latex/xpackages/ldcsetup.sty new file mode 100644 index 00000000000..57d5e448d17 --- /dev/null +++ b/Master/texmf-dist/tex/latex/xpackages/ldcsetup.sty @@ -0,0 +1,192 @@ +%% +%% This is file `ldcsetup.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% ldcsetup.dtx (with options: `package') +%% +%% (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. +%% +%% ====================================================================== +%% +%% File: ldcsetup.dtx (C) Copyright 1999 Frank Mittelbach, Chris Rowley, David Carlisle +%% (C) Copyright 2004-2007 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 +%% 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. +%% +%% ----------------------------------------------------------------------- +%% +\RequirePackage{l3names} +\GetIdInfo$Id: ldcsetup.dtx 636 2007-09-12 20:03:06Z mittelba $ + {coding conventions and stuff} +\ProvidesExplPackage + {\filename}{\filedate}{\fileversion}{\filedescription} +\RequirePackage{keyval,l3calc} +\ExplSyntaxOff +%% Puts an ignored space at the end of the line, so `|\ |' does the right +\def\IgnoreWhiteSpace{% + \edef\@tempa{% + \catcode`\noexpand\~=\the\catcode`\~\relax + \catcode`\noexpand\ =\the\catcode`\ \relax + \catcode`\noexpand\^^I=\the\catcode`\^^I\relax + \catcode`\noexpand\@=\the\catcode`\@\relax + \endlinechar=\the\endlinechar\relax + }% + \ifx\@currname\@empty + \expandafter\AtBeginDocument\expandafter{\@tempa}% + \else + \expandafter\AtEndOfPackage\expandafter{\@tempa}% + \fi + \catcode`\~=10\relax + \catcode`\ =9\relax + \catcode`\^^I=9\relax + \makeatletter + \endlinechar=` % + \relax +} +\def\InternalSyntaxOn{% + \edef\@tempa{% + \catcode`\noexpand\~=\the\catcode`\~\relax + \catcode`\noexpand\ =\the\catcode`\ \relax + \catcode`\noexpand\^^I=\the\catcode`\^^I\relax + \catcode`\noexpand\@=\the\catcode`\@\relax + \catcode`\noexpand\:=\the\catcode`\:\relax + \catcode`\noexpand\_=\the\catcode`\_\relax + \endlinechar=\the\endlinechar\relax + \endlinechar=13\relax + }% +%%% ???? + \ifx\InternalSyntaxOff\relax + \expandafter\def\expandafter\InternalSyntaxOff\expandafter +{\@tempa\let\InternalSyntaxOff\relax}% + \fi + \ifx\@currname\@empty + \expandafter\AtBeginDocument\expandafter{\@tempa}% + \else + \expandafter\AtEndOfPackage\expandafter{\@tempa}% + \fi + \catcode`\~=10\relax + \catcode`\ =9\relax + \catcode`\^^I=9\relax + \makeatletter + \catcode`\_=11\relax + \catcode`\:=11\relax + \endlinechar=` % + \relax +} +\let\InternalSyntaxOff\relax +\ExplSyntaxOn +\def\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}% + \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{% + \KV@@sp@def\@tempa{#1}% + \def\@tempd{#3}% + \ifx\@tempa\@empty\else + \expandafter\let\expandafter\@tempc + \csname\KV@prefix\@tempa\endcsname + \ifx\@tempc\relax + \KV@error{\@tempa\space \expandafter\@gobbletwo\string\@undefined}\@eha + \else + \ifx\@tempd\@empty + \KV@default + \else + \KV@@sp@def\@tempb{#2}% + \ifx\@tempd\KV@equal + \expandafter\@tempc\expandafter{\@tempb}\relax + \else + \KV@error{Extra~=~ sign~ after~ `#1'}\KV@erry + \fi + \fi + \fi + \fi} +\def\KV@erry{\expandafter\KV@errx\meaning\@tempd\relax ignored\MessageBreak + missing~comma~in~`\expandafter\strip@prefix\meaning\@tempb'~?} +\def\KV@errx#1>#2==\relax{% + `#2' } +\def\KV@default{% + \expandafter\let\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{ + \begingroup +\def\KV@@sp@c##1\@nil##2\relax##3{\addto@hook##3{{##1}}} +\def\KV@split##1=##2=##3\relax{% + \def\@tempd{##3}% + \expandafter\ifx\expandafter=\@firstofone##1=\else + \ifx\@tempd\@empty + \addto@hook\KV@toks\KV@default@elt + \KV@@sp@def\KV@toks{##1}% + \else + \ifx\@tempd\KV@equal + \addto@hook\KV@toks\KV@elt + \KV@@sp@def\KV@toks{##1}% + \KV@@sp@def\KV@toks{##2}% + \else + \KV@err{Extra `=' after `##1'}\@ehd + \fi + \fi + \fi} + \KV@toks{} + \KV@do#1,\relax, + \expandafter + \endgroup + \the\KV@toks} +\let:NN \SetInternalCounter \calc_int_set:Nn +\let:NN \GSetInternalCounter\calc_int_gset:Nn +\def\UndeclareRobustCommand#1{% + \cs_gundefine:N #1 + \exp_args:Nc \cs_gundefine:N {\cs_to_str:N #1~} +} +\endinput +%% +%% End of file `ldcsetup.sty'. diff --git a/Master/texmf-dist/tex/latex/xpackages/template.sty b/Master/texmf-dist/tex/latex/xpackages/template.sty new file mode 100644 index 00000000000..354eee4abd0 --- /dev/null +++ b/Master/texmf-dist/tex/latex/xpackages/template.sty @@ -0,0 +1,569 @@ +%% +%% This is file `template.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% template.dtx (with options: `package,trace') +%% +%% (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. +%% +%% ====================================================================== +%% +%% File: template.dtx (C) Copyright 1999-2001 David Carlisle, Frank Mittelbach +%% (C) Copyright 2004-2008 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 +%% 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. +%% +%% ----------------------------------------------------------------------- +%% +\RequirePackage{l3names} +\GetIdInfo$Id: template.dtx 749 2008-08-03 19:01:36Z morten $ + {template} +\ProvidesExplPackage + {\filename}{\filedate}{\fileversion}{\filedescription} +\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{ + \group_begin: + \TP_instdecl_generate_assignments:nn {#2}{#3} + \gdef:Npx #1 { + \tlp_if_eq:cNTF { TP>/#2 } \c_TP_doparameterassignments_tlp + { \toks_use:N \l_TP_KV_assignments_toks } + { + \exp_not:N \TP_push_assignments:n + {\toks_use:N\l_TP_KV_assignments_toks} + \exp_not:c {TP>/#2} + } + } + \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{ + \TP_instdecl_generate_assignments:nn {#1/#2}{#3} + \TP_push_assignments: + \cs_use:c { TP>/#1/#2 } +} +\def_new:Npn \DoParameterAssignments{ + \exp_after:NN + \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{ + \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{ + \toks_gput_left:Nn\g_TP_assignments_stack_toks{{#1}} +} +\def_new: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} + \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: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:w TP@<#1>\cs_end: +} +\def_long_new:NNn\DeclareTemplate 5{ + \cs_if_free:cTF{TP@<#1>} + {\undefinedtype\DeclareTemplateType{#1}#3} + { + \int_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{ + \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} + \toks_clear:N\l_TP_default_assignments_toks + %\int_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 } + {\toks_use:N\l_TP_default_assignments_toks} + + \tlp_clear:c {TPR>/\l_TP_curr_name_tlp} + + \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} +} +\def_new:Npn \TP_templdecl_process_KV:nn#1#2{% + \let:NN \TP_templdecl_add_global_or_nothing: \use_noop: + \bool_set_false:N\l_TP_global_assignment_bool + \tlp_set:Nn\l_TP_currkey_tlp{#1} + \TP_templdecl_parse_KV:N#2\q_stop} +\def_new:Npn \TP_templdecl_parse_KV:N#1{ + \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}} +} +\bool_new:N \l_TP_global_assignment_bool +\def_new:cpn{TP_use_arg_type_+:w} { + \bool_set_true:N\l_TP_global_assignment_bool + \def: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 { + \TP_parse_optional_key_default:nw + { + \let:NN \TP_templdecl_add_global_or_nothing: \use_noop: + \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 { + \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 { + \TP_parse_optional_key_default:nw + { + \let:NN\TP_templdecl_add_global_or_nothing:\use_noop: + \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 { + \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 { + \TP_parse_optional_key_default:nw + {\TP_templdecl_setup_n_key:N} +} +\def_new: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{ + \TP_parse_optional_key_default:nw{\TP_templdecl_setup_f_key:Nn{#1}{#2}} +} +\def_new: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: + \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_if_free:cTF {if#2} + { \PackageError{template}{Bad~boolean~setting~#1=#2}\@eha } + { \tlp_set_eq:cc {if_#1:}{if_#2:} + \toks_put_right:Nf \l_TP_KV_assignments_toks + { \tlp_set_eq:cc {if_#1:}{if_#2:} } + } +} +\def_new: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 { + \TP_templdecl_define_key:n + { \TP_templdecl_eval_s_key_value:nnn{##1}#1 } +} +\def_new: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{ + \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 + { + \io_put_term:x{\token_to_string: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} } + %\TP_templdecl_add_global_or_nothing: + %\toks_put_right:Nn \l_TP_KV_assignments_toks + % { \def: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}} + } + {\toks_put_right:Nn \l_TP_KV_assignments_toks + {\def:Npx #1 { \toks_use:N \KV@toks}} + } + } + { + \TP_let_instance:Nnn#1{#2}{#3} + \toks_put_right:Nf \l_TP_KV_assignments_toks + { \TP_let_instance:Nnn#1{#2}{#3} } + } +} +\def_new: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{ + \TP_templdecl_define_key:n + { \toks_put_right:Nn\l_TP_KV_assignments_toks{#1} } +} +\def_new: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 { + \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{ + \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}} + +\DeclareArgumentType t[{meaning}{}{\NoValue}{#1[#2]}{#2} +\DeclareDocumentCommand\TP_parse_optional_key_default:nw{mt}{ + \IfNoValueTF{#2} + {\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{ + \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{ + \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 + \group_end: + \exp_after:NN + \toks_set:Nn + \exp_after:NN + \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 + } + \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 + { \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{ + \TP_templdecl_define_key:n{ + \tlist_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_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 + { + \group_begin: + \TP_multiselection_add:nnnnnn #1#2##1 + \group_end: + \tlist_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 + {\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: + } + } + } + { + #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: + } + } + } + } +} +\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{ + \l_TP_default_assignments_toks{##1##3} + } + \exp_after:NN \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{ + \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} } +} +\def_new:Npn \TP_templdecl_setup_n_key:N#1{ + \TP_templdecl_define_key:n{ + \tlist_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} + } + } + { + \def:Npn #1{##1} % setting it? + \toks_put_right:Nn \l_TP_KV_assignments_toks + { \tlp_set:Nn #1{##1} } + } + } +} +\def_new: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: + } +} +\def_new:Npn \DeclareInstance { \DeclareCollectionInstance{} } +\def_long_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> } + { {#2} \TP_get_arg_count:n{#1} } +} +\def_new:Npn \TP_let_instance:Nnn#1#2#3{ + \let:Nc #1 + { + \cs_if_free:cTF { \TP_get_csname_prefix:n{#2} #3 } + { <>#2/ } + { \TP_get_csname_prefix:n{#2} } + #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: + \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= + \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= + \cs_meaning:c{TPR>/#1/#2}} + \io_put_term:x{*} + \io_put_term:x{*~ Body:} + \io_put_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_show:c {<#1>#2/#3}} +\def_new:Npn \ShowInstance{\ShowCollectionInstance{}} +\def_new:Npn \TP_templdecl_setup_fakeregister_key:NNn#1#2#3{ + \TP_templdecl_define_key:n{ + \tlist_if_head_eq_meaning:nNTF{##1..}\DelayEvaluation + { + \toks_set:No \l_tmpa_toks {\use_arg_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} } + + } + } + { + \tlist_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}} + } + { + #1#2{##1} + \toks_put_right:Nx\l_TP_KV_assignments_toks + {\exp_not:n{\def: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{ + \toks_gset:Nn \g_TP_multiselection_toks {\if_case:w #4} + \clist_map_inline:nn {#5}{ + \tlist_if_head_eq_meaning:nNTF{##1..}\DelayEvaluation + { + \TP_multiselection_add_or_case:n {##1} + } + { + #1#2{##1} + \TP_multiselection_add_or_case:o { \toks_use:N #2 } + } + } + \toks_gput_right:Nn \g_TP_multiselection_toks { + \else: \use_arg_i_after_fi:nw{#6}\fi: + } +} +\def_new:Npn \TP_multiselection_add_or_case:n #1 { + \toks_gput_right:Nn \g_TP_multiselection_toks { + \or: \use_arg_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_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 + \else: + \exp_after:NN\use_arg_i:nn + \fi:} +\def_new: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:} + + \setkeys {\cs:w TPO>/#1/#3\cs_end:}{#4} + + \tlp_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} } +} +\def_new: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 + {\cs:w TPD>/#1\cs_end:\scan_stop:\scan_stop:} + + \toks_set:Nd \l_TP_KV_assignments_toks + {\cs:w TPR>/#1\cs_end:} + + \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 + \toks_use:N\l_TP_default_assignments_toks + +} +\def_new: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 { + {\toks_use:N \l_tmpa_toks \toks_use:N \l_TP_KV_assignments_toks} + } + \l_TP_KV_assignments_toks \l_tmpa_tlp + \TP_instdecl_add_default_recurse:nn + } +} +\def_new: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.} + } +} +\endinput +%% +%% End of file `template.sty'. diff --git a/Master/texmf-dist/tex/latex/xpackages/xparse.sty b/Master/texmf-dist/tex/latex/xpackages/xparse.sty new file mode 100644 index 00000000000..c2a3e0785ab --- /dev/null +++ b/Master/texmf-dist/tex/latex/xpackages/xparse.sty @@ -0,0 +1,564 @@ +%% +%% This is file `xparse.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% xparse.dtx (with options: `package') +%% +%% (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. +%% +%% ====================================================================== +%% +%% File: xparse.dtx (C) Copyright 1999 Frank Mittelbach, Chris Rowley, David Carlisle +%% (C) Copyright 2004-2008 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 +%% 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. +%% +%% ----------------------------------------------------------------------- +%% +\RequirePackage{l3names} +\GetIdInfo$Id: xparse.dtx 748 2008-08-03 19:00:50Z morten $ + {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 { + \xparse_error:x { + Command~name~`\token_to_string:N #1'~ already~defined! + } +} +\def_new:NNn \xparse_not_yet_defined_error_msg:N 1 { + \xparse_error:x { + Command~`\token_to_string:N #1'~ not~ yet~defined! + } +} +\def_new:NNn \xparse_begins_with_end_error_msg:N 1 { + \xparse_error:x { + Command~`\token_to_string:N #1'~begins~with~ + `\token_to_string:N \end'! + } +} +\def_new:NNn \xparse_unknown_arg_type_error_msg:N 1{ + \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 { + \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 + { + \xparse_begins_with_end:NTF #1 + { \xparse_begins_with_end_error_msg:N #1 \use_arg_ii:nn } + \use_arg_i:nn + } + { \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 +} +\def_new:NNn \xparse_if_redefinable:NTF 1 { + \cs_free:NTF #1 + { \xparse_not_yet_defined_error_msg:N #1 \use_arg_ii:nn } + { + \xparse_begins_with_end:NTF #1 + { \xparse_begins_with_end_error_msg:N #1 \use_arg_ii:nn } + \use_arg_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 { + \group_begin: + \exp_args:Nc \xparse_begins_with_end_aux:N { + \tlist_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 + \group_end: + \exp_after:NN \use_arg_i:nn + \else: + \group_end: + \exp_after:NN \use_arg_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{ + \xparse_prepare_signature:n {#2} + \def_protected:Npx #1 { + \exp_not:n { \toks_set:Nn \l_xparse_grabbed_args_toks } + {\exp_not:c {\token_to_string: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 +} +\def_long_new:NNn \xparse_declare_document_environment:nnnn 4 { + \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} +} +\def_protected_new:NNn \xparse_parsed_end_environment: 0{ + \exp_after:NN \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 } +} +\let_new:NN \DeclareDocumentCommand \xparse_declare_document_command:Nnn +\def_new:NNn \NewDocumentCommand 1 { + \xparse_if_definable:NTF #1 + { \xparse_declare_document_command:Nnn #1 } + \use_none:nn +} +\def_new:NNn \RenewDocumentCommand 1 { + \xparse_if_redefinable:NTF #1 + { \xparse_declare_document_command:Nnn #1 } + \use_none:nn +} +\let_new:NN \DeclareDocumentEnvironment + \xparse_declare_document_environment:nnnn +\def_new:NNn \NewDocumentEnvironment 1 { + \xparse_if_definable:cTF {#1} + { \xparse_declare_document_environment:nnnn {#1} } + \use_none:nnn +} +\def_new:NNn \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 + { \DeclareDocumentCommand #1} + \use_none:nn +} +\def_new:NNn \ProvideDocumentEnvironment 1{ + \cs_free:cTF {#1} + { \DeclareDocumentEnvironment {#1} } + \use_none:nnn +} +\def_long_new:NNn \DeclareDocumentCommandInterface 3{ + \xparse_prepare_signature:n {#3} + \def_protected: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 + {\xparse_undefined_command_implementation:n{#2}} +} +\def_new:NNn \xparse_undefined_command_implementation:n 1{ + ``#1'' + \xparse_no_command_implementation_warning:n {#1} +} +\def_long_new:NNn \DeclareDocumentCommandImplementation 3{ + \def_long:cNn {impl-#1}#2{#3} +} +\def_new:NNn \xparse_prepare_signature:n 1 { + \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 + \xparse_parse_signature:n #1 \q_nil +} +\tlp_new:Nn \g_xparse_ignore_marker_tlp {} +\seq_new:N \g_xparse_ignore_marker_seq +\bool_new:N \g_xparse_insert_marker_bool +\def_new: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}{ + \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} + } +} +\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{ + \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{ + \quark_if_nil:NTF #1 + { + \xparse_add_remaining_m_args: + } + { + \int_incr:N \l_xparse_total_args_int + \xparse_check_and_add_argument_type:N #1 + \bool_if:NT \g_xparse_insert_marker_bool + { + \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 + } + \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:} + { \xparse_unknown_arg_type_error_msg:N #1 + \int_incr:N \l_xparse_mandatory_args_int + } + { \cs_use:c {xparse_add_arg_type_#1:} } +} +\let_new:NN \xparse_read_arg_type_or_grab_default:n + \xparse_parse_signature:n +\def_new:NNn \xparse_grab_default_arg:n 1{ + \toks_put_right:Nn \l_xparse_grabbed_args_toks {{#1}} + \let: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{ + \toks_put_right:Nn \l_xparse_grabbed_args_toks {{#1}} + \let: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: { + \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 + { + \toks_put_right:Nx \l_xparse_grabbed_args_toks { + \exp_not:c{xparse_m + \int_use:N \l_xparse_mandatory_args_int + :w } + } + \int_zero:N \l_xparse_mandatory_args_int + } +} +\def_new: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{ + \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{ + \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{ + \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{ + \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{ + \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{ + \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 + #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 + #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{ + \toks_put_right:Nn \l_xparse_grabbed_args_toks{{#2}} + #1 \l_xparse_grabbed_args_toks +} +\def_new:Npn \xparse_add_arg_type_l: { + \xparse_add_remaining_m_args: + \bool_if:NTF \g_xparse_allow_par_bool + { + \toks_put_right:Nn \l_xparse_grabbed_args_toks {\xparse_allow_par_l:w} + } + { \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#{ + \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#{ + \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 + { + \exp_not:N \toks_put_right:Nn \exp_not:N + \l_xparse_grabbed_args_toks \exp_not:N \c_true + ##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 + ##2 \exp_not:N\l_xparse_grabbed_args_toks + } + } + } + \def: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 + } +} +\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 + { \exp_not:c{xparse_#1_#3_help:nw}{##1} } + { + \exp_not:n { + #4 \toks_put_right:Nn \l_xparse_grabbed_args_toks {#5} + } + ##1 \exp_not:N\l_xparse_grabbed_args_toks + } + } + \def_long:cpx {xparse_allow_par \l_tmpa_tlp _#1:w}##1 + \l_xparse_grabbed_args_toks{ + \exp_not:c{peek_#3 \l_tmpa_tlp :NTF} \exp_not:N #2 + { \exp_not:c{xparse_allow_par_#1_#3_help:nw}{##1} } + { + \exp_not:n { + #4 \toks_put_right:Nn \l_xparse_grabbed_args_toks {#5} + } + ##1 \exp_not:N\l_xparse_grabbed_args_toks + } + } + } + \def: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 + _#1:w + } + } + \let: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 + { \exp_not:c{xparse_#1_#3_help:nw}{##2} } + { + \exp_not:N \toks_put_right:Nn + \exp_not:N \l_xparse_grabbed_args_toks {{##1}} + ##2 \exp_not:N \l_xparse_grabbed_args_toks + } + } + \def_long:cpx {xparse_allow_par \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 + { \exp_not:c{xparse_allow_par_#1_#3_help:nw}{##2} } + { + \exp_not:N \toks_put_right:Nn + \exp_not:N \l_xparse_grabbed_args_toks {{##1}} + ##2 \exp_not:N \l_xparse_grabbed_args_toks + } + } + } + \def: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 + _#1:w + } + } + \let:Nc \xparse_read_arg_type_or_grab_default:n + {xparse_grab_default_arg + \bool_if:NT \g_xparse_allow_par_bool {_allow_par} + :n + } + } + \xparse_define_helper:Nnnn #1{#3}{#4}{#5} +} +\def_new:NNn \xparse_define_helper:Nnnn 4{ + \toks_set:Nn \l_tmpa_toks + { + #3 + { + \toks_put_right:Nn \l_xparse_grabbed_args_toks {{#4}} + ##1 \l_xparse_grabbed_args_toks + } + } + \toks_set:Nx \l_tmpa_toks { + \exp_not:n {\def:cpn{xparse_#1_#2_help:nw}} + \toks_use:N \l_tmpa_toks + \exp_not:n {\def:cpn{xparse_allow_par_#1_#2_help:nw}} + \toks_use:N\l_tmpa_toks + } + \toks_use:N \l_tmpa_toks +} +\DeclareArgumentType o[{meaning}{}{\NoValue}{#1[#2]}{#2} +\DeclareArgumentType c({meaning}{ + \xparse_error:x{ + Missing~ coordinate~ argument.~ A~ value~ of~ (0,0)~ is~ assumed} + } + {{00}} + {#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:} + ##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 } + {\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 + } + \def_long:cNx {xparse_pseudo_arg_#1:w} #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} + { + \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:} + } + \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 + } + } + { + \exp_not:c{xparse_pseudo_nobrace_arg_#1:N} + } + } +} +\def_new:NNn \UsePseudoArgument 1{\cs_use:c{xparse_pseudo_arg_#1:w}} +\endinput +%% +%% End of file `xparse.sty'. |