diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/base/latexrelease.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/base/latexrelease.sty | 2160 |
1 files changed, 1861 insertions, 299 deletions
diff --git a/Master/texmf-dist/tex/latex/base/latexrelease.sty b/Master/texmf-dist/tex/latex/base/latexrelease.sty index 0c2d1a5bd96..51bccae7522 100644 --- a/Master/texmf-dist/tex/latex/base/latexrelease.sty +++ b/Master/texmf-dist/tex/latex/base/latexrelease.sty @@ -16,6 +16,7 @@ %% lthooks.dtx (with options: `latexrelease') %% ltcmdhooks.dtx (with options: `latexrelease') %% ltsockets.dtx (with options: `latexrelease') +%% lttemplates.dtx (with options: `latexrelease') %% ltalloc.dtx (with options: `latexrelease') %% ltcntrl.dtx (with options: `latexrelease') %% lterror.dtx (with options: `latexrelease') @@ -292,7 +293,7 @@ } %%% From File: ltvers.dtx \edef\latexreleaseversion - {2023-11-01} + {2024-06-01} \newif\if@includeinrelease \@includeinreleasefalse \def\IncludeInRelease#1{% @@ -570,25 +571,6 @@ of this package available from CTAN} "luatex", tex.extraprimitives("core","omega", "aleph", "luatex") ) - local i - local t = { } - for _,i in pairs(tex.extraprimitives("luatex")) do - if not string.match(i,"^U") then - if not string.match(i, "^luatex") then - table.insert(t,i) - end - else - if string.match(i,"^Uchar$") then - table.insert(t,i) - end - end - end - for _,i in pairs(t) do - tex.print( - "\noexpand\\let\noexpand\\" .. i - .. "\noexpand\\undefined" - ) - end } \EndIncludeInRelease \fi @@ -985,7 +967,7 @@ of this package available from CTAN} \tracinggroups\z@ \tracingparagraphs\z@ \tracingmacros\z@ - \tracinglostchars\@ne + \tracinglostchars\tw@ \tracingpages\z@ \tracingstats\z@ }% @@ -1362,7 +1344,10 @@ of this package available from CTAN} \cs_gset_eq:NN \@expl@cs@to@str@@N \cs_to_str:N \cs_gset_eq:NN \@expl@str@if@eq@@nnTF \str_if_eq:nnTF \cs_gset_eq:NN \@expl@cs@prefix@spec@@N \cs_prefix_spec:N -\cs_gset_eq:NN \@expl@cs@argument@spec@@N \cs_argument_spec:N +\cs_if_exist:NTF \cs_parameter_spec:N + { \cs_gset_eq:NN \@expl@cs@parameter@spec@@N \cs_parameter_spec:N } + { \cs_gset_eq:NN \@expl@cs@parameter@spec@@N \cs_argument_spec:N } +\cs_gset_eq:NN \__kernel_cs_parameter_spec:N \@expl@cs@parameter@spec@@N \cs_gset_eq:NN \@expl@cs@replacement@spec@@N \cs_replacement_spec:N \cs_gset_eq:NN \@expl@str@map@function@@NN \str_map_function:NN \cs_gset_eq:NN \@expl@char@generate@@nn \char_generate:nn @@ -1373,7 +1358,7 @@ of this package available from CTAN} \let \@expl@cs@to@str@@N \@undefined \let \@expl@str@if@eq@@nnTF \@undefined \let \@expl@cs@prefix@spec@@N \@undefined -\let \@expl@cs@argument@spec@@N \@undefined +\let \@expl@cs@parameter@spec@@N \@undefined \let \@expl@cs@replacement@spec@@N \@undefined \let \@expl@str@map@function@@NN \@undefined \EndIncludeInRelease @@ -1796,7 +1781,7 @@ of this package available from CTAN} \long\def\@show@newcommand@aux#1#2#3{% \typeout{> \string#1=\@expl@cs@prefix@spec@@N#1macro:}% #3{default \string##1=\expandafter\detokenize\@gobblethree#2.^^J% - \@expl@cs@argument@spec@@N#1->\@expl@cs@replacement@spec@@N#1}} + \@expl@cs@parameter@spec@@N#1->\@expl@cs@replacement@spec@@N#1}} \long\def\@show@tokens#1{% \edef\reserved@a{#1}% \showtokens\expandafter @@ -1844,7 +1829,7 @@ of this package available from CTAN} \@show@environment@end#1} \long\def\@show@environment@begin#1{% \typeout{> \string\begin{\@expl@cs@to@str@@N#1}=environment:}% - \typeout{\@expl@cs@argument@spec@@N#1->% + \typeout{\@expl@cs@parameter@spec@@N#1->% \@expl@cs@replacement@spec@@N#1.^^J}} \long\def\@show@normalenv#1{% \@show@environment@begin#1% @@ -1855,12 +1840,12 @@ of this package available from CTAN} \long\def\@show@environment@end@aux#1#2{% \@show@tokens{\string\end{\@expl@cs@to@str@@N#2}% \ifx\relax#1=undefined% - \else:^^J\@expl@cs@argument@spec@@N#1->% + \else:^^J\@expl@cs@parameter@spec@@N#1->% \@expl@cs@replacement@spec@@N#1% \fi}} \def\@show@nonstop#1{% \typeout{> \string#1=\@expl@cs@prefix@spec@@N#1macro:^^J% - \@expl@cs@argument@spec@@N#1->\@expl@cs@replacement@spec@@N#1.}} + \@expl@cs@parameter@spec@@N#1->\@expl@cs@replacement@spec@@N#1.}} \def\@show@typeout#1{\typeout{> #1.^^J}} \EndIncludeInRelease \IncludeInRelease{0000-00-00}{\ShowEnvironment} @@ -1997,8 +1982,8 @@ of this package available from CTAN} \EndIncludeInRelease %%% From File: ltcmd.dtx -\def\ltcmdversion{v1.2a} -\def\ltcmddate{2023-08-19} +\def\ltcmdversion{v1.2e} +\def\ltcmddate{2024-04-17} \edef\@latexrelease@catcode@null{\the\catcode`\^^@ } \catcode`\^^@=12 \ExplSyntaxOn @@ -2082,8 +2067,6 @@ of this package available from CTAN} \cs_new_protected:Npn \__cmd_declare_cmd_internal:Nnnn #1#2#3#4 { \tl_set:Nx \l__cmd_function_tl { \cs_to_str:N #1 } - \tl_set:Nx \l__cmd_fn_tl - { \exp_not:c { \l__cmd_function_tl \c_space_tl } } \__cmd_normalize_arg_spec:n {#2} \exp_args:No \__cmd_prepare_signature:n \l__cmd_arg_spec_tl \__cmd_declare_cmd_code:Nnn #1 {#2} {#3} @@ -2091,12 +2074,60 @@ of this package available from CTAN} \__cmd_break_point:n {#2} } \cs_new_eq:NN \__cmd_break_point:n \use_none:n -\cs_new_protected:Npn \__cmd_declare_cmd_code:Nnn +\cs_new:Npn \__cmd_all_m_check:n #1 + { \tl_map_function:nN {#1} \__cmd_all_m_check_aux:n } +\cs_new:Npn \__cmd_all_m_check_aux:n #1 { - \bool_if:NTF \l__cmd_grab_expandably_bool - { \__cmd_declare_cmd_code_expandable:Nnn } - { \__cmd_declare_cmd_code_aux:Nnn } + \str_if_eq:nnF {#1} { m } + { + \str_if_eq:nnF {#1} { + } + { X } + } + } +\cs_new_protected:Npn \__cmd_declare_cmd_code:Nnn #1#2 + { + \bool_lazy_any:nTF + { + { \l__cmd_environment_bool } + { + \bool_lazy_and_p:nn + { \l__cmd_some_short_bool } + { \l__cmd_some_long_bool } + } + { ! \tl_if_blank_p:e { \__cmd_all_m_check:n {#2} } } + } + { + \tl_set:Nx \l__cmd_fn_tl + { \exp_not:c { \l__cmd_function_tl \c_space_tl } } + \bool_if:NTF \l__cmd_grab_expandably_bool + { \__cmd_declare_cmd_code_expandable:Nnn } + { \__cmd_declare_cmd_code_aux:Nnn } + } + { \__cmd_declare_cmd_optimized:Nnn } + #1 {#2} } +\cs_new_protected:Npn \__cmd_declare_cmd_optimized:Nnn #1#2#3 + { + \bool_if:NTF \l__cmd_expandable_bool + { \cs_set_nopar:Npe } + { \cs_set_protected_nopar:Npe } + #1 + { + \exp_not:N \__cmd_start_optimized: + \exp_not:c { \l__cmd_function_tl \c_space_tl code } + } + \exp_args:Ncc \cs_generate_from_arg_count:NNnn + { \l__cmd_function_tl \c_space_tl code } + { + cs_set + \bool_if:NF \l__cmd_expandable_bool { _protected } + \bool_if:NF \l__cmd_some_long_bool { _nopar } + :Npn + } + \l__cmd_current_arg_int + {#3} + } +\cs_new:Npn \__cmd_start_optimized: { } \cs_new_protected:Npn \__cmd_declare_cmd_code_aux:Nnn #1#2#3 { \cs_generate_from_arg_count:cNnn @@ -2698,7 +2729,12 @@ of this package available from CTAN} \bool_if:NT \l__cmd_some_obey_spaces_bool { \msg_error:nnxx { cmd } { invalid-bang } - { \__cmd_environment_or_command: } { \tl_to_str:n {#1} } + { \__cmd_environment_or_command: } + { + \bool_if:NTF \l__cmd_obey_spaces_bool + { \tl_to_str:n {'#1'} } + { an~optional~argument~before~mandatory~ \tl_to_str:n {'#1'} } + } \__cmd_bad_def:wn } \tl_clear:N \l__cmd_last_delimiters_tl @@ -3022,9 +3058,10 @@ of this package available from CTAN} \use:x { \int_set:Nn \tex_escapechar:D { 92 } - \exp_not:N \__cmd_cmd_type_cases:NnnnnF \exp_not:N #2 + \exp_not:N \__cmd_cmd_type_cases:NnnnnnF \exp_not:N #2 { \__cmd_copy_command:nnNN } { \__cmd_copy_expandable:nnNN } + { \__cmd_copy_optimized:nnNN } { \__cmd_copy_environment:nnNN } { \__cmd_copy_environment_end:nnNN } { \__cmd_cant_copy:nwn { non-ltcmd } } @@ -3100,6 +3137,18 @@ of this package available from CTAN} \IncludeInRelease{2020/10/01}{\__cmd_copy_expandable:nnNN}% {Support~\NewCommandCopy~in~ltcmd} \EndIncludeInRelease +\cs_new_protected:Npn \__cmd_copy_optimized:nnNN #1#2#3#4 + { + \cs_set_eq:cc { #1 ~ code } { #2 ~ code } + \token_if_protected_macro:NTF #4 + { \cs_set_protected_nopar:Npe } + { \cs_set_nopar:Npe } + #3 + { + \exp_not:N \__cmd_start_optimized: + \exp_not:c { #1 ~ code } + } + } \IncludeInRelease{2021/11/15}{\__cmd_copy:NN (part 2)}% {Support~\NewCommandCopy~in~ltcmd} \cs_new:Npn \__cmd_copy_expandable:NnNNNNnnn #1 #2 #3 #4 #5 #6 #7 #8 #9 @@ -3228,9 +3277,10 @@ of this package available from CTAN} \use:x { \int_set:Nn \tex_escapechar:D { 92 } - \exp_not:N \__cmd_cmd_type_cases:NnnnnF \exp_not:N #1 + \exp_not:N \__cmd_cmd_type_cases:NnnnnnF \exp_not:N #1 { \__cmd_show_command:N } { \__cmd_show_expandable:N } + { \__cmd_show_optimized:N } { \__cmd_show_environment:N } { \__cmd_show_environment_end:N } { \__cmd_cant_copy:nwn { non-ltcmd } } @@ -3284,6 +3334,43 @@ of this package available from CTAN} -> \cs_replacement_spec:N #4 } } +\cs_new_protected:Npn \__cmd_show_optimized:N #1 + { + \exp_args:Nc \__cmd_show_optimized:NN + { \cs_to_str:N #1 \c_space_tl code } + #1 + } +\cs_new_protected:Npn \__cmd_show_optimized:NN #1#2 + { + \cs_set:Npe \__cmd_show_optimized_aux:N ##1 + { + \c_space_tl \c_space_tl \c_hash_str ##1 : + \bool_lazy_or:nnT + { \token_if_long_macro_p:N #1 } + { \token_if_protected_long_macro_p:N #1 } + { + } m + \iow_newline: + } + \tl_show:e + { + \token_to_str:N #2 = + \bool_lazy_or:nnF + { \token_if_protected_macro_p:N #1 } + { \token_if_protected_long_macro_p:N #1 } + { expandable ~ } document~command: + \iow_newline: + \int_step_function:nN + { + \int_div_truncate:nn + { \tl_count:e { \cs_parameter_spec:N #1 } } + { 2 } + } + \__cmd_show_optimized_aux:N + -> + \cs_replacement_spec:N #1 + } + } +\cs_generate_variant:Nn \tl_count:n { e } \cs_new_protected:Npn \__cmd_show_environment:N #1 { \exp_after:wN \__cmd_show_environment:Nnnw #1 \q__cmd @@ -3850,6 +3937,24 @@ of this package available from CTAN} \__cmd_add_arg:o \c_novalue_tl } } +\IncludeInRelease{2024/06/01}{\__cmd_grab_v_aux_put:N}% + {Endlines~as~\obeyedline} +\cs_new_protected:Npn \__cmd_grab_v_aux_put:N #1 + { + \tl_put_right:Nx \l__cmd_v_arg_tl + { + \token_if_active:NTF #1 + { \exp_not:N #1 } + { + \int_compare:nNnTF {`#1} = \tex_endlinechar:D + { \exp_not:N \obeyedline } + { \token_to_str:N #1 } + } + } + } +\EndIncludeInRelease +\IncludeInRelease{2020/10/01}{\__cmd_grab_v_aux_put:N}% + {Endlines~as~\obeyedline} \cs_new_protected:Npn \__cmd_grab_v_aux_put:N #1 { \tl_put_right:Nx \l__cmd_v_arg_tl @@ -3858,6 +3963,7 @@ of this package available from CTAN} { \exp_not:N #1 } { \token_to_str:N #1 } } } +\EndIncludeInRelease \cs_new_protected:Npn \__cmd_grab_v_token_if_char:NTF #1 { \str_if_eq:eeTF { } { \str_tail:n {#1} } } \cs_new_protected:Npn \__cmd_add_arg:n #1 @@ -4326,30 +4432,31 @@ of this package available from CTAN} #1 {#2} {#4} \__cmd_tl_mapthread_loop:w #1#3 \q_mark } -\cs_new_protected:Npn \__cmd_cmd_type_cases:NnnnnF #1 #2 #3 #4 #5 #6 +\cs_new_protected:Npn \__cmd_cmd_type_cases:NnnnnnF #1 #2 #3 #4 #5 #6 #7 { \exp_args:Ne \str_case_e:nnF { - \exp_args:Nf \tl_if_empty:nT { \cs_argument_spec:N #1 } + \exp_args:Nf \tl_if_empty:nT { \__kernel_cs_parameter_spec:N #1 } { \exp_not:N \exp_not:n { \exp_not:e { \tl_head:N #1 } } } } { { \exp_not:N \__cmd_start:nNNnnn } {#2} { \exp_not:N \__cmd_start_expandable:nNNNNn } {#3} - { \exp_not:N \__cmd_start_env:nnnnn } {#4} + { \exp_not:N \__cmd_start_optimized: } {#4} + { \exp_not:N \__cmd_start_env:nnnnn } {#5} { \exp_after:wN \exp_not:N \cs:w environment~ \exp_last_unbraced:Ne \use_none:nnn { \cs_to_str:N #1 } ~end~aux \cs_end: - } {#5} + } {#6} } - {#6} + {#7} } \cs_new_protected:Npn \__kernel_cmd_if_xparse:NTF #1 { - \__cmd_cmd_type_cases:NnnnnF #1 - { } { } { } { } { \use_iii:nnn } + \__cmd_cmd_type_cases:NnnnnnF #1 + { } { } { } { } { } { \use_iii:nnn } \use_i:nn } \cs_new_protected:Npn \__cmd_peek_nonspace:NTF @@ -4405,10 +4512,8 @@ of this package available from CTAN} \bool_if:NTF \l__cmd_environment_bool { environment ~ ' \l__cmd_environment_str ' } { - command ~ ' - \exp_args:Nf \tl_trim_spaces:n - { \exp_after:wN \token_to_str:N \l__cmd_fn_tl } - ' + command ~ + ' \c_backslash_str \tl_to_str:N \l__cmd_function_tl ' } } \msg_new:nnnn { cmd } { arg-after-body } @@ -4500,7 +4605,7 @@ of this package available from CTAN} { Invalid~argument~prefix~'!'~in~#1. } { The~prefix~'!'~is~only~allowed~for~trailing~optional~arguments.~ - You~tried~to~apply~it~to~'#2'. + You~tried~to~apply~it~to~#2. \c__cmd_ignore_def_tl } \msg_new:nnnn { cmd } { not-definable } @@ -4809,8 +4914,6 @@ of this package available from CTAN} \catcode`\^^@=\@latexrelease@catcode@null\relax %%% From File: lthooks.dtx -\def\lthooksversion{v1.1f} -\def\lthooksdate{2023/10/02} \ExplSyntaxOn \NewModuleRelease{2020/10/01}{lthooks} {The~hook~management~system} @@ -5281,7 +5384,8 @@ of this package available from CTAN} \msg_error:nnnnn { hooks } { set-top-level } { for } { SetDefaultHookLabel } {#1} } - { \exp_args:Nx \__hook_set_default_label:n { \__hook_make_name:n {#1} } } + { \exp_args:Nx + \__hook_set_default_label:n { \__hook_make_name:n {#1} } } } \cs_new_protected:Npn \__hook_set_default_label:n #1 { @@ -5388,7 +5492,8 @@ of this package available from CTAN} \IncludeInRelease{2020/10/01}{\hook_gput_code:nnn} {Providing~hooks} \cs_gset_protected:Npn \hook_gput_code:nnn #1 #2 - { \__hook_normalize_hook_args:Nnn \__hook_gput_code:nnn {#1} {#2} } + { \__hook_normalize_hook_args:Nnn + \__hook_gput_code:nnn {#1} {#2} } \cs_gset_protected:Npn \__hook_gput_code:nnn #1 #2 #3 { \__hook_if_execute_immediately:nTF {#1} @@ -5402,7 +5507,8 @@ of this package available from CTAN} { \__hook_if_disabled:nTF {#1} { \msg_error:nnn { hooks } { hook-disabled } {#1} } - { \__hook_try_declaring_generic_hook:nnn {#1} {#2} {#3} } + { \__hook_try_declaring_generic_hook:nnn + {#1} {#2} {#3} } } } } @@ -5414,7 +5520,8 @@ of this package available from CTAN} \on@line\space <-~ \tl_to_str:n{#3}} } \str_if_eq:nnTF {#2} { top-level } { - \str_if_eq:eeTF { top-level } { \__hook_currname_or_default: } + \str_if_eq:eeTF { top-level } + { \__hook_currname_or_default: } { \__hook_init_structure:n {#1} \__hook_tl_gput_right:cn { __hook_toplevel~#1 } {#3} @@ -5422,7 +5529,8 @@ of this package available from CTAN} { \msg_error:nnn { hooks } { misused-top-level } {#1} } } { - \prop_get:cnNTF { g__hook_#1_code_prop } {#2} \l__hook_return_tl + \prop_get:cnNTF + { g__hook_#1_code_prop } {#2} \l__hook_return_tl { \prop_gput:cno { g__hook_#1_code_prop } {#2} { \l__hook_return_tl #3 } @@ -5458,7 +5566,8 @@ of this package available from CTAN} \__hook_init_structure:n {#1} \__hook_hook_gput_code_do:nnn {#1} {#2} {#3} } -\IncludeInRelease{2023/06/01}{\__hook_try_declaring_generic_hook:nnn} +\IncludeInRelease{2023/06/01} + {\__hook_try_declaring_generic_hook:nnn} {Hooks~with~args} \cs_new_protected:Npn \__hook_try_declaring_generic_hook:nnn #1 { @@ -5475,54 +5584,66 @@ of this package available from CTAN} {#1} } \EndIncludeInRelease -\IncludeInRelease{2021/11/15}{\__hook_try_declaring_generic_hook:nnn} +\IncludeInRelease{2021/11/15} + {\__hook_try_declaring_generic_hook:nnn} {Standardise~generic~hook~names} \cs_gset_protected:Npn \__hook_try_declaring_generic_hook:nnn #1 { - \__hook_try_declaring_generic_hook:wnTF #1 / / / \scan_stop: {#1} + \__hook_try_declaring_generic_hook:wnTF #1 / / / \scan_stop: + {#1} \hook_gput_code:nnn \__hook_gput_undeclared_hook:nnn {#1} } -\cs_gset_protected:Npn \__hook_try_declaring_generic_next_hook:nn #1 +\cs_gset_protected:Npn + \__hook_try_declaring_generic_next_hook:nn #1 { - \__hook_try_declaring_generic_hook:wnTF #1 / / / \scan_stop: {#1} + \__hook_try_declaring_generic_hook:wnTF #1 / / / \scan_stop: + {#1} \hook_gput_next_code:nn \__hook_gput_next_do:nn {#1} } \EndIncludeInRelease -\IncludeInRelease{2020/10/01}{\__hook_try_declaring_generic_hook:nnn} +\IncludeInRelease{2020/10/01} + {\__hook_try_declaring_generic_hook:nnn} {Standardise~generic~hook~names} -\cs_new_protected:Npn \__hook_try_declaring_generic_hook:nnn #1 +\cs_new_protected:Npn + \__hook_try_declaring_generic_hook:nnn #1 { \__hook_try_declaring_generic_hook:nNNnn {#1} \hook_gput_code:nnn \__hook_gput_undeclared_hook:nnn } -\cs_new_protected:Npn \__hook_try_declaring_generic_next_hook:nn #1 +\cs_new_protected:Npn + \__hook_try_declaring_generic_next_hook:nn #1 { \__hook_try_declaring_generic_hook:nNNnn {#1} \hook_gput_next_code:nn \__hook_gput_next_do:nn } \cs_new_protected:Npn \__hook_try_declaring_generic_hook:nNNnn #1 { - \__hook_if_file_hook:wTF #1 / \s__hook_mark + \__hook_if_file_hook:wTF #1 / / \s__hook_mark { - \exp_args:Ne \__hook_try_declaring_generic_hook_split:nNNnn + \exp_args:Ne + \__hook_try_declaring_generic_hook_split:nNNnn { \exp_args:Ne \__hook_file_hook_normalize:n {#1} } } { \__hook_try_declaring_generic_hook_split:nNNnn {#1} } } -\cs_new_protected:Npn \__hook_try_declaring_generic_hook_split:nNNnn #1 #2 #3 +\cs_new_protected:Npn + \__hook_try_declaring_generic_hook_split:nNNnn #1 #2 #3 { - \__hook_try_declaring_generic_hook:wnTF #1 / / / \scan_stop: {#1} + \__hook_try_declaring_generic_hook:wnTF #1 / / / \scan_stop: + {#1} { #2 } { #3 } {#1} } \EndIncludeInRelease -\IncludeInRelease{2023/06/01}{\__hook_try_declaring_generic_hook:wn} +\IncludeInRelease{2023/06/01} + {\__hook_try_declaring_generic_hook:wn} {Hooks~with~args} -\prg_new_protected_conditional:Npnn \__hook_try_declaring_generic_hook:wn +\prg_new_protected_conditional:Npnn + \__hook_try_declaring_generic_hook:wn #1 / #2 / #3 / #4 \scan_stop: #5 { TF } { \__hook_if_generic:nTF {#5} @@ -5576,9 +5697,11 @@ of this package available from CTAN} #1 #2 { #3 / #5 / #4 } } \EndIncludeInRelease -\IncludeInRelease{2021/11/15}{\__hook_try_declaring_generic_hook:wn} +\IncludeInRelease{2021/11/15} + {\__hook_try_declaring_generic_hook:wn} {Standardise~generic~hook~names} -\prg_new_protected_conditional:Npnn \__hook_try_declaring_generic_hook:wn +\prg_new_protected_conditional:Npnn + \__hook_try_declaring_generic_hook:wn #1 / #2 / #3 / #4 \scan_stop: #5 { TF } { \__hook_if_generic:nTF {#5} @@ -5604,9 +5727,11 @@ of this package available from CTAN} } } \EndIncludeInRelease -\IncludeInRelease{2021/06/01}{\__hook_try_declaring_generic_hook:wn} +\IncludeInRelease{2021/06/01} + {\__hook_try_declaring_generic_hook:wn} {Support~cmd~hooks} -\prg_new_protected_conditional:Npnn \__hook_try_declaring_generic_hook:wn +\prg_new_protected_conditional:Npnn + \__hook_try_declaring_generic_hook:wn #1 / #2 / #3 / #4 \scan_stop: #5 { TF } { \tl_if_empty:nTF {#2} @@ -5620,10 +5745,12 @@ of this package available from CTAN} { \__hook_try_put_cmd_hook:n {#5} } \__hook_make_usable:n {#5} } - \prop_if_in:NnTF \c__hook_generics_reversed_ii_prop {#2} + \prop_if_in:NnTF + \c__hook_generics_reversed_ii_prop {#2} { \tl_gset:cn { g__hook_#5_reversed_tl } { - } } { - \prop_if_in:NnT \c__hook_generics_reversed_iii_prop {#3} + \prop_if_in:NnT + \c__hook_generics_reversed_iii_prop {#3} { \tl_gset:cn { g__hook_#5_reversed_tl } { - } } } \prg_return_true: @@ -5632,9 +5759,11 @@ of this package available from CTAN} } } \EndIncludeInRelease -\IncludeInRelease{2020/10/01}{\__hook_try_declaring_generic_hook:wn} +\IncludeInRelease{2020/10/01} + {\__hook_try_declaring_generic_hook:wn} {Support~cmd~hooks} -\prg_new_protected_conditional:Npnn \__hook_try_declaring_generic_hook:wn +\prg_new_protected_conditional:Npnn + \__hook_try_declaring_generic_hook:wn #1 / #2 / #3 / #4 \scan_stop: #5 { TF } { \tl_if_empty:nTF {#2} @@ -5643,10 +5772,12 @@ of this package available from CTAN} \prop_if_in:NnTF \c__hook_generics_prop {#1} { \__hook_if_declared:nF {#5} { \hook_new:n {#5} } - \prop_if_in:NnTF \c__hook_generics_reversed_ii_prop {#2} + \prop_if_in:NnTF + \c__hook_generics_reversed_ii_prop {#2} { \tl_gset:cn { g__hook_#5_reversed_tl } { - } } { - \prop_if_in:NnT \c__hook_generics_reversed_iii_prop {#3} + \prop_if_in:NnT + \c__hook_generics_reversed_iii_prop {#3} { \tl_gset:cn { g__hook_#5_reversed_tl } { - } } } \prg_return_true: @@ -5687,11 +5818,11 @@ of this package available from CTAN} { \__hook_strip_double_slash:n {#1} } \cs_new:Npn \__hook_strip_double_slash:n #1 { \__hook_strip_double_slash:w #1 // \s__hook_mark } -\cs_new:Npn \__hook_strip_double_slash:w #1/#2/#3 // #4 \s__hook_mark +\cs_new:Npn \__hook_strip_double_slash:w #1/#2/#3//#4\s__hook_mark { \tl_if_empty:nTF {#4} { #1/#2/#3 } - { \__hook_strip_double_slash:w #1/#2/#3 / #4 \s__hook_mark } + { \__hook_strip_double_slash:w #1/#2/#3 /#4\s__hook_mark } } \EndIncludeInRelease \IncludeInRelease{2021/11/15}{\c__hook_generics_prop} @@ -5722,9 +5853,12 @@ of this package available from CTAN} \EndIncludeInRelease \IncludeInRelease{2020/10/01}{\c__hook_generics_reversed_ii_prop} {Standardise~generic~hook~names} -\prop_const_from_keyval:Nn \c__hook_generics_reversed_ii_prop {after=,end=} -\prop_const_from_keyval:Nn \c__hook_generics_reversed_iii_prop {after=} -\prop_const_from_keyval:Nn \c__hook_generics_file_prop {before=,after=} +\prop_const_from_keyval:Nn + \c__hook_generics_reversed_ii_prop {after=,end=} +\prop_const_from_keyval:Nn + \c__hook_generics_reversed_iii_prop {after=} +\prop_const_from_keyval:Nn + \c__hook_generics_file_prop {before=,after=} \EndIncludeInRelease \IncludeInRelease{2023/06/01}{\c__hook_parameter_cmd/./before_tl} {Hooks~with~args} @@ -5752,7 +5886,8 @@ of this package available from CTAN} \str_if_eq:nnTF {#2} { top-level } { \__hook_toplevel_gset:nn {#1} { } } { - \prop_gpop:cnNF { g__hook_#1_code_prop } {#2} \l__hook_return_tl + \prop_gpop:cnNF { g__hook_#1_code_prop } + {#2} \l__hook_return_tl { \msg_warning:nnnn { hooks } { cannot-remove } {#1} {#2} } } } @@ -5763,7 +5898,8 @@ of this package available from CTAN} \__hook_if_deprecated_generic:nTF {#1} { \__hook_deprecated_generic_warn:n {#1} - \__hook_do_deprecated_generic:Nn \__hook_gremove_code:nn {#1} {#2} + \__hook_do_deprecated_generic:Nn + \__hook_gremove_code:nn {#1} {#2} } { \msg_warning:nnnn { hooks } { cannot-remove } {#1} {#2} } } @@ -5785,8 +5921,10 @@ of this package available from CTAN} \str_if_eq:nnTF {#2} { top-level } { \__hook_tl_gclear:c { __hook_toplevel~#1 } } { - \prop_gpop:cnNF { g__hook_#1_code_prop } {#2} \l__hook_return_tl - { \msg_warning:nnnn { hooks } { cannot-remove } {#1} {#2} } + \prop_gpop:cnNF { g__hook_#1_code_prop } + {#2} \l__hook_return_tl + { \msg_warning:nnnn { hooks } { cannot-remove } + {#1} {#2} } } } \__hook_if_usable:nT {#1} @@ -5796,9 +5934,11 @@ of this package available from CTAN} \__hook_if_deprecated_generic:nTF {#1} { \__hook_deprecated_generic_warn:n {#1} - \__hook_do_deprecated_generic:Nn \__hook_gremove_code:nn {#1} {#2} + \__hook_do_deprecated_generic:Nn + \__hook_gremove_code:nn {#1} {#2} } - { \msg_warning:nnnn { hooks } { cannot-remove } {#1} {#2} } + { \msg_warning:nnnn { hooks } { cannot-remove } + {#1} {#2} } } } \EndIncludeInRelease @@ -5817,7 +5957,8 @@ of this package available from CTAN} {#1} {#2} } \cs_new_protected:Npn \__hook_cs_gput_right_fast:nnn #1 #2 #3 - { \cs_gset:cpx { __hook#1~#2 } { \exp_not:v { __hook#1~#2 } \exp_not:n {#3} } } + { \cs_gset:cpx { __hook#1~#2 } + { \exp_not:v { __hook#1~#2 } \exp_not:n {#3} } } \cs_new_protected:Npn \__hook_cs_gput_right_slow:nnn #1 #2 #3 { \cs_if_exist:cF { __hook#1~#2 } @@ -5928,7 +6069,8 @@ of this package available from CTAN} } \exp_last_unbraced:NNf \cs_set:Npn \__hook_tmp:w { \__hook_parameter:n {#1} } { } - \tl_set:Ne \l__hook_tmpa_tl { \__hook_braced_cs_parameter:n { __hook_tmp:w } } + \tl_set:Ne \l__hook_tmpa_tl + { \__hook_braced_cs_parameter:n { __hook_tmp:w } } \cs_gset_protected:Npx \__hook_normalise_fn:nn ##1 ##2 { \group_begin: @@ -6114,8 +6256,8 @@ of this package available from CTAN} \__hook_if_deprecated_generic:nT {#1} { \__hook_deprecated_generic_warn:n {#1} - \__hook_do_deprecated_generic:Nn \__hook_gset_rule:nnnn {#1} - {#2} {#3} {#4} + \__hook_do_deprecated_generic:Nn \__hook_gset_rule:nnnn + {#1} {#2} {#3} {#4} \exp_after:wN \use_none:nnnnnnnnn \use_none:n } \__hook_init_structure:n {#1} @@ -6133,27 +6275,34 @@ of this package available from CTAN} \EndIncludeInRelease \cs_new_protected:Npn \__hook_rule_before_gset:nnn #1#2#3 { - \__hook_tl_gset:cx { g__hook_#1_rule_ \__hook_label_pair:nn {#2} {#3} _tl } + \__hook_tl_gset:cx + { g__hook_#1_rule_ \__hook_label_pair:nn {#2} {#3} _tl } { \__hook_label_ordered:nnTF {#2} {#3} { < } { > } } } \cs_new_eq:cN { __hook_rule_<_gset:nnn } \__hook_rule_before_gset:nnn \cs_new_protected:Npn \__hook_rule_after_gset:nnn #1#2#3 { - \__hook_tl_gset:cx { g__hook_#1_rule_ \__hook_label_pair:nn {#3} {#2} _tl } + \__hook_tl_gset:cx + { g__hook_#1_rule_ \__hook_label_pair:nn {#3} {#2} _tl } { \__hook_label_ordered:nnTF {#3} {#2} { < } { > } } } \cs_new_eq:cN { __hook_rule_>_gset:nnn } \__hook_rule_after_gset:nnn \cs_new_protected:Npn \__hook_rule_voids_gset:nnn #1#2#3 { - \__hook_tl_gset:cx { g__hook_#1_rule_ \__hook_label_pair:nn {#2} {#3} _tl } + \__hook_tl_gset:cx + { g__hook_#1_rule_ \__hook_label_pair:nn {#2} {#3} _tl } { \__hook_label_ordered:nnTF {#2} {#3} { -> } { <- } } } \cs_new_protected:cpn { __hook_rule_incompatible-error_gset:nnn } #1#2#3 - { \__hook_tl_gset:cn { g__hook_#1_rule_ \__hook_label_pair:nn {#2} {#3} _tl } - { xE } } + { \__hook_tl_gset:cn + { g__hook_#1_rule_ \__hook_label_pair:nn {#2} {#3} _tl } + { xE } + } \cs_new_protected:cpn { __hook_rule_incompatible-warning_gset:nnn } #1#2#3 - { \__hook_tl_gset:cn { g__hook_#1_rule_ \__hook_label_pair:nn {#2} {#3} _tl } - { xW } } + { \__hook_tl_gset:cn + { g__hook_#1_rule_ \__hook_label_pair:nn {#2} {#3} _tl } + { xW } + } \cs_new_protected:Npn \__hook_rule_unrelated_gset:nnn #1#2#3 { } \cs_new_protected:Npn \__hook_rule_gclear:nnn #1#2#3 { \cs_undefine:c { g__hook_#1_rule_ \__hook_label_pair:nn {#2} {#3} _tl } } @@ -6211,7 +6360,8 @@ of this package available from CTAN} {Hooks~with~args} \cs_gset_protected:Npn \__hook_initialize_all: { - \cs_gset_eq:NN \__hook_update_hook_code:n \__hook_initialize_hook_code:n + \cs_gset_eq:NN \__hook_update_hook_code:n + \__hook_initialize_hook_code:n \__hook_debug:n { \prop_gclear:N \g__hook_used_prop } \seq_map_inline:Nn \g__hook_all_seq { \__hook_update_hook_code:n {##1} } @@ -6221,7 +6371,8 @@ of this package available from CTAN} \prop_map_inline:Nn \g__hook_used_prop { \iow_term:x - { ^^J ~ ##1 ~ -> ~ \cs_replacement_spec:c { __hook~##1 } ~ } + { ^^J ~ ##1 ~ -> ~ + \cs_replacement_spec:c { __hook~##1 } ~ } } } \cs_gset_eq:NN \hook_use:n \__hook_use_initialized:n @@ -6243,8 +6394,10 @@ of this package available from CTAN} { \__hook_code_gset:ne {#1} { - \exp_not:c { __hook_toplevel~#1 } \__hook_braced_parameter:n {#1} - \exp_not:c { __hook_next~#1 } \__hook_braced_parameter:n {#1} + \exp_not:c { __hook_toplevel~#1 } + \__hook_braced_parameter:n {#1} + \exp_not:c { __hook_next~#1 } + \__hook_braced_parameter:n {#1} } } { @@ -6267,7 +6420,8 @@ of this package available from CTAN} \cs_gset_protected:Npn \__hook_initialize_hook_code:n #1 { \__hook_debug:n - { \iow_term:x { ^^J Update~code~for~hook~'#1' \on@line :^^J } } + { \iow_term:x { ^^J Update~code~for~hook~'#1' + \on@line :^^J } } \__hook_include_legacy_code_chunk:n {#1} \__hook_if_usable:nT {#1} { @@ -6281,15 +6435,21 @@ of this package available from CTAN} } { \__hook_if_reversed:nTF {#1} - { \cs_set_eq:NN \__hook_tl_gput:Nn \__hook_tl_gput_left:Nn - \cs_set_eq:NN \__hook_clist_gput:NV \clist_gput_left:NV } - { \cs_set_eq:NN \__hook_tl_gput:Nn \__hook_tl_gput_right:Nn - \cs_set_eq:NN \__hook_clist_gput:NV \clist_gput_right:NV } - \prop_set_eq:Nc \l__hook_work_prop { g__hook_#1_code_prop } + { \cs_set_eq:NN \__hook_tl_gput:Nn + \__hook_tl_gput_left:Nn + \cs_set_eq:NN \__hook_clist_gput:NV + \clist_gput_left:NV } + { \cs_set_eq:NN \__hook_tl_gput:Nn + \__hook_tl_gput_right:Nn + \cs_set_eq:NN \__hook_clist_gput:NV + \clist_gput_right:NV } + \prop_set_eq:Nc \l__hook_work_prop + { g__hook_#1_code_prop } \__hook_initialize_single:ccn { __hook~#1 } { g__hook_#1_labels_clist } {#1} \__hook_debug:n - { \exp_args:NNx \prop_gput:Nnn \g__hook_used_prop {#1} { } } + { \exp_args:NNx \prop_gput:Nnn \g__hook_used_prop + {#1} { } } } } } @@ -6356,7 +6516,8 @@ of this package available from CTAN} \int_compare:nNnT { \cs:w \__hook_tl_csname:n {##1} \cs_end: } = 0 { - \tl_set:cn { \__hook_tl_csname:n { \l__hook_rear_tl } } {##1} + \tl_set:cn + { \__hook_tl_csname:n { \l__hook_rear_tl } } {##1} \tl_set:Nn \l__hook_rear_tl {##1} } } @@ -6407,42 +6568,50 @@ of this package available from CTAN} {#3} } } - \__hook_debug:n { \__hook_debug_label_data:N \l__hook_work_prop } + \__hook_debug:n + { \__hook_debug_label_data:N \l__hook_work_prop } \tl_set:Nn \l__hook_rear_tl { 0 } \tl_set:cn { \__hook_tl_csname:n { 0 } } { 0 } \seq_map_inline:Nn \l__hook_labels_seq { - \int_compare:nNnT { \cs:w \__hook_tl_csname:n {##1} \cs_end: } = 0 - { - \tl_set:cn { \__hook_tl_csname:n { \l__hook_rear_tl } }{##1} - \tl_set:Nn \l__hook_rear_tl {##1} - } + \int_compare:nNnT + { \cs:w \__hook_tl_csname:n {##1} \cs_end: } = 0 + { + \tl_set:cn { \__hook_tl_csname:n + { \l__hook_rear_tl } } {##1} + \tl_set:Nn \l__hook_rear_tl {##1} + } } \tl_set_eq:Nc \l__hook_front_tl { \__hook_tl_csname:n { 0 } } \__hook_tl_gclear:N #1 \clist_gclear:N #2 - \bool_while_do:nn { ! \str_if_eq_p:Vn \l__hook_front_tl { 0 } } + \bool_while_do:nn + { ! \str_if_eq_p:Vn \l__hook_front_tl { 0 } } { \int_decr:N \l__hook_labels_int - \prop_get:NVN \l__hook_work_prop \l__hook_front_tl \l__hook_return_tl + \prop_get:NVN \l__hook_work_prop + \l__hook_front_tl \l__hook_return_tl \exp_args:NNV \__hook_tl_gput:Nn #1 \l__hook_return_tl \__hook_clist_gput:NV #2 \l__hook_front_tl - \__hook_debug:n{ \iow_term:x{Handled~ code~ for~ \l__hook_front_tl} } - \seq_map_inline:cn { \__hook_seq_csname:n { \l__hook_front_tl } } + \__hook_debug:n{ \iow_term:x + {Handled~ code~ for~ \l__hook_front_tl} } + \seq_map_inline:cn + { \__hook_seq_csname:n { \l__hook_front_tl } } { \tl_set:cx { \__hook_tl_csname:n {##1} } - { \int_eval:n - { \cs:w \__hook_tl_csname:n {##1} \cs_end: - 1 } - } + { \int_eval:n + { \cs:w \__hook_tl_csname:n {##1} \cs_end: - 1 } + } \int_compare:nNnT - { \cs:w \__hook_tl_csname:n {##1} \cs_end: } = 0 - { - \tl_set:cn { \__hook_tl_csname:n { \l__hook_rear_tl } } {##1} - \tl_set:Nn \l__hook_rear_tl {##1} - } + { \cs:w \__hook_tl_csname:n {##1} \cs_end: } = 0 + { + \tl_set:cn { \__hook_tl_csname:n + { \l__hook_rear_tl } } {##1} + \tl_set:Nn \l__hook_rear_tl {##1} + } } \tl_set_eq:Nc \l__hook_front_tl - { \__hook_tl_csname:n { \l__hook_front_tl } } + { \__hook_tl_csname:n { \l__hook_front_tl } } } \int_compare:nNnF \l__hook_labels_int = 0 { @@ -6451,7 +6620,8 @@ of this package available from CTAN} \__hook_debug_label_data:N \l__hook_work_prop \iow_term:x{====================} } - \exp_args:NNo \__hook_tl_gput:Nn #1 { \cs:w __hook_toplevel~#3 \cs_end: } + \exp_args:NNo \__hook_tl_gput:Nn #1 + { \cs:w __hook_toplevel~#3 \cs_end: } \__hook_tl_gput_right:No #1 { \cs:w __hook_next~#3 \cs_end: } } \cs_generate_variant:Nn \__hook_tl_gput_right:Nn { No } @@ -6588,7 +6758,7 @@ of this package available from CTAN} hook~'#1' \__hook_if_disabled:nF {#1} { - \exp_args:Nf \__hook_print_args:nn {#1} + \exp_args:Nne \__hook_print_args:nn {#1} { \int_eval:n { \str_count:e { \__hook_parameter:n {#1} } / 3 } @@ -6697,7 +6867,8 @@ of this package available from CTAN} } \__hook_preamble_hook:n {#1} \__hook_log_cmd:x - { ^^J ->~The~ \__hook_if_generic:nT {#1} { generic~ } hook~'#1': } + { ^^J ->~The~ \__hook_if_generic:nT + {#1} { generic~ } hook~'#1': } \__hook_if_usable:nF {#1} { \__hook_log_line:x { The~hook~is~not~declared. } } \__hook_if_disabled:nT {#1} @@ -6710,26 +6881,30 @@ of this package available from CTAN} { \__hook_log_line_indent:x { --- } } { \prop_map_inline:cn { g__hook_#1_code_prop } - { \__hook_log_line_indent:x { ##1~->~\tl_to_str:n {##2} } } + { \__hook_log_line_indent:x + { ##1~->~\tl_to_str:n {##2} } } } \__hook_log_line:x { Document-level~(top-level)~code \__hook_if_usable:nT {#1} - { ~(executed~\__hook_if_reversed:nTF {#1} {first} {last} ) } : + { ~(executed~ + \__hook_if_reversed:nTF {#1} {first} {last} ) } : } \__hook_log_line_indent:x { \tl_if_empty:cTF { __hook_toplevel~#1 } { --- } - { -> ~ \exp_args:Nv \tl_to_str:n { __hook_toplevel~#1 } } + { -> ~ \exp_args:Nv \tl_to_str:n + { __hook_toplevel~#1 } } } \__hook_log_line:x { Extra~code~for~next~invocation: } \__hook_log_line_indent:x { \tl_if_empty:cTF { __hook_next~#1 } { --- } - { ->~ \exp_args:Nv \__hook_log_next_code:n { __hook_next~#1 } } + { ->~ \exp_args:Nv \__hook_log_next_code:n + { __hook_next~#1 } } } \__hook_log_line:x { Rules: } \bool_set_true:N \l__hook_tmpa_bool @@ -6753,7 +6928,8 @@ of this package available from CTAN} { Execution~order \bool_if:NTF \l__hook_tmpa_bool - { \__hook_if_reversed:nT {#1} { ~(after~reversal) } } + { \__hook_if_reversed:nT + {#1}{ ~(after~reversal) } } { ~(after~ \__hook_if_reversed:nT {#1} { reversal~and~ } applying~rules) @@ -6764,16 +6940,19 @@ of this package available from CTAN} \@spaces \clist_if_empty:cTF { g__hook_#1_labels_clist } { --- } - { \clist_use:cn { g__hook_#1_labels_clist } { ,~ } } + { \clist_use:cn + { g__hook_#1_labels_clist } { ,~ } } } } { \__hook_log_line:x { Execution~order: } #2 { - \@spaces Not~set~because~the~hook~ \__hook_if_usable:nTF {#1} + \@spaces Not~set~because~the~hook~ + \__hook_if_usable:nTF {#1} { code~pool~is~empty } - { is~\__hook_if_disabled:nTF {#1} {disabled} {undeclared} } + { is~\__hook_if_disabled:nTF + {#1} {disabled} {undeclared} } } } } @@ -6863,7 +7042,8 @@ of this package available from CTAN} \IncludeInRelease{2020/10/01}{\hook_gput_next_code:nn} {Hooks~with~args} \cs_gset_protected:Npn \hook_gput_next_code:nn #1 - { \__hook_normalize_hook_args:Nn \__hook_gput_next_code:nn {#1} } + { \__hook_normalize_hook_args:Nn + \__hook_gput_next_code:nn {#1} } \cs_gset_protected:Npn \hook_gput_next_code_with_args:nn #1 #2 { } \EndIncludeInRelease \cs_new_protected:Npn \__hook_gput_next_code:nn #1 #2 @@ -6979,7 +7159,8 @@ of this package available from CTAN} \fi: \cs:w __hook~#1 \__hook_use_end: } -\cs_new:Npn \__hook_use_undefined:w #1 #2 __hook~#3 \__hook_use_end: +\cs_new:Npn \__hook_use_undefined:w + #1 #2 __hook~#3 \__hook_use_end: { #1 % fi \__hook_use:wn #3 / \s__hook_mark {#3} @@ -7039,12 +7220,13 @@ of this package available from CTAN} } \cs_new_protected:Npn \__hook_try_file_hook:n #1 { - \__hook_if_file_hook:wTF #1 / \s__hook_mark + \__hook_if_file_hook:wTF #1 / / \s__hook_mark { \exp_args:Ne \__hook_if_usable_use:n { \exp_args:Ne \__hook_file_hook_normalize:n {#1} } } - { \__hook_if_usable_use:n {#1} } % file/ generic hook (e.g. file/before) + { \__hook_if_usable_use:n {#1} } + % file/ generic hook (e.g. file/before) } \cs_new_protected:Npn \__hook_if_usable_use:n #1 { @@ -7060,12 +7242,14 @@ of this package available from CTAN} \cs_new_protected:Npn \hook_use_once:n #1 { \__hook_if_execute_immediately:nF {#1} - { \__hook_normalize_hook_args:Nn \__hook_use_once:nn { \use:n {#1} } { 0 } } + { \__hook_normalize_hook_args:Nn \__hook_use_once:nn + { \use:n {#1} } { 0 } } } \cs_new_protected:Npn \hook_use_once:nnw #1 #2 { \__hook_if_execute_immediately:nF {#1} - { \__hook_normalize_hook_args:Nn \__hook_use_once:nn { \use:n {#1} } {#2} } + { \__hook_normalize_hook_args:Nn \__hook_use_once:nn + { \use:n {#1} } {#2} } } \EndIncludeInRelease \IncludeInRelease{2020/10/01}{\hook_use_once:nnw} @@ -7073,7 +7257,8 @@ of this package available from CTAN} \cs_gset_protected:Npn \hook_use_once:n #1 { \__hook_if_execute_immediately:nF {#1} - { \__hook_normalize_hook_args:Nn \__hook_use_once:n { \use:n {#1} } } + { \__hook_normalize_hook_args:Nn \__hook_use_once:n + { \use:n {#1} } } } \cs_gset:Npn \hook_use_once:nnw #1 #2 { \use:c { use_none: \prg_replicate:nn {#2} { n } } } @@ -7085,7 +7270,8 @@ of this package available from CTAN} \__hook_preamble_hook:n {#1} \__hook_use_once_set:n {#1} \__hook_replacing_args_false: - \__hook_cs_gput_right:nnn { _next } {#1} { \__hook_use_once_clear:n {#1} } + \__hook_cs_gput_right:nnn { _next } {#1} + { \__hook_use_once_clear:n {#1} } \__hook_replacing_args_reset: \__hook_if_usable:nTF {#1} { \__hook_use_initialized:n {#1} } @@ -7333,7 +7519,8 @@ of this package available from CTAN} { Cannot~add~code~to~disabled~hook~'#1'. } { The~hook~'#1'~you~tried~to~add~code~to~was~previously~disabled~ - with~\iow_char:N\\hook_disable_generic:n~or~\iow_char:N\\DisableGenericHook,~so~ + with~\iow_char:N\\hook_disable_generic:n~or~ + \iow_char:N\\DisableGenericHook,~so~ it~cannot~have~code~added~to~it. } \msg_new:nnn { hooks } { empty-label } @@ -7442,7 +7629,7 @@ of this package available from CTAN} {Hooks~with~args} \cs_new_protected:Npn \NewHookWithArguments #1 #2 { } \cs_new_protected:Npn \NewReversedHookWithArguments #1 #2 { } -\cs_new_protected:Npn \NewMirroredHookPairWithArguments #1 #2 #3 { } +\cs_new_protected:Npn \NewMirroredHookPairWithArguments #1 #2 #3{} \EndIncludeInRelease \IncludeInRelease{2021/06/01}{\ActivateGenericHook} {Providing~hooks} @@ -7644,7 +7831,8 @@ of this package available from CTAN} \exp_args:No \exp_not:o { \cs:w __hook#1~#2 \exp_last_unbraced:Ne \cs_end: - { \__hook_braced_cs_parameter:n { __hook#1~#2 } } + { \__hook_braced_cs_parameter:n + { __hook#1~#2 } } } } } @@ -7659,12 +7847,10 @@ of this package available from CTAN} } \ExplSyntaxOff %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% File: ltcmdhooks.dtx +%% From File: ltcmdhooks.dtx %% Copyright (C) 2020-2024 %% Frank Mittelbach, Phelype Oleinik, The LaTeX Project -%%% From File: ltcmdhooks.dtx -\def\ltcmdhooksversion{v1.0i} -\def\ltcmdhooksdate{2023/06/16} +%%% From File: lthooks.dtx \ExplSyntaxOn \NewModuleRelease{2021/06/01}{ltcmdhooks} {The~hook~management~system~for~commands} @@ -7823,7 +8009,7 @@ of this package available from CTAN} \__hook_patch_debug:x { ++~command~can~be~patched~without~rescanning } \int_set:Nn \l__hook_patch_num_args_int { - \exp_args:Nf \str_count:n { \cs_argument_spec:N #2 } / 2 + \exp_args:Nf \str_count:n { \__kernel_cs_parameter_spec:N #2 } / 2 \bool_if:NT #1 { -1 } } \int_compare:nNnTF { \l__hook_patch_num_args_int } > { \c_zero_int } @@ -7898,7 +8084,7 @@ of this package available from CTAN} \__hook_patch_debug:x { ++~command~can~be~patched~without~rescanning } \int_set:Nn \l__hook_patch_num_args_int { - \exp_args:Nf \str_count:n { \cs_argument_spec:N #2 } / 2 + \exp_args:Nf \str_count:n { \__kernel_cs_parameter_spec:N #2 } / 2 \bool_if:NT #1 { -1 } } \int_compare:nNnTF { \l__hook_patch_num_args_int } > { \c_zero_int } @@ -8031,7 +8217,7 @@ of this package available from CTAN} { ~ \__hook_double_hashes:w } \cs_new_protected:Npn \__hook_retokenize_patch:Nnn #1 #2 #3 { - \str_if_eq:eeTF { \cs_argument_spec:N #1 } { } + \str_if_eq:eeTF { \__kernel_cs_parameter_spec:N #1 } { } { \__hook_patch_expand_redefine:NNnn \c_false_bool #1 {#2} {#3} } { \__hook_patch_debug:x { ..~command~can~only~be~patched~by~rescanning } @@ -8274,8 +8460,6 @@ of this package available from CTAN} \ExplSyntaxOff %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% From File: ltsockets.dtx -\def\ltsocketsversion{0.9a} -\def\ltsocketsdate{2023-08-21} \ExplSyntaxOn \NewModuleRelease{2023/11/01}{ltsockets} {The~socket~management~system} @@ -8465,6 +8649,1192 @@ of this package available from CTAN} \EndModuleRelease \ExplSyntaxOff %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% From File: lttemplates.dtx +\ExplSyntaxOn +\NewModuleRelease{2024/06/01}{lttemplates} + {Prototype~document~commands}% +\tl_const:Nn \c__template_code_root_tl { template~code~>~ } +\tl_const:Nn \c__template_defaults_root_tl { template~defaults~>~ } +\tl_const:Nn \c__template_instances_root_tl { template~instance~>~ } +\tl_const:Nn \c__template_keytypes_root_tl { template~key~types~>~ } +\tl_const:Nn \c__template_key_order_root_tl { template~key~order~>~ } +\tl_const:Nn \c__template_values_root_tl { template~values~>~ } +\tl_const:Nn \c__template_vars_root_tl { template~vars~>~ } +\seq_const_from_clist:Nn \c__template_keytypes_arg_seq + { choice , function , instance } +\prop_new:N \g__template_type_prop +\tl_new:N \l__template_assignments_tl +\tl_new:N \l__template_default_tl +\bool_new:N \l__template_error_bool +\bool_new:N \l__template_global_bool +\tl_new:N \l__template_key_name_tl +\tl_new:N \l__template_keytype_tl +\tl_new:N \l__template_keytype_arg_tl +\tl_new:N \l__template_value_tl +\tl_new:N \l__template_var_tl +\prop_new:N \l__template_keytypes_prop +\seq_new:N \l__template_key_order_seq +\prop_new:N \l__template_values_prop +\prop_new:N \l__template_vars_prop +\clist_new:N \l__template_tmp_clist +\dim_new:N \l__template_tmp_dim +\int_new:N \l__template_tmp_int +\muskip_new:N \l__template_tmp_muskip +\skip_new:N \l__template_tmp_skip +\tl_new:N \l__template_tmp_tl +\scan_new:N \s__template_mark +\scan_new:N \s__template_stop +\quark_new:N \q__template_nil +\__kernel_quark_new_conditional:Nn \__template_quark_if_nil:N { F } +\cs_new_protected:Npn \__template_execute_if_arg_agree:nnT #1#2#3 + { + \prop_get:NnN \g__template_type_prop {#1} \l__template_tmp_tl + \int_compare:nNnTF {#2} = \l__template_tmp_tl + {#3} + { + \msg_error:nneee { template } { argument-number-mismatch } + {#1} { \l__template_tmp_tl } {#2} + } + } +\cs_new_protected:Npn \__template_execute_if_code_exist:nnT #1#2#3 + { + \cs_if_exist:cTF { \c__template_code_root_tl #1 / #2 } + {#3} + { \msg_error:nnnn { template } { no-template-code } {#1} {#2} } + } +\cs_new_protected:Npn \__template_execute_if_keytype_exist:nT #1#2 + { + \cs_if_exist:cTF { __template_store_value_ #1 :n } + {#2} + { \msg_error:nnn { template } { unknown-keytype } {#1} } + } +\cs_generate_variant:Nn \__template_execute_if_keytype_exist:nT { V } +\cs_new_protected:Npn \__template_execute_if_type_exist:nT #1#2 + { + \prop_if_in:NnTF \g__template_type_prop {#1} + {#2} + { \msg_error:nnn { template } { unknown-type } {#1} } + } +\cs_new_protected:Npn \__template_if_keys_exist:nnT #1#2#3 + { + \cs_if_exist:cTF { \c__template_keytypes_root_tl #1 / #2 } + {#3} + { \msg_error:nnnn { template } { unknown-template } {#1} {#2} } + } +\prg_new_conditional:Npnn \__template_if_key_value:n #1 { T , F , TF } + { + \str_if_eq:noTF { \KeyValue } { \tl_head:w #1 \q_nil \q_stop } + \prg_return_true: + \prg_return_false: + } +\prg_generate_conditional_variant:Nnn \__template_if_key_value:n { V } { T , F , TF } +\prg_new_conditional:Npnn \__template_if_instance_exist:nn #1#2 { T, F, TF } + { + \cs_if_exist:cTF { \c__template_instances_root_tl #1 / #2 } + \prg_return_true: + \prg_return_false: + } +\prg_new_conditional:Npnn \__template_if_use_template:n #1 { TF } + { + \str_if_eq:noTF { \UseTemplate } { \tl_head:w #1 \q_nil \q_stop } + \prg_return_true: + \prg_return_false: +} +\cs_new_protected:Npn \__template_store_defaults:nn #1#2 + { + \debug_suspend: + \prop_gclear_new:c { \c__template_defaults_root_tl #1 / #2 } + \prop_gset_eq:cN { \c__template_defaults_root_tl #1 / #2 } + \l__template_values_prop + \debug_resume: + } +\cs_new_protected:Npn \__template_store_keytypes:nn #1#2 + { + \debug_suspend: + \prop_if_exist:cTF { \c__template_keytypes_root_tl #1 / #2 } + { + \msg_info:nnnn { template } { declare-template-interface } {#1} {#2} + \prop_gclear:c { \c__template_keytypes_root_tl #1 / #2 } + } + { \prop_new:c { \c__template_keytypes_root_tl #1 / #2 } } + \prop_gset_eq:cN { \c__template_keytypes_root_tl #1 / #2 } + \l__template_keytypes_prop + \seq_gclear_new:c { \c__template_key_order_root_tl #1 / #2 } + \seq_gset_eq:cN { \c__template_key_order_root_tl #1 / #2 } + \l__template_key_order_seq + \debug_resume: + } +\cs_new_protected:Npn \__template_store_values:nn #1#2 + { + \debug_suspend: + \prop_clear_new:c { \c__template_values_root_tl #1 / #2 } + \prop_set_eq:cN { \c__template_values_root_tl #1 / #2 } + \l__template_values_prop + \debug_resume: + } +\cs_new_protected:Npn \__template_store_vars:nn #1#2 + { + \debug_suspend: + \prop_gclear_new:c { \c__template_vars_root_tl #1 / #2 } + \prop_gset_eq:cN { \c__template_vars_root_tl #1 / #2 } + \l__template_vars_prop + \debug_resume: + } +\cs_new_protected:Npn \__template_recover_defaults:nn #1#2 + { + \prop_if_exist:cTF + { \c__template_defaults_root_tl #1 / #2 } + { + \prop_set_eq:Nc \l__template_values_prop + { \c__template_defaults_root_tl #1 / #2 } + } + { \prop_clear:N \l__template_values_prop } + } +\cs_new_protected:Npn \__template_recover_keytypes:nn #1#2 + { + \prop_if_exist:cTF + { \c__template_keytypes_root_tl #1 / #2 } + { + \prop_set_eq:Nc \l__template_keytypes_prop + { \c__template_keytypes_root_tl #1 / #2 } + } + { \prop_clear:N \l__template_keytypes_prop } + \seq_if_exist:cTF { \c__template_key_order_root_tl #1 / #2 } + { + \seq_set_eq:Nc \l__template_key_order_seq + { \c__template_key_order_root_tl #1 / #2 } + } + { \seq_clear:N \l__template_key_order_seq } + } +\cs_new_protected:Npn \__template_recover_values:nn #1#2 + { + \prop_if_exist:cTF + { \c__template_values_root_tl #1 / #2 } + { + \prop_set_eq:Nc \l__template_values_prop + { \c__template_values_root_tl #1 / #2 } + } + { \prop_clear:N \l__template_values_prop } + } +\cs_new_protected:Npn \__template_recover_vars:nn #1#2 + { + \prop_if_exist:cTF + { \c__template_vars_root_tl #1 / #2 } + { + \prop_set_eq:Nc \l__template_vars_prop + { \c__template_vars_root_tl #1 / #2 } + } + { \prop_clear:N \l__template_vars_prop } + } +\cs_new_protected:Npn \__template_define_type:nn #1#2 + { + \prop_if_in:NnTF \g__template_type_prop {#1} + { \msg_error:nnn { template } { type-already-defined } {#1} } + { \__template_declare_type:nn {#1} {#2} } + } +\cs_new_protected:Npn \__template_declare_type:nn #1#2 + { + \int_set:Nn \l__template_tmp_int {#2} + \int_compare:nTF { 0 <= \l__template_tmp_int <= 9 } + { + \msg_info:nnnV { template } { declare-type } + {#1} \l__template_tmp_int + \prop_gput:NnV \g__template_type_prop {#1} + \l__template_tmp_int + } + { + \msg_error:nnnV { template } { bad-number-of-arguments } + {#1} \l__template_tmp_int + } + } +\cs_new_protected:Npn \__template_declare_template_keys:nnnn #1#2#3#4 + { + \__template_execute_if_type_exist:nT {#1} + { + \__template_execute_if_arg_agree:nnT {#1} {#3} + { + \prop_clear:N \l__template_values_prop + \prop_clear:N \l__template_keytypes_prop + \seq_clear:N \l__template_key_order_seq + \keyval_parse:NNn + \__template_parse_keys_elt:n \__template_parse_keys_elt:nn {#4} + \__template_store_defaults:nn {#1} {#2} + \__template_store_keytypes:nn {#1} {#2} + } + } + } +\cs_new_protected:Npn \__template_parse_keys_elt:n #1 + { + \__template_split_keytype:n {#1} + \bool_if:NF \l__template_error_bool + { + \__template_execute_if_keytype_exist:VT \l__template_keytype_tl + { + \seq_map_function:NN \c__template_keytypes_arg_seq + \__template_parse_keys_elt_aux:n + \bool_if:NF \l__template_error_bool + { + \seq_if_in:NoTF \l__template_key_order_seq + \l__template_key_name_tl + { + \msg_error:nnV { template } { duplicate-key-interface } + \l__template_key_name_tl + } + { \__template_parse_keys_elt_aux: } + } + } + } + } +\cs_new_protected:Npn \__template_parse_keys_elt_aux:n #1 + { + \str_if_eq:VnT \l__template_keytype_tl {#1} + { + \tl_if_empty:NT \l__template_keytype_arg_tl + { + \msg_error:nnn { template } { keytype-requires-argument } {#1} + \bool_set_true:N \l__template_error_bool + \seq_map_break: + } + } + } +\cs_new_protected:Npn \__template_parse_keys_elt_aux: + { + \tl_set:Ne \l__template_tmp_tl + { + \l__template_keytype_tl + \tl_if_empty:NF \l__template_keytype_arg_tl + { { \l__template_keytype_arg_tl } } + } + \prop_put:NVV \l__template_keytypes_prop \l__template_key_name_tl + \l__template_tmp_tl + \seq_put_right:NV \l__template_key_order_seq \l__template_key_name_tl + \str_if_eq:VnT \l__template_keytype_tl { choice } + { + \clist_if_in:NnT \l__template_keytype_arg_tl { unknown } + { \msg_error:nn { template } { choice-unknown-reserved } } + } + } +\cs_new_protected:Npn \__template_parse_keys_elt:nn #1#2 + { + \__template_parse_keys_elt:n {#1} + \use:c { __template_store_value_ \l__template_keytype_tl :n } {#2} + } +\cs_new_protected:Npe \__template_split_keytype:n #1 + { + \exp_not:N \bool_set_false:N \exp_not:N \l__template_error_bool + \tl_set:Nn \exp_not:N \l__template_tmp_tl {#1} + \tl_replace_all:Nnn \exp_not:N \l__template_tmp_tl { : } { \token_to_str:N : } + \tl_if_in:VnTF \exp_not:N \l__template_tmp_tl { \token_to_str:N : } + { + \exp_not:n + { + \tl_clear:N \l__template_key_name_tl + \exp_after:wN \__template_split_keytype_aux:w + \l__template_tmp_tl \s__template_stop + } + } + { + \exp_not:N \bool_set_true:N \exp_not:N \l__template_error_bool + \msg_error:nnn { template } { missing-keytype } {#1} + } + } +\use:e + { + \cs_new_protected:Npn \exp_not:N \__template_split_keytype_aux:w + #1 \token_to_str:N : #2 \s__template_stop + { + \tl_put_right:Ne \exp_not:N \l__template_key_name_tl + { + \exp_not:N \tl_trim_spaces:e + { \exp_not:N \tl_to_str:n {#1} } + } + \tl_if_in:nnTF {#2} { \token_to_str:N : } + { + \tl_put_right:Nn \exp_not:N \l__template_key_name_tl + { \token_to_str:N : } + \exp_not:N \__template_split_keytype_aux:w #2 \s__template_stop + } + { + \exp_not:N \tl_if_empty:NTF \exp_not:N \l__template_key_name_tl + { + \msg_error:nnn { template } { empty-key-name } + { \token_to_str:N : #2 } + } + { \exp_not:N \__template_split_keytype_arg:n {#2} } + } + } + } +\cs_new_protected:Npn \__template_split_keytype_arg:n #1 + { + \tl_set:Ne \l__template_keytype_tl { \tl_trim_spaces:n {#1} } + \tl_clear:N \l__template_keytype_arg_tl + \cs_set_protected:Npn \__template_split_keytype_arg_aux:n ##1 + { + \tl_if_in:nnT {#1} {##1} + { + \cs_set:Npn \__template_split_keytype_arg_aux:w + ####1 ##1 ####2 \s__template_stop + { + \tl_if_blank:nT {####1} + { + \tl_set:Ne \l__template_keytype_tl + { \tl_trim_spaces:n {##1} } + \tl_if_blank:nF {####2} + { + \tl_set:Ne \l__template_keytype_arg_tl + { \use:n ####2 } + } + \seq_map_break: + } + } + \__template_split_keytype_arg_aux:w #1 \s__template_stop + } + } + \seq_map_function:NN \c__template_keytypes_arg_seq + \__template_split_keytype_arg_aux:n + } +\cs_generate_variant:Nn \__template_split_keytype_arg:n { V } +\cs_new:Npn \__template_split_keytype_arg_aux:n #1 { } +\cs_new:Npn \__template_split_keytype_arg_aux:w #1 \s__template_stop { } +\cs_new_protected:Npn \__template_store_value_boolean:n #1 + { \prop_put:Non \l__template_values_prop \l__template_key_name_tl {#1} } +\cs_new_protected:Npn \__template_store_value:n #1 + { \prop_put:Non \l__template_values_prop \l__template_key_name_tl {#1} } +\cs_new_eq:NN \__template_store_value_choice:n \__template_store_value:n +\cs_new_eq:NN \__template_store_value_function:n \__template_store_value:n +\cs_new_eq:NN \__template_store_value_instance:n \__template_store_value:n +\cs_new_protected:Npn \__template_store_value_aux:Nn #1#2 + { \prop_put:Non \l__template_values_prop \l__template_key_name_tl {#2} } +\cs_new_protected:Npn \__template_store_value_integer:n + { \__template_store_value_aux:Nn \int_eval:n } +\cs_new_protected:Npn \__template_store_value_length:n + { \__template_store_value_aux:Nn \dim_eval:n } +\cs_new_protected:Npn \__template_store_value_muskip:n + { \__template_store_value_aux:Nn \muskip_eval:n } +\cs_new_protected:Npn \__template_store_value_real:n + { \__template_store_value_aux:Nn \fp_eval:n } +\cs_new_protected:Npn \__template_store_value_skip:n + { \__template_store_value_aux:Nn \skip_eval:n } +\cs_new_protected:Npn \__template_store_value_tokenlist:n + { \__template_store_value_aux:Nn \use:n } +\cs_new_eq:NN \__template_store_value_commalist:n \__template_store_value_tokenlist:n +\cs_new_protected:Npn \__template_declare_template_code:nnnnn #1#2#3#4#5 + { + \__template_execute_if_type_exist:nT {#1} + { + \__template_execute_if_arg_agree:nnT {#1} {#3} + { + \__template_if_keys_exist:nnT {#1} {#2} + { + \__template_store_key_implementation:nnn {#1} {#2} {#4} + \regex_match:nnTF { \c { AssignTemplateKeys } } {#5} + { \__template_declare_template_code:nnnn {#1} {#2} {#3} {#5} } + { + \__template_declare_template_code:nnnn + {#1} {#2} {#3} { \AssignTemplateKeys #5 } + } + } + } + } + } +\cs_new_protected:Npn \__template_declare_template_code:nnnn #1#2#3#4 + { + \cs_if_exist:cT { \c__template_code_root_tl #1 / #2 } + { \msg_info:nnnn { template } { declare-template-code } {#1} {#2} } + \cs_generate_from_arg_count:cNnn + { \c__template_code_root_tl #1 / #2 } + \cs_gset_protected:Npn {#3} {#4} + } +\cs_new_protected:Npn \__template_store_key_implementation:nnn #1#2#3 + { + \__template_recover_defaults:nn {#1} {#2} + \__template_recover_keytypes:nn {#1} {#2} + \prop_clear:N \l__template_vars_prop + \keyval_parse:nnn + { \__template_parse_vars_elt:n } { \__template_parse_vars_elt:nnn { #1 / #2 } } {#3} + \__template_store_vars:nn {#1} {#2} + \prop_map_inline:Nn \l__template_keytypes_prop + { \msg_error:nnnnn { template } { key-not-implemented } {##1} {#2} {#1} } + } +\cs_new_protected:Npn \__template_parse_vars_elt:n #1 + { \msg_error:nnn { template } { key-no-variable } {#1} } +\cs_new_protected:Npn \__template_parse_vars_elt:nnn #1#2#3 + { + \tl_set:Ne \l__template_key_name_tl + { \tl_trim_spaces:e { \tl_to_str:n {#2} } } + \prop_get:NVNTF \l__template_keytypes_prop + \l__template_key_name_tl + \l__template_keytype_tl + { + \__template_split_keytype_arg:V \l__template_keytype_tl + \__template_parse_vars_elt_aux:nn {#1} {#3} + \prop_remove:NV \l__template_keytypes_prop \l__template_key_name_tl + } + { \msg_error:nnn { template } { unknown-key } {#2} } + } +\cs_new_protected:Npn \__template_parse_vars_elt_aux:nn #1#2 + { + \__template_parse_vars_elt_aux:nw {#1} #2 global global \s__template_stop + } +\cs_new_protected:Npn \__template_parse_vars_elt_aux:nw + #1#2 global #3 global #4 \s__template_stop + { + \tl_if_blank:nTF {#4} + { \__template_parse_vars_elt_aux:nnn {#1} { } {#2} } + { + \tl_if_blank:nTF {#2} + { + \__template_parse_vars_elt_aux:nne + {#1} { global } { \tl_trim_spaces:n {#3} } + } + { \msg_error:nnn { template } { bad-variable } { #2 global #3 } } + } + } +\cs_new_protected:Npn \__template_parse_vars_elt_aux:nnn #1#2#3 + { + \str_case:VnF \l__template_keytype_tl + { + { choice } { \__template_implement_choices:nn {#1} {#3} } + { function } + { + \cs_if_exist:NF #3 + { \cs_new:Npn #3 { } } + \__template_parse_vars_elt_key:nn {#1} + { + .code:n = + { + \cs_generate_from_arg_count:NNnn + \exp_not:N #3 + \exp_not:c + { cs_ \str_if_eq:nnT {#1} { global } { g } set:Npn } + { \exp_not:V \l__template_keytype_arg_tl } + {##1} + } + } + \prop_put:NVn \l__template_vars_prop + \l__template_key_name_tl {#2#3} + } + { instance } + { + \__template_parse_vars_elt_key:nn {#1} + { + .code:n = + { + \exp_not:c + { cs_ \str_if_eq:nnT {#1} { global } { g } set:Npn } + \exp_not:N #3 { \UseInstance {##1} } + } + } + \prop_put:NVn \l__template_vars_prop + \l__template_key_name_tl {#2#3} + } + } + { + \tl_if_single:nTF {#3} + { + \cs_if_exist:NF #3 + { \use:c { \__template_map_var_type: _new:N } #3 } + \__template_parse_vars_elt_key:nn {#1} + { + . \__template_map_var_type: + _ \str_if_eq:nnT {#1} { global } { g } set:N + = \exp_not:N #3 + } + \prop_put:NVn \l__template_vars_prop + \l__template_key_name_tl {#2#3} + } + { \msg_error:nnn { template } { bad-variable } {#2#3} } + } + } +\cs_generate_variant:Nn \__template_parse_vars_elt_aux:nnn { nne } +\cs_new_protected:Npn \__template_parse_vars_elt_key:nn #1#2 + { + \keys_define:ne { template / #1 } + { \l__template_key_name_tl #2 } + } +\cs_new:Npn \__template_map_var_type: + { + \str_case:Vn \l__template_keytype_tl + { + { boolean } { bool } + { commalist } { clist } + { integer } { int } + { length } { dim } + { muskip } { muskip } + { real } { fp } + { skip } { skip } + { tokenlist } { tl } + } + } +\cs_new_protected:Npn \__template_implement_choices:nn #1#2 + { + \clist_set:NV \l__template_tmp_clist \l__template_keytype_arg_tl + \prop_put:NVn \l__template_vars_prop \l__template_key_name_tl { } + \keys_define:ne { template / #1 } { \l__template_key_name_tl .choice: } + \keyval_parse:nnn + { \__template_implement_choice_elt:n } + { \__template_implement_choice_elt:nnn {#1} } + {#2} + \prop_get:NVNT \l__template_values_prop \l__template_key_name_tl + \l__template_tmp_tl + { \__template_implement_choices_default: } + \clist_if_empty:NF \l__template_tmp_clist + { + \clist_map_inline:Nn \l__template_tmp_clist + { \msg_error:nnn { template } { choice-not-implemented } {##1} } + } + } +\cs_new_protected:Npn \__template_implement_choices_default: + { + \tl_set:Ne \l__template_tmp_tl + { \l__template_key_name_tl \c_space_tl \l__template_tmp_tl } + \prop_if_in:NVF \l__template_vars_prop \l__template_tmp_tl + { + \tl_set:Ne \l__template_tmp_tl + { \l__template_key_name_tl \c_space_tl \l__template_tmp_tl } + \prop_if_in:NVF \l__template_vars_prop \l__template_tmp_tl + { + \prop_get:NVN \l__template_keytypes_prop \l__template_key_name_tl + \l__template_tmp_tl + \__template_split_keytype_arg:V \l__template_tmp_tl + \prop_get:NVN \l__template_values_prop \l__template_key_name_tl + \l__template_tmp_tl + \msg_error:nnVV { template } { unknown-default-choice } + \l__template_key_name_tl + \l__template_key_name_tl + } + } + } +\cs_new_protected:Npn \__template_implement_choice_elt:nnn #1#2#3 + { + \clist_if_empty:NTF \l__template_tmp_clist + { + \str_if_eq:nnTF {#2} { unknown } + { \__template_implement_choice_elt_aux:nnn {#1} {#2} {#3} } + { \__template_implement_choice_elt_aux:n {#2} } + } + { + \clist_if_in:NnTF \l__template_tmp_clist {#2} + { + \clist_remove_all:Nn \l__template_tmp_clist {#2} + \__template_implement_choice_elt_aux:nnn {#1} {#2} {#3} + } + { \__template_implement_choice_elt_aux:n {#2} } + } + } +\cs_new_protected:Npn \__template_implement_choice_elt_aux:n #1 + { + \prop_get:NVN \l__template_keytypes_prop \l__template_key_name_tl + \l__template_tmp_tl + \__template_split_keytype_arg:V \l__template_tmp_tl + \msg_error:nnVn { template } { unknown-choice } \l__template_key_name_tl {#1} + } +\cs_new_protected:Npn \__template_implement_choice_elt_aux:nnn #1#2#3 + { + \keys_define:ne { template / #1 } + { \l__template_key_name_tl / #2 .code:n = { \exp_not:n {#3} } } + \tl_set:Ne \l__template_tmp_tl + { \l__template_key_name_tl \c_space_tl #2 } + \prop_put:NVn \l__template_vars_prop \l__template_tmp_tl {#3} + } +\cs_new_protected:Npn \__template_implement_choice_elt:n #1 + { + \msg_error:nnVn { template } { choice-requires-code } + \l__template_key_name_tl {#1} + } +\cs_new_protected:Npn \__template_edit_defaults:nnn #1#2#3 + { + \__template_if_keys_exist:nnT {#1} {#2} + { + \__template_recover_defaults:nn {#1} {#2} + \__template_parse_values:nnn {#1} {#2} {#3} + \__template_store_defaults:nn {#1} {#2} + } + } +\cs_new_protected:Npn \__template_parse_values:nnn #1#2#3 + { + \__template_recover_keytypes:nn {#1} {#2} + \keyval_parse:NNn + \__template_parse_values_elt:n \__template_parse_values_elt:nn {#3} + } +\cs_new_protected:Npn \__template_parse_values_elt:n #1 + { + \bool_set_true:N \l__template_error_bool + \msg_error:nnn { template } { key-no-value } {#1} + } +\cs_new_protected:Npn \__template_parse_values_elt:nn #1#2 + { + \tl_set:Ne \l__template_key_name_tl + { \tl_trim_spaces:e { \tl_to_str:n {#1} } } + \prop_get:NVNTF \l__template_keytypes_prop \l__template_key_name_tl + \l__template_tmp_tl + { \__template_parse_values_elt_aux:n {#2} } + { \msg_error:nnV { template } { unknown-key } \l__template_key_name_tl } + } +\cs_new_protected:Npn \__template_parse_values_elt_aux:n #1 + { + \__template_split_keytype_arg:V \l__template_tmp_tl + \use:c { __template_store_value_ \l__template_keytype_tl :n } {#1} + } +\cs_new_protected:Npn \__template_template_set_eq:nnn #1#2#3 + { + \__template_recover_defaults:nn {#1} {#3} + \__template_store_defaults:nn {#1} {#2} + \__template_recover_keytypes:nn {#1} {#3} + \__template_store_keytypes:nn {#1} {#2} + \__template_recover_vars:nn {#1} {#3} + \__template_store_vars:nn {#1} {#2} + \cs_if_exist:cT { \c__template_code_root_tl #1 / #2 } + { \msg_info:nnnn { template } { declare-template-code } {#1} {#2} } + \cs_gset_eq:cc { \c__template_code_root_tl #1 / #2 } + { \c__template_code_root_tl #1 / #3 } + } +\cs_new_protected:Npn \__template_declare_instance:nnnn #1#2#3#4 + { + \__template_execute_if_code_exist:nnT {#1} {#2} + { + \__template_recover_defaults:nn {#1} {#2} + \__template_recover_vars:nn {#1} {#2} + \__template_declare_instance_aux:nnnn {#1} {#2} {#3} {#4} + } + } +\cs_new_protected:Npn \__template_declare_instance_aux:nnnn #1#2#3#4 + { + \bool_set_false:N \l__template_error_bool + \__template_parse_values:nnn {#1} {#2} {#4} + \bool_if:NF \l__template_error_bool + { + \prop_put:Nnn \l__template_values_prop { from~template } {#2} + \__template_store_values:nn {#1} {#3} + \__template_convert_to_assignments: + \cs_if_exist:cT { \c__template_instances_root_tl #1 / #3 } + { \msg_info:nnnn { template } { declare-instance } {#3} {#1} } + \cs_set_protected:cpe { \c__template_instances_root_tl #1 / #3 } + { + \exp_not:N \__template_assignments_push:n + { \exp_not:V \l__template_assignments_tl } + \exp_not:c { \c__template_code_root_tl #1 / #2 } + } + } + } +\cs_new_protected:Npn \__template_instance_set_eq:nnn #1#2#3 + { + \__template_if_instance_exist:nnTF {#1} {#3} + { + \__template_recover_values:nn {#1} {#3} + \__template_store_values:nn {#1} {#2} + \cs_if_exist:cT { \c__template_instances_root_tl #1 / #2 } + { \msg_info:nnnn { template } { declare-instance } {#2} {#1} } + \cs_set_eq:cc { \c__template_instances_root_tl #1 / #2 } + { \c__template_instances_root_tl #1 / #3 } + } + { \msg_error:nnnn { template } { unknown-instance } {#1} {#3} } + } +\cs_new_protected:Npn \__template_edit_instance:nnn #1#2#3 + { + \__template_if_instance_exist:nnTF {#1} {#2} + { + \__template_recover_values:nn {#1} {#2} + \prop_get:NnN \l__template_values_prop { from~template } + \l__template_tmp_tl + \__template_edit_instance_aux:nVnn + {#1} \l__template_tmp_tl {#2} {#3} + } + { \msg_error:nnnn { template } { unknown-instance } {#1} {#2} } + } +\cs_new_protected:Npn \__template_edit_instance_aux:nnnn #1#2#3#4 + { + \__template_recover_vars:nn {#1} {#2} + \__template_declare_instance_aux:nnnn {#1} {#2} {#3} {#4} + } +\cs_generate_variant:Nn \__template_edit_instance_aux:nnnn { nV } +\cs_new_protected:Npn \__template_convert_to_assignments: + { + \tl_clear:N \l__template_assignments_tl + \seq_map_function:NN \l__template_key_order_seq + \__template_convert_to_assignments_aux:n + } +\cs_new_protected:Npn \__template_convert_to_assignments_aux:n #1 + { + \prop_get:NnN \l__template_keytypes_prop {#1} \l__template_tmp_tl + \__template_convert_to_assignments_aux:nV {#1} \l__template_tmp_tl + } +\cs_new_protected:Npn \__template_convert_to_assignments_aux:nn #1#2 + { + \prop_get:NnNT \l__template_values_prop {#1} \l__template_value_tl + { + \prop_get:NnNTF \l__template_vars_prop {#1} \l__template_var_tl + { + \__template_split_keytype_arg:n {#2} + \str_if_eq:VnF \l__template_keytype_tl { choice } + { + \str_if_eq:VnF \l__template_keytype_tl { code } + { \__template_find_global: } + } + \tl_set:Nn \l__template_key_name_tl {#1} + \cs_if_exist_use:cF { __template_assign_ \l__template_keytype_tl : } + { \__template_assign_variable: } + } + { \msg_error:nnn { template } { unknown-attribute } {#1} } + } + } +\cs_generate_variant:Nn \__template_convert_to_assignments_aux:nn { nV } +\cs_new_protected:Npn \__template_find_global: + { + \bool_set_false:N \l__template_global_bool + \tl_if_in:onT \l__template_var_tl { global } + { + \exp_after:wN \__template_find_global_aux:w \l__template_var_tl \s__template_stop + } + } +\cs_new_protected:Npn \__template_find_global_aux:w #1 global #2 \s__template_stop + { + \tl_set:Nn \l__template_var_tl {#2} + \bool_set_true:N \l__template_global_bool + } +\cs_new_protected:Npn \__template_use_template:nnn #1#2#3 + { + \__template_execute_if_code_exist:nnT {#1} {#2} + { + \__template_recover_defaults:nn {#1} {#2} + \__template_recover_vars:nn {#1} {#2} + \__template_parse_values:nnn {#1} {#2} {#3} + \__template_convert_to_assignments: + \use:c { \c__template_code_root_tl #1 / #2 } + } + } +\cs_new_protected:Npn \__template_assign_boolean: + { + \bool_if:NTF \l__template_global_bool + { \__template_assign_boolean_aux:n { bool_gset } } + { \__template_assign_boolean_aux:n { bool_set } } + } +\cs_new_protected:Npn \__template_assign_boolean_aux:n #1 + { + \__template_if_key_value:VTF \l__template_value_tl + { + \__template_key_to_value: + \tl_put_right:Ne \l__template_assignments_tl + { + \exp_not:c { #1 _eq:NN } + \exp_not:V \l__template_var_tl + \exp_not:V \l__template_value_tl + } + } + { + \tl_put_right:Ne \l__template_assignments_tl + { + \exp_not:c { #1 _ \l__template_value_tl :N } + \exp_not:V \l__template_var_tl + } + } + } +\cs_new_protected:Npn \__template_assign_choice: + { + \__template_assign_choice_aux:eF + { \l__template_key_name_tl \c_space_tl \l__template_value_tl } + { + \__template_assign_choice_aux:eF + { \l__template_key_name_tl \c_space_tl unknown } + { + \prop_get:NVN \l__template_keytypes_prop \l__template_key_name_tl + \l__template_tmp_tl + \__template_split_keytype_arg:V \l__template_tmp_tl + \msg_error:nnVV { template } { unknown-choice } + \l__template_key_name_tl + \l__template_value_tl + } + } + } +\cs_new_protected:Npn \__template_assign_choice_aux:nF #1 + { + \prop_get:NnNTF \l__template_vars_prop {#1} \l__template_tmp_tl + { \tl_put_right:NV \l__template_assignments_tl \l__template_tmp_tl } + } +\cs_generate_variant:Nn \__template_assign_choice_aux:nF { e } +\cs_new_protected:Npn \__template_assign_function: + { + \bool_if:NTF \l__template_global_bool + { \__template_assign_function_aux:N \cs_gset:Npn } + { \__template_assign_function_aux:N \cs_set:Npn } + } +\cs_new_protected:Npn \__template_assign_function_aux:N #1 + { + \tl_put_right:Ne \l__template_assignments_tl + { + \cs_generate_from_arg_count:NNnn + \exp_not:V \l__template_var_tl + \exp_not:N #1 + { \exp_not:V \l__template_keytype_arg_tl } + { \exp_not:V \l__template_value_tl } + } + } +\cs_new_protected:Npn \__template_assign_instance: + { + \bool_if:NTF \l__template_global_bool + { \__template_assign_instance_aux:N \cs_gset_protected:Npn } + { \__template_assign_instance_aux:N \cs_set_protected:Npn } + } +\cs_new_protected:Npn \__template_assign_instance_aux:N #1 + { + \tl_put_right:Ne \l__template_assignments_tl + { + \exp_not:N #1 \exp_not:V \l__template_var_tl + { + \__template_use_instance:nn + { \exp_not:V \l__template_keytype_arg_tl } + { \exp_not:V \l__template_value_tl } + } + } + } +\cs_new_protected:Npn \__template_assign_variable: + { + \__template_assign_variable:c + { + \__template_map_var_type: _ + \bool_if:NT \l__template_global_bool { g } set:Nn + } + } +\cs_new_protected:Npn \__template_assign_variable:N #1 + { + \__template_if_key_value:VT \l__template_value_tl + { \__template_key_to_value: } + \tl_put_right:Ne \l__template_assignments_tl + { + #1 \exp_not:V \l__template_var_tl + { \exp_not:V \l__template_value_tl } + } + } +\cs_generate_variant:Nn \__template_assign_variable:N { c } +\cs_new_protected:Npn \__template_key_to_value: + { \exp_after:wN \__template_key_to_value_auxi:w \l__template_value_tl } +\cs_new_protected:Npn \__template_key_to_value_auxi:w \KeyValue #1 + { + \tl_set:Ne \l__template_tmp_tl { \tl_trim_spaces:e { \tl_to_str:n {#1} } } + \prop_get:NVNTF \l__template_vars_prop \l__template_tmp_tl + \l__template_value_tl + { + \exp_after:wN \__template_key_to_value_auxii:w \l__template_value_tl + \s__template_mark global \q__template_nil \s__template_stop + } + { \msg_error:nnV { template } { unknown-attribute } \l__template_tmp_tl } + } +\cs_new_protected:Npn \__template_key_to_value_auxii:w #1 global #2#3 \s__template_stop + { + \__template_quark_if_nil:NF #2 + { \tl_set:Nn \l__template_value_tl {#2} } + } +\cs_new_protected:Npn \__template_use_instance:nn #1#2 + { + \__template_if_use_template:nTF {#2} + { \__template_use_instance_aux:nNnnn {#1} #2 } + { \__template_use_instance_aux:nn {#1} {#2} } + } +\cs_new_protected:Npn \__template_use_instance_aux:nNnnn #1#2#3#4#5 + { + \str_if_eq:nnTF {#1} {#3} + { \__template_use_template:nnn {#3} {#4} {#5} } + { \msg_error:nnnn { template } { type-mismatch } {#1} {#3} } +} +\cs_new_protected:Npn \__template_use_instance_aux:nn #1#2 + { + \__template_if_instance_exist:nnTF {#1} {#2} + { \use:c { \c__template_instances_root_tl #1 / #2 } } + { \msg_error:nnnn { template } { unknown-instance } {#1} {#2} } + } +\cs_new:Npn \__template_assignments_pop: { \l__template_assignments_tl } +\cs_new_protected:Npn \__template_assignments_push:n #1 + { \tl_set:Nn \l__template_assignments_tl {#1} } +\cs_new_protected:Npn \__template_show_code:nn #1#2 + { \cs_show:c { \c__template_code_root_tl #1 / #2 } } +\cs_new_protected:Npn \__template_show_defaults:nn #1#2 + { + \__template_if_keys_exist:nnT {#1} {#2} + { + \__template_recover_defaults:nn {#1} {#2} + \__template_show:Nnnn \l__template_values_prop + {#1} {#2} { default~values } + } + } +\cs_new_protected:Npn \__template_show_keytypes:nn #1#2 + { + \__template_if_keys_exist:nnT {#1} {#2} + { + \__template_recover_keytypes:nn {#1} {#2} + \__template_show:Nnnn \l__template_keytypes_prop + {#1} {#2} { interface } + } + } +\cs_new_protected:Npn \__template_show_vars:nn #1#2 + { + \__template_execute_if_code_exist:nnT {#1} {#2} + { + \__template_recover_vars:nn {#1} {#2} + \__template_show:Nnnn \l__template_vars_prop + {#1} {#2} { variable~mapping } + } + } +\cs_new_protected:Npn \__template_show:Nnnn #1#2#3#4 + { + \msg_show:nneeee { template } { show-attribute } + { \tl_to_str:n {#2} } + { \tl_to_str:n {#3} } + { \tl_to_str:n {#4} } + { \prop_map_function:NN #1 \msg_show_item_unbraced:nn } + } +\cs_new_protected:Npn \__template_show_values:nn #1#2 + { + \__template_if_instance_exist:nnT {#1} {#2} + { + \__template_recover_values:nn {#1} {#2} + \msg_show:nneee { template } { show-values } + { \tl_to_str:n {#1} } + { \tl_to_str:n {#2} } + { + \prop_map_function:NN \l__template_values_prop + \msg_show_item_unbraced:nn + } + } + } +\msg_new:nnnn { template } { argument-number-mismatch } + { Template~type~'#1'~takes~#2~argument(s). } + { + Templates~of~type~'#1'~require~#2~argument(s).\\ + You~have~tried~to~make~a~template~for~'#1'~ + with~#3~argument(s),~which~is~not~possible:~ + the~number~of~arguments~must~agree. + } +\msg_new:nnnn { template } { bad-number-of-arguments } + { Bad~number~of~arguments~for~template~type~'#1'. } + { + A~template~may~accept~between~0~and~9~arguments.\\ + You~asked~to~use~#2~arguments:~this~is~not~supported. + } +\msg_new:nnnn { template } { bad-variable } + { Incorrect~variable~description~'#1'. } + { + The~argument~'#1'~is~not~of~the~form \\ + ~~'<variable>'\\ + ~or~\\ + ~~'global~<variable>'.\\ + It~must~be~given~in~one~of~these~formats~to~be~used~in~a~template. + } +\msg_new:nnnn { template } { choice-not-implemented } + { The~choice~'#1'~has~no~implementation. } + { + Each~choice~listed~in~the~interface~for~a~template~must~ + have~an~implementation. + } +\msg_new:nnnn { template } { choice-no-code } + { The~choice~'#1'~requires~implementation~details. } + { + When~creating~template~code~using~\DeclareTemplateCode,~ + each~choice~name~must~have~an~associated~implementation.\\ + This~should~be~given~after~a~'='~sign:~LaTeX~did~not~find~one. + } +\msg_new:nnnn { template } { choice-requires-code } + { The~choice~'#2'~for~key~'#1'~requires~an~implementation. } + { + You~should~have~put:\\ + \ \ #1~:~choice~{~#2 = <code> ~} \\ + but~LaTeX~did~not~find~any~<code>. + } +\msg_new:nnnn { template } { duplicate-key-interface } + { Key~'#1'~appears~twice~in~interface~definition~\msg_line_context:. } + { + Each~key~can~only~have~one~interface~declared~in~a~template.\\ + LaTeX~found~two~interfaces~for~'#1'. + } +\msg_new:nnnn { template } { keytype-requires-argument } + { The~key~type~'#1'~requires~an~argument~\msg_line_context:. } + { + You~should~have~put:\\ + \ \ <key-name>~:~#1~{~<argument>~} \\ + but~LaTeX~did~not~find~an~<argument>. + } +\msg_new:nnnn { template } { invalid-keytype } + { The~key~'#1'~is~missing~a~key-type~\msg_line_context:. } + { + Each~key~in~a~template~requires~a~key-type,~given~in~the~form:\\ + \ \ <key>~:~<key-type>\\ + LaTeX~could~not~find~a~<key-type>~in~your~input. + } +\msg_new:nnnn { template } { key-no-value } + { The~key~'#1'~has~no~value~\msg_line_context:. } + { + When~creating~an~instance~of~a~template~ + every~key~listed~must~include~a~value:\\ + \ \ <key>~=~<value> + } +\msg_new:nnnn { template } { key-no-variable } + { The~key~'#1'~requires~implementation~details~\msg_line_context:. } + { + When~creating~template~code~using~\DeclareTemplateCode,~ + each~key~name~must~have~an~associated~implementation.\\ + This~should~be~given~after~a~'='~sign:~LaTeX~did~not~find~one. + } +\msg_new:nnnn { template } { key-not-implemented } + { Key~'#1'~has~no~implementation~\msg_line_context:. } + { + The~definition~of~key~implementations~for~template~'#2'~ + of~template~type~'#3'~does~not~include~any~details~for~key~'#1'.\\ + The~key~was~declared~in~the~interface~definition,~ + and~so~an~implementation~is~required. + } +\msg_new:nnnn { template } { missing-keytype } + { The~key~'#1'~is~missing~a~key-type~\msg_line_context:. } + { + Key~interface~definitions~should~be~of~the~form\\ + \ \ #1~:~<key-type>\\ + but~LaTeX~could~not~find~a~<key-type>. + } +\msg_new:nnnn { template } { no-template-code } + { + The~template~'#2'~of~type~'#1'~is~unknown~ + or~has~no~implementation. + } + { + There~is~no~code~available~for~the~template~name~given.\\ + This~should~be~given~using~\DeclareTemplateCode. + } +\msg_new:nnnn { template } { type-already-defined } + { Template~type~'#1'~already~defined. } + { + You~have~used~\NewTemplateType~ + with~a~template~type~that~has~already~been~defined. + } +\msg_new:nnnn { template } { type-mismatch } + { Template~types~'#1'~and~'#2'~do~not~agree. } + { + You~are~trying~to~use~a~template~directly~with~\UseInstance + (or~a~similar~function),~but~the~template~types~do~not~match. + } +\msg_new:nnnn { template } { unknown-attribute } + { The~template~attribute~'#1'~is~unknown. } + { + There~is~a~definition~in~the~current~template~reading\\ + \ \ \token_to_str:N \KeyValue {~#1~} \\ + but~there~is~no~key~called~'#1'. + } +\msg_new:nnnn { template } { unknown-choice } + { The~choice~'#2'~was~not~declared~for~key~'#1'. } + { + The~key~'#1'~takes~a~fixed~list~of~choices~ + and~this~list~does~not~include~'#2'. + } +\msg_new:nnnn { template } { unknown-default-choice } + { The~default~choice~'#2'~was~not~declared~for~key~'#1'. } + { + The~key~'#1'~takes~a~fixed~list~of~choices~ + and~this~list~does~not~include~'#2'. + } +\msg_new:nnnn { template } { unknown-instance } + { The~instance~'#2'~of~type~'#1'~is~unknown. } + { + You~have~asked~to~use~an~instance~'#2',~ + but~this~has~not~been~created. + } +\msg_new:nnnn { template } { unknown-key } + { Unknown~template~key~'#1'. } + { + The~key~'#1'~was~not~declared~in~the~interface~ + for~the~current~template. + } +\msg_new:nnnn { template } { unknown-keytype } + { The~key-type~'#1'~is~unknown. } + { + Valid~key-types~are:\\ + -~boolean;\\ + -~choice;\\ + -~commalist;\\ + -~function;\\ + -~instance;\\ + -~integer;\\ + -~length;\\ + -~muskip;\\ + -~real;\\ + -~skip;\\ + -~tokenlist. + } +\msg_new:nnnn { template } { unknown-type } + { The~template~type~'#1'~is~unknown. } + { + A~template~type~needs~to~be~defined~with~\NewTemplateType + prior~to~using~it. + } +\msg_new:nnnn { template } { unknown-template } + { The~template~'#2'~of~type~'#1'~is~unknown. } + { + No~interface~has~been~declared~for~a~template~ + '#2'~of~template~type~'#1'. + } +\msg_new:nnn { template } { declare-instance } + { Declaring~instance~~'#1'~of~type~#2~\msg_line_context:. } +\msg_new:nnn { template } { declare-template-code } + { Declaring~code~for~template~'#2'~of~template~type~'#1'~\msg_line_context:. } +\msg_new:nnn { template } { declare-template-interface } + { + Declaring~interface~for~template~'#2'~of~template~type~'#1'~ + \msg_line_context:. + } +\msg_new:nnn { template } { declare-type } + { Declaring~template~type~'#1'~taking~#2~argument(s)~\msg_line_context:. } +\msg_new:nnn { template } { show-attribute } + { + The~template~'#2'~of~type~'#1'~has~ + \tl_if_empty:nTF {#4} { no~#3. } { #3 : #4 } + } +\msg_new:nnn { template } { show-values } + { + The~instance~'#2'~of~type~'#1'~has~ + \tl_if_empty:nTF {#3} { no~values. } { values: #3 } + } +\prop_gput:Nnn \g_msg_module_type_prop { template } { LaTeX } +\cs_new_protected:Npn \NewTemplateType #1#2 + { \__template_define_type:nn {#1} {#2} } +\cs_new_protected:Npn \DeclareTemplateInterface #1#2#3#4 + { \__template_declare_template_keys:nnnn {#1} {#2} {#3} {#4} } +\cs_new_protected:Npn \DeclareTemplateCode #1#2#3#4#5 + { \__template_declare_template_code:nnnnn {#1} {#2} {#3} {#4} {#5} } +\cs_new_protected:Npn \DeclareTemplateCopy #1#2#3 + { \__template_template_set_eq:nnn {#1} {#2} {#3} } +\cs_new_protected:Npn \EditTemplateDefaults #1#2#3 + { \__template_edit_defaults:nnn {#1} {#2} {#3} } +\cs_new_protected:Npn \UseTemplate #1#2#3 + { \__template_use_template:nnn {#1} {#2} {#3} } +\cs_new_protected:Npn \DeclareInstance #1#2#3#4 + { \__template_declare_instance:nnnn {#1} {#3} {#2} {#4} } +\cs_new_protected:Npn \DeclareInstanceCopy #1#2#3 + { \__template_instance_set_eq:nnn {#1} {#2} {#3} } +\cs_new_protected:Npn \EditInstance #1#2#3 + { \__template_edit_instance:nnn {#1} {#2} {#3} } +\cs_new_protected:Npn \UseInstance #1#2 + { \__template_use_instance:nn {#1} {#2} } +\cs_new_protected:Npn \ShowTemplateCode #1#2 + { \__template_show_code:nn {#1} {#2} } +\cs_new_protected:Npn \ShowTemplateDefaults #1#2 + { \__template_show_defaults:nn {#1} {#2} } +\cs_new_protected:Npn \ShowTemplateInterface #1#2 + { \__template_show_keytypes:nn {#1} {#2} } +\cs_new_protected:Npn \ShowTemplateVariables #1#2 + { \__template_show_vars:nn {#1} {#2} } +\cs_new_protected:Npn \ShowInstanceValues #1#2 + { \__template_show_values:nn {#1} {#2} } +\cs_new:Npn \IfInstanceExistsTF #1#2 + { \__template_if_instance_exist:nnTF {#1} {#2} } +\cs_new:Npn \IfInstanceExistsT #1#2 + { \__template_if_instance_exist:nnT {#1} {#2} } +\cs_new:Npn \IfInstanceExistsF #1#2 + { \__template_if_instance_exist:nnF {#1} {#2} } +\cs_new_protected:Npn \KeyValue #1 {#1} +\cs_new_protected:Npn \AssignTemplateKeys { \__template_assignments_pop: } +\cs_new_protected:Npn \SetTemplateKeys #1#2#3 + { \keys_set_known:nnN { template / #1 / #2 } {#3} \l__template_tmp_clist } +\IncludeInRelease{0000/00/00}{lttemplates}% + {Prototype~document~commands}% + +\EndModuleRelease +\ExplSyntaxOff %%% From File: ltalloc.dtx %%% From File: ltcntrl.dtx %%% From File: lterror.dtx @@ -8514,8 +9884,6 @@ of this package available from CTAN} %% Copyright (C) 2020-2024 %% Frank Mittelbach, The LaTeX Project %%% From File: ltpara.dtx -\def\ltparaversion{v1.0l} -\def\ltparadate{2023/01/30} \ExplSyntaxOn @@ -8548,9 +9916,16 @@ of this package available from CTAN} \@kernel@before@para@begin \hook_use:n {para/begin} \if_mode_horizontal: \else: - \msg_error:nnnn { hooks }{ para-mode }{begin}{vertical} \fi: + \msg_error:nnnn { hooks }{ para-mode }{begin}{horizontal} \fi: \__para_handle_indent: } +\cs_set:Npn \__para_tmp:w #1#2#3#4#5 { } +\tl_gput_right:Nx \g__para_standard_everypar_tl { + \exp_not:N \the + \exp_not:N \toks + \exp_after:wN \__para_tmp:w \token_to_meaning:N \everypar + \c_space_tl +} \EndIncludeInRelease \IncludeInRelease{2021/06/01} {\g__para_standard_everypar_tl}{minipage~ fix} @@ -8572,7 +9947,7 @@ of this package available from CTAN} \@kernel@before@para@begin \hook_use:n {para/begin} \if_mode_horizontal: \else: - \msg_error:nnnn { hooks }{ para-mode }{begin}{vertical} \fi: + \msg_error:nnnn { hooks }{ para-mode }{begin}{horizontal} \fi: \__para_handle_indent: } \cs_set:Npn \__para_tmp:w #1#2#3#4#5 { } @@ -8587,10 +9962,10 @@ of this package available from CTAN} \newtoks \everypar \tl_gput_right:Nx \g__para_standard_everypar_tl { - \exp_not:N \the - \exp_not:N \toks - \the \allocationnumber - \c_space_tl + \exp_not:N \the + \exp_not:N \toks + \the \allocationnumber + \c_space_tl } \box_new:N \g_para_indent_box @@ -8651,7 +10026,7 @@ of this package available from CTAN} \cs_set_eq:NN \par \para_end: \cs_set_eq:NN \@@par \para_end: \cs_set_eq:NN \endgraf \para_end: -\everypar{\@nodocument} %% To get an error if text appears before the +\everypar{\@nodocument} %% To get an error if text appears before the \document \msg_new:nnnn { hooks } { para-mode } { Illegal~mode~ change~ in~ hook~ 'para/#1'.\\ @@ -8698,8 +10073,6 @@ of this package available from CTAN} %% Copyright (C) 2021-2024 %% Frank Mittelbach, The LaTeX Project %%% From File: ltmeta.dtx -\def\ltmetaversion{v1.0b} -\def\ltmetadate{2022/05/18} \NewModuleRelease{2022/06/01}{ltmeta} {Document Metadata handling} \let \IfDocumentMetadataTF \@secondoftwo @@ -10346,7 +11719,7 @@ of this package available from CTAN} \EndIncludeInRelease %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% From File: ltfssaxes.dtx -%% Copyright (C) 1999-2020 Frank Mittelbach +%% Copyright (C) 2019-2020 Frank Mittelbach \IncludeInRelease{2020/02/02}% {\DeclareFontSeriesChangeRule}{Series change rules}% \def\DeclareFontSeriesChangeRule#1#2#3#4{% @@ -12227,7 +13600,7 @@ of this package available from CTAN} \let\@defaultfamilyhook\@undefined \EndIncludeInRelease -%%% From File: fontdef.dtx +%%% From File: fontdef.dtx \IncludeInRelease{2017/01/01}% {\encodingdefault}{TU encoding default}% \ifx\Umathcode\@undefined @@ -12725,8 +14098,7 @@ of this package available from CTAN} \DeclareEncodingSubset{TS1}{lmss} {1} \DeclareEncodingSubset{TS1}{lmssq} {1} \DeclareEncodingSubset{TS1}{lmvtt} {1} -\DeclareEncodingSubset{TS1}{lmtt} {1} % missing TM, SM and - % pertenthousand for some reason +\DeclareEncodingSubset{TS1}{lmtt} {1} % missing TM, SM and pertenthousand \DeclareEncodingSubset{TS1}{ptmx} {2} \DeclareEncodingSubset{TS1}{ptmj} {2} \DeclareEncodingSubset{TS1}{ul8} {2} @@ -12764,23 +14136,31 @@ of this package available from CTAN} \DeclareEncodingSubset{TS1}{lato-*} {0} % with a bunch of tofu inside \DeclareEncodingSubset{TS1}{opensans-*} {0} % with a bunch of tofu inside \DeclareEncodingSubset{TS1}{cantarell-*} {0} % with a bunch of tofu inside -\DeclareEncodingSubset{TS1}{fbb-*} {0} % missing centoldstyle \DeclareEncodingSubset{TS1}{tli} {1} % with lots of tofu inside +\DeclareEncodingSubset{TS1}{fbb-*} {2} % missing centoldstyle \DeclareEncodingSubset{TS1}{Alegreya-*} {2} \DeclareEncodingSubset{TS1}{AlegreyaSans-*} {2} +\DeclareEncodingSubset{TS1}{BaskervilleF-*} {2} \DeclareEncodingSubset{TS1}{DejaVuSans-TLF} {2} \DeclareEncodingSubset{TS1}{DejaVuSansCondensed-TLF} {2} \DeclareEncodingSubset{TS1}{DejaVuSansMono-TLF} {2} \DeclareEncodingSubset{TS1}{EBGaramond-*} {2} +\DeclareEncodingSubset{TS1}{Merriwthr-OsF} {2} +\DeclareEncodingSubset{TS1}{MerriwthrSans-OsF} {2} +\DeclareEncodingSubset{TS1}{Montserrat-*} {2} +\DeclareEncodingSubset{TS1}{MontserratAlternates-*} {2} +\DeclareEncodingSubset{TS1}{NotoSansMono-TLF} {2} +\DeclareEncodingSubset{TS1}{NotoSansMono-TOsF} {2} \DeclareEncodingSubset{TS1}{Tempora-TLF} {2} \DeclareEncodingSubset{TS1}{Tempora-TOsF} {2} +\DeclareEncodingSubset{TS1}{XCharter-TLF} {2} +\DeclareEncodingSubset{TS1}{XCharter-TOsF} {2} +\DeclareEncodingSubset{TS1}{erewhon-*} {2} \DeclareEncodingSubset{TS1}{Arimo-TLF} {3} -\DeclareEncodingSubset{TS1}{Carlito-*} {3} -\DeclareEncodingSubset{TS1}{FiraSans-*} {3} +\DeclareEncodingSubset{TS1}{Crlt-*} {3} +\DeclareEncodingSubset{TS1}{IBMPlexMono-TLF} {3} \DeclareEncodingSubset{TS1}{IBMPlexSans-TLF} {3} -\DeclareEncodingSubset{TS1}{Merriweather-OsF} {3} -\DeclareEncodingSubset{TS1}{Montserrat-*} {3} -\DeclareEncodingSubset{TS1}{MontserratAlternates-*} {3} +\DeclareEncodingSubset{TS1}{IBMPlexSerif-TLF} {3} \DeclareEncodingSubset{TS1}{SourceCodePro-TLF} {3} \DeclareEncodingSubset{TS1}{SourceCodePro-TOsF} {3} \DeclareEncodingSubset{TS1}{SourceSansPro-*} {3} @@ -12795,6 +14175,7 @@ of this package available from CTAN} \DeclareEncodingSubset{TS1}{CrimsonPro-*} {4} \DeclareEncodingSubset{TS1}{FiraMono-TLF} {4} \DeclareEncodingSubset{TS1}{FiraMono-TOsF} {4} +\DeclareEncodingSubset{TS1}{FiraSans-*} {4} \DeclareEncodingSubset{TS1}{Go-TLF} {4} \DeclareEncodingSubset{TS1}{GoMono-TLF} {4} \DeclareEncodingSubset{TS1}{InriaSans-*} {4} @@ -12807,7 +14188,6 @@ of this package available from CTAN} \DeclareEncodingSubset{TS1}{LinguisticsPro-OsF} {4} \DeclareEncodingSubset{TS1}{LinuxBiolinumT-*} {4} \DeclareEncodingSubset{TS1}{LinuxLibertineT-*} {4} -\DeclareEncodingSubset{TS1}{MerriweatherSans-OsF} {4} \DeclareEncodingSubset{TS1}{MintSpirit-*} {4} \DeclareEncodingSubset{TS1}{MintSpiritNoTwo-*} {4} \DeclareEncodingSubset{TS1}{PTMono-TLF} {4} @@ -12824,57 +14204,50 @@ of this package available from CTAN} \DeclareEncodingSubset{TS1}{Rosario-*} {4} \DeclareEncodingSubset{TS1}{SticksTooText-*} {4} \DeclareEncodingSubset{TS1}{UniversalisADFStd-LF} {4} -\DeclareEncodingSubset{TS1}{Almendra-OsF} {5} +\DeclareEncodingSubset{TS1}{Almndr-OsF} {5} \DeclareEncodingSubset{TS1}{Baskervaldx-*} {5} -\DeclareEncodingSubset{TS1}{BaskervilleF-*} {5} -\DeclareEncodingSubset{TS1}{Bitter-TLF} {5} +\DeclareEncodingSubset{TS1}{Bttr-TLF} {5} \DeclareEncodingSubset{TS1}{Cinzel-LF} {5} \DeclareEncodingSubset{TS1}{CinzelDecorative-LF} {5} +\DeclareEncodingSubset{TS1}{Cochineal-*} {5} \DeclareEncodingSubset{TS1}{DejaVuSerif-TLF} {5} \DeclareEncodingSubset{TS1}{DejaVuSerifCondensed-TLF} {5} \DeclareEncodingSubset{TS1}{GilliusADF-LF} {5} \DeclareEncodingSubset{TS1}{GilliusADFCond-LF} {5} \DeclareEncodingSubset{TS1}{GilliusADFNoTwo-LF} {5} \DeclareEncodingSubset{TS1}{GilliusADFNoTwoCond-LF} {5} -\DeclareEncodingSubset{TS1}{LobsterTwo-LF} {5} \DeclareEncodingSubset{TS1}{OldStandard-TLF} {5} -\DeclareEncodingSubset{TS1}{PlayfairDisplay-TLF} {5} -\DeclareEncodingSubset{TS1}{PlayfairDisplay-TOsF} {5} +\DeclareEncodingSubset{TS1}{PlyfrDisplay-TLF} {5} +\DeclareEncodingSubset{TS1}{PlyfrDisplay-TOsF} {5} \DeclareEncodingSubset{TS1}{TheanoDidot-TLF} {5} \DeclareEncodingSubset{TS1}{TheanoDidot-TOsF} {5} \DeclareEncodingSubset{TS1}{TheanoModern-TLF} {5} \DeclareEncodingSubset{TS1}{TheanoModern-TOsF} {5} \DeclareEncodingSubset{TS1}{TheanoOldStyle-TLF} {5} \DeclareEncodingSubset{TS1}{TheanoOldStyle-TOsF} {5} +\DeclareEncodingSubset{TS1}{charssil-TLF} {5} \DeclareEncodingSubset{TS1}{Crimson-TLF} {6} -\DeclareEncodingSubset{TS1}{IBMPlexMono-TLF} {6} -\DeclareEncodingSubset{TS1}{IBMPlexSerif-TLF} {6} -\DeclareEncodingSubset{TS1}{LibertinusMono-TLF} {6} \DeclareEncodingSubset{TS1}{LibertinusSerifDisplay-LF}{6} \DeclareEncodingSubset{TS1}{LinuxLibertineDisplayT-*} {6} \DeclareEncodingSubset{TS1}{LinuxLibertineMonoT-LF} {6} \DeclareEncodingSubset{TS1}{LinuxLibertineMonoT-TLF} {6} -\DeclareEncodingSubset{TS1}{Overlock-LF} {6} +\DeclareEncodingSubset{TS1}{Ovrlck-LF} {6} +\DeclareEncodingSubset{TS1}{ComicNeue-TLF} {7} +\DeclareEncodingSubset{TS1}{ComicNeueAngular-TLF} {7} \DeclareEncodingSubset{TS1}{CormorantGaramond-*} {7} \DeclareEncodingSubset{TS1}{Heuristica-TLF} {7} \DeclareEncodingSubset{TS1}{Heuristica-TOsF} {7} \DeclareEncodingSubset{TS1}{IMFELLEnglish-TLF} {7} -\DeclareEncodingSubset{TS1}{LibreBaskerville-TLF} {7} -\DeclareEncodingSubset{TS1}{LibreCaslon-*} {7} -\DeclareEncodingSubset{TS1}{Marcellus-LF} {7} +\DeclareEncodingSubset{TS1}{LibreBskrvl-TLF} {7} +\DeclareEncodingSubset{TS1}{LibreCsln-*} {7} +\DeclareEncodingSubset{TS1}{Lbstr-LF} {7} +\DeclareEncodingSubset{TS1}{Mrcls-LF} {7} \DeclareEncodingSubset{TS1}{NotoSans-*} {7} -\DeclareEncodingSubset{TS1}{NotoSansMono-TLF} {7} -\DeclareEncodingSubset{TS1}{NotoSansMono-TOsF} {7} \DeclareEncodingSubset{TS1}{NotoSerif-*} {7} -\DeclareEncodingSubset{TS1}{Quattrocento-TLF} {7} -\DeclareEncodingSubset{TS1}{QuattrocentoSans-TLF} {7} -\DeclareEncodingSubset{TS1}{XCharter-TLF} {7} -\DeclareEncodingSubset{TS1}{XCharter-TOsF} {7} -\DeclareEncodingSubset{TS1}{erewhon-*} {7} -\DeclareEncodingSubset{TS1}{ComicNeue-TLF} {7} -\DeclareEncodingSubset{TS1}{ComicNeueAngular-TLF} {7} -\DeclareEncodingSubset{TS1}{Forum-LF} {7} % the superiors are missing -\DeclareEncodingSubset{TS1}{Cochineal-*} {8} +\DeclareEncodingSubset{TS1}{Quattro-LF} {7} +\DeclareEncodingSubset{TS1}{QuattroSans-LF} {7} +\DeclareEncodingSubset{TS1}{Frm-LF} {7} % the superiors are missing +\DeclareEncodingSubset{TS1}{LibertinusMono-TLF} {8} \DeclareEncodingSubset{TS1}{AlgolRevived-TLF} {9} \def\UseLegacyTextSymbols{% \DeclareTextSymbolDefault{\textasteriskcentered}{OMS}% @@ -13112,7 +14485,6 @@ of this package available from CTAN} \EndModuleRelease - %%% From File: ltpageno.dtx %%% From File: ltxref.dtx \IncludeInRelease{2023/06/01}% @@ -13260,12 +14632,7 @@ of this package available from CTAN} \let\Ref\@undefined \EndIncludeInRelease -%% File: ltproperties.dtx -\def\ltpropertiesversion{1.0c} -\def\ltpropertiesdate{2023-10-15} - - - +%%% From File: ltproperties.dtx \ExplSyntaxOn \NewModuleRelease{2023/11/01}{ltproperties} {Cross-referencing~properties} @@ -13320,7 +14687,7 @@ of this package available from CTAN} { \legacy_if:nT { @filesw } { - \iow_shipout_x:Nx \@auxout + \protected@write \@auxout {} { \token_to_str:N \new@label@record {#1} @@ -13432,7 +14799,9 @@ of this package available from CTAN} } } \prg_generate_conditional_variant:Nnn \property_if_exist:n {e} {TF} -\cs_new_eq:NN \IfPropertyExistTF \property_if_exist:eTF +\cs_new_eq:NN \IfPropertyExistsTF \property_if_exist:eTF +\cs_new:Npn \IfPropertyExistsT #1#2 {\property_if_exist:eTF {#1}{#2}{} } +\cs_new:Npn \IfPropertyExistsF #1 {\property_if_exist:eTF {#1}{} } \prg_new_conditional:Npnn \property_if_recorded:n #1 { p , T , F, TF } % #1 label { @@ -13445,7 +14814,9 @@ of this package available from CTAN} } } \prg_generate_conditional_variant:Nnn \property_if_recorded:n {e} {TF} -\cs_new_eq:NN \IfLabelExistTF \property_if_recorded:eTF +\cs_new_eq:NN \IfLabelExistsTF \property_if_recorded:eTF +\cs_new:Npn \IfLabelExistsT #1#2 {\property_if_exist:eTF {#1}{#2}{} } +\cs_new:Npn \IfLabelExistsF #1 {\property_if_exist:eTF {#1}{} } \prg_new_conditional:Npnn \property_if_recorded:nn #1#2 { p , T , F, TF } % #1 label #2 property { @@ -13534,8 +14905,8 @@ of this package available from CTAN} \let \RefProperty \@undefined \let \RefUndefinedWarn \@undefined -\let \IfPropertyExistTF \@undefined -\let \IfLabelExistTF \@undefined +\let \IfPropertyExistsTF \@undefined +\let \IfLabelExistsTF \@undefined \let \IfPropertyRecordedTF \@undefined \let\new@label@record \@undefined @@ -14651,6 +16022,23 @@ of this package available from CTAN} \@ifnextchar[{\@rsbox{#1}}{\@irsbox{#1}[]}} \expandafter\let\csname raisebox \endcsname\@undefined \EndIncludeInRelease +\IncludeInRelease{2024/06/01}% + {\@finalstrut}{final strut correction}% +\def\@finalstrut#1{% + \unskip + \ifhmode \nobreak + \else + \vskip-\baselineskip + \fi + \vrule\@width\z@\@height\z@\@depth\dp#1} +\EndIncludeInRelease +\IncludeInRelease{0000/00/00}% + {\@finalstrut}{final strut correction}% +\def\@finalstrut#1{% + \unskip\ifhmode\nobreak\fi + \vrule\@width\z@\@height\z@\@depth\dp#1} + +\EndIncludeInRelease %%% From File: lttab.dtx \IncludeInRelease{2020/10/01}% {\@itabcr}{Tabbing calc syntax}% @@ -15283,6 +16671,32 @@ of this package available from CTAN} \EndIncludeInRelease %%% From File: ltthm.dtx +\IncludeInRelease{2024/03/18}% + {\@thm}{no link target}% +\def\@thm#1#2{% + \@kernel@refstepcounter{#1}% + \@ifnextchar[{\@ythm{#1}{#2}}{\@xthm{#1}{#2}}} +\EndIncludeInRelease +\IncludeInRelease{0000/00/00}% + {\@thm}{no link target}% +\def\@thm#1#2{% + \refstepcounter{#1}% + \@ifnextchar[{\@ythm{#1}{#2}}{\@xthm{#1}{#2}}} +\EndIncludeInRelease +\IncludeInRelease{2024/03/18}% + {\@begintheorem}{add link targets}% +\def\@begintheorem#1#2{\trivlist + \item[\MakeLinkTarget{\@currentcounter}\hskip \labelsep{\bfseries #1\ #2}]\itshape} +\def\@opargbegintheorem#1#2#3{\trivlist + \item[\MakeLinkTarget{\@currentcounter}\hskip \labelsep{\bfseries #1\ #2\ (#3)}]\itshape} +\EndIncludeInRelease +\IncludeInRelease{0000/00/00}% + {\@begintheorem}{add link targets}% +\def\@begintheorem#1#2{\trivlist + \item[\hskip \labelsep{\bfseries #1\ #2}]\itshape} +\def\@opargbegintheorem#1#2#3{\trivlist + \item[\hskip \labelsep{\bfseries #1\ #2\ (#3)}]\itshape} +\EndIncludeInRelease %%% From File: ltsect.dtx \IncludeInRelease{2019/10/01}% {\title}{Make commands robust}% @@ -15773,8 +17187,6 @@ of this package available from CTAN} %% Copyright (C) 2022-2024 %% Frank Mittelbach, The LaTeX Project %%% From File: ltmarks.dtx -\def\ltmarksversion{v1.0d} -\def\ltmarksdate{2022/06/01} %% \end{function} \ExplSyntaxOn @@ -15813,42 +17225,84 @@ of this package available from CTAN} \tl_new:c { g__mark_last-column_top_ #1 _tl } \tl_new:c { g__mark_last-column_first_ #1 _tl } \tl_new:c { g__mark_last-column_last_ #1 _tl } + \tl_set:cn { g__mark_page_top_ #1 _tl }{ \__mark_id:n{0} } + \tl_set:cn { g__mark_page_first_ #1 _tl }{ \__mark_id:n{0} } + \tl_set:cn { g__mark_page_last_ #1 _tl }{ \__mark_id:n{0} } + \tl_set:cn { g__mark_previous-page_top_ #1 _tl }{ \__mark_id:n{0} } + \tl_set:cn { g__mark_previous-page_first_ #1 _tl }{ \__mark_id:n{0} } + \tl_set:cn { g__mark_previous-page_last_ #1 _tl }{ \__mark_id:n{0} } + \tl_set:cn { g__mark_column_top_ #1 _tl }{ \__mark_id:n{0} } + \tl_set:cn { g__mark_column_first_ #1 _tl }{ \__mark_id:n{0} } + \tl_set:cn { g__mark_column_last_ #1 _tl }{ \__mark_id:n{0} } + \tl_set:cn { g__mark_previous-column_top_ #1 _tl }{ \__mark_id:n{0} } + \tl_set:cn { g__mark_previous-column_first_ #1 _tl }{ \__mark_id:n{0} } + \tl_set:cn { g__mark_previous-column_last_ #1 _tl }{ \__mark_id:n{0} } + \tl_set:cn { g__mark_first-column_top_ #1 _tl }{ \__mark_id:n{0} } + \tl_set:cn { g__mark_first-column_first_ #1 _tl }{ \__mark_id:n{0} } + \tl_set:cn { g__mark_first-column_last_ #1 _tl }{ \__mark_id:n{0} } + \tl_set:cn { g__mark_last-column_top_ #1 _tl }{ \__mark_id:n{0} } + \tl_set:cn { g__mark_last-column_first_ #1 _tl }{ \__mark_id:n{0} } + \tl_set:cn { g__mark_last-column_last_ #1 _tl }{ \__mark_id:n{0} } } \box_new:N \l__mark_box +\box_new:N \l__mark_ii_box \tl_new:N \g__mark_tmp_tl \tl_new:N \g__mark_new_top_tl -\cs_new_protected:Npn \__mark_update_structure:nn #1#2 - { - \__mark_update_structure_alias:nn { previous-#1 } {#1} +\cs_new_protected:Npn \__mark_extract_and_handle_marks:nn #1#2 { \group_begin: \dim_set_eq:NN \tex_splitmaxdepth:D \c_max_dim \int_set_eq:NN \tex_vbadness:D \c_max_int \dim_set_eq:NN \tex_vfuzz:D \c_max_dim - \vbox_set_to_ht:Nnn \l__mark_box { -.5\c_max_dim } + \__mark_prepare_and_extract:nn {#1} {#2} + \group_end: + } +\cs_new_protected:Npn \__mark_prepare_and_extract:nn #1#2 { + \vbox_set:Nn \l__mark_box + { + #2 + \tex_unskip:D + \box_set_to_last:N \l__mark_box + \int_compare:nNnT \tex_lastnodetype:D < 0 { - #2 - \tex_unskip:D - \box_set_to_last:N \l__mark_box - \int_compare:nNnT \tex_lastnodetype:D < 0 - { - \box_if_vertical:NT \l__mark_box - { - \vbox_set_to_ht:Nnn \l__mark_box { -.5\c_max_dim } - { - \vbox_unpack:N \l__mark_box - \tex_kern:D \c_zero_dim % ensure that box - % is not empty - } - \int_compare:nNnT \tex_badness:D > 0 - { \vbox_unpack:N \l__mark_box } - } - } - \tex_kern:D \c_zero_dim + \box_if_vertical:NT \l__mark_box + { \vbox_unpack:N \l__mark_box } } - \int_compare:nNnTF \tex_badness:D > 0 - { - \vbox_set_split_to_ht:NNn \l__mark_box \l__mark_box \c_max_dim - \seq_map_inline:Nn \g__mark_classes_seq + } + \__mark_vbox_set_split_to_maxdimen:NN \l__mark_ii_box \l__mark_box + \box_if_empty:NTF \l__mark_box + { #1 } + { + \__mark_prepare_and_extract:nn {#1} + { \vbox_unpack:N \l__mark_ii_box + \vbox_unpack:N \l__mark_box } + } +} +\cs_set_eq:cN {Infinite~shrink~error~above~ignored~!}\c_max_dim +\cs_new_protected:Npx \__mark_vbox_set_split_to_maxdimen:NN #1#2 { + \tl_set:Ne \exp_not:N \l__mark_saved_parameters_tl + { + \tex_interactionmode:D + \exp_not:N \int_use:N \tex_interactionmode:D \scan_stop: + \tex_escapechar:D + \exp_not:N \int_use:N \tex_escapechar:D \scan_stop: + } + \tex_escapechar:D -1 \scan_stop: + \tex_interactionmode:D 0 \scan_stop: + \tex_setbox:D #1 \tex_vsplit:D #2 to + \exp_not:N \use:n { + \use:c{Infinite~shrink~error~above~ignored~!} + } + \exp_not:N \l__mark_saved_parameters_tl +} +\tl_new:N \l__mark_saved_parameters_tl +\cs_new_protected:Npn \__mark_update_structure_from_material:nn #1#2 { + \__mark_extract_and_handle_marks:nn + { \__mark_update_structure_from_splitmarks:n {#1} } + { #2 } +} +\cs_new_protected:Npn \__mark_update_structure_from_splitmarks:n #1 { + \__mark_update_structure_alias:nn { previous-#1 } {#1} + \seq_map_inline:Nn \g__mark_classes_seq { \tl_gset_eq:Nc \g__mark_new_top_tl { g__mark_#1_last_##1_tl } \tl_gset_eq:cN { g__mark_#1_top_##1_tl } \g__mark_new_top_tl @@ -15870,19 +17324,40 @@ of this package available from CTAN} } } } - } - { - \msg_error:nnn { mark } { infinite-shrinkage } {#1} - \seq_map_inline:Nn \g__mark_classes_seq +} +\cs_new_protected:Npn \__mark_get_marks_for_reinsertion:nNN #1#2#3 { + \tl_clear:N \g__mark_first_marks_tl + \tl_clear:N \g__mark_last_marks_tl + \__mark_extract_and_handle_marks:nn + \__mark_get_from_splitmarks: + { #1 } + \tl_set_eq:NN #2 \g__mark_first_marks_tl + \tl_set_eq:NN #3 \g__mark_last_marks_tl +} +\cs_new_protected:Npn \__mark_get_from_splitmarks: { + \seq_map_inline:Nn \g__mark_classes_seq { - \tl_gset_eq:cc { g__mark_#1_top_ ##1_tl } - { g__mark_#1_last_ ##1_tl } - \tl_gset_eq:cc { g__mark_#1_first_##1_tl } - { g__mark_#1_last_ ##1_tl } + \tl_gset:No \g__mark_tmp_tl + { \tex_splitbotmarks:D \use:c { c__mark_class_##1_mark } } + + \tl_if_empty:NTF \g__mark_tmp_tl + { + } + { + \tl_gput_right:Ne \g__mark_last_marks_tl + { \mark_insert:nn {##1} { \g__mark_tmp_tl } } + \tl_gput_right:Ne \g__mark_first_marks_tl + { \mark_insert:nn {##1} + { + \tex_splitfirstmarks:D + \use:c { c__mark_class_##1_mark } + } + } + } } - } - \group_end: - } +} +\tl_new:N \g__mark_first_marks_tl +\tl_new:N \g__mark_last_marks_tl \cs_new_protected:Npn \__mark_update_structure_alias:nn #1#2 { \seq_map_inline:Nn \g__mark_classes_seq { @@ -15912,12 +17387,14 @@ of this package available from CTAN} \group_begin: \@kernel@before@insertmark \hook_use:n { insertmark } - \unrestored@protected@xdef \g__mark_tmp_tl {#2} + \unrestored@protected@xdef \g__mark_tmp_tl + { + \__mark_id:n{ \int_use:N\g__mark_int } + #2 + } \tex_marks:D \use:c { c__mark_class_ #1 _mark } { - \tl_if_empty:NTF \g__mark_tmp_tl - { \exp_not:n { \prg_do_nothing: } } - { \exp_not:o { \g__mark_tmp_tl } } + \exp_not:o { \g__mark_tmp_tl } } \group_end: \if@nobreak\ifvmode\nobreak\fi\fi @@ -15927,15 +17404,23 @@ of this package available from CTAN} { \tl_to_str:n {#1} } } } +\cs_new_protected:Npn \__mark_id:n #1 { } +\int_new:N \g__mark_int \cs_new:Npn \@kernel@before@insertmark { \cs_set_eq:NN \label \scan_stop: \cs_set_eq:NN \index \scan_stop: \cs_set_eq:NN \glossary \scan_stop: + \int_compare:nNnTF \g__mark_int < {99999} + { \int_gincr:N \g__mark_int } + { \int_gzero:N \g__mark_int } + } \hook_new:n {insertmark} -\cs_new:Npn \mark_use_first:nn #1#2 { \exp_not:v { g__mark_#1_first_#2_tl } } -\cs_new:Npn \mark_use_last:nn #1#2 { \exp_not:v { g__mark_#1_last_#2_tl } } -\cs_new:Npn \mark_use_top:nn #1#2 { \exp_not:v { g__mark_#1_top_#2_tl } } +\cs_new:Npn \mark_use_first:nn #1#2 { \__mark_use:v { g__mark_#1_first_#2_tl } } +\cs_new:Npn \mark_use_last:nn #1#2 { \__mark_use:v { g__mark_#1_last_#2_tl } } +\cs_new:Npn \mark_use_top:nn #1#2 { \__mark_use:v { g__mark_#1_top_#2_tl } } +\cs_new:Npn \__mark_use:n #1 { \exp_not:o { \use_none:nn #1 } } +\cs_generate_variant:Nn \__mark_use:n { v } \prg_new_conditional:Npnn \mark_if_eq:nnnn #1#2#3#4 { T , F , TF } { \tl_if_eq:ccTF { g__mark_ #1 _#3_ #2 _tl } @@ -15975,15 +17460,6 @@ of this package available from CTAN} all~columns~have~been~assembled. \c__msg_return_text_tl } -\msg_new:nnnn { mark } { infinite-shrinkage } - { Infinite~shrinkage~found~in~'#1'. } - { - \c__msg_coding_error_text_tl - The~mark~region~'#1'~contains~some~infinite~negative~glue~ - allowing~it~to~shrink~to~an~arbitrary~size.~ - This~makes~it~impossible~to~split~the~region~apart~to~ - get~at~its~marks.~They~are~lost. - } \bool_new:N \g__mark_debug_bool \cs_new_eq:NN \__mark_debug:n \use_none:n \cs_new_protected:Npn \mark_debug_on: @@ -16003,6 +17479,8 @@ of this package available from CTAN} } \cs_new_eq:NN \DebugMarksOn \mark_debug_on: \cs_new_eq:NN \DebugMarksOff \mark_debug_off: +\cs_new_protected:Npn \ShowMarksAt #1 { +} \cs_new_eq:NN \NewMarkClass \mark_new_class:n \@onlypreamble \NewMarkClass \cs_new_eq:NN \InsertMark \mark_insert:nn @@ -16018,11 +17496,11 @@ of this package available from CTAN} \cs_new_protected:Npn \__mark_update_singlecol_structures: { \box_if_vertical:NTF \@outputbox { - \__mark_update_structure:nn {page} + \__mark_update_structure_from_material:nn {page} { \vbox_unpack:N \@outputbox } } { - \__mark_update_structure:nn {page} + \__mark_update_structure_from_material:nn {page} { \hbox_unpack:N \@outputbox } } \__mark_update_structure_alias:nn {previous-column}{previous-page} @@ -16033,11 +17511,11 @@ of this package available from CTAN} \cs_new_protected:Npn \__mark_update_dblcol_structures: { \box_if_vertical:NTF \@outputbox { - \__mark_update_structure:nn {column} + \__mark_update_structure_from_material:nn {column} { \vbox_unpack:N \@outputbox } } { - \__mark_update_structure:nn {column} + \__mark_update_structure_from_material:nn {column} { \hbox_unpack:N \@outputbox } } \legacy_if:nTF {@firstcolumn} @@ -16057,10 +17535,19 @@ of this package available from CTAN} { g__mark_page_last_ ##1 _tl } \tl_gset_eq:cc { g__mark_page_top_ ##1 _tl } { g__mark_first-column_top_ ##1 _tl } - \tl_gset_eq:cc { g__mark_ page_first_ ##1 _tl } + + \tl_if_eq:ccTF { g__mark_first-column_top_ ##1 _tl } { g__mark_first-column_first_ ##1 _tl } - \tl_gset_eq:cc { g__mark_page_last_ ##1 _tl } - { g__mark_last-column_last_ ##1 _tl } + { + \tl_gset_eq:cc { g__mark_page_first_ ##1 _tl } + { g__mark_last-column_first_ ##1 _tl } + } + { + \tl_gset_eq:cc { g__mark_page_first_ ##1 _tl } + { g__mark_first-column_first_ ##1 _tl } + } + \tl_gset_eq:cc { g__mark_page_last_ ##1 _tl } + { g__mark_last-column_last_ ##1 _tl } } } } @@ -16323,15 +17810,15 @@ of this package available from CTAN} }% \reserved@a} \EndIncludeInRelease -\IncludeInRelease{2021/11/15}% - {\IfPackageLoadedtTF}{Test package loading}% +\IncludeInRelease{2024/06/01}% + {\IfPackageLoadedTF}{Test package loading}% \let \IfPackageLoadedTF \@ifpackageloaded \let \IfClassLoadedTF \@ifclassloaded \let \IfPackageLoadedWithOptionsTF \@ifpackagewith \let \IfClassLoadedWithOptionsTF \@ifclasswith \EndIncludeInRelease \IncludeInRelease{0000/00/00}% - {\IfPackageLoadedtTF}{Test package loading}% + {\IfPackageLoadedTF}{Test package loading}% \let \IfPackageLoadedTF \@ifpackageloaded \let \IfClassLoadedTF \@ifclassloaded @@ -16339,6 +17826,63 @@ of this package available from CTAN} \let \IfClassLoadedWithOptionsTF \@ifclasswith \EndIncludeInRelease +\IncludeInRelease{2024/06/01}% + {\IfPackageLoadedT}{More conditionals}% +\def\IfPackageLoadedT #1#2{\IfPackageLoadedTF{#1}{#2}{}} +\def\IfPackageLoadedF #1{\IfPackageLoadedTF{#1}{}} +\def\IfClassLoadedT #1#2{\IfClassLoadedTF{#1}{#2}{}} +\def\IfClassLoadedF #1{\IfClassLoadedTF{#1}{}} +\def\IfPackageAtLeastT#1#2#3{\IfPackageAtLeastTF{#1}{#2}{#3}{}} +\def\IfPackageAtLeastF #1#2{\IfPackageAtLeastTF{#1}{#2}{}} +\def\IfClassAtLeastT #1#2#3{\IfClassAtLeastTF{#1}{#2}{#3}{}} +\def\IfClassAtLeastF #1#2{\IfClassAtLeastTF{#1}{#2}{}} +\def\IfFileAtLeastT #1#2#3{\IfFileAtLeastTF{#1}{#2}{#3}{}} +\def\IfFileAtLeastF #1#2{\IfFileAtLeastTF{#1}{#2}{}} +\def\IfFormatAtLeastT #1#2{\IfFormatAtLeastTF{#1}{#2}{}} +\def\IfFormatAtLeastF #1{\IfFormatAtLeastTF{#1}{}} +\def\IfPackageLoadedWithOptionsT #1#2#3{\IfPackageLoadedWithOptionsTF{#1}{#2}{#3}{}} +\def\IfPackageLoadedWithOptionsF #1#2{\IfPackageLoadedWithOptionsTF{#1}{#2}{}} +\def\IfClassLoadedWithOptionsT #1#2#3{\IfClassLoadedWithOptionsTF{#1}{#2}{#3}{}} +\def\IfClassLoadedWithOptionsF #1#2{\IfClassLoadedWithOptionsTF{#1}{#2}{}} +\def\IfFileLoadedTF#1{% + \expandafter\ifx\csname ver@#1\endcsname\relax + \expandafter\@secondoftwo + \else + \expandafter\@firstoftwo + \fi} +\def\IfFileLoadedT#1#2{\IfFileLoadedTF{#1}{#2}{}} +\def\IfFileLoadedF #1{\IfFileLoadedTF{#1}{}} +\EndIncludeInRelease +\IncludeInRelease{0000/00/00}% + {\IfPackageLoadedT}{More conditionals}% + +\def\IfPackageLoadedT #1#2{\IfPackageLoadedTF{#1}{#2}{}} +\def\IfPackageLoadedF #1{\IfPackageLoadedTF{#1}{}} +\def\IfClassLoadedT #1#2{\IfClassLoadedTF{#1}{#2}{}} +\def\IfClassLoadedF #1{\IfClassLoadedTF{#1}{}} +\def\IfPackageAtLeastT#1#2#3{\IfPackageAtLeastTF{#1}{#2}{#3}{}} +\def\IfPackageAtLeastF #1#2{\IfPackageAtLeastTF{#1}{#2}{}} +\def\IfClassAtLeastT #1#2#3{\IfClassAtLeastTF{#1}{#2}{#3}{}} +\def\IfClassAtLeastF #1#2{\IfClassAtLeastTF{#1}{#2}{}} +\def\IfFileAtLeastT #1#2#3{\IfFileAtLeastTF{#1}{#2}{#3}{}} +\def\IfFileAtLeastF #1#2{\IfFileAtLeastTF{#1}{#2}{}} +\def\IfFormatAtLeastT #1#2{\IfFormatAtLeastTF{#1}{#2}{}} +\def\IfFormatAtLeastF #1{\IfFormatAtLeastTF{#1}{}} +\def\IfPackageLoadedWithOptionsT #1#2#3{\IfPackageLoadedWithOptionsTF{#1}{#2}{#3}{}} +\def\IfPackageLoadedWithOptionsF #1#2{\IfPackageLoadedWithOptionsTF{#1}{#2}{}} +\def\IfClassLoadedWithOptionsT #1#2#3{\IfClassLoadedWithOptionsTF{#1}{#2}{#3}{}} +\def\IfClassLoadedWithOptionsF #1#2{\IfClassLoadedWithOptionsTF{#1}{#2}{}} + +\def\IfFileLoadedTF#1{% + \expandafter\ifx\csname ver@#1\endcsname\relax + \expandafter\@secondoftwo + \else + \expandafter\@firstoftwo + \fi} +\def\IfFileLoadedT#1#2{\IfFileLoadedTF{#1}{#2}{}} +\def\IfFileLoadedF #1{\IfFileLoadedTF{#1}{}} + +\EndIncludeInRelease \IncludeInRelease{2020/10/01}% {\ProvidesPackage}{Check name with \strcmp}% \def\ProvidesPackage#1{% @@ -16425,11 +17969,11 @@ of this package available from CTAN} \expandafter\let \csname opt@#3.#1\expandafter\endcsname \csname opt@\reserved@a\endcsname - \@ifundefined{@raw@opt@#3.#1}% - {\expandafter\gdef\csname @raw@opt@#3.#1\expandafter\endcsname - \expandafter{#2}}% - {\expandafter\g@addto@macro\csname @raw@opt@#3.#1\expandafter\endcsname - \expandafter{\expandafter,#2}}% + \@ifundefined{@raw@opt@#3.#1}% + {\expandafter\gdef\csname @raw@opt@#3.#1\expandafter\endcsname + \expandafter{#2}}% + {\expandafter\g@addto@macro\csname @raw@opt@#3.#1\expandafter\endcsname + \expandafter{\expandafter,#2}}% } \EndIncludeInRelease \IncludeInRelease{2020/10/01}{\@pass@ptions} @@ -16607,6 +18151,25 @@ of this package available from CTAN} \AtEndOfPackage{\let\@unprocessedoptions\relax}% \@loadwithoptions\@pkgextension\RequirePackage} \EndIncludeInRelease +\IncludeInRelease{2024/06/01}% + {\@fileswithoptions}{Check Group}% +\def\@fileswithoptions#1{% + \ifnum\currentgrouplevel>\z@ + \@latex@error + {Loading a class or package in a group}% + {Classes and packages should only be loaded at the top level}% + \fi + \@ifnextchar[%] + {\@fileswith@ptions#1}% + {\@fileswith@ptions#1[]}} +\EndIncludeInRelease +\IncludeInRelease{0000/00/00}% + {\@fileswithoptions}{Check Group}% +\def\@fileswithoptions#1{% + \@ifnextchar[%] + {\@fileswith@ptions#1}% + {\@fileswith@ptions#1[]}} +\EndIncludeInRelease \IncludeInRelease{2020/10/01}% {\@fileswith@pti@ns}{ifx tests in \@fileswith@pti@ns}% \def\@fileswith@pti@ns#1[#2]#3[#4]{% @@ -16707,9 +18270,12 @@ of this package available from CTAN} \@ifundefined{opt@handler@\@currname.\@currext} {\@onefilewithoptions@clashchk{#2}} {% - \expandafter\protected@edef\csname opt@\@currname.\@currext\endcsname + \expandafter\protected@edef + \csname opt@\@currname.\@currext\endcsname {\zap@space#2 \@empty}% - \@namedef{@raw@opt@\@currname.\@currext}{#2}% + \expandafter\def + \csname @raw@opt@\@currname.\@currext\expandafter\endcsname + \expandafter{#2}% \@nameuse{opt@handler@\@currname.\@currext}% }% }% @@ -17255,8 +18821,6 @@ of this package available from CTAN} \endgroup% \EndIncludeInRelease %%% From File: ltfilehook.dtx -\providecommand\ltfilehookversion{v1.0o} -\providecommand\ltfilehookdate{2023/07/10} \IncludeInRelease{2020/10/01}% {\CurrentFile}{Hook management file}% \ExplSyntaxOn @@ -17744,8 +19308,6 @@ of this package available from CTAN} %% Frank Mittelbach, The LaTeX Project %% %%% From File: ltshipout.dtx -\providecommand\ltshipoutversion{v1.0n} -\providecommand\ltshipoutdate{2022/11/08} \IncludeInRelease{2020/10/01}% {\shipout}{Hook management (shipout)}% \ExplSyntaxOn |