diff options
author | Karl Berry <karl@freefriends.org> | 2017-03-08 23:01:35 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-03-08 23:01:35 +0000 |
commit | 6fca20c09474a7f6a3559af1c984243a83669f61 (patch) | |
tree | cbfda048c91853241ef903a84a088c1e3a66fd50 /Master/texmf-dist/tex/latex/l3packages | |
parent | ddbc1f2a5f193876d6f1df544e286029c6d671f8 (diff) |
l3 (8mar17)
git-svn-id: svn://tug.org/texlive/trunk@43432 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/l3packages')
5 files changed, 389 insertions, 197 deletions
diff --git a/Master/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty b/Master/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty index 0910faf247e..9877bb95a42 100644 --- a/Master/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty +++ b/Master/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty @@ -19,8 +19,8 @@ %% and all files in that bundle must be distributed together. %% %% File: l3keys2e.dtx (C) Copyright 2009,2011-2017 The LaTeX3 Project -\RequirePackage{expl3}[2017/02/10] -\@ifpackagelater{expl3}{2017/02/10} +\RequirePackage{expl3}[2017/03/07] +\@ifpackagelater{expl3}{2017/03/07} {} {% \PackageError{l3keys2e}{Support package l3kernel too old} @@ -34,8 +34,8 @@ } \def\ExplFileName{l3keys2e} \def\ExplFileDescription{LaTeX2e option processing using LaTeX3 keys} -\def\ExplFileDate{2017/02/10} -\def\ExplFileVersion{6878} +\def\ExplFileDate{2017/03/07} +\def\ExplFileVersion{6984} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} \cs_generate_variant:Nn \clist_put_right:Nn { Nv } diff --git a/Master/texmf-dist/tex/latex/l3packages/xfp/xfp.sty b/Master/texmf-dist/tex/latex/l3packages/xfp/xfp.sty new file mode 100644 index 00000000000..b014890405e --- /dev/null +++ b/Master/texmf-dist/tex/latex/l3packages/xfp/xfp.sty @@ -0,0 +1,44 @@ +%% +%% This is file `xfp.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% xfp.dtx (with options: `package') +%% +%% Copyright (C) 2017 The 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 "l3packages bundle" (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% File: xfp.dtx (C) Copyright 2017 The LaTeX3 Project +\RequirePackage{expl3}[2017/03/07] +\@ifpackagelater{expl3}{2017/03/07} + {} + {% + \PackageError{xfpu}{Support package l3kernel too old} + {% + Please install an up to date version of l3kernel\MessageBreak + using your TeX package manager or from CTAN.\MessageBreak + \MessageBreak + Loading xfpu will abort!% + }% + \endinput + } +\def\ExplFileName{xfp} +\def\ExplFileDescription{LaTeX Floating Point Unit} +\def\ExplFileDate{2017/03/07} +\def\ExplFileVersion{6984} +\ProvidesExplPackage + {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} +\NewExpandableDocumentCommand \fpeval { m } { \fp_eval:n {#1} } +%% +%% +%% End of file `xfp.sty'. diff --git a/Master/texmf-dist/tex/latex/l3packages/xfrac/xfrac.sty b/Master/texmf-dist/tex/latex/l3packages/xfrac/xfrac.sty index 17f3d1bc319..502208f2580 100644 --- a/Master/texmf-dist/tex/latex/l3packages/xfrac/xfrac.sty +++ b/Master/texmf-dist/tex/latex/l3packages/xfrac/xfrac.sty @@ -20,8 +20,8 @@ %% %% File: xfrac.dtx Copyright (C) 2004, 2008-2010 Morten Hoegholm %% (C) 2011,2012,2014-2017 The LaTeX3 Project -\RequirePackage{expl3}[2017/02/10] -\@ifpackagelater{expl3}{2017/02/10} +\RequirePackage{expl3}[2017/03/07] +\@ifpackagelater{expl3}{2017/03/07} {} {% \PackageError{xfrac}{Support package l3kernel too old} @@ -36,8 +36,8 @@ \RequirePackage{amstext,graphicx,l3keys2e,textcomp,xparse,xtemplate} \def\ExplFileName{xfrac} \def\ExplFileDescription{L3 Experimental split-level fractions} -\def\ExplFileDate{2017/02/10} -\def\ExplFileVersion{6878} +\def\ExplFileDate{2017/03/07} +\def\ExplFileVersion{6984} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} \keys_define:nn { xfrac } diff --git a/Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty b/Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty index 08e27c11845..1c415e3b513 100644 --- a/Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty +++ b/Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty @@ -23,8 +23,8 @@ %% (C) Copyright 2004-2008 Frank Mittelbach, %% The LaTeX3 Project %% (C) Copyright 2009-2017 The LaTeX3 Project -\RequirePackage{expl3}[2017/02/10] -\@ifpackagelater{expl3}{2017/02/10} +\RequirePackage{expl3}[2017/03/07] +\@ifpackagelater{expl3}{2017/03/07} {} {% \PackageError{xparse}{Support package l3kernel too old} @@ -38,14 +38,12 @@ } \def\ExplFileName{xparse} \def\ExplFileDescription{L3 Experimental document command parser} -\def\ExplFileDate{2017/02/10} -\def\ExplFileVersion{6878} +\def\ExplFileDate{2017/03/07} +\def\ExplFileVersion{6984} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} \tl_const:Nx \c__xparse_no_value_tl { \char_generate:nn { `\- } { 11 } NoValue- } -\bool_new:N \l__xparse_all_long_bool -\bool_new:N \l__xparse_all_long_set_bool \tl_new:N \l__xparse_arg_spec_tl \tl_new:N \l__xparse_args_tl \tl_new:N \l__xparse_args_i_tl @@ -65,6 +63,7 @@ \tl_new:N \l__xparse_fn_tl \tl_new:N \l__xparse_fn_code_tl \tl_new:N \l__xparse_function_tl +\bool_new:N \l__xparse_grab_expandably_bool \tl_new:N \l__xparse_last_delimiters_tl \bool_new:N \l__xparse_long_bool \int_new:N \l__xparse_m_args_int @@ -74,6 +73,8 @@ \tl_new:N \l__xparse_process_one_tl \bool_new:N \l__xparse_process_some_bool \tl_new:N \l__xparse_signature_tl +\bool_new:N \l__xparse_some_long_bool +\bool_new:N \l__xparse_some_short_bool \prop_new:N \l__xparse_tmp_prop \tl_new:N \l__xparse_tmpa_tl \tl_new:N \l__xparse_tmpb_tl @@ -96,6 +97,13 @@ { \token_to_str:N #1 } { \tl_to_str:n {#2} } } { + \bool_lazy_or:nnT + { \cs_if_exist_p:c { \cs_to_str:N #1 ~ code } } + { \cs_if_exist_p:c { \cs_to_str:N #1 ~ defaults } } + { + \__msg_kernel_warning:nnx { xparse } { unsupported-let } + { \token_to_str:N #1 } + } \__msg_kernel_info:nnxx { xparse } { define-command } { \token_to_str:N #1 } { \tl_to_str:n {#2} } } @@ -114,7 +122,7 @@ \cs_new_eq:NN \__xparse_break_point:n \use_none:n \cs_new_protected:Npn \__xparse_declare_cmd_code:Nnn { - \bool_if:NTF \l__xparse_expandable_bool + \bool_if:NTF \l__xparse_grab_expandably_bool { \__xparse_declare_cmd_code_expandable:Nnn } { \__xparse_declare_cmd_code_aux:Nnn } } @@ -142,9 +150,10 @@ } \cs_new_protected:Npn \__xparse_declare_cmd_code_expandable:Nnn #1#2#3 { - \cs_generate_from_arg_count:cNnn + \exp_args:Ncc \cs_generate_from_arg_count:NNnn { \l__xparse_function_tl \c_space_tl code } - \cs_set:Npn \l__xparse_current_arg_int {#3} + { cs_set \bool_if:NF \l__xparse_expandable_bool { _protected } :Npn } + \l__xparse_current_arg_int {#3} \bool_if:NT \l__xparse_defaults_bool { \use:x @@ -155,19 +164,35 @@ { \exp_not:o \l__xparse_defaults_tl } } } - \cs_set_nopar:Npx #1 + \bool_if:NTF \l__xparse_expandable_bool + { \cs_set_nopar:Npx } { \cs_set_protected_nopar:Npx } #1 { - \exp_not:N \__xparse_start_expandable:nNNNn + \exp_not:N \__xparse_start_expandable:nNNNNn { \exp_not:n {#2} } \exp_not:c { \l__xparse_function_tl \c_space_tl } + \exp_not:c + { + \l__xparse_function_tl \c_space_tl + \bool_if:NT \l__xparse_some_short_bool + { \bool_if:NT \l__xparse_some_long_bool { \c_space_tl } } + } \exp_not:c { \l__xparse_function_tl \c_space_tl code } - \exp_not:c { \l__xparse_function_tl \c_space_tl defaults } + \bool_if:NTF \l__xparse_defaults_bool + { \exp_not:c { \l__xparse_function_tl \c_space_tl defaults } } + { ? } { \exp_not:o \l__xparse_signature_tl } } - \bool_if:NTF \l__xparse_all_long_bool - { \cs_set:cpx } + \bool_if:NTF \l__xparse_some_long_bool + { + \bool_if:NT \l__xparse_some_short_bool + { + \cs_set_nopar:cpx { \l__xparse_function_tl \c_space_tl \c_space_tl } + ##1##2 { ##1 {##2} } + } + \cs_set:cpx + } { \cs_set_nopar:cpx } - { \l__xparse_function_tl \c_space_tl } ##1##2 { ##1 {##2} } + { \l__xparse_function_tl \c_space_tl } ##1##2 { ##1 {##2} } } \cs_new_protected:Npn \__xparse_declare_env:nnnn #1#2 { @@ -203,7 +228,12 @@ \cs_set_eq:cc {#1} { environment~ #1 } \cs_set_eq:cc { end #1 } { environment~ #1 ~end } } -\cs_new_protected:Npn \__xparse_start:nNNnnn #1#2#3#4#5#6 +\cs_new_protected:Npx \__xparse_start:nNNnnn + { + \exp_not:c { xparse~function~is~not~expandable } + \exp_not:N \__xparse_start_aux:nNNnnn + } +\cs_new_protected:Npn \__xparse_start_aux:nNNnnn #1#2#3#4#5#6 { \tl_clear:N \l__xparse_args_tl \tl_set:Nn \l__xparse_fn_tl {#2} @@ -309,15 +339,15 @@ \cs_new_protected:Npn \__xparse_args_process_aux:n { \exp_args:No \__xparse_args_process_aux:nn { \ProcessedArgument } } \cs_new_protected:Npn \__xparse_args_process_aux:nn #1#2 { #2 {#1} } -\cs_new:Npn \__xparse_start_expandable:nNNNn #1#2#3#4#5 - { #5 \__xparse_end_expandable:NNw #4 #3 \q__xparse #2 } +\cs_new:Npn \__xparse_start_expandable:nNNNNn #1#2#3#4#5#6 + { #6 \__xparse_end_expandable:NNw #5 #4 \q__xparse #2#3 } \cs_new:Npn \__xparse_end_expandable:NNw #1#2 { \__xparse_end_expandable_aux:w #1#2 \prg_do_nothing: } -\cs_new:Npn \__xparse_end_expandable_aux:w #1#2#3 \q__xparse #4 - { \exp_args:No \__xparse_end_expandable_aux:nNNN {#3} #1 #2 #4 } -\cs_new:Npn \__xparse_end_expandable_aux:nNNN #1#2#3#4 +\cs_new:Npn \__xparse_end_expandable_aux:w #1#2#3 \q__xparse + { \exp_args:No \__xparse_end_expandable_aux:nNNNN {#3} #1 #2 } +\cs_new:Npn \__xparse_end_expandable_aux:nNNNN #1#2#3#4#5 { - \cs_if_exist:NF #2 { \exp_after:wN \use_iv:nnnn } + \token_if_eq_charcode:NNT ? #2 { \exp_after:wN \use_iv:nnnn } \__xparse_end_expandable_defaults:nnnNNn {#1} { } {#1} #2#3 { } { } { } { } { } { } { } { } { } { } { @@ -373,6 +403,10 @@ \int_zero:N \l__xparse_current_arg_int \tl_clear:N \l__xparse_last_delimiters_tl \tl_clear:N \l__xparse_arg_spec_tl + \bool_set_true:N \l__xparse_grab_expandably_bool + \bool_set_false:N \l__xparse_long_bool + \bool_set_false:N \l__xparse_some_long_bool + \bool_set_false:N \l__xparse_some_short_bool \__xparse_normalize_arg_spec_loop:n #1 \q_recursion_tail \q_recursion_tail \q_recursion_tail \q_recursion_stop \int_compare:nNnT \l__xparse_current_arg_int > 9 @@ -390,6 +424,10 @@ \__xparse_bad_def:wn } } + \bool_if:NT \l__xparse_expandable_bool + { \bool_set_true:N \l__xparse_grab_expandably_bool } + \bool_if:NT \l__xparse_environment_bool + { \bool_set_false:N \l__xparse_grab_expandably_bool } } \cs_new_protected:Npn \__xparse_normalize_arg_spec_loop:n #1 { @@ -440,12 +478,14 @@ } \tl_put_right:Nn \l__xparse_arg_spec_tl { > {#1} } \int_decr:N \l__xparse_current_arg_int + \bool_set_false:N \l__xparse_grab_expandably_bool \__xparse_normalize_arg_spec_loop:n {#2} } \cs_new_protected:cpn { __xparse_normalize_type_+:w } #1 { \quark_if_recursion_tail_stop_do:nn {#1} { \__xparse_bad_arg_spec:wn } \tl_put_right:Nn \l__xparse_arg_spec_tl { + } + \bool_set_true:N \l__xparse_long_bool \int_decr:N \l__xparse_current_arg_int \__xparse_normalize_arg_spec_loop:n {#1} } @@ -454,8 +494,9 @@ \__xparse_single_token_check:n {#1} \__xparse_single_token_check:n {#2} \quark_if_recursion_tail_stop_do:nn {#3} { \__xparse_bad_arg_spec:wn } - \tl_put_right:Nn \l__xparse_arg_spec_tl { D #1 #2 {#3} } + \__xparse_add_arg_spec:n { D #1 #2 {#3} } \tl_put_right:Nn \l__xparse_last_delimiters_tl {#1} + \bool_set_false:N \l__xparse_grab_expandably_bool \__xparse_normalize_arg_spec_loop:n } \cs_new_protected:Npn \__xparse_normalize_type_E:w #1#2 @@ -463,17 +504,27 @@ \quark_if_recursion_tail_stop_do:nn {#2} { \__xparse_bad_arg_spec:wn } \tl_if_blank:nT {#1} { \__xparse_bad_arg_spec:wn } \tl_map_function:nN {#1} \__xparse_single_token_check:n + \__xparse_normalize_E_unique_check:w #1 \q_nil \q_stop \int_compare:nNnT { \tl_count:n {#2} } > { \tl_count:n {#1} } { \__xparse_bad_arg_spec:wn } - \tl_put_right:Nn \l__xparse_arg_spec_tl { E {#1} {#2} } + \__xparse_add_arg_spec:n { E {#1} {#2} } \tl_put_right:Nn \l__xparse_last_delimiters_tl {#1} + \bool_set_false:N \l__xparse_grab_expandably_bool \__xparse_normalize_arg_spec_loop:n } +\cs_new_protected:Npn \__xparse_normalize_E_unique_check:w #1#2 \q_stop + { + \quark_if_nil:NF #1 + { + \tl_if_in:nnT {#2} {#1} { \__xparse_bad_arg_spec:wn } + \__xparse_normalize_E_unique_check:w #2 \q_stop + } + } \cs_new_protected:Npn \__xparse_normalize_type_G:w #1 { \quark_if_recursion_tail_stop_do:nn {#1} { \__xparse_bad_arg_spec:wn } - \__xparse_normalize_error_if_expandable:N G - \tl_put_right:Nn \l__xparse_arg_spec_tl { G {#1} } + \__xparse_normalize_check_gv:N G + \__xparse_add_arg_spec:n { G {#1} } \tl_put_right:Nn \l__xparse_last_delimiters_tl { { } } \__xparse_normalize_arg_spec_loop:n } @@ -483,12 +534,14 @@ \quark_if_recursion_tail_stop_do:Nn #1 { \__xparse_bad_arg_spec:wn } \tl_put_right:Nn \l__xparse_arg_spec_tl { t #1 } \tl_put_right:Nn \l__xparse_last_delimiters_tl {#1} + \bool_set_false:N \l__xparse_grab_expandably_bool + \bool_set_false:N \l__xparse_long_bool \__xparse_normalize_arg_spec_loop:n } \cs_new_protected:Npn \__xparse_normalize_type_l:w { - \__xparse_normalize_error_if_expandable:N l - \tl_put_right:Nn \l__xparse_arg_spec_tl { l } + \__xparse_normalize_check_lu:N l + \__xparse_add_arg_spec:n { l } \int_incr:N \l__xparse_mandatory_args_int \tl_clear:N \l__xparse_last_delimiters_tl \__xparse_normalize_arg_spec_loop:n @@ -496,7 +549,7 @@ \cs_new_protected:Npn \__xparse_normalize_type_m:w { \__xparse_delimiter_check:nnn { } { m } { \iow_char:N \{ } - \tl_put_right:Nn \l__xparse_arg_spec_tl { m } + \__xparse_add_arg_spec:n { m } \int_incr:N \l__xparse_mandatory_args_int \tl_clear:N \l__xparse_last_delimiters_tl \__xparse_normalize_arg_spec_loop:n @@ -507,24 +560,25 @@ \__xparse_single_token_check:n {#2} \quark_if_recursion_tail_stop_do:nn {#3} { \__xparse_bad_arg_spec:wn } \__xparse_delimiter_check:nnn {#1} { R/r } { \tl_to_str:n {#1} } - \tl_put_right:Nn \l__xparse_arg_spec_tl { R #1 #2 {#3} } + \__xparse_add_arg_spec:n { R #1 #2 {#3} } \int_incr:N \l__xparse_mandatory_args_int \tl_clear:N \l__xparse_last_delimiters_tl + \bool_set_false:N \l__xparse_grab_expandably_bool \__xparse_normalize_arg_spec_loop:n } \cs_new_protected:Npn \__xparse_normalize_type_u:w #1 { \quark_if_recursion_tail_stop_do:nn {#1} { \__xparse_bad_arg_spec:wn } - \__xparse_normalize_error_if_expandable:N u - \tl_put_right:Nn \l__xparse_arg_spec_tl { u {#1} } + \__xparse_normalize_check_lu:N u + \__xparse_add_arg_spec:n { u {#1} } \int_incr:N \l__xparse_mandatory_args_int \tl_clear:N \l__xparse_last_delimiters_tl \__xparse_normalize_arg_spec_loop:n } \cs_new_protected:Npn \__xparse_normalize_type_v:w { - \__xparse_normalize_error_if_expandable:N v - \tl_put_right:Nn \l__xparse_arg_spec_tl { v } + \__xparse_normalize_check_gv:N v + \__xparse_add_arg_spec:n { v } \int_incr:N \l__xparse_mandatory_args_int \tl_clear:N \l__xparse_last_delimiters_tl \__xparse_normalize_arg_spec_loop:n @@ -538,7 +592,7 @@ \__xparse_bad_def:wn } } -\cs_new_protected:Npn \__xparse_normalize_error_if_expandable:N #1 +\cs_new_protected:Npn \__xparse_normalize_check_gv:N #1 { \bool_if:NT \l__xparse_expandable_bool { @@ -547,6 +601,20 @@ { \iow_char:N \\ \l__xparse_function_tl } { \tl_to_str:n {#1} } \__xparse_bad_def:wn } + \bool_set_false:N \l__xparse_grab_expandably_bool + } +\cs_new_protected:Npn \__xparse_normalize_check_lu:N #1 + { + \bool_if:NT \l__xparse_expandable_bool + { + \tl_if_empty:NF \l__xparse_last_delimiters_tl + { + \__msg_kernel_error:nnxx + { xparse } { invalid-after-optional-expandably } + { \iow_char:N \\ \l__xparse_function_tl } { \tl_to_str:n {#1} } + \__xparse_bad_def:wn + } + } } \cs_new_protected:Npn \__xparse_delimiter_check:nnn #1#2#3 { @@ -565,10 +633,29 @@ { \iow_char:N \\ \l__xparse_function_tl } { \tl_to_str:n {#2} } } \cs_new_protected:Npn \__xparse_bad_def:wn #1 \__xparse_break_point:n #2 { } +\cs_new_protected:Npn \__xparse_add_arg_spec:n #1 + { + \bool_if:NF \l__xparse_long_bool + { + \bool_if:NT \l__xparse_some_long_bool + { + \bool_if:NT \l__xparse_expandable_bool + { + \__msg_kernel_error:nnx { xparse } { inconsistent-long } + { \iow_char:N \\ \l__xparse_function_tl } + \__xparse_bad_def:wn + } + \bool_set_false:N \l__xparse_grab_expandably_bool + } + } + \bool_if:NTF \l__xparse_long_bool + { \bool_set_true:N \l__xparse_some_long_bool } + { \bool_set_true:N \l__xparse_some_short_bool } + \bool_set_false:N \l__xparse_long_bool + \tl_put_right:Nn \l__xparse_arg_spec_tl {#1} + } \cs_new_protected:Npn \__xparse_prepare_signature:n #1 { - \bool_set_false:N \l__xparse_all_long_bool - \bool_set_false:N \l__xparse_all_long_set_bool \int_zero:N \l__xparse_current_arg_int \bool_set_false:N \l__xparse_long_bool \int_zero:N \l__xparse_m_args_int @@ -593,7 +680,7 @@ \use:c { __xparse_add - \bool_if:NT \l__xparse_expandable_bool { _expandable } + \bool_if:NT \l__xparse_grab_expandably_bool { _expandable } _type_ \token_to_str:N #1 :w } } @@ -685,7 +772,7 @@ } \cs_new_protected:Npn \__xparse_flush_m_args: { - \int_compare:nNnT \l__xparse_m_args_int > \c_zero + \int_compare:nNnT \l__xparse_m_args_int > 0 { \tl_put_right:Nx \l__xparse_signature_tl { \exp_not:c { __xparse_grab_m_ \int_use:N \l__xparse_m_args_int :w } } @@ -716,7 +803,7 @@ { __xparse_grab_ #1 \bool_if:NT \l__xparse_long_bool { _long } - \int_compare:nNnF \l__xparse_mandatory_args_int > \c_zero + \int_compare:nNnF \l__xparse_mandatory_args_int > 0 { _trailing } :w } @@ -766,18 +853,16 @@ \tl_if_eq:nnTF {#2} {#3} { \__xparse_add_expandable_type_D_aux:NN #1 #2 } { \__xparse_add_expandable_type_D_aux:NNN #1 #2 #3 } - \bool_set_false:N \l__xparse_long_bool \__xparse_prepare_signature:N } \cs_new_protected:Npn \__xparse_add_expandable_type_D_aux:NNN #1#2#3 { - \__xparse_add_expandable_grabber:n {#1} - \bool_if:NTF \l__xparse_all_long_bool + \bool_if:NTF \l__xparse_long_bool { \cs_set:cpx } { \cs_set_nopar:cpx } { \l__xparse_expandable_aux_name_tl } ##1 ##2 #2 ##3 \q__xparse ##4 #3 { ##1 {##2} {##3} {##4} } - \tl_put_right:Nx \l__xparse_signature_tl + \__xparse_add_expandable_grabber:nn {#1} { \exp_not:c { \l__xparse_expandable_aux_name_tl } \exp_not:n { #2 #3 } @@ -785,13 +870,12 @@ } \cs_new_protected:Npn \__xparse_add_expandable_type_D_aux:NN #1#2 { - \__xparse_add_expandable_grabber:n { #1_alt } - \bool_if:NTF \l__xparse_all_long_bool + \bool_if:NTF \l__xparse_long_bool { \cs_set:cpx } { \cs_set_nopar:cpx } { \l__xparse_expandable_aux_name_tl } ##1 #2 ##2 #2 { ##1 {##2} } - \tl_put_right:Nx \l__xparse_signature_tl + \__xparse_add_expandable_grabber:nn { #1_alt } { \exp_not:c { \l__xparse_expandable_aux_name_tl } \exp_not:n {#2} @@ -800,10 +884,10 @@ \cs_new_protected:Npn \__xparse_add_expandable_type_E:w #1#2 { \__xparse_add_default_E:nn {#1} {#2} - \__xparse_add_expandable_grabber:n { E } \tl_clear:N \l__xparse_tmpb_tl \tl_map_function:nN {#1} \__xparse_add_expandable_type_E_aux:n - \tl_put_right:Nx \l__xparse_signature_tl + \__xparse_add_expandable_grabber:nn + { E \bool_if:NT \l__xparse_long_bool { _long } } { { \exp_not:o \l__xparse_tmpb_tl } { @@ -811,7 +895,6 @@ { { \c__xparse_no_value_tl } } } } - \bool_set_false:N \l__xparse_long_bool \__xparse_prepare_signature:N } \cs_new_protected:Npn \__xparse_add_expandable_type_E_aux:n #1 @@ -820,10 +903,13 @@ \tl_put_right:Nx \l__xparse_tmpb_tl { \exp_not:o \l__xparse_tmpa_tl \exp_not:N #1 } } +\cs_new_protected:Npn \__xparse_add_expandable_type_l:w + { \__xparse_add_expandable_type_u:w ## } \cs_new_protected:Npn \__xparse_add_expandable_type_m:w { \__xparse_add_default: - \__xparse_add_expandable_grabber:n { m } + \__xparse_add_expandable_grabber:nn + { m \bool_if:NT \l__xparse_long_bool { _long } } { } \__xparse_prepare_signature:N } \cs_new_protected:Npn \__xparse_add_expandable_type_R:w @@ -831,41 +917,30 @@ \cs_new_protected:Npn \__xparse_add_expandable_type_t:w #1 { \__xparse_add_default: - \__xparse_add_expandable_grabber_t: \__xparse_get_grabber:NN #1 \l__xparse_tmpa_tl - \tl_put_right:Nx \l__xparse_signature_tl + \__xparse_add_expandable_grabber:nn { t } { \exp_not:o \l__xparse_tmpa_tl \exp_not:N #1 } - \bool_set_false:N \l__xparse_long_bool \__xparse_prepare_signature:N } -\cs_new_protected:Npn \__xparse_add_expandable_grabber:n #1 +\cs_new_protected:Npn \__xparse_add_expandable_type_u:w #1 { - \bool_if:NTF \l__xparse_all_long_set_bool - { - \bool_if:nT - { \bool_xor_p:nn { \l__xparse_all_long_bool } { \l__xparse_long_bool } } - { - \__msg_kernel_error:nnx { xparse } { inconsistent-long } - { \iow_char:N \\ \l__xparse_function_tl } - \__xparse_bad_def:wn - } - } - { - \bool_set:Nn \l__xparse_all_long_bool { \l__xparse_long_bool } - \bool_set_true:N \l__xparse_all_long_set_bool - } - \tl_put_right:Nx \l__xparse_signature_tl - { \exp_not:c { __xparse_expandable_grab_ #1 :w } } - \bool_set_false:N \l__xparse_long_bool + \__xparse_add_default: + \bool_if:NTF \l__xparse_long_bool + { \cs_set:cpn } + { \cs_set_nopar:cpn } + { \l__xparse_expandable_aux_name_tl } ##1 \q__xparse ##2 ##3 ##4 #1 + { ##1 {##4} \q__xparse ##2 ##3 } + \__xparse_add_expandable_grabber:nn { u } + { \exp_not:c { \l__xparse_expandable_aux_name_tl } } + \__xparse_prepare_signature:N } -\cs_new_protected:Npn \__xparse_add_expandable_grabber_t: +\cs_new_protected:Npn \__xparse_add_expandable_grabber:nn #1#2 { - \tl_put_right:Nn \l__xparse_signature_tl - { \__xparse_expandable_grab_t:w } - \bool_set_false:N \l__xparse_long_bool + \tl_put_right:Nx \l__xparse_signature_tl + { \exp_not:c { __xparse_expandable_grab_ #1 :w } #2 } } \cs_new_protected:Npn \__xparse_get_grabber:NN #1#2 { @@ -1271,7 +1346,7 @@ \cs_new_protected:Npx \__xparse_grab_v_bgroup: { \exp_not:N \__xparse_grab_v_aux_catcodes: - \exp_not:n { \int_set_eq:NN \l__xparse_v_nesting_int \c_one } + \exp_not:n { \int_set:Nn \l__xparse_v_nesting_int { 1 } } \exp_not:N \__xparse_grab_v_aux_put:N \iow_char:N \{ \exp_not:N \__xparse_grab_v_bgroup_loop: } @@ -1288,7 +1363,7 @@ \token_if_eq_charcode:NNTF \c_group_end_token #1 { \int_decr:N \l__xparse_v_nesting_int - \int_compare:nNnTF \l__xparse_v_nesting_int > \c_zero + \int_compare:nNnTF \l__xparse_v_nesting_int > 0 { \__xparse_grab_v_aux_put:N #1 \__xparse_grab_v_bgroup_loop: @@ -1349,33 +1424,37 @@ \l__xparse_signature_tl \__xparse_run_code: } \cs_generate_variant:Nn \__xparse_add_arg:n { V , o , x } -\cs_new:Npn \__xparse_expandable_grab_D:w #1 \q__xparse #2 - { #2 { \__xparse_expandable_grab_D:NNNwNn #1 \q__xparse #2 } } +\cs_new:Npn \__xparse_expandable_grab_D:w #1 \q__xparse #2#3 + { #2 { \__xparse_expandable_grab_D:NNNwNNn #1 \q__xparse #2 #3 } } \cs_set_protected:Npn \__xparse_tmp:w #1 { - \cs_new:Npn \__xparse_expandable_grab_D:NNNwNn ##1##2##3##4 \q__xparse ##5##6 + \cs_new:Npn \__xparse_expandable_grab_D:NNNwNNn ##1##2##3##4 \q__xparse ##5##6##7 { - \str_if_eq:onTF - { ##1 { } { } ##6 ##2 \q__xparse ##3 } - { { } {##2} { } } + \str_if_eq:nnTF {##2} {##7} + { + \str_if_eq:onTF + { ##1 { } { } ##7 ##2 \q__xparse ##3 } + { { } {##2} { } } + } + { \use_ii:nn } { ##1 - { \__xparse_expandable_grab_D:NNNwNnnn ##1##2##3##4 \q__xparse ##5 } + { \__xparse_expandable_grab_D:NNNwNNnnn ##1##2##3##4 \q__xparse ##5##6 } \q_nil { } ##2 \ERROR \q__xparse \ERROR } - { ##4 {#1} \q__xparse ##5 {##6} } + { ##4 {#1} \q__xparse ##5 ##6 {##7} } } } \exp_args:No \__xparse_tmp:w { \c__xparse_no_value_tl } -\cs_new:Npn \__xparse_expandable_grab_D:NNNwNnnn #1#2#3#4 \q__xparse #5#6#7#8 +\cs_new:Npn \__xparse_expandable_grab_D:NNNwNNnnn #1#2#3#4 \q__xparse #5#6#7#8#9 { - \exp_args:Nof \__xparse_expandable_grab_D:nnNNNwN - { \use_ii:nn #6 #2 } - { \__xparse_expandable_grab_D:Nw #3 \exp_stop_f: #7 #8 } - #1#2#3 #4 \q__xparse #5 + \exp_args:Nof \__xparse_expandable_grab_D:nnNNNwNN + { \use_ii:nn #7 #2 } + { \__xparse_expandable_grab_D:Nw #3 \exp_stop_f: #8 #9 } + #1#2#3 #4 \q__xparse #5 #6 } \cs_new:Npn \__xparse_expandable_grab_D:Nw #1#2 \ERROR \ERROR { #2 #1 } -\cs_new:Npn \__xparse_expandable_grab_D:nnNNNwN #1#2#3#4#5#6 \q__xparse #7 +\cs_new:Npn \__xparse_expandable_grab_D:nnNNNwNN #1#2#3#4#5#6 \q__xparse #7#8 { \exp_args:No \tl_if_empty:oTF { #3 { \use_none:nnn } #2 \q__xparse #5 #4 \q__xparse #5 } @@ -1389,52 +1468,60 @@ { \__xparse_put_arg_expandable:ow { \use_iii:nnn #1#2 } } { \__xparse_put_arg_expandable:ow { \use_none:nn #1#2 } } } - #6 \q__xparse #7 + #6 \q__xparse #7 #8 } { #3 - { \__xparse_expandable_grab_D:NNNwNnnn #3#4#5#6 \q__xparse #7 } + { \__xparse_expandable_grab_D:NNNwNNnnn #3#4#5#6 \q__xparse #7 #8 } \q_nil {#1} #2 \ERROR \q__xparse \ERROR } } -\cs_new:Npn \__xparse_expandable_grab_D_alt:w #1 \q__xparse #2 - { #2 { \__xparse_expandable_grab_D_alt:NNwNn #1 \q__xparse #2 } } +\cs_new:Npn \__xparse_expandable_grab_D_alt:w #1 \q__xparse #2#3 + { #2 { \__xparse_expandable_grab_D_alt:NNwNNn #1 \q__xparse #2 #3 } } \cs_set_protected:Npn \__xparse_tmp:w #1 { - \cs_new:Npn \__xparse_expandable_grab_D_alt:NNwNn ##1##2##3 \q__xparse ##4##5 + \cs_new:Npn \__xparse_expandable_grab_D_alt:NNwNNn ##1##2##3 \q__xparse ##4##5##6 { - \str_if_eq:onTF - { ##1 { } ##5 ##2 ##2 } - { { } ##2 } + \str_if_eq:nnTF {##6} {##2} + { + \str_if_eq:onTF + { ##1 { } ##6 ##2 ##2 } + { { } ##2 } + } + { \use_ii:nn } { ##1 - { \__xparse_expandable_grab_D_alt:Nwn ##4 ##3 \q__xparse } - ##5 \ERROR + { \__xparse_expandable_grab_D_alt:NNwn ##4 ##5 ##3 \q__xparse } + ##6 \ERROR } - { ##3 {#1} \q__xparse ##4 {##5} } + { ##3 {#1} \q__xparse ##4 ##5 {##6} } } } \exp_args:No \__xparse_tmp:w { \c__xparse_no_value_tl } -\cs_new:Npn \__xparse_expandable_grab_D_alt:Nwn #1#2 \q__xparse #3 +\cs_new:Npn \__xparse_expandable_grab_D_alt:NNwn #1#2#3 \q__xparse #4 { - \tl_if_blank:oTF { \use_none:n #3 } - { \__xparse_put_arg_expandable:ow { \use_none:n #3 } } + \tl_if_blank:oTF { \use_none:n #4 } + { \__xparse_put_arg_expandable:ow { \use_none:n #4 } } { \str_if_eq_x:nnTF - { \exp_not:o { \use_none:n #3 } } - { { \exp_not:o { \use_ii:nnn #3 \q_nil } } } - { \__xparse_put_arg_expandable:ow { \use_ii:nn #3 } } - { \__xparse_put_arg_expandable:ow { \use_none:n #3 } } - } - #2 \q__xparse #1 - } -\cs_new:Npn \__xparse_expandable_grab_E:w #1 \q__xparse #2 - { #2 { \__xparse_expandable_grab_E_test:nnwn #1 \q__xparse #2 } } -\cs_new:Npn \__xparse_expandable_grab_E_test:nnwn #1#2#3 \q__xparse #4#5 - { - \__xparse_expandable_grab_E_loop:nnnNNw {#5} { } { } + { \exp_not:o { \use_none:n #4 } } + { { \exp_not:o { \use_ii:nnn #4 \q_nil } } } + { \__xparse_put_arg_expandable:ow { \use_ii:nn #4 } } + { \__xparse_put_arg_expandable:ow { \use_none:n #4 } } + } + #3 \q__xparse #1 #2 + } +\cs_new:Npn \__xparse_expandable_grab_E:w #1 \q__xparse #2#3 + { \__xparse_expandable_grab_E_aux:w #1 \q__xparse #2 #3 #3 } +\cs_new:Npn \__xparse_expandable_grab_E_long:w #1 \q__xparse #2#3 + { \__xparse_expandable_grab_E_aux:w #1 \q__xparse #2 #3 #2 } +\cs_new:Npn \__xparse_expandable_grab_E_aux:w #1 \q__xparse #2#3#4 + { #2 { \__xparse_expandable_grab_E_test:nnw #1 \q__xparse #2 #3 #4 } } +\cs_new:Npn \__xparse_expandable_grab_E_test:nnw #1#2#3 \q__xparse #4#5#6#7 + { + \__xparse_expandable_grab_E_loop:nnnNNw {#7} { } { } #1 \q_nil \q_nil \q_nil \q_mark #2 \q_nil - #3 \q__xparse #4 + #3 \q__xparse #4 #5 #6 } \cs_new:Npn \__xparse_expandable_grab_E_loop:nnnNNw #1#2#3#4#5#6 \q_nil #7 \q_mark #8 @@ -1445,7 +1532,7 @@ \__xparse_if_no_value:nTF {#8} { \str_if_eq:onTF { #4 { } #1 #5 } {#5} } { \use_ii:nn } - { \__xparse_expandable_grab_E_aux:w { #2 #4 #5 #6 } {#3} ~ } + { \__xparse_expandable_grab_E_find:w { #2 #4 #5 #6 } {#3} ~ } { \__xparse_expandable_grab_E_loop:nnnNNw {#1} { #2 #4 #5 } { #3 {#8} } @@ -1453,68 +1540,79 @@ } } } -\cs_new:Npn \__xparse_expandable_grab_E_aux:w #1 \q__xparse #2 - { #2 { \__xparse_expandable_grab_E_aux:nnw #1 \q__xparse #2 } } -\cs_new:Npn \__xparse_expandable_grab_E_aux:nnw #1#2#3 \q_nil #4 \q__xparse #5#6 - { \__xparse_expandable_grab_E:w {#1} { #2 {#6} #3 } #4 \q__xparse #5 } -\cs_new:Npn \__xparse_expandable_grab_E_end:nnw #1#2#3 \q__xparse #4 - { #3 {#2} \q__xparse #4 {#1} } -\cs_new:Npn \__xparse_expandable_grab_m:w #1 \q__xparse #2 - { #2 { \__xparse_expandable_grab_m_aux:wNn #1 \q__xparse #2 } } -\cs_new:Npn \__xparse_expandable_grab_m_aux:wNn #1 \q__xparse #2#3 - { #1 {#3} \q__xparse #2 } -\cs_new:Npn \__xparse_expandable_grab_R:w #1 \q__xparse #2 - { #2 { \__xparse_expandable_grab_R_aux:NNNwNn #1 \q__xparse #2 } } +\cs_new:Npn \__xparse_expandable_grab_E_find:w #1 \q__xparse #2#3#4 + { #4 { \__xparse_expandable_grab_E_find:nnw #1 \q__xparse #2 #3 #4 } } +\cs_new:Npn \__xparse_expandable_grab_E_find:nnw #1#2#3 \q_nil #4 \q__xparse #5#6#7#8 + { \__xparse_expandable_grab_E_aux:w {#1} { #2 {#8} #3 } #4 \q__xparse #5 #6 #7 } +\cs_new:Npn \__xparse_expandable_grab_E_end:nnw #1#2#3 \q__xparse #4#5#6 + { #3 {#2} \q__xparse #4 #5 {#1} } +\cs_new:Npn \__xparse_expandable_grab_m:w #1 \q__xparse #2#3 + { #3 { \__xparse_expandable_grab_m_aux:wNn #1 \q__xparse #2 #3 } } +\cs_new:Npn \__xparse_expandable_grab_m_long:w #1 \q__xparse #2#3 + { #2 { \__xparse_expandable_grab_m_aux:wNn #1 \q__xparse #2 #3 } } +\cs_new:Npn \__xparse_expandable_grab_m_aux:wNn #1 \q__xparse #2#3#4 + { #1 {#4} \q__xparse #2 #3 } +\cs_new:Npn \__xparse_expandable_grab_R:w #1 \q__xparse #2#3 + { #2 { \__xparse_expandable_grab_R_aux:NNNwNNn #1 \q__xparse #2#3 } } \cs_set_protected:Npn \__xparse_tmp:w #1 { - \cs_new:Npn \__xparse_expandable_grab_R_aux:NNNwNn ##1##2##3##4 \q__xparse ##5##6 + \cs_new:Npn \__xparse_expandable_grab_R_aux:NNNwNNn ##1##2##3##4 \q__xparse ##5##6##7 { - \str_if_eq:onTF - { ##1 { } { } ##6 ##2 \q__xparse ##3 } - { { } {##2} { } } + \str_if_eq:nnTF {##7} {##2} + { + \str_if_eq:onTF + { ##1 { } { } ##7 ##2 \q__xparse ##3 } + { { } {##2} { } } + } + { \use_ii:nn } { ##1 - { \__xparse_expandable_grab_D:NNNwNnnn ##1##2##3##4 \q__xparse ##5 } + { \__xparse_expandable_grab_D:NNNwNNnnn ##1##2##3##4 \q__xparse ##5##6 } \q_nil { } ##2 \ERROR \q__xparse \ERROR } { \__msg_kernel_expandable_error:nnnn { xparse } { missing-required } {##5} {##2} - ##4 {#1} \q__xparse ##5 {##6} + ##4 {#1} \q__xparse ##5 ##6 {##7} } } } \exp_args:No \__xparse_tmp:w { \c__xparse_no_value_tl } -\cs_new:Npn \__xparse_expandable_grab_R_alt:w #1 \q__xparse #2 - { #2 { \__xparse_expandable_grab_R_alt_aux:NNnwNn #1 \q__xparse #2 } } +\cs_new:Npn \__xparse_expandable_grab_R_alt:w #1 \q__xparse #2#3 + { #2 { \__xparse_expandable_grab_R_alt_aux:NNnwNn #1 \q__xparse #2#3 } } \cs_set_protected:Npn \__xparse_tmp:w #1 { - \cs_new:Npn \__xparse_expandable_grab_R_alt_aux:NNwNn ##1##2##3 \q__xparse ##4##5 + \cs_new:Npn \__xparse_expandable_grab_R_alt_aux:NNwNn ##1##2##3 \q__xparse ##4##5##6 { - \str_if_eq:onTF - { ##1 { } ##5 ##2 ##2 } - { { } ##2 } + \str_if_eq:nnTF {##6} {##2} + { + \str_if_eq:onTF + { ##1 { } ##6 ##2 ##2 } + { { } ##2 } + } + { \use_ii:nn } { ##1 - { \__xparse_expandable_grab_D_alt:Nwn ##4 ##3 \q__xparse } - ##5 \ERROR + { \__xparse_expandable_grab_D_alt:NNwn ##4 ##5 ##3 \q__xparse } + ##6 \ERROR } { \__msg_kernel_expandable_error:nnnn { xparse } { missing-required } {##4} {##2} - ##3 {#1} \q__xparse ##4 {##5} + ##3 {#1} \q__xparse ##4 ##5 {##6} } } } \exp_args:No \__xparse_tmp:w { \c__xparse_no_value_tl } -\cs_new:Npn \__xparse_expandable_grab_t:w #1 \q__xparse #2 - { #2 { \__xparse_expandable_grab_t_aux:NNwn #1 \q__xparse #2 } } -\cs_new:Npn \__xparse_expandable_grab_t_aux:NNwn #1#2#3 \q__xparse #4#5 +\cs_new:Npn \__xparse_expandable_grab_t:w #1 \q__xparse #2#3 + { #2 { \__xparse_expandable_grab_t_aux:NNwn #1 \q__xparse #2 #3 } } +\cs_new:Npn \__xparse_expandable_grab_t_aux:NNwn #1#2#3 \q__xparse #4#5#6 { - \str_if_eq:onTF { #1 { } #5 #2 } {#2} - { #3 { \BooleanTrue } \q__xparse #4 } - { #3 { \BooleanFalse } \q__xparse #4 {#5} } + \str_if_eq:onTF { #1 { } #6 #2 } {#2} + { #3 { \BooleanTrue } \q__xparse #4 #5 } + { #3 { \BooleanFalse } \q__xparse #4 #5 {#6} } } +\cs_new_eq:NN \__xparse_expandable_grab_u:w \prg_do_nothing: \cs_new:Npn \__xparse_put_arg_expandable:nw #1#2 \q__xparse { #2 {#1} \q__xparse } \cs_generate_variant:Nn \__xparse_put_arg_expandable:nw { o } \cs_new_protected:Npn \__xparse_bool_reverse:N #1 @@ -1567,27 +1665,27 @@ } \cs_new_protected:Npn \__xparse_split_argument_aux:nnnn #1#2#3#4 { - \int_compare:nNnF {#1} = { #2 + \c_one } + \int_compare:nNnF {#1} = { #2 + 1 } { - \int_compare:nNnTF {#1} > { #2 + \c_one } + \int_compare:nNnTF {#1} > { #2 + 1 } { \tl_set:Nx \ProcessedArgument { \exp_last_unbraced:NnNo \__xparse_split_argument_aux:n - { #2 + \c_one } + { #2 + 1 } \use_none_delimit_by_q_stop:w \ProcessedArgument \q_stop } \__msg_kernel_error:nnxxx { xparse } { split-excess-tokens } - { \tl_to_str:n {#3} } { \int_eval:n { #2 + \c_one } } + { \tl_to_str:n {#3} } { \int_eval:n { #2 + 1 } } { \tl_to_str:n {#4} } } { \tl_put_right:Nx \ProcessedArgument { - \prg_replicate:nn { #2 + \c_one - (#1) } + \prg_replicate:nn { #2 + 1 - (#1) } { { \exp_not:V \c__xparse_no_value_tl } } } } @@ -1749,7 +1847,7 @@ } { { \token_to_str:N \__xparse_start:nNNnnn } { } - { \token_to_str:N \__xparse_start_expandable:nNNNn } { } + { \token_to_str:N \__xparse_start_expandable:nNNNNn } { } } } \cs_new:Npn \__xparse_cmd_if_xparse_aux:w #1 ~ #2 \q_stop {#1} @@ -1764,16 +1862,16 @@ \__msg_kernel_new:nnnn { xparse } { command-already-defined } { Command~'#1'~already~defined! } { - You~have~used~\NewDocumentCommand + You~have~used~#2~ with~a~command~that~already~has~a~definition. \\ The~existing~definition~of~'#1'~will~not~be~altered. } \__msg_kernel_new:nnnn { xparse } { command-not-yet-defined } { Command ~'#1'~not~yet~defined! } { - You~have~used~\RenewDocumentCommand + You~have~used~#2~ with~a~command~that~was~never~defined. \\ - A~new~command~'#1'~will~be~created. + LaTeX~will~ignore~this~entire~definition. } \__msg_kernel_new:nnnn { xparse } { environment-already-defined } { Environment~'#1'~already~defined! } @@ -1787,7 +1885,7 @@ { You~have~used~\RenewDocumentEnvironment with~an~environment~that~was~never~defined. \\ - A~new~environment~'#1'~will~be~created. + LaTeX~will~ignore~this~entire~definition. } \__msg_kernel_new:nnnn { xparse } { expandable-ending-optional } { @@ -1804,8 +1902,8 @@ { Inconsistent~long~arguments~for~expandable~command~'#1'. } { \c__msg_coding_error_text_tl - The~arguments~for~an~expandable~command~must~either~all~be~ - short~or~all~be~long.~You~have~tried~to~mix~the~two~types. + The~arguments~for~an~expandable~command~must~not~involve~short~ + arguments~after~long~arguments.~You~have~tried~to~mix~the~two~types. } \__msg_kernel_new:nnnn { xparse } { invalid-expandable-argument-type } { Argument~type~'#2'~not~available~for~expandable~command~'#1'. } @@ -1816,6 +1914,18 @@ \\ \\ LaTeX~will~ignore~this~entire~definition. } +\__msg_kernel_new:nnnn { xparse } { invalid-after-optional-expandably } + { + Argument~type~'#2'~not~available~after~optional~argument~ + for~expandable~command~'#1'. + } + { + \c__msg_coding_error_text_tl + The~letter~'#2'~does~not~specify~an~argument~type~which~can~be~used~ + in~an~expandable~command~after~an~optional~argument. + \\ \\ + LaTeX~will~ignore~this~entire~definition. + } \__msg_kernel_new:nnnn { xparse } { loop-in-defaults } { Circular~dependency~in~defaults~of~'#1'. } { @@ -1958,21 +2068,23 @@ as~a~previous~optional~argument,~it~will~not~be~possible~to~ omit~all~optional~arguments~when~calling~this~command. } -\cs_new_eq:NN \BooleanFalse \c_false_bool -\cs_new_eq:NN \BooleanTrue \c_true_bool -\cs_new_protected:Npn \DeclareDocumentCommand #1#2#3 +\__msg_kernel_new:nnn { xparse } { unsupported-let } { - \__xparse_check_definable:nNT {#1} \DeclareDocumentCommand - { \__xparse_declare_cmd:Nnn #1 {#2} {#3} } + The~command~'#1'~was~undefined~but~not~the~associated~commands~ + '#1~code'~and/or~'#1~defaults'.~Maybe~you~tried~using~ + \iow_char:N\\let.~This~may~lead~to~an~infinite~loop. } +\cs_new_eq:NN \BooleanFalse \c_false_bool +\cs_new_eq:NN \BooleanTrue \c_true_bool \cs_new_protected:Npn \NewDocumentCommand #1#2#3 { \__xparse_check_definable:nNT {#1} \NewDocumentCommand { \cs_if_exist:NTF #1 { - \__msg_kernel_error:nnx { xparse } { command-already-defined } - { \token_to_str:N #1 } + \__msg_kernel_error:nnxx { xparse } { command-already-defined } + { \use:nnn \token_to_str:N #1 { } } + { \token_to_str:N \NewDocumentCommand } } { \__xparse_declare_cmd:Nnn #1 {#2} {#3} } } @@ -1984,8 +2096,9 @@ \cs_if_exist:NTF #1 { \__xparse_declare_cmd:Nnn #1 {#2} {#3} } { - \__msg_kernel_error:nnx { xparse } { command-not-yet-defined } - { \token_to_str:N #1 } + \__msg_kernel_error:nnxx { xparse } { command-not-yet-defined } + { \use:nnn \token_to_str:N #1 { } } + { \token_to_str:N \RenewDocumentCommand } } } } @@ -1994,8 +2107,11 @@ \__xparse_check_definable:nNT {#1} \ProvideDocumentCommand { \cs_if_exist:NF #1 { \__xparse_declare_cmd:Nnn #1 {#2} {#3} } } } -\cs_new_protected:Npn \DeclareDocumentEnvironment #1#2#3#4 - { \__xparse_declare_env:nnnn {#1} {#2} {#3} {#4} } +\cs_new_protected:Npn \DeclareDocumentCommand #1#2#3 + { + \__xparse_check_definable:nNT {#1} \DeclareDocumentCommand + { \__xparse_declare_cmd:Nnn #1 {#2} {#3} } + } \cs_new_protected:Npn \NewDocumentEnvironment #1#2#3#4 { \cs_if_exist:cTF {#1} @@ -2010,6 +2126,42 @@ } \cs_new_protected:Npn \ProvideDocumentEnvironment #1#2#3#4 { \cs_if_exist:cF {#1} { \__xparse_declare_env:nnnn {#1} {#2} {#3} {#4} } } +\cs_new_protected:Npn \DeclareDocumentEnvironment #1#2#3#4 + { \__xparse_declare_env:nnnn {#1} {#2} {#3} {#4} } +\cs_new_protected:Npn \NewExpandableDocumentCommand #1#2#3 + { + \__xparse_check_definable:nNT {#1} \NewExpandableDocumentCommand + { + \cs_if_exist:NTF #1 + { + \__msg_kernel_error:nnxx { xparse } { command-already-defined } + { \use:nnn \token_to_str:N #1 { } } + { \token_to_str:N \NewExpandableDocumentCommand } + } + { \__xparse_declare_expandable_cmd:Nnn #1 {#2} {#3} } + } + } +\cs_new_protected:Npn \RenewExpandableDocumentCommand #1#2#3 + { + \__xparse_check_definable:nNT {#1} \RenewExpandableDocumentCommand + { + \cs_if_exist:NTF #1 + { \__xparse_declare_expandable_cmd:Nnn #1 {#2} {#3} } + { + \__msg_kernel_error:nnxx { xparse } { command-not-yet-defined } + { \use:nnn \token_to_str:N #1 { } } + { \token_to_str:N \RenewExpandableDocumentCommand } + } + } + } +\cs_new_protected:Npn \ProvideExpandableDocumentCommand #1#2#3 + { + \__xparse_check_definable:nNT {#1} \ProvideExpandableDocumentCommand + { + \cs_if_exist:NF #1 + { \__xparse_declare_expandable_cmd:Nnn #1 {#2} {#3} } + } + } \cs_new_protected:Npn \DeclareExpandableDocumentCommand #1#2#3 { \__xparse_check_definable:nNT {#1} \DeclareExpandableDocumentCommand diff --git a/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty b/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty index 47b2b06a1da..75598aca6e2 100644 --- a/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty +++ b/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty @@ -23,8 +23,8 @@ %% (C) Copyright 2004-2010 Frank Mittelbach, %% The LaTeX3 Project %% (C) Copyright 2011-2016 The LaTeX3 Project -\RequirePackage{expl3}[2017/02/10] -\@ifpackagelater{expl3}{2017/02/10} +\RequirePackage{expl3}[2017/03/07] +\@ifpackagelater{expl3}{2017/03/07} {} {% \PackageError{xtemplate}{Support package l3kernel too old} @@ -38,8 +38,8 @@ } \def\ExplFileName{xtemplate} \def\ExplFileDescription{L3 Experimental prototype document functions} -\def\ExplFileDate{2017/02/10} -\def\ExplFileVersion{6878} +\def\ExplFileDate{2017/03/07} +\def\ExplFileVersion{6984} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} \tl_const:Nn \c__xtemplate_code_root_tl { template~code~>~ } @@ -213,21 +213,17 @@ \cs_new_protected:Npn \__xtemplate_declare_object_type:nn #1#2 { \int_set:Nn \l__xtemplate_tmp_int {#2} - \bool_if:nTF + \int_compare:nTF { 0 <= \l__xtemplate_tmp_int <= 9 } { - \int_compare_p:nNn {#2} > \c_nine || - \int_compare_p:nNn {#2} < \c_zero + \msg_info:nnxx { xtemplate } { declare-object-type } + {#1} { \exp_not:V \l__xtemplate_tmp_int } + \prop_gput:NnV \g__xtemplate_object_type_prop {#1} + \l__xtemplate_tmp_int } { \msg_error:nnxx { xtemplate } { bad-number-of-arguments } {#1} { \exp_not:V \l__xtemplate_tmp_int } } - { - \msg_info:nnxx { xtemplate } { declare-object-type } - {#1} {#2} - \prop_gput:NnV \g__xtemplate_object_type_prop {#1} - \l__xtemplate_tmp_int - } } \cs_new_protected:Npn \__xtemplate_declare_template_keys:nnnn #1#2#3#4 { |