summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/base/latexrelease.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/base/latexrelease.sty')
-rw-r--r--Master/texmf-dist/tex/latex/base/latexrelease.sty2098
1 files changed, 1919 insertions, 179 deletions
diff --git a/Master/texmf-dist/tex/latex/base/latexrelease.sty b/Master/texmf-dist/tex/latex/base/latexrelease.sty
index 0597e6a5ba4..8084e186c1c 100644
--- a/Master/texmf-dist/tex/latex/base/latexrelease.sty
+++ b/Master/texmf-dist/tex/latex/base/latexrelease.sty
@@ -65,7 +65,7 @@
%% (but please observe conditions on bug reports sent to that address!)
%%
%%
-%% Copyright (C) 1993-2022
+%% Copyright (C) 1993-2023
%% The LaTeX Project and any individual authors listed elsewhere
%% in this file.
%%
@@ -290,7 +290,7 @@
}
%%% From File: ltvers.dtx
\edef\latexreleaseversion
- {2022-11-01}
+ {2023-06-01}
\newif\if@includeinrelease
\@includeinreleasefalse
\def\IncludeInRelease#1{%
@@ -421,7 +421,7 @@
\@skipping@modulefalse
\fi}
\ProvidesPackage{latexrelease}
- [2022/02/28 v1.0o LaTeX release emulation and tests
+ [2022/11/14 v1.0p LaTeX release emulation and tests
(including releases up to \latexreleaseversion)]
\NeedsTeXFormat{LaTeX2e}[1996/06/01]
\@ifundefined{sourceLaTeXdate}{%
@@ -544,6 +544,7 @@ of this package available from CTAN}
\q_recursion_tail \q_recursion_tail
\q_recursion_stop
\msg_redirect_name:nnn { hooks } { exists } { none }
+\msg_redirect_name:nnn { mark } { class-already-defined }{ none }
\cs_gset_protected:Npn \latexrelease@postltcmd
{
\__latexrelease_redefines:w
@@ -764,6 +765,7 @@ of this package available from CTAN}
\def\extrafloats#1{%
\ifnum#1>\z@
\count@\numexpr\float@count-1\relax
+ \ifnum\count@<266 \ch@ck0\m@ne\insert\fi
\ch@ck0\count@\count
\ch@ck1\count@\dimen
\ch@ck2\count@\skip
@@ -772,8 +774,7 @@ of this package available from CTAN}
\global\expandafter\e@alloc@chardef
\csname bx@\the\float@count\endcsname\float@count
\@cons\@freelist{\csname bx@\the\float@count\endcsname}%
-\expandafter
-\extrafloats\expandafter{\numexpr#1-1\relax}%
+\expandafter\extrafloats\expandafter{\the\numexpr#1-1\expandafter}%
\fi}%
\fi
\EndIncludeInRelease
@@ -1630,9 +1631,11 @@ of this package available from CTAN}
\long\def\declare@commandcopy#1#2#3#4{%
\edef\reserved@a{\@expl@cs@to@str@@N#3}%
\@ifundefined\reserved@a{#1}{#2}%
- {\robust@command@act
- \@declarecommandcopylisthook#4%
- \declare@commandcopy@let{#3#4}}}
+ {\declare@commandcopy@do{#3}{#4}}}
+\long\def\declare@commandcopy@do#1#2{%
+ \robust@command@act
+ \@declarecommandcopylisthook#2%
+ \declare@commandcopy@let{#1#2}}
\def\@declarecommandcopylisthook{%
{\@if@DeclareRobustCommand \@copy@DeclareRobustCommand}%
{\@if@newcommand \@copy@newcommand}}
@@ -1647,6 +1650,35 @@ of this package available from CTAN}
\let\@declarecommandcopylisthook\@undefined
\let\declare@commandcopy@let\@undefined
\EndIncludeInRelease
+\IncludeInRelease{2023-06-01}{\DeclareEnvironmentCopy}
+ {Add \NewEnvironmentCopy, \RenewEnvironmentCopy, and \DeclareEnvironmentCopy}%
+\def\NewEnvironmentCopy{%
+ \declare@environmentcopy
+ {\@firstofone}%
+ {\@firstoftwo\@notdefinable}}
+\def\RenewEnvironmentCopy{%
+ \declare@environmentcopy
+ {\@latex@error{Environment \reserved@a\space undefined}\@ehc
+ \@firstofone}%
+ {\@firstofone}}
+\def\DeclareEnvironmentCopy{%
+ \declare@environmentcopy
+ {\@firstofone}%
+ {\@firstofone}}
+\long\def\declare@environmentcopy#1#2#3#4{%
+ \edef\reserved@a{\@ifundefined{#3}{end#3}{#3}}%
+ \@ifundefined\reserved@a
+ {\def\reserved@a{#3}#1}%
+ {\def\reserved@a{#3}#2}%
+ {\ExpandArgs{cc}\declare@commandcopy@do{#3}{#4}%
+ \ExpandArgs{cc}\declare@commandcopy@do{end#3}{end#4}}}
+\EndIncludeInRelease
+\IncludeInRelease{0000-00-00}{\DeclareEnvironmentCopy}
+ {Undefine \NewEnvironmentCopy, \RenewEnvironmentCopy, and \DeclareEnvironmentCopy}%
+\let\NewEnvironmentCopy\@undefined
+\let\RenewEnvironmentCopy\@undefined
+\let\DeclareEnvironmentCopy\@undefined
+\EndIncludeInRelease
\IncludeInRelease{2020-10-01}{\ShowCommand}%
{Add \ShowCommand}%
\long\def\ShowCommand#1{%
@@ -1718,9 +1750,10 @@ of this package available from CTAN}
\robust@command@chk@safe#1%
{\@if@newcommand#1%
{\@show@newcommand}%
- {\show}}%
- {\show}%
+ {\@show@macro}}%
+ {\@show@macro}%
#1}
+\let\@show@macro\show
\long\def\@if@newcommand#1{%
\edef\reserved@a{%
\noexpand\@protected@testopt
@@ -1748,13 +1781,15 @@ of this package available from CTAN}
\typeout{->\@expl@cs@replacement@spec@@N#1.^^J}%
\expandafter\@show@newcommand@aux
\csname\@backslashchar\@expl@cs@to@str@@N#1\expandafter\endcsname
- \expandafter{#1}}
-\long\def\@show@newcommand@aux#1#2{%
+ \expandafter{#1}\@show@tokens}
+\long\def\@show@newcommand@aux#1#2#3{%
\typeout{> \string#1=\@expl@cs@prefix@spec@@N#1macro:}%
- \edef\reserved@a{%
- default \string##1=\expandafter\detokenize\@gobblethree#2.^^J%
- \@expl@cs@argument@spec@@N#1->\@expl@cs@replacement@spec@@N#1}%
- \showtokens\expandafter\expandafter\expandafter{\expandafter\reserved@a}}
+ #3{default \string##1=\expandafter\detokenize\@gobblethree#2.^^J%
+ \@expl@cs@argument@spec@@N#1->\@expl@cs@replacement@spec@@N#1}}
+\long\def\@show@tokens#1{%
+ \edef\reserved@a{#1}%
+ \showtokens\expandafter
+ \expandafter\expandafter{\expandafter\reserved@a}}
\EndIncludeInRelease
\IncludeInRelease{0000-00-00}{\@if@DeclareRobustCommand}
{Undefine \@if@DeclareRobustCommand, \@if@newcommand,
@@ -1770,6 +1805,57 @@ of this package available from CTAN}
\let\show@kernel@robust@command\@undefined
\let\@show@newcommand@aux\@undefined
\EndIncludeInRelease
+\IncludeInRelease{2023-06-01}{\ShowEnvironment}
+ {Add \ShowEnvironment}%
+\def\ShowEnvironment#1{%
+ \expandafter\@show@environment\csname #1\endcsname}
+\long\def\@show@environment#1{%
+ \robust@command@act
+ \@showenvironmentlisthook#1%
+ \@show@normalenv#1}
+\def\@showenvironmentlisthook{%
+ {\@if@DeclareRobustCommand \@show@DeclareRobustCommand@env}%
+ {\@if@newcommand \@show@newcommand@env}}
+\long\def\@show@newcommand@env#1{%
+ \@show@environment@begin#1%
+ \expandafter\@show@newcommand@aux
+ \csname\@backslashchar\@expl@cs@to@str@@N#1\expandafter\endcsname
+ \expandafter{#1}\@show@typeout
+ \@show@environment@end#1}
+\long\def\@show@DeclareRobustCommand@env#1{%
+ \@show@environment@begin#1%
+ \begingroup
+ \let\@show@tokens\@show@typeout
+ \let\@show@macro\@show@nonstop
+ \expandafter\show@kernel@robust@command
+ \csname\@expl@cs@to@str@@N#1 \endcsname
+ \endgroup
+ \@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->%
+ \@expl@cs@replacement@spec@@N#1.^^J}}
+\long\def\@show@normalenv#1{%
+ \@show@environment@begin#1%
+ \@show@environment@end#1}
+\long\def\@show@environment@end#1{%
+ \expandafter\@show@environment@end@aux
+ \csname end\@expl@cs@to@str@@N#1\endcsname#1}
+\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->%
+ \@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.}}
+\def\@show@typeout#1{\typeout{> #1.^^J}}
+\EndIncludeInRelease
+\IncludeInRelease{0000-00-00}{\ShowEnvironment}
+ {Undefine \ShowEnvironment}%
+\let\ShowEnvironment\@undefined
+\EndIncludeInRelease
\IncludeInRelease{2018-04-01}{\@ifundefined}
{Leave commands undefined in \@ifundefined}%
\def\@ifundefined#1{%
@@ -1900,8 +1986,8 @@ of this package available from CTAN}
\EndIncludeInRelease
%%% From File: ltcmd.dtx
-\def\ltcmdversion{v1.1a}
-\def\ltcmddate{2022-08-16}
+\def\ltcmdversion{v1.1e}
+\def\ltcmddate{2023-05-26}
\edef\@latexrelease@catcode@null{\the\catcode`\^^@ }
\catcode`\^^@=12
\ExplSyntaxOn
@@ -2186,10 +2272,10 @@ of this package available from CTAN}
\int_zero:N \l__cmd_current_arg_int
\__cmd_tl_mapthread_function:NNN \l__cmd_args_tl \l__cmd_defaults_tl
\__cmd_defaults_def:nn
- \cs_generate_from_arg_count:NNVo \__cmd_tmp:w \cs_set:Npn
+ \cs_generate_from_arg_count:NNno \__cmd_tmp:w \cs_set:Npn
\l__cmd_current_arg_int \l__cmd_tmpa_tl
}
-\cs_generate_variant:Nn \cs_generate_from_arg_count:NNnn { NNVo }
+\cs_generate_variant:Nn \cs_generate_from_arg_count:NNnn { NNno }
\cs_new_protected:Npn \__cmd_defaults_def:nn
{
\int_incr:N \l__cmd_current_arg_int
@@ -2968,6 +3054,27 @@ of this package available from CTAN}
\exp_not:c { #8 ~ } \exp_not:c { #8 ~ code }
\exp_not:n { {#5} {#6} {#7} }
}
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__cmd_copy:NN}%
+ {Support~\NewCommandCopy~in~ltcmd}
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\__cmd_copy_expandable:nnNN}%
+ {Distinguish~non-expandable~document~commands}
+\cs_new_protected:Npn \__cmd_copy_expandable:nnNN #1 #2 #3 #4
+ {
+ \cs_set_eq:cc { #1 ~ code } { #2 ~ code }
+ \__cmd_set_eq_if_exist:cc { #1 ~ } { #2 ~ }
+ \__cmd_set_eq_if_exist:cc { #1 ~ \c_space_tl } { #2 ~ \c_space_tl }
+ \__cmd_set_eq_if_exist:cc { #1 ~ defaults } { #2 ~ defaults }
+ \exp_after:wN \__cmd_copy_expandable_signature:NnNNNNnnn #4 {#1} {#2}
+ \token_if_protected_macro:NTF #4
+ { \cs_set_protected_nopar:Npx }{ \cs_set_nopar:Npx }
+ #3
+ { \exp_after:wN \__cmd_copy_expandable:NnNNNNnnn #4 {#1} {#2} }
+ }
+\EndIncludeInRelease
+\IncludeInRelease{2021/11/15}{\__cmd_copy_expandable:nnNN}%
+ {Support~\NewCommandCopy~in~ltcmd}
\cs_new_protected:Npn \__cmd_copy_expandable:nnNN #1 #2 #3 #4
{
\cs_set_eq:cc { #1 ~ code } { #2 ~ code }
@@ -2978,6 +3085,12 @@ of this package available from CTAN}
\cs_set_nopar:Npx #3
{ \exp_after:wN \__cmd_copy_expandable:NnNNNNnnn #4 {#1} {#2} }
}
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__cmd_copy_expandable:nnNN}%
+ {Support~\NewCommandCopy~in~ltcmd}
+\EndIncludeInRelease
+\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
{
\exp_not:N #1 \exp_not:n { {#2} }
@@ -3094,7 +3207,7 @@ of this package available from CTAN}
}
\exp_args:No \__cmd_tmp:w { \tl_to_str:n { end } }
\EndIncludeInRelease
-\IncludeInRelease{2020/10/01}{\__cmd_copy:NN}%
+\IncludeInRelease{2020/10/01}{\__cmd_copy:NN (part 2)}%
{Support~\NewCommandCopy~in~ltcmd}
\EndIncludeInRelease
\IncludeInRelease{2021/11/15}{\__cmd_show:N}%
@@ -3118,19 +3231,46 @@ of this package available from CTAN}
\cs_new_protected:Npn \__cmd_show_command:N #1
{ \exp_after:wN \__cmd_show_command:NnNNwN #1 \q__cmd #1 }
\cs_new_protected:Npn \__cmd_show_command:NnNNwN #1 #2 #3 #4 #5 \q__cmd #6
- { \__cmd_show_command_aux:nNNn { document~command } #6 #4 {#2} }
+ {
+ \__cmd_show_command_aux:NnNNn \tl_show:x
+ { document~command } #6 #4 {#2}
+ }
\cs_new_protected:Npn \__cmd_show_expandable:N #1
{ \exp_after:wN \__cmd_show_expandable:NnNNNNnN #1 #1 }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__cmd_show:N}%
+ {Support~\ShowCommand~in~ltcmd}
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\__cmd_show_expandable:NnNNNNnN}%
+ {Distinguish~non-expandable~document~commands}
\cs_new_protected:Npn \__cmd_show_expandable:NnNNNNnN #1 #2 #3 #4 #5 #6 #7 #8
- { \__cmd_show_command_aux:nNNn { expandable~document~command } #8 #5 {#2} }
-\cs_new_protected:Npn \__cmd_show_command_aux:nNNn #1 #2 #3 #4
{
- \__cmd_split_signature:n {#4}
- \tl_show:x
+ \exp_args:NNe \__cmd_show_command_aux:NnNNn \tl_show:x
+ { \token_if_protected_macro:NF #8 { expandable~ } document~command }
+ #8 #5 {#2}
+ }
+\EndIncludeInRelease
+\IncludeInRelease{2021/11/15}{\__cmd_show_expandable:NnNNNNnN}%
+ {Support~\ShowCommand~in~ltcmd}
+\cs_new_protected:Npn \__cmd_show_expandable:NnNNNNnN #1 #2 #3 #4 #5 #6 #7 #8
+ {
+ \__cmd_show_command_aux:NnNNn \tl_show:x
+ { expandable~document~command } #8 #5 {#2}
+ }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__cmd_show_expandable:NnNNNNnN}%
+ {Support~\ShowCommand~in~ltcmd}
+\EndIncludeInRelease
+\IncludeInRelease{2021/11/15}{\__cmd_show:N (part 2)}%
+ {Support~\ShowCommand~in~ltcmd}
+\cs_new_protected:Npn \__cmd_show_command_aux:NnNNn #1 #2 #3 #4 #5
+ {
+ \__cmd_split_signature:n {#5}
+ #1
{
- \token_to_str:N #2 = #1: \iow_newline:
+ \token_to_str:N #3 = #2: \iow_newline:
\tl_use:N \l__cmd_tmpa_tl
- -> \cs_replacement_spec:N #3
+ -> \cs_replacement_spec:N #4
}
}
\cs_new_protected:Npn \__cmd_show_environment:N #1
@@ -3147,12 +3287,14 @@ of this package available from CTAN}
{
\use:x
{
- \__cmd_show_command_aux:nNNn { document~environment }
+ \__cmd_show_command_aux:NnNNn \__cmd_show:x { document~environment }
{ \exp_not:N \begin {#3} }
\exp_not:c { environment~ #3 ~ code }
{#2}
}
}
+\cs_new_protected:Npn \__cmd_show:x #1
+ { \iow_term:x { > ~ #1 . \iow_newline: } }
\cs_new_protected:Npn \__cmd_show_environment_end:N #1
{
\exp_args:NNx \__cmd_check_end:Nn \l__cmd_tmpa_tl { \cs_to_str:N #1 }
@@ -3160,6 +3302,8 @@ of this package available from CTAN}
}
\tl_gput_right:Nn \@showcommandlisthook
{ { \__kernel_cmd_if_xparse:NTF \__cmd_show:N } }
+\tl_gput_right:Nn \@showenvironmentlisthook
+ { { \__kernel_cmd_if_xparse:NTF \__cmd_show:N } }
\cs_new_protected:Npn \__cmd_split_signature:n #1
{
\int_set:Nn \l__cmd_current_arg_int { 1 }
@@ -3240,7 +3384,7 @@ of this package available from CTAN}
\int_incr:N \l__cmd_current_arg_int
}
\EndIncludeInRelease
-\IncludeInRelease{2020/10/01}{\__cmd_show:N}%
+\IncludeInRelease{2020/10/01}{\__cmd_show:N (part 2)}%
{Support~\ShowCommand~in~ltcmd}
\EndIncludeInRelease
\cs_new_protected:Npn \__cmd_grab_b:w
@@ -3574,6 +3718,7 @@ of this package available from CTAN}
\tl_set:Nn \l__cmd_signature_tl {#1}
\group_begin:
\tex_escapechar:D = 92 \scan_stop:
+ \tex_endlinechar:D = `\^^M \scan_stop:
\tl_clear:N \l__cmd_v_arg_tl
\peek_remove_spaces:n
{
@@ -3591,8 +3736,8 @@ of this package available from CTAN}
}
\cs_new_protected:Npn \__cmd_grab_v_group_end:
{
- \exp_args:NNNo
- \group_end:
+ \exp_args:NNNo
+ \group_end:
\tl_set:Nn \l__cmd_v_arg_tl { \l__cmd_v_arg_tl }
}
\cs_new_protected:Npn \__cmd_grab_v_aux_test:N #1
@@ -3670,7 +3815,6 @@ of this package available from CTAN}
{
\cs_set_eq:NN \do \char_set_catcode_other:N
\dospecials
- \tex_endlinechar:D = `\^^M \scan_stop:
\bool_if:NTF \l__cmd_long_bool
{ \char_set_catcode_other:n { \tex_endlinechar:D } }
{ \char_set_catcode_parameter:n { \tex_endlinechar:D } }
@@ -4740,8 +4884,8 @@ of this package available from CTAN}
\catcode`\^^@=\@latexrelease@catcode@null\relax
%%% From File: lthooks.dtx
-\def\lthooksversion{v1.0v}
-\def\lthooksdate{2022/06/15}
+\def\lthooksversion{v1.1e}
+\def\lthooksdate{2023/06/06}
\ExplSyntaxOn
\NewModuleRelease{2020/10/01}{lthooks}
{The~hook~management~system}
@@ -4774,44 +4918,64 @@ of this package available from CTAN}
\tl_new:N \g__hook_hook_curr_name_tl
\seq_new:N \g__hook_name_stack_seq
\cs_new_eq:NN \__hook_tmp:w ?
+\tl_const:Nn \c__hook_empty_tl { }
+\tl_const:Nn \c__hook_nine_parameters_tl { #1#2#3#4#5#6#7#8#9 }
\cs_generate_variant:Nn \tl_gremove_once:Nn { Nx }
\cs_generate_variant:Nn \tl_show:n { x }
\cs_generate_variant:Nn \tl_log:n { x }
+\cs_generate_variant:Nn \tl_set:Nn { Ne }
+\cs_generate_variant:Nn \cs_replacement_spec:N { c }
+\cs_generate_variant:Nn \prop_put:Nnn { Nne }
+\cs_generate_variant:Nn \str_count:n { e }
\scan_new:N \s__hook_mark
-\cs_new:Npn \__hook_clean_to_scan:w #1 \s__hook_mark { }
-\cs_new_protected:Npn \__hook_tl_set:Nn #1#2
- { \cs_set_nopar:Npx #1 { \__kernel_exp_not:w {#2} } }
-\cs_new_protected:Npn \__hook_tl_set:Nx #1#2
- { \cs_set_nopar:Npx #1 {#2} }
-\cs_generate_variant:Nn \__hook_tl_set:Nn { c }
-\cs_generate_variant:Nn \__hook_tl_set:Nx { c }
+\cs_new:Npn \__hook_use_none_delimit_by_s_mark:w #1 \s__hook_mark { }
+\cs_new:Npn \__hook_use_i_delimit_by_s_mark:nw #1 #2 \s__hook_mark {#1}
+\cs_new_protected:Npn \__hook_tl_set:cn #1#2
+ { \cs_set_nopar:cpx {#1} { \__kernel_exp_not:w {#2} } }
\cs_new_protected:Npn \__hook_tl_gset:Nn #1#2
{ \cs_gset_nopar:Npx #1 { \__kernel_exp_not:w {#2} } }
-\cs_new_protected:Npn \__hook_tl_gset:No #1#2
- { \cs_gset_nopar:Npx #1 { \__kernel_exp_not:w \exp_after:wN {#2} } }
\cs_new_protected:Npn \__hook_tl_gset:Nx #1#2
{ \cs_gset_nopar:Npx #1 {#2} }
-\cs_generate_variant:Nn \__hook_tl_gset:Nn { c }
-\cs_generate_variant:Nn \__hook_tl_gset:No { c }
+\cs_generate_variant:Nn \__hook_tl_gset:Nn { c, co }
\cs_generate_variant:Nn \__hook_tl_gset:Nx { c }
\cs_new_protected:Npn \__hook_tl_gput_right:Nn #1#2
{ \__hook_tl_gset:Nx #1 { \__kernel_exp_not:w \exp_after:wN { #1 #2 } } }
-\cs_generate_variant:Nn \__hook_tl_gput_right:Nn { No, cn }
+\cs_generate_variant:Nn \__hook_tl_gput_right:Nn { Ne, cn }
\cs_new_protected:Npn \__hook_tl_gput_left:Nn #1#2
{
\__hook_tl_gset:Nx #1
{ \__kernel_exp_not:w {#2} \__kernel_exp_not:w \exp_after:wN {#1} }
}
-\cs_generate_variant:Nn \__hook_tl_gput_left:Nn { No }
\cs_new_eq:NN \__hook_tl_gset_eq:NN \tl_gset_eq:NN
\cs_new_protected:Npn \__hook_tl_gclear:N #1
{ \__hook_tl_gset_eq:NN #1 \c_empty_tl }
\cs_generate_variant:Nn \__hook_tl_gclear:N { c }
-
+\IncludeInRelease{2023/06/01}{\hook_new_with_args:nn}
+ {Hooks~with~args}
\cs_new_protected:Npn \hook_new:n #1
+ { \__hook_normalize_hook_args:Nn \__hook_new:nn {#1} { 0 } }
+\cs_new_protected:Npn \hook_new_with_args:nn #1 #2
+ { \__hook_normalize_hook_args:Nn \__hook_new:nn {#1} {#2} }
+\cs_new_protected:Npn \__hook_new:nn #1 #2
+ {
+ \__hook_if_declared:nTF {#1}
+ { \msg_error:nnn { hooks } { exists } {#1} }
+ {
+ \tl_new:c { g__hook_#1_declared_tl }
+ \cs_undefine:c { __hook~#1 }
+ \cs_undefine:c { c__hook_#1_parameter_tl }
+ \__hook_make_usable:nn {#1} {#2}
+ \__hook_update_hook_code:n {#1}
+ }
+ }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\hook_new_with_args:nn}
+ {Hooks~with~args}
+\cs_gset_protected:Npn \hook_new:n #1
{ \__hook_normalize_hook_args:Nn \__hook_new:n {#1} }
-\cs_new_protected:Npn \__hook_new:n #1
+\cs_undefine:N \__hook_new:nn
+\cs_gset_protected:Npn \__hook_new:n #1
{
\__hook_if_declared:nTF {#1}
{ \msg_error:nnn { hooks } { exists } {#1} }
@@ -4820,7 +4984,40 @@ of this package available from CTAN}
\__hook_make_usable:n {#1}
}
}
-\cs_new_protected:Npn \__hook_make_usable:n #1
+\cs_gset_protected:Npn \hook_new_with_args:nn #1 { }
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\__hook_make_usable:nn}
+ {Hooks~with~args}
+\cs_new_protected:Npn \__hook_make_usable:nn #1 #2
+ {
+ \__hook_if_usable:nF {#1}
+ {
+ \seq_gput_right:Nn \g__hook_all_seq {#1}
+ \__kernel_cs_parm_from_arg_count:nnF
+ { \tl_const:cn { c__hook_#1_parameter_tl } } {#2}
+ {
+ \msg_error:nnnn { hooks } { too-many-args } {#1} {#2}
+ \tl_const:cx { c__hook_#1_parameter_tl }
+ { \exp_not:V \c__hook_nine_parameters_tl }
+ }
+ \__hook_normalise_cs_args:nn { _toplevel } {#1}
+ \__hook_normalise_cs_args:nn { _next } {#1}
+ \__hook_code_gset:nn {#1} { }
+ \__hook_init_structure:n {#1}
+ \__hook_normalise_code_pool:n {#1}
+ \clist_if_exist:cF { g__hook_#1_labels_clist }
+ {
+ \clist_new:c { g__hook_#1_labels_clist }
+ \tl_new:c { g__hook_#1_reversed_tl }
+ }
+ \__hook_include_legacy_code_chunk:n {#1}
+ }
+ }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__hook_make_usable:nn}
+ {Hooks~with~args}
+\cs_undefine:N \__hook_make_usable:nn
+\cs_gset_protected:Npn \__hook_make_usable:n #1
{
\tl_if_exist:cF { __hook~#1 }
{
@@ -4832,38 +5029,127 @@ of this package available from CTAN}
\__hook_include_legacy_code_chunk:n {#1}
}
}
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\__hook_init_structure:n}
+ {Hooks~with~args}
\cs_new_protected:Npn \__hook_init_structure:n #1
{
\__hook_if_structure_exist:nF {#1}
{
\prop_new:c { g__hook_#1_code_prop }
+ \__hook_toplevel_gset:nn {#1} { }
+ \__hook_next_gset:nn {#1} { }
+ }
+ }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__hook_init_structure:n}
+ {Hooks~with~args}
+\cs_gset_protected:Npn \__hook_init_structure:n #1
+ {
+ \__hook_if_structure_exist:nF {#1}
+ {
+ \prop_new:c { g__hook_#1_code_prop }
\tl_new:c { __hook_toplevel~#1 }
\tl_new:c { __hook_next~#1 }
}
}
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\hook_new_reversed_with_args:nn}
+ {Hooks~with~args}
\cs_new_protected:Npn \hook_new_reversed:n #1
+ { \__hook_normalize_hook_args:Nn \__hook_new_reversed:nn {#1} { 0 } }
+\cs_new_protected:Npn \hook_new_reversed_with_args:nn #1 #2
+ { \__hook_normalize_hook_args:Nn \__hook_new_reversed:nn {#1} {#2} }
+\cs_new_protected:Npn \__hook_new_reversed:nn #1 #2
+ {
+ \__hook_if_declared:nTF {#1}
+ { \msg_error:nnn { hooks } { exists } {#1} }
+ {
+ \__hook_new:nn {#1} {#2}
+ \tl_gset:cn { g__hook_#1_reversed_tl } { - }
+ }
+ }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\hook_new_reversed_with_args:nn}
+ {Hooks~with~args}
+\cs_gset_protected:Npn \hook_new_reversed:n #1
{ \__hook_normalize_hook_args:Nn \__hook_new_reversed:n {#1} }
-\cs_new_protected:Npn \__hook_new_reversed:n #1
+\cs_undefine:N \__hook_new_reversed:nn
+\cs_gset_protected:Npn \__hook_new_reversed:n #1
{
\__hook_new:n {#1}
\tl_gset:cn { g__hook_#1_reversed_tl } { - }
}
+\cs_undefine:N \__hook_new_reversed:nn
+\cs_gset_protected:Npn \hook_new_reversed_with_args:nn #1 #2 { }
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\hook_new_pair_with_args:nnn}
+ {Hooks~with~args}
\cs_new_protected:Npn \hook_new_pair:nn #1#2
- { \hook_new:n {#1} \hook_new_reversed:n {#2} }
+ { \__hook_normalize_hook_args:Nnn \__hook_new_pair:nnn {#1} {#2} { 0 } }
+\cs_new_protected:Npn \hook_new_pair_with_args:nnn #1#2#3
+ { \__hook_normalize_hook_args:Nnn \__hook_new_pair:nnn {#1} {#2} {#3} }
+\cs_new_protected:Npn \__hook_new_pair:nnn #1 #2 #3
+ {
+ \__hook_if_declared:nTF {#1}
+ { \msg_error:nnn { hooks } { exists } {#1} }
+ {
+ \__hook_if_declared:nTF {#2}
+ { \msg_error:nnn { hooks } { exists } {#2} }
+ {
+ \__hook_new:nn {#1} {#3}
+ \__hook_new_reversed:nn {#2} {#3}
+ }
+ }
+ }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\hook_new_pair_with_args:nnn}
+ {Hooks~with~args}
+\cs_gset_protected:Npn \hook_new_pair:nn #1#2
+ {
+ \hook_new:n {#1}
+ \hook_new_reversed:n {#2}
+ }
+\cs_gset_protected:Npn \hook_new_pair_with_args:nnn #1#2#3
+ { }
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\__hook_include_legacy_code_chunk:n}
+ {Hooks~with~args}
\cs_new_protected:Npn \__hook_include_legacy_code_chunk:n #1
{
\tl_if_exist:cT { @#1hook }
{
\tl_if_empty:cF { @#1hook }
{
- \exp_args:Nnnv \__hook_hook_gput_code_do:nnn {#1}
- { legacy } { @#1hook }
+ \__hook_replacing_args_false:
+ \use:e
+ {
+ \__hook_hook_gput_code_do:nnn {#1} { legacy }
+ { \exp_not:v { @#1hook } }
+ }
+ \__hook_replacing_args_reset:
\__hook_tl_gclear:c { @#1hook }
}
}
}
-\IncludeInRelease{2021/06/01}%
- {\hook_disable_generic:n}{Disable~hooks}
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__hook_include_legacy_code_chunk:n}
+ {Hooks~with~args}
+\cs_gset_protected:Npn \__hook_include_legacy_code_chunk:n #1
+ {
+ \tl_if_exist:cT { @#1hook }
+ {
+ \tl_if_empty:cF { @#1hook }
+ {
+ \exp_args:Nnnv \__hook_hook_gput_code_do:nnn
+ {#1} { legacy } { @#1hook }
+ \__hook_tl_gclear:c { @#1hook }
+ }
+ }
+ }
+\EndIncludeInRelease
+\IncludeInRelease{2021/06/01}{\hook_disable_generic:n}
+ {Disable~hooks}
\cs_new_protected:Npn \hook_disable_generic:n #1
{ \__hook_normalize_hook_args:Nn \__hook_disable:n {#1} }
\cs_new_protected:Npn \__hook_disable:n #1
@@ -4875,19 +5161,19 @@ of this package available from CTAN}
{
\bool_lazy_and:nnTF
{ \tl_if_exist_p:c { g__hook_#1_declared_tl } }
- { ! \tl_if_exist_p:c { __hook~#1 } }
+ { ! \cs_if_exist_p:c { __hook~#1 } }
{ \prg_return_true: }
{ \prg_return_false: }
}
\EndIncludeInRelease
-\IncludeInRelease{2020/10/01}
- {\hook_disable_generic:n}{Disable~hooks}
+\IncludeInRelease{2020/10/01}{\hook_disable_generic:n}
+ {Disable~hooks}
\cs_new_protected:Npn \hook_disable_generic:n #1 {}
\EndIncludeInRelease
-\IncludeInRelease{2021/06/01}%
- {\hook_activate_generic:n}{Providing~hooks}
+\IncludeInRelease{2023/06/01}{\hook_activate_generic:n}
+ {Providing~hooks}
\cs_new_protected:Npn \hook_activate_generic:n #1
{ \__hook_normalize_hook_args:Nn \__hook_activate_generic:nn {#1} { } }
\cs_new_protected:Npn \__hook_activate_generic:nn #1 #2
@@ -4898,6 +5184,24 @@ of this package available from CTAN}
\__hook_if_declared:nF {#1}
{
\tl_new:c { g__hook_#1_declared_tl }
+ \__hook_make_usable:nn {#1} { 0 }
+ \tl_gset:cx { g__hook_#1_reversed_tl }
+ { \__hook_if_generic_reversed:nT {#1} { - } }
+ \__hook_update_hook_code:n {#1}
+ }
+ }
+ }
+\EndIncludeInRelease
+\IncludeInRelease{2021/06/01}{\hook_activate_generic:n}
+ {Providing~hooks}
+\cs_gset_protected:Npn \__hook_activate_generic:nn #1 #2
+ {
+ \__hook_if_disabled:nTF {#1}
+ { \msg_warning:nnn { hooks } { activate-disabled } {#1} }
+ {
+ \__hook_if_declared:nF {#1}
+ {
+ \tl_new:c { g__hook_#1_declared_tl }
\__hook_make_usable:n {#1}
\tl_gset:cx { g__hook_#1_reversed_tl }
{ \__hook_if_generic_reversed:nT {#1} { - } }
@@ -4906,11 +5210,9 @@ of this package available from CTAN}
}
}
\EndIncludeInRelease
-\IncludeInRelease{2020/10/01}
- {\hook_activate_generic:n}{Providing~hooks}
-
-\cs_new_protected:Npn \hook_activate_generic:n #1 {}
-
+\IncludeInRelease{2020/10/01}{\hook_activate_generic:n}
+ {Providing~hooks}
+\cs_gset_protected:Npn \hook_activate_generic:n #1 { }
\EndIncludeInRelease
\cs_new:Npn \__hook_parse_label_default:n #1
{
@@ -5065,10 +5367,105 @@ of this package available from CTAN}
}
{ \tl_gset:Nn \g__hook_hook_curr_name_tl {#1} }
}
-\cs_new_protected:Npn \hook_gput_code:nnn #1 #2
- { \__hook_normalize_hook_args:Nnn \__hook_gput_code:nnn {#1} {#2} }
+\IncludeInRelease{2023/06/01}{\hook_gput_code_with_args:nnn}
+ {Hooks~with~args}
+\cs_new_protected:Npn \hook_gput_code:nnn #1 #2 #3
+ {
+ \__hook_replacing_args_false:
+ \__hook_normalize_hook_args:Nnn \__hook_gput_code:nnn {#1} {#2} {#3}
+ \__hook_replacing_args_reset:
+ }
+\cs_new_protected:Npn \hook_gput_code_with_args:nnn #1 #2 #3
+ {
+ \__hook_replacing_args_true:
+ \__hook_normalize_hook_args:Nnn \__hook_gput_code:nnn {#1} {#2} {#3}
+ \__hook_replacing_args_reset:
+ }
\cs_new_protected:Npn \__hook_gput_code:nnn #1 #2 #3
{
+ \__hook_chk_args_allowed:nn {#1} { AddToHook }
+ \__hook_if_execute_immediately:nTF {#1}
+ {
+ \__hook_if_replacing_args:TF
+ {
+ \msg_error:nnnn { hooks } { one-time-args }
+ {#1} { AddToHook }
+ }
+ { }
+ \use:n
+ }
+ { \__hook_gput_code_store:nnn {#1} {#2} }
+ {#3}
+ }
+\cs_new_protected:Npn \__hook_gput_code_store:nnn #1 #2 #3
+ {
+ \__hook_if_usable:nTF {#1}
+ {
+ \__hook_hook_gput_code_do:nnn {#1} {#2} {#3}
+ \__hook_update_hook_code:n {#1}
+ }
+ {
+ \__hook_if_disabled:nTF {#1}
+ { \msg_error:nnn { hooks } { hook-disabled } {#1} }
+ { \__hook_try_declaring_generic_hook:nnn {#1} {#2} {#3} }
+ }
+ }
+\cs_new_protected:Npn \__hook_hook_gput_code_do:nnn #1 #2 #3
+ {
+ \__hook_debug:n{\iow_term:x{****~ Add~ to~
+ \__hook_if_usable:nF {#1} { undeclared~ }
+ hook~ #1~ (#2)
+ \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: }
+ {
+ \__hook_init_structure:n {#1}
+ \__hook_cs_gput_right:nnn { _toplevel } {#1} {#3}
+ }
+ { \msg_error:nnn { hooks } { misused-top-level } {#1} }
+ }
+ {
+ \exp_args:Nx \__hook_prop_gput_labeled_cleanup:nnn
+ {
+ \__hook_if_replacing_args:TF
+ { \exp_not:n }
+ { \__hook_double_hashes:n }
+ {#3}
+ }
+ {#1} {#2}
+ }
+ }
+\cs_new_protected:Npn \__hook_prop_gput_labeled_cleanup:nnn #1 #2 #3
+ {
+ \tl_set:Nn \l__hook_return_tl {#1}
+ \__hook_if_replacing_args:TF
+ {
+ \__hook_if_usable:nT {#2}
+ {
+ \__hook_set_normalise_fn:nn {#2}
+ { Invalid~code~added~\msg_line_context: }
+ \__hook_normalise_fn:nn {#3} {#1}
+ \prop_get:NnN \l__hook_work_prop {#3} \l__hook_return_tl
+ }
+ }
+ { }
+ \exp_args:NcV \__hook_prop_gput_labeled_do:Nnn
+ { g__hook_#2_code_prop } \l__hook_return_tl {#3}
+ }
+\cs_new_protected:Npn \__hook_prop_gput_labeled_do:Nnn #1 #2 #3
+ {
+ \prop_get:NnNTF #1 {#3} \l__hook_return_tl
+ { \prop_gput:Nno #1 {#3} { \l__hook_return_tl #2 } }
+ { \prop_gput:Nnn #1 {#3} {#2} }
+ }
+\EndIncludeInRelease
+\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} }
+\cs_gset_protected:Npn \__hook_gput_code:nnn #1 #2 #3
+ {
\__hook_if_execute_immediately:nTF {#1}
{#3}
{
@@ -5084,7 +5481,7 @@ of this package available from CTAN}
}
}
}
-\cs_new_protected:Npn \__hook_hook_gput_code_do:nnn #1 #2 #3
+\cs_gset_protected:Npn \__hook_hook_gput_code_do:nnn #1 #2 #3
{
\__hook_debug:n{\iow_term:x{****~ Add~ to~
\__hook_if_usable:nF {#1} { undeclared~ }
@@ -5108,21 +5505,61 @@ of this package available from CTAN}
{ \prop_gput:cnn { g__hook_#1_code_prop } {#2} {#3} }
}
}
+\cs_gset_protected:Npn \hook_gput_code_with_args:nnn #1#2#3 { }
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\__hook_chk_args_allowed:nn}
+ {Hooks~with~args}
+\cs_new_protected:Npn \__hook_chk_args_allowed:nn #1 #2
+ {
+ \__hook_if_replacing_args:TF
+ {
+ \__hook_if_declared:nT {#1}
+ { \tl_if_empty:cT { c__hook_#1_parameter_tl } { \use_ii:nn } }
+ \use_none:n
+ {
+ \msg_error:nnnn { hooks } { without-args } {#1} {#2}
+ \__hook_replacing_args_false:
+ }
+ }
+ { }
+ }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__hook_chk_args_allowed:nn}
+ {Hooks~with~args}
+\cs_undefine:N \__hook_chk_args_allowed:nn
+\EndIncludeInRelease
\cs_new_protected:Npn \__hook_gput_undeclared_hook:nnn #1 #2 #3
{
\__hook_init_structure:n {#1}
\__hook_hook_gput_code_do:nnn {#1} {#2} {#3}
}
+\IncludeInRelease{2023/06/01}{\__hook_try_declaring_generic_hook:nnn}
+ {Hooks~with~args}
+\cs_new_protected:Npn \__hook_try_declaring_generic_hook:nnn #1
+ {
+ \__hook_try_declaring_generic_hook:wnTF #1 / / / \scan_stop: {#1}
+ \__hook_gput_code:nnn
+ \__hook_gput_undeclared_hook:nnn
+ {#1}
+ }
+\cs_new_protected:Npn \__hook_try_declaring_generic_next_hook:nn #1
+ {
+ \__hook_try_declaring_generic_hook:wnTF #1 / / / \scan_stop: {#1}
+ \__hook_gput_next_code:nn
+ \__hook_gput_next_do:nn
+ {#1}
+ }
+\EndIncludeInRelease
\IncludeInRelease{2021/11/15}{\__hook_try_declaring_generic_hook:nnn}
{Standardise~generic~hook~names}
-\cs_new_protected:Npn \__hook_try_declaring_generic_hook:nnn #1
+\cs_gset_protected:Npn \__hook_try_declaring_generic_hook:nnn #1
{
\__hook_try_declaring_generic_hook:wnTF #1 / / / \scan_stop: {#1}
\hook_gput_code:nnn
\__hook_gput_undeclared_hook:nnn
{#1}
}
-\cs_new_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_gput_next_code:nn
@@ -5158,8 +5595,8 @@ of this package available from CTAN}
{ #3 } {#1}
}
\EndIncludeInRelease
-\IncludeInRelease{2021/11/15}{\__hook_try_declaring_generic_hook:wn}%
- {Standardise~generic~hook~names}
+\IncludeInRelease{2023/06/01}{\__hook_try_declaring_generic_hook:wn}
+ {Hooks~with~args}
\prg_new_protected_conditional:Npnn \__hook_try_declaring_generic_hook:wn
#1 / #2 / #3 / #4 \scan_stop: #5 { TF }
{
@@ -5168,8 +5605,12 @@ of this package available from CTAN}
\__hook_if_usable:nF {#5}
{
\str_if_eq:nnT {#1} { cmd }
- { \__hook_try_put_cmd_hook:n {#5} }
- \__hook_make_usable:n {#5}
+ {
+ \__hook_try_put_cmd_hook:n {#5}
+ \__hook_make_usable:nn {#5} { 9 }
+ \use_none:nnn
+ }
+ \__hook_make_usable:nn {#5} { 0 }
}
\__hook_if_generic_reversed:nT {#5}
{ \tl_gset:cn { g__hook_#5_reversed_tl } { - } }
@@ -5210,6 +5651,34 @@ of this package available from CTAN}
#1 #2 { #3 / #5 / #4 }
}
\EndIncludeInRelease
+\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
+ #1 / #2 / #3 / #4 \scan_stop: #5 { TF }
+ {
+ \__hook_if_generic:nTF {#5}
+ {
+ \__hook_if_usable:nF {#5}
+ {
+ \str_if_eq:nnT {#1} { cmd }
+ { \__hook_try_put_cmd_hook:n {#5} }
+ \__hook_make_usable:n {#5}
+ }
+ \__hook_if_generic_reversed:nT {#5}
+ { \tl_gset:cn { g__hook_#5_reversed_tl } { - } }
+ \prg_return_true:
+ }
+ {
+ \__hook_if_deprecated_generic:nTF {#5}
+ {
+ \__hook_deprecated_generic_warn:n {#5}
+ \exp_after:wN \__hook_declare_deprecated_generic:NNn
+ \exp:w % \exp_end:
+ }
+ { \prg_return_false: }
+ }
+ }
+\EndIncludeInRelease
\IncludeInRelease{2021/06/01}{\__hook_try_declaring_generic_hook:wn}
{Support~cmd~hooks}
\prg_new_protected_conditional:Npnn \__hook_try_declaring_generic_hook:wn
@@ -5238,7 +5707,7 @@ 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
#1 / #2 / #3 / #4 \scan_stop: #5 { TF }
@@ -5260,23 +5729,11 @@ of this package available from CTAN}
{ \prg_return_false: }
}
}
-
\EndIncludeInRelease
-\IncludeInRelease{2021/11/15}{\__hook_if_file_hook:w}%
+\IncludeInRelease{2021/11/15}{\__hook_if_file_hook:w}
{Standardise~generic~hook~names}
-\prg_new_conditional:Npnn \__hook_if_file_hook:w
- #1 / #2 \s__hook_mark #3 { TF }
- {
- \__hook_if_generic:nTF {#3}
- {
- \str_if_eq:nnTF {#1} { file }
- { \prg_return_true: }
- { \prg_return_false: }
- }
- { \prg_return_false: }
- }
\EndIncludeInRelease
-\IncludeInRelease{2020/10/01}{\__hook_if_file_hook:w}%
+\IncludeInRelease{2020/10/01}{\__hook_if_file_hook:w}
{Standardise~generic~hook~names}
\prg_new_conditional:Npnn \__hook_if_file_hook:w
#1 / #2 / #3 \s__hook_mark { TF }
@@ -5296,10 +5753,10 @@ of this package available from CTAN}
{ \prg_return_false: }
}
\EndIncludeInRelease
-\IncludeInRelease{2021/11/15}{\__hook_file_hook_normalize:n}%
+\IncludeInRelease{2021/11/15}{\__hook_file_hook_normalize:n}
{Standardise~generic~hook~names}
\EndIncludeInRelease
-\IncludeInRelease{2020/10/01}{\__hook_file_hook_normalize:n}%
+\IncludeInRelease{2020/10/01}{\__hook_file_hook_normalize:n}
{Standardise~generic~hook~names}
\cs_new:Npn \__hook_file_hook_normalize:n #1
{ \__hook_strip_double_slash:n {#1} }
@@ -5312,7 +5769,7 @@ of this package available from CTAN}
{ \__hook_strip_double_slash:w #1/#2/#3 / #4 \s__hook_mark }
}
\EndIncludeInRelease
-\IncludeInRelease{2021/11/15}{\c__hook_generics_prop}%
+\IncludeInRelease{2021/11/15}{\c__hook_generics_prop}
{Standardise~generic~hook~names}
\clist_map_inline:nn { cmd , env , file , package , class , include }
{
@@ -5330,20 +5787,30 @@ of this package available from CTAN}
}
\tl_const:cn { c__hook_deprecated_include/./end_tl } { }
\EndIncludeInRelease
-\IncludeInRelease{2020/10/01}{\c__hook_generics_prop}%
+\IncludeInRelease{2020/10/01}{\c__hook_generics_prop}
{Standardise~generic~hook~names}
\prop_const_from_keyval:Nn \c__hook_generics_prop
{cmd=,env=,file=,package=,class=,include=}
\EndIncludeInRelease
-\IncludeInRelease{2021/11/15}{\c__hook_generics_reversed_ii_prop}%
+\IncludeInRelease{2021/11/15}{\c__hook_generics_reversed_ii_prop}
{Standardise~generic~hook~names}
\EndIncludeInRelease
-\IncludeInRelease{2020/10/01}{\c__hook_generics_reversed_ii_prop}%
+\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=}
\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\c__hook_parameter_cmd/./before_tl}
+ {Hooks~with~args}
+\tl_const:cn { c__hook_parameter_cmd/./before_tl } { #1#2#3#4#5#6#7#8#9 }
+\tl_const:cn { c__hook_parameter_cmd/./after_tl } { #1#2#3#4#5#6#7#8#9 }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\c__hook_parameter_cmd/./before_tl}
+ {Hooks~with~args}
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\hook_gremove_code:nn}
+ {Hooks~with~args}
\cs_new_protected:Npn \hook_gremove_code:nn #1 #2
{ \__hook_normalize_hook_args:Nnn \__hook_gremove_code:nn {#1} {#2} }
\cs_new_protected:Npn \__hook_gremove_code:nn #1 #2
@@ -5353,6 +5820,39 @@ of this package available from CTAN}
\str_if_eq:nnTF {#2} {*}
{
\prop_gclear:c { g__hook_#1_code_prop }
+ \__hook_toplevel_gset:nn {#1} { }
+ \__hook_next_gset:nn {#1} { }
+ }
+ {
+ \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
+ { \msg_warning:nnnn { hooks } { cannot-remove } {#1} {#2} }
+ }
+ }
+ \__hook_if_usable:nT {#1}
+ { \__hook_update_hook_code:n {#1} }
+ }
+ {
+ \__hook_if_deprecated_generic:nTF {#1}
+ {
+ \__hook_deprecated_generic_warn:n {#1}
+ \__hook_do_deprecated_generic:Nn \__hook_gremove_code:nn {#1} {#2}
+ }
+ { \msg_warning:nnnn { hooks } { cannot-remove } {#1} {#2} }
+ }
+ }
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\hook_gremove_code:nn}
+ {Hooks~with~args}
+\cs_new_protected:Npn \__hook_gremove_code:nn #1 #2
+ {
+ \__hook_if_structure_exist:nTF {#1}
+ {
+ \str_if_eq:nnTF {#2} {*}
+ {
+ \prop_gclear:c { g__hook_#1_code_prop }
\__hook_tl_gclear:c { __hook_toplevel~#1 }
\__hook_tl_gclear:c { __hook_next~#1 }
}
@@ -5376,9 +5876,276 @@ of this package available from CTAN}
{ \msg_warning:nnnn { hooks } { cannot-remove } {#1} {#2} }
}
}
-\prop_new:c {g__hook_??_code_prop}
-\prop_new:c {__hook~??}
-\tl_new:c {g__hook_??_reversed_tl}
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\__hook_cs_gput_right:nnn}
+ {Hooks~with~args}
+\cs_new_protected:Npn \__hook_cs_gput_right:nnn #1 #2
+ {
+ \if:w T
+ \__hook_if_declared:nF {#2} { F }
+ \tl_if_empty:cF { c__hook_#2_parameter_tl } { F }
+ T
+ \exp_after:wN \__hook_cs_gput_right_fast:nnn
+ \else:
+ \exp_after:wN \__hook_cs_gput_right_slow:nnn
+ \fi:
+ {#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_new_protected:Npn \__hook_cs_gput_right_slow:nnn #1 #2 #3
+ {
+ \cs_if_exist:cF { __hook#1~#2 }
+ { \__hook_code_gset_aux:nnn {#1} {#2} { } }
+ \__hook_code_gset_auxi:eeen
+ {
+ \__hook_if_declared:nTF {#2}
+ { \tl_use:c { c__hook_#2_parameter_tl } }
+ {
+ \__hook_if_generic:nTF {#2}
+ { \__hook_generic_parameter:n {#2} }
+ { \c__hook_nine_parameters_tl }
+ }
+ }
+ {
+ \exp_args:NNo \exp_args:No \__hook_double_hashes:n
+ {
+ \cs:w __hook#1~#2 \exp_last_unbraced:Ne \cs_end:
+ { \__hook_braced_cs_parameter:n { __hook#1~#2 } }
+ }
+ }
+ {
+ \__hook_if_replacing_args:TF
+ { \exp_not:n }
+ { \__hook_double_hashes:n }
+ {#3}
+ }
+ { __hook#1~#2 }
+ }
+\cs_new_protected:Npn \__hook_code_gset_auxi:nnnn #1 #2 #3 #4
+ { \cs_gset:cpn {#4} #1 { #2 #3 } }
+\cs_generate_variant:Nn \__hook_code_gset_auxi:nnnn { eeen }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__hook_cs_gput_right:nnn}
+ {Hooks~with~args}
+\cs_undefine:N \__hook_cs_gput_right:nnn
+\cs_undefine:N \__hook_cs_gput_right_fast:nnn
+\cs_undefine:N \__hook_cs_gput_right_slow:nnn
+\cs_undefine:N \__hook_code_gset_auxi:nnnn
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\__hook_code_gset:nn}
+ {Hooks~with~args}
+\cs_new_protected:Npn \__hook_code_gset:nn
+ { \__hook_code_gset_aux:nnn { } }
+\cs_new_protected:Npn \__hook_toplevel_gset:nn
+ { \__hook_code_gset_aux:nnn { _toplevel } }
+\cs_new_protected:Npn \__hook_next_gset:nn
+ { \__hook_code_gset_aux:nnn { _next } }
+\cs_new_protected:Npn \__hook_code_gset_aux:nnn #1 #2 #3
+ {
+ \cs_gset:cpn { __hook#1~#2 \exp_last_unbraced:Ne }
+ { \__hook_parameter:n {#2} }
+ {#3}
+ }
+\cs_generate_variant:Nn \__hook_code_gset:nn { ne }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__hook_code_gset:nn}
+ {Hooks~with~args}
+\cs_undefine:N \__hook_code_gset:nn
+\cs_undefine:N \__hook_toplevel_gset:nn
+\cs_undefine:N \__hook_next_gset:nn
+\cs_undefine:N \__hook_code_gset_aux:nnn
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\__hook_normalise_cs_args:nn}
+ {Hooks~with~args}
+\cs_new_protected:Npn \__hook_normalise_cs_args:nn #1 #2
+ {
+ \cs_if_exist:cT { __hook#1~#2 }
+ {
+ \__hook_code_gset_auxi:eeen
+ { \tl_use:c { c__hook_#2_parameter_tl } }
+ {
+ \exp_args:NNo \exp_args:No \__hook_double_hashes:n
+ {
+ \cs:w __hook#1~#2 \exp_last_unbraced:Ne \cs_end:
+ { \__hook_braced_cs_parameter:n { __hook#1~#2 } }
+ }
+ }
+ { }
+ { __hook#1~#2 }
+ }
+ }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__hook_normalise_cs_args:nn}
+ {Hooks~with~args}
+\cs_undefine:N \__hook_normalise_cs_args:nn
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\__hook_normalise_code_pool:n}
+ {Hooks~with~args}
+\cs_new_protected:Npn \__hook_normalise_code_pool:n #1
+ {
+ \__hook_set_normalise_fn:nn {#1} { Offending~label:~'##1' }
+ \prop_clear:N \l__hook_work_prop
+ \prop_map_function:cN { g__hook_#1_code_prop } \__hook_normalise_fn:nn
+ \prop_gset_eq:cN { g__hook_#1_code_prop } \l__hook_work_prop
+ }
+\cs_new_protected:Npn \__hook_set_normalise_fn:nn #1 #2
+ {
+ \cs_set:Npn \__hook_tmp:w ##1##2##3##4##5##6##7##8##9 { }
+ \tl_set:Ne \l__hook_tmpb_tl
+ { \__hook_braced_cs_parameter:n { __hook_tmp:w } }
+ \group_begin:
+ \__hook_tl_set:cn { c__hook_hash_tl } { \exp_not:N \c__hook_hashes_tl }
+ \use:e
+ {
+ \group_end:
+ \tl_set:Nn \exp_not:N \l__hook_tmpb_tl { \l__hook_tmpb_tl }
+ }
+ \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 } }
+ \cs_gset_protected:Npx \__hook_normalise_fn:nn ##1 ##2
+ {
+ \group_begin:
+ \int_set:Nn \tex_escapechar:D { -1 }
+ \cs_set:cpn
+ {
+ hook~'#1'. ^^J
+ (hooks) \prg_replicate:nn { 13 } { ~ }
+ #2 % more message text
+ }
+ \exp_not:v { c__hook_#1_parameter_tl }
+ {##2}
+ \group_end:
+ \cs_set:Npn \exp_not:N \__hook_tmp:w
+ \exp_not:V \c__hook_nine_parameters_tl
+ {
+ \prop_put:Nne \exp_not:N \l__hook_work_prop
+ {##1} { \exp_not:N \__hook_double_hashes:n {##2} }
+ }
+ \exp_not:N \__hook_tmp:w
+ \exp_not:V \l__hook_tmpa_tl
+ \exp_args:No \exp_not:o
+ { \exp_after:wN \__hook_tmp:w \l__hook_tmpb_tl }
+ }
+ }
+\cs_new_eq:NN \__hook_normalise_fn:nn ?
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__hook_normalise_code_pool:n}
+ {Hooks~with~args}
+\cs_undefine:N \__hook_normalise_code_pool:n
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\__hook_cs_if_empty:c}
+ {Hooks~with~args}
+\prg_new_conditional:Npnn \__hook_cs_if_empty:c #1 { p, T, F, TF }
+ {
+ \if:w \scan_stop: \__hook_replacement_spec:c {#1} \scan_stop:
+ \prg_return_true:
+ \else:
+ \prg_return_false:
+ \fi:
+ }
+\cs_new:Npn \__hook_replacement_spec:c #1
+ {
+ \exp_args:Nc \token_if_macro:NT {#1}
+ { \cs_replacement_spec:c {#1} }
+ }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__hook_cs_if_empty:c}
+ {Hooks~with~args}
+\cs_undefine:N \__hook_cs_if_empty:c
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\__hook_braced_cs_parameter:n}
+ {Hooks~with~args}
+\cs_new:Npn \__hook_braced_cs_parameter:n #1
+ {
+ \exp_last_unbraced:Ne \__hook_braced_hidden_loop:w
+ { \exp_args:Nc \__hook_cs_parameter_count:N {#1} } ? \s__hook_mark
+ }
+\cs_new:Npn \__hook_braced_hidden_loop:w #1
+ {
+ \if:w ? #1
+ \__hook_use_i_delimit_by_s_mark:nw
+ \fi:
+ { \exp_not:N \c__hook_hash_tl #1 }
+ \__hook_braced_hidden_loop:w
+ }
+\cs_new:Npn \__hook_cs_parameter_count:N #1
+ {
+ \exp_last_unbraced:Nf \__hook_cs_parameter_count:w
+ { \token_if_macro:NT #1 { \cs_parameter_spec:N #1 } }
+ ? \__hook_cs_end:w ? \__hook_cs_end:w ? \__hook_cs_end:w
+ ? \__hook_cs_end:w ? \__hook_cs_end:w ? \__hook_cs_end:w
+ ? \__hook_cs_end:w ? \__hook_cs_end:w ? \__hook_cs_end:w
+ \s__hook_mark
+ }
+\cs_new:Npn \__hook_cs_parameter_count:w #1#2 #3#4 #5#6 #7#8
+ { #2 #4 #6 #8 \__hook_cs_parameter_count:w }
+\cs_new:Npn \__hook_cs_end:w #1 \s__hook_mark { }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__hook_braced_cs_parameter:n}
+ {Hooks~with~args}
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\__hook_braced_parameter:n}
+ {Hooks~with~args}
+\cs_new:Npn \__hook_braced_parameter:n #1
+ {
+ \if_case:w
+ \int_eval:n
+ { \exp_args:Nv \str_count:n { c__hook_#1_parameter_tl } / 3 }
+ \exp_stop_f:
+ \or: {##1}
+ \or: {##1} {##2}
+ \or: {##1} {##2} {##3}
+ \or: {##1} {##2} {##3} {##4}
+ \or: {##1} {##2} {##3} {##4} {##5}
+ \or: {##1} {##2} {##3} {##4} {##5} {##6}
+ \or: {##1} {##2} {##3} {##4} {##5} {##6} {##7}
+ \or: {##1} {##2} {##3} {##4} {##5} {##6} {##7} {##8}
+ \or: {##1} {##2} {##3} {##4} {##5} {##6} {##7} {##8} {##9}
+ \else:
+ \msg_expandable_error:nnn { latex2e } { should-not-happen }
+ { Invalid~parameter~spec. }
+ \fi:
+ }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__hook_braced_parameter:n}
+ {Hooks~with~args}
+\cs_undefine:N \__hook_braced_parameter:n
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\__hook_parameter:n}
+ {Hooks~with~args}
+\cs_new:Npn \__hook_parameter:n #1
+ {
+ \cs:w c__hook_
+ \tl_if_exist:cTF { c__hook_#1_parameter_tl }
+ { #1_parameter } { empty }
+ _tl \cs_end:
+ }
+\cs_new:Npn \__hook_generic_parameter:n #1
+ { \__hook_generic_parameter:w #1 / / / \s__hook_mark }
+\cs_new:Npn \__hook_generic_parameter:w #1 / #2 / #3 / #4 \s__hook_mark
+ {
+ \cs_if_exist_use:cF { c__hook_parameter_#1/./#3_tl }
+ { \c__hook_empty_tl }
+ }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__hook_parameter:n}
+ {Hooks~with~args}
+\cs_undefine:N \__hook_parameter:n
+\cs_undefine:N \__hook_generic_parameter:n
+\EndIncludeInRelease
+\prop_new:c { g__hook_??_code_prop }
+\prop_new:c { __hook~?? }
+\tl_new:c { g__hook_??_reversed_tl }
+\IncludeInRelease{2023/06/01}{\c__hook_??_parameter_tl}
+ {Hooks~with~args}
+\tl_const:cn { c__hook_??_parameter_tl } { }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\c__hook_??_parameter_tl}
+ {Hooks~with~args}
+\cs_undefine:c { c__hook_??_parameter_tl }
+\EndIncludeInRelease
\cs_new_protected:Npn \hook_gset_rule:nnnn #1#2#3#4
{
\__hook_normalize_hook_rule_args:Nnnnn \__hook_gset_rule:nnnn
@@ -5393,13 +6160,13 @@ of this package available from CTAN}
\__hook_deprecated_generic_warn:n {#1}
\__hook_do_deprecated_generic:Nn \__hook_gset_rule:nnnn {#1}
{#2} {#3} {#4}
- \__hook_clean_to_scan:w
+ \__hook_use_none_delimit_by_s_mark:w
}
\__hook_if_execute_immediately:nT {#1}
{
\msg_error:nnnnnn { hooks } { rule-too-late }
{#1} {#2} {#3} {#4}
- \__hook_clean_to_scan:w
+ \__hook_use_none_delimit_by_s_mark:w
}
\__hook_init_structure:n {#1}
\__hook_rule_gclear:nnn {#1} {#2} {#4}
@@ -5489,23 +6256,55 @@ of this package available from CTAN}
\cs_end:
}
\cs_new_eq:NN \__hook_update_hook_code:n \use_none:n
-\cs_new_protected:Npn \__hook_initialize_all: {
- \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
+\IncludeInRelease{2023/06/01}{\__hook_initialize_all:}
+ {Hooks~with~args}
+\cs_new_protected:Npn \__hook_initialize_all:
+ {
+ \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
{
+ \tl_if_empty:cTF { c__hook_##1_parameter_tl }
+ { \__hook_replacing_args_false: }
+ { \__hook_replacing_args_true: }
\__hook_update_hook_code:n {##1}
+ \__hook_replacing_args_reset:
}
- \__hook_debug:n
- { \iow_term:x{^^JAll~ initialized~ (non-empty)~ hooks:}
- \prop_map_inline:Nn \g__hook_used_prop
- { \iow_term:x{^^J~ ##1~ ->~
- \exp_not:v {__hook~##1}~ }
- }
- }
- \cs_gset_eq:NN \hook_use:n \__hook_use_initialized:n
- \cs_gset_eq:NN \__hook_preamble_hook:n \use_none:n
-}
+ \__hook_debug:n
+ {
+ \iow_term:x { ^^J All~initialized~(non-empty)~hooks: }
+ \prop_map_inline:Nn \g__hook_used_prop
+ {
+ \iow_term:x
+ { ^^J ~ ##1 ~ -> ~ \cs_replacement_spec:c { __hook~##1 } ~ }
+ }
+ }
+ \__hook_post_initialization_defs:
+ }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__hook_initialize_all:}
+ {Hooks~with~args}
+\cs_gset_protected:Npn \__hook_initialize_all:
+ {
+ \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} }
+ \__hook_debug:n
+ {
+ \iow_term:x{^^JAll~ initialized~ (non-empty)~ hooks:}
+ \prop_map_inline:Nn \g__hook_used_prop
+ {
+ \iow_term:x
+ { ^^J ~ ##1 ~ -> ~ \cs_replacement_spec:c { __hook~##1 } ~ }
+ }
+ }
+ \cs_gset_eq:NN \hook_use:n \__hook_use_initialized:n
+ \cs_gset_eq:NN \__hook_preamble_hook:n \use_none:n
+ }
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\__hook_initialize_hook_code:n}
+ {Hooks~with~args}
\cs_new_protected:Npn \__hook_initialize_hook_code:n #1
{
\__hook_debug:n
@@ -5515,6 +6314,38 @@ of this package available from CTAN}
{
\prop_if_empty:cTF { g__hook_#1_code_prop }
{
+ \__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}
+ }
+ }
+ {
+ \__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 }
+ \__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} { } }
+ }
+ }
+ }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__hook_initialize_hook_code:n}
+ {Hooks~with~args}
+\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 } }
+ \__hook_include_legacy_code_chunk:n {#1}
+ \__hook_if_usable:nT {#1}
+ {
+ \prop_if_empty:cTF { g__hook_#1_code_prop }
+ {
\__hook_tl_gset:co { __hook~#1 }
{
\cs:w __hook_toplevel~#1 \exp_after:wN \cs_end:
@@ -5535,6 +6366,7 @@ of this package available from CTAN}
}
}
}
+\EndIncludeInRelease
\cs_new:Npn \__hook_tl_csname:n #1 { l__hook_label_#1_tl }
\cs_new:Npn \__hook_seq_csname:n #1 { l__hook_label_#1_seq }
\seq_new:N \l__hook_labels_seq
@@ -5542,6 +6374,89 @@ of this package available from CTAN}
\tl_new:N \l__hook_front_tl
\tl_new:N \l__hook_rear_tl
\tl_new:c { \__hook_tl_csname:n { 0 } }
+\IncludeInRelease{2023/06/01}{\__hook_initialize_single:NNn}
+ {Hooks~with~args}
+\cs_new_protected:Npn \__hook_initialize_single:NNn #1#2#3
+ {
+ \seq_clear:N \l__hook_labels_seq
+ \int_zero:N \l__hook_labels_int
+ \tl_set:Nn \l__hook_cur_hook_tl {#3}
+ \prop_map_inline:Nn \l__hook_work_prop
+ {
+ \int_incr:N \l__hook_labels_int
+ \seq_put_right:Nn \l__hook_labels_seq {##1}
+ \__hook_tl_set:cn { \__hook_tl_csname:n {##1} } { 0 }
+ \seq_clear_new:c { \__hook_seq_csname:n {##1} }
+ }
+ \prop_map_inline:Nn \l__hook_work_prop
+ {
+ \prop_map_inline:Nn \l__hook_work_prop
+ {
+ \__hook_if_label_case:nnnnn {##1} {####1}
+ { \prop_map_break: }
+ { \__hook_apply_label_pair:nnn {##1} {####1} }
+ { \__hook_apply_label_pair:nnn {####1} {##1} }
+ {#3}
+ }
+ }
+ \__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}
+ }
+ }
+ \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 } }
+ {
+ \int_decr:N \l__hook_labels_int
+ \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 } }
+ {
+ \tl_set:cx { \__hook_tl_csname:n {##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}
+ }
+ }
+ \tl_set_eq:Nc \l__hook_front_tl
+ { \__hook_tl_csname:n { \l__hook_front_tl } }
+ }
+ \int_compare:nNnF \l__hook_labels_int = 0
+ {
+ \iow_term:x{====================}
+ \iow_term:x{Error:~ label~ rules~ are~ incompatible:}
+ \__hook_debug_label_data:N \l__hook_work_prop
+ \iow_term:x{====================}
+ }
+ \exp_args:NNe \__hook_tl_gput:Nn #1
+ { \exp_not:c { __hook_toplevel~#3 } \__hook_braced_parameter:n {#3} }
+ \__hook_tl_gput_right:Ne #1
+ { \exp_not:c { __hook_next~#3 } \__hook_braced_parameter:n {#3} }
+ \use:e
+ {
+ \cs_gset:cpn { __hook~#3 } \use:c { c__hook_#3_parameter_tl }
+ { \exp_not:V #1 }
+ }
+ }
+\cs_generate_variant:Nn \__hook_initialize_single:NNn { cc }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__hook_initialize_single:NNn}
+ {Hooks~with~args}
\cs_new_protected:Npn \__hook_initialize_single:NNn #1#2#3
{
\seq_clear:N \l__hook_labels_seq
@@ -5612,7 +6527,8 @@ of this package available from CTAN}
\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_initialize_single:NNn { cc }
+\cs_generate_variant:Nn \__hook_tl_gput_right:Nn { No }
+\EndIncludeInRelease
\cs_new:Npn \__hook_tl_gput:Nn { \ERROR }
\cs_new:Npn \__hook_clist_gput:NV { \ERROR }
\cs_new_protected:Npn \__hook_apply_label_pair:nnn #1#2#3
@@ -5727,6 +6643,123 @@ of this package available from CTAN}
{ \__hook_log_cmd:x { >~#1 } }
\cs_new_protected:Npn \__hook_log_line_indent:x #1
{ \__hook_log_cmd:x { >~\@spaces #1 } }
+\IncludeInRelease{2023/06/01}{\__hook_log:nN}
+ {Hooks~with~args}
+\cs_new_protected:Npn \__hook_log:nN #1 #2
+ {
+ \__hook_if_deprecated_generic:nT {#1}
+ {
+ \__hook_deprecated_generic_warn:n {#1}
+ \__hook_do_deprecated_generic:Nn \__hook_log:nN {#1} #2
+ \exp_after:wN \use_none:nnnnnnnnn \use_none:nnnnn
+ }
+ \__hook_preamble_hook:n {#1}
+ \__hook_log_cmd:x
+ {
+ ^^J ->~The~
+ \__hook_if_generic:nT {#1} { generic~ }
+ hook~'#1'
+ \__hook_if_disabled:nF {#1}
+ {
+ \exp_args:Nf \__hook_print_args:nn {#1}
+ {
+ \int_eval:n
+ { \str_count:e { \__hook_parameter:n {#1} } / 3 }
+ }
+ }
+ :
+ }
+ \__hook_if_usable:nF {#1}
+ { \__hook_log_line:x { The~hook~is~not~declared. } }
+ \__hook_if_disabled:nT {#1}
+ { \__hook_log_line:x { The~hook~is~disabled. } }
+ \hook_if_empty:nTF {#1}
+ { #2 { The~hook~is~empty } }
+ {
+ \__hook_log_line:x { Code~chunks: }
+ \prop_if_empty:cTF { g__hook_#1_code_prop }
+ { \__hook_log_line_indent:x { --- } }
+ {
+ \prop_map_inline:cn { g__hook_#1_code_prop }
+ {
+ \exp_after:wN \cs_set:Npn \exp_after:wN \__hook_tmp:w
+ \c__hook_nine_parameters_tl {##2}
+ \__hook_log_line_indent:x
+ { ##1~->~\cs_replacement_spec:N \__hook_tmp:w }
+ }
+ }
+ \__hook_log_line:x
+ {
+ Document-level~(top-level)~code
+ \__hook_if_usable:nT {#1}
+ { ~(executed~\__hook_if_reversed:nTF {#1} {first} {last} ) } :
+ }
+ \__hook_log_line_indent:x
+ {
+ \__hook_cs_if_empty:cTF { __hook_toplevel~#1 }
+ { --- }
+ { -> ~ \cs_replacement_spec:c { __hook_toplevel~#1 } }
+ }
+ \__hook_log_line:x { Extra~code~for~next~invocation: }
+ \__hook_log_line_indent:x
+ {
+ \__hook_cs_if_empty:cTF { __hook_next~#1 }
+ { --- }
+ {
+ -> ~ \exp_last_unbraced:Nf \__hook_log_next_code:w
+ { \cs_replacement_spec:c { __hook_next~#1 } }
+ }
+ }
+ \__hook_log_line:x { Rules: }
+ \bool_set_true:N \l__hook_tmpa_bool
+ \__hook_list_rules:nn {#1}
+ {
+ \bool_set_false:N \l__hook_tmpa_bool
+ \__hook_log_line_indent:x
+ {
+ ##2~ with~
+ \str_if_eq:nnT {##3} {??} { default~ }
+ relation~ ##1
+ }
+ }
+ \bool_if:NT \l__hook_tmpa_bool
+ { \__hook_log_line_indent:x { --- } }
+ \bool_lazy_and:nnTF
+ { \__hook_if_usable_p:n {#1} }
+ { ! \hook_if_empty_p:n {#1} }
+ {
+ \__hook_log_line:x
+ {
+ Execution~order
+ \bool_if:NTF \l__hook_tmpa_bool
+ { \__hook_if_reversed:nT {#1} { ~(after~reversal) } }
+ { ~(after~
+ \__hook_if_reversed:nT {#1} { reversal~and~ }
+ applying~rules)
+ } :
+ }
+ #2 % \tl_show:n
+ {
+ \@spaces
+ \clist_if_empty:cTF { 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}
+ { code~pool~is~empty }
+ { is~\__hook_if_disabled:nTF {#1} {disabled} {undeclared} }
+ }
+ }
+ }
+ }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__hook_log:nN}
+ {Hooks~with~args}
\cs_new_protected:Npn \__hook_log:nN #1 #2
{
\__hook_if_deprecated_generic:nT {#1}
@@ -5804,7 +6837,7 @@ 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 } { ,~ } }
}
}
{
@@ -5818,8 +6851,28 @@ of this package available from CTAN}
}
}
}
-\cs_new:Npn \__hook_log_next_code:n #1
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\__hook_log_next_code:n}
+ {Hooks~with~args}
+\exp_last_unbraced:NNNNo
+\cs_new:Npn \__hook_log_next_code:w #1 \c_right_brace_str { }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__hook_log_next_code:n}
+ {Hooks~with~args}
+\cs_gset:Npn \__hook_log_next_code:n #1
{ \exp_args:No \tl_to_str:n { \use_none:nn #1 } }
+\EndIncludeInRelease
+\cs_new:Npn \__hook_print_args:nn #1 #2
+ {
+ \int_compare:nNnT {#2} > { 0 }
+ {
+ \__hook_if_declared:nT {#1} { \use_none:nnn }
+ \__hook_if_cmd_hook:nT {#1}
+ { \use_i:nnn { ~ (unknown ~ } }
+ \use:n { ~ (#2 ~ }
+ argument \int_compare:nNnT {#2} > { 1 } { s } )
+ }
+ }
\cs_new_protected:Npn \__hook_list_rules:nn #1 #2
{
\cs_set_protected:Npn \__hook_tmp:w ##1 ##2 ##3 {#2}
@@ -5865,24 +6918,59 @@ of this package available from CTAN}
}
\exp_args:No \__hook_tmp:w { \use:nn { ~ } { ~ } }
}
-\cs_new_protected:Npn \hook_gput_next_code:nn #1
+\IncludeInRelease{2023/06/01}{\hook_gput_next_code:nn}
+ {Hooks~with~args}
+\cs_new_protected:Npn \hook_gput_next_code:nn #1 #2
+ {
+ \__hook_replacing_args_false:
+ \__hook_normalize_hook_args:Nn \__hook_gput_next_code:nn {#1} {#2}
+ \__hook_replacing_args_reset:
+ }
+\cs_new_protected:Npn \hook_gput_next_code_with_args:nn #1 #2
+ {
+ \__hook_replacing_args_true:
+ \__hook_normalize_hook_args:Nn \__hook_gput_next_code:nn {#1} {#2}
+ \__hook_replacing_args_reset:
+ }
+\EndIncludeInRelease
+\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} }
+\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
{
\__hook_if_disabled:nTF {#1}
{ \msg_error:nnn { hooks } { hook-disabled } {#1} }
{
\__hook_if_structure_exist:nTF {#1}
- { \__hook_gput_next_do:nn {#1} {#2} }
- { \__hook_try_declaring_generic_next_hook:nn {#1} {#2} }
+ { \__hook_gput_next_do:nn }
+ { \__hook_try_declaring_generic_next_hook:nn }
+ {#1} {#2}
}
}
+\IncludeInRelease{2023/06/01}{\__hook_gput_next_do:nn}
+ {Hooks~with~args}
\cs_new_protected:Npn \__hook_gput_next_do:nn #1
{
+ \__hook_init_structure:n {#1}
+ \__hook_chk_args_allowed:nn {#1} { AddToHookNext }
+ \__hook_cs_if_empty:cT { __hook~#1 }
+ { \__hook_update_hook_code:n {#1} }
+ \__hook_cs_if_empty:cT { __hook_next~#1 }
+ { \__hook_next_gset:nn {#1} { \__hook_clear_next:n {#1} } }
+ \__hook_cs_gput_right:nnn { _next } {#1}
+ }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__hook_gput_next_do:nn}
+ {Hooks~with~args}
+\cs_gset_protected:Npn \__hook_gput_next_do:nn #1
+ {
\exp_args:Nc \__hook_gput_next_do:Nnn
{ __hook_next~#1 } {#1}
}
-\cs_new_protected:Npn \__hook_gput_next_do:Nnn #1 #2
+\cs_gset_protected:Npn \__hook_gput_next_do:Nnn #1 #2
{
\tl_if_empty:cT { __hook~#2 }
{ \__hook_update_hook_code:n {#2} }
@@ -5890,10 +6978,41 @@ of this package available from CTAN}
{ \__hook_tl_gset:Nn #1 { \__hook_clear_next:n {#2} } }
\__hook_tl_gput_right:Nn #1
}
+\EndIncludeInRelease
\cs_new_protected:Npn \hook_gclear_next_code:n #1
{ \__hook_normalize_hook_args:Nn \__hook_clear_next:n {#1} }
+\IncludeInRelease{2023/06/01}{\__hook_clear_next:n}
+ {Hooks~with~args}
\cs_new_protected:Npn \__hook_clear_next:n #1
+ { \__hook_next_gset:nn {#1} { } }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__hook_clear_next:n}
+ {Hooks~with~args}
+\cs_gset_protected:Npn \__hook_clear_next:n #1
{ \cs_gset_eq:cN { __hook_next~#1 } \c_empty_tl }
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\hook_use:n}
+ {Hooks~with~args}
+\cs_new_protected:Npn \hook_use:n #1
+ {
+ \__hook_preamble_hook:n {#1}
+ \__hook_use_initialized:n {#1}
+ }
+\cs_new:Npn \__hook_use_initialized:n #1
+ {
+ \if_cs_exist:w __hook~#1 \cs_end:
+ \cs:w __hook~#1 \use_i:nn
+ \fi:
+ \use_none:n
+ \cs_end:
+ }
+\cs_new_protected:Npn \__hook_preamble_hook:n #1
+ {
+ \if_cs_exist:w __hook~#1 \cs_end:
+ \__hook_initialize_hook_code:n {#1}
+ \fi:
+ }
+\EndIncludeInRelease
\IncludeInRelease{2021/11/15}{\hook_use:n}
{Standardise~generic~hook~names}
\cs_new_protected:Npn \hook_use:n #1
@@ -5912,6 +7031,7 @@ of this package available from CTAN}
}
\cs_new_protected:Npn \__hook_preamble_hook:n #1
{ \__hook_initialize_hook_code:n {#1} }
+\cs_new:Npn \hook_use:nnw #1 { }
\EndIncludeInRelease
\IncludeInRelease{2020/10/01}{\hook_use:n}
{Standardise~generic~hook~names}
@@ -5940,6 +7060,44 @@ of this package available from CTAN}
\cs_new_protected:Npn \__hook_preamble_hook:n #1
{ \__hook_initialize_hook_code:n {#1} }
\cs_new_eq:NN \__hook_use_end: \cs_end:
+\cs_new:Npn \hook_use:nnw #1 { }
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\hook_use:nnw}
+ {Hooks~with~args}
+\cs_new_protected:Npn \hook_use:nnw #1
+ {
+ \__hook_preamble_hook:n {#1}
+ \__hook_use_initialized:nnw {#1}
+ }
+\cs_new:Npn \__hook_use_initialized:nnw #1 #2
+ {
+ \cs:w
+ \if_cs_exist:w __hook~#1 \cs_end:
+ __hook~#1
+ \else:
+ use_none: \prg_replicate:nn {#2} { n }
+ \fi:
+ \cs_end:
+ }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\hook_use:nnw}
+ {Hooks~with~args}
+\cs_gset:Npn \hook_use:nnw #1 #2
+ { \use:c { use_none: \prg_replicate:nn {#2} { n } } }
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\__hook_post_initialization_defs:}
+ {Hooks~with~args}
+\cs_new_protected:Npn \__hook_post_initialization_defs:
+ {
+ \cs_gset_eq:NN \hook_use:n \__hook_use_initialized:n
+ \cs_gset_eq:NN \hook_use:nnw \__hook_use_initialized:nnw
+ \cs_gset_eq:NN \__hook_preamble_hook:n \use_none:n
+ \cs_gset_eq:NN \__hook_post_initialization_defs: \prg_do_nothing:
+ }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__hook_post_initialization_defs:}
+ {Hooks~with~args}
+\cs_undefine:N \__hook_post_initialization_defs:
\EndIncludeInRelease
\IncludeInRelease{2021/11/15}{\__hook_use:wn}
{Standardise~generic~hook~names}
@@ -5970,41 +7128,111 @@ of this package available from CTAN}
}
}
\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\hook_use_once:nnw}
+ {Hooks~with~args}
\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 } }
+ }
+\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} }
+ }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\hook_use_once:nnw}
+ {Hooks~with~args}
+\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} } }
}
-\cs_new_protected:Npn \__hook_use_once:n #1
+\cs_gset:Npn \hook_use_once:nnw #1 #2
+ { \use:c { use_none: \prg_replicate:nn {#2} { n } } }
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\__hook_use_once:nn}
+ {Hooks~with~args}
+\cs_new_protected:Npn \__hook_use_once:nn #1 #2
+ {
+ \__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_replacing_args_reset:
+ \__hook_if_usable:nTF {#1}
+ { \__hook_use_initialized:n {#1} }
+ {
+ \int_compare:nNnT {#2} > { 0 }
+ { \use:c { use_none: \prg_replicate:nn {#2} { n } } }
+ }
+ }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__hook_use_once:nn}
+ {Hooks~with~args}
+\cs_gset_protected:Npn \__hook_use_once:n #1
{
\__hook_preamble_hook:n {#1}
\__hook_use_once_set:n {#1}
\__hook_use_initialized:n {#1}
\__hook_use_once_clear:n {#1}
}
+\cs_undefine:N \__hook_use_once:nn
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\__hook_use_once_clear:n}
+ {Hooks~with~args}
\cs_new_protected:Npn \__hook_use_once_set:n #1
{ \__hook_tl_gset:cn { g__hook_#1_reversed_tl } { I } }
\cs_new_protected:Npn \__hook_use_once_clear:n #1
{
+ \__hook_code_gset:nn {#1} { }
+ \__hook_next_gset:nn {#1} { }
+ \__hook_toplevel_gset:nn {#1} { }
+ \prop_gclear_new:c { g__hook_#1_code_prop }
+ }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__hook_use_once_clear:n}
+ {Hooks~with~args}
+\cs_new_protected:Npn \__hook_use_once_clear:n #1
+ {
\__hook_tl_gclear:c { __hook~#1 }
\__hook_tl_gclear:c { __hook_next~#1 }
\__hook_tl_gclear:c { __hook_toplevel~#1 }
\prop_gclear_new:c { g__hook_#1_code_prop }
}
+\EndIncludeInRelease
\prg_new_conditional:Npnn \__hook_if_execute_immediately:n #1 { T, F, TF }
{
- \__hook_if_usable:nTF {#1}
- {
- \exp_after:wN \__hook_clean_to_scan:w
- \if:w I \cs:w g__hook_#1_reversed_tl \cs_end:
- \s__hook_mark \prg_return_true:
- \else:
- \s__hook_mark \prg_return_false:
+ \exp_after:wN \__hook_use_none_delimit_by_s_mark:w
+ \if:w I
+ \if_cs_exist:w g__hook_#1_reversed_tl \cs_end:
+ \cs:w g__hook_#1_reversed_tl \exp_after:wN \cs_end:
\fi:
- }
- { \prg_return_false: }
+ X
+ \s__hook_mark \prg_return_true:
+ \else:
+ \s__hook_mark \prg_return_false:
+ \fi:
}
-
+\IncludeInRelease{2023/06/01}{\hook_if_empty:n}
+ {Hooks~with~args}
+\prg_new_conditional:Npnn \hook_if_empty:n #1 { p , T , F , TF }
+ {
+ \if:w
+ T
+ \prop_if_exist:cT { g__hook_#1_code_prop }
+ { \prop_if_empty:cF { g__hook_#1_code_prop } { F } }
+ \__hook_cs_if_empty:cF { __hook_toplevel~#1 } { F }
+ \__hook_cs_if_empty:cF { __hook_next~#1 } { F }
+ T
+ \prg_return_true:
+ \else:
+ \prg_return_false:
+ \fi:
+ }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\hook_if_empty:n}
+ {Hooks~with~args}
\prg_new_conditional:Npnn \hook_if_empty:n #1 { p , T , F , TF }
{
\__hook_if_structure_exist:nTF {#1}
@@ -6021,9 +7249,10 @@ of this package available from CTAN}
}
{ \prg_return_true: }
}
+\EndIncludeInRelease
\prg_new_conditional:Npnn \__hook_if_usable:n #1 { p , T , F , TF }
{
- \tl_if_exist:cTF { __hook~#1 }
+ \cs_if_exist:cTF { __hook~#1 }
{ \prg_return_true: }
{ \prg_return_false: }
}
@@ -6041,7 +7270,7 @@ of this package available from CTAN}
}
\prg_new_conditional:Npnn \__hook_if_reversed:n #1 { p , T , F , TF }
{
- \exp_after:wN \__hook_clean_to_scan:w
+ \exp_after:wN \__hook_use_none_delimit_by_s_mark:w
\if:w - \cs:w g__hook_#1_reversed_tl \cs_end:
\s__hook_mark \prg_return_true:
\else:
@@ -6068,6 +7297,26 @@ of this package available from CTAN}
}
{ \prg_return_false: }
}
+\IncludeInRelease{2023/06/01}{\__hook_if_cmd_hook:n}
+ {Hooks~with~args}
+\prg_new_conditional:Npnn \__hook_if_cmd_hook:n #1 { T }
+ { \__hook_if_cmd_hook:w #1 / / / \s__hook_mark }
+\cs_new:Npn \__hook_if_cmd_hook:w #1 / #2 / #3 / #4 \s__hook_mark
+ {
+ \if:w Y
+ \str_if_eq:nnF {#1} { cmd } { N }
+ \tl_if_exist:cF { c__hook_generic_#1/./#3_tl } { N }
+ Y
+ \prg_return_true:
+ \else:
+ \prg_return_false:
+ \fi:
+ }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__hook_if_cmd_hook:n}
+ {Hooks~with~args}
+\cs_undefine:N \__hook_if_cmd_hook:nT
+\EndIncludeInRelease
\prg_new_conditional:Npnn \__hook_if_generic_reversed:n #1 { T }
{ \__hook_if_generic_reversed:w #1 / / / \scan_stop: }
\cs_new:Npn \__hook_if_generic_reversed:w #1 / #2 / #3 / #4 \scan_stop:
@@ -6078,6 +7327,31 @@ of this package available from CTAN}
\prg_return_false:
\fi:
}
+\seq_new:N \g__hook_replacing_stack_seq
+\cs_new:Npn \__hook_misused_if_replacing_args:nn #1 #2
+ {
+ \msg_expandable_error:nnn { latex2e } { should-not-happen }
+ { Misused~\__hook_if_replacing_args:. }
+ }
+\cs_new:Npn \__hook_if_replacing_args:TF
+ { \__hook_misused_if_replacing_args:nn }
+\cs_new_protected:Npn \__hook_replacing_args_true:
+ {
+ \seq_gpush:No \g__hook_replacing_stack_seq
+ { \__hook_if_replacing_args:TF }
+ \cs_set:Npn \__hook_if_replacing_args:TF { \use_i:nn }
+ }
+\cs_new_protected:Npn \__hook_replacing_args_false:
+ {
+ \seq_gpush:No \g__hook_replacing_stack_seq
+ { \__hook_if_replacing_args:TF }
+ \cs_set:Npn \__hook_if_replacing_args:TF { \use_ii:nn }
+ }
+\cs_new_protected:Npn \__hook_replacing_args_reset:
+ {
+ \seq_gpop:NN \g__hook_replacing_stack_seq \l__hook_return_tl
+ \cs_gset_eq:NN \__hook_if_replacing_args:TF \l__hook_return_tl
+ }
\prop_gput:Nnn \g_msg_module_type_prop { hooks } { LaTeX }
\prop_gput:Nnn \g_msg_module_type_prop { latex2e } { LaTeX }
\prop_gput:Nnn \g_msg_module_name_prop { latex2e } { kernel }
@@ -6096,6 +7370,38 @@ of this package available from CTAN}
{ There~ already~ exists~ a~ hook~ declaration~ with~ this~
name.\\
Please~ use~ a~ different~ name~ for~ your~ hook.}
+\IncludeInRelease{2023/06/01}{too-many-args}
+ {Hooks~with~args}
+\msg_new:nnnn { hooks } { too-many-args }
+ { Too~many~arguments~for~hook~'#1'. }
+ {
+ You~tried~to~declare~a~hook~with~#2~arguments,~but~a~
+ hook~can~only~have~up~to~nine.~LaTeX~will~define~this~
+ hook~with~nine~arguments.
+ }
+\msg_new:nnnn { hooks } { without-args }
+ { Hook~'#1'~has~no~arguments. }
+ {
+ You~tried~to~use~\iow_char:N\\#2WithArguments~
+ on~a~hook~that~takes~no~arguments.\\
+ Check~the~usage~of~the~hook~or~use~\iow_char:N\\#2~instead.\\
+ \\
+ LaTeX~will~use~\iow_char:N\\#2.
+ }
+\msg_new:nnnn { hooks } { one-time-args }
+ { You~can't~have~arguments~in~used~one-time~hook~'#1'. }
+ {
+ You~tried~to~use~\iow_char:N\\#2WithArguments~
+ on~a~one-time~hook~that~has~already~been~used.~
+ You~have~to~add~the~code~before~the~hook~is~used,~
+ or~add~the~code~without~arguments~using~\iow_char:N\\#2~instead.\\
+ \\
+ LaTeX~will~use~\iow_char:N\\#2.
+ }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{too-many-args}
+ {Hooks~with~args}
+\EndIncludeInRelease
\msg_new:nnnn { hooks } { hook-disabled }
{ Cannot~add~code~to~disabled~hook~'#1'. }
{
@@ -6190,24 +7496,61 @@ of this package available from CTAN}
Generic~hook~'#1/#2/#3'~is~deprecated. \\
Use~hook~'#1/#3/#2'~instead.
}
-\NewDocumentCommand \NewHook { m }{ \hook_new:n {#1} }
-\NewDocumentCommand \NewReversedHook { m }{ \hook_new_reversed:n {#1} }
-\NewDocumentCommand \NewMirroredHookPair { mm }{ \hook_new_pair:nn {#1}{#2} }
-\IncludeInRelease{2021/06/01}%
- {\hook_activate_generic:n}{Providing~hooks}
-\NewDocumentCommand \ActivateGenericHook { m }{ \hook_activate_generic:n {#1} }
-\NewDocumentCommand \DisableGenericHook { m }{ \hook_disable_generic:n {#1} }
-\EndIncludeInRelease
-\IncludeInRelease{2020/10/01}
- {\hook_activate_generic:n}{Providing~hooks}
-
-\def \ActivateGenericHook#1{}
-
-\EndIncludeInRelease
+\NewDocumentCommand \NewHook { m }
+ { \hook_new:n {#1} }
+\NewDocumentCommand \NewReversedHook { m }
+ { \hook_new_reversed:n {#1} }
+\NewDocumentCommand \NewMirroredHookPair { mm }
+ { \hook_new_pair:nn {#1}{#2} }
+\IncludeInRelease{2023/06/01}{\NewHookWithArguments}
+ {Hooks~with~args}
+\NewDocumentCommand \NewHookWithArguments { mm }
+ { \hook_new_with_args:nn {#1} {#2} }
+\NewDocumentCommand \NewReversedHookWithArguments { mm }
+ { \hook_new_reversed_with_args:nn {#1} {#2} }
+\NewDocumentCommand \NewMirroredHookPairWithArguments { mmm }
+ { \hook_new_pair_with_args:nnn {#1} {#2} {#3} }
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\NewHookWithArguments}
+ {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 { }
+\EndIncludeInRelease
+\IncludeInRelease{2021/06/01}{\ActivateGenericHook}
+ {Providing~hooks}
+\NewDocumentCommand \ActivateGenericHook { m }
+ { \hook_activate_generic:n {#1} }
+\NewDocumentCommand \DisableGenericHook { m }
+ { \hook_disable_generic:n {#1} }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\ActivateGenericHook}
+ {Providing~hooks}
+\def \ActivateGenericHook #1 { }
+\def \DisableGenericHook #1 { }
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\AddToHookWithArguments}
+ {Hooks~with~args}
\NewDocumentCommand \AddToHook { m o +m }
{ \hook_gput_code:nnn {#1} {#2} {#3} }
+\NewDocumentCommand \AddToHookWithArguments { m o +m }
+ { \hook_gput_code_with_args:nnn {#1} {#2} {#3} }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\AddToHookWithArguments}
+ {Hooks~with~args}
+\cs_new_protected:Npn \AddToHookWithArguments #1 #2 #3 { }
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\AddToHookNextWithArguments}
+ {Hooks~with~args}
\NewDocumentCommand \AddToHookNext { m +m }
{ \hook_gput_next_code:nn {#1} {#2} }
+\NewDocumentCommand \AddToHookNextWithArguments { m +m }
+ { \hook_gput_next_code_with_args:nn {#1} {#2} }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\AddToHookNextWithArguments}
+ {Hooks~with~args}
+\cs_new_protected:Npn \AddToHookNextWithArguments #1 #2 { }
+\EndIncludeInRelease
\NewDocumentCommand \ClearHookNext { m }
{ \hook_gclear_next_code:n {#1} }
\NewDocumentCommand \RemoveFromHook { m o }
@@ -6224,8 +7567,18 @@ of this package available from CTAN}
\str_gset:Nx \g_file_curr_name_str {#3}
#1 #2 {#3}
}
+\IncludeInRelease{2023/06/01}{\UseHookWithArguments}
+ {Hooks~with~args}
\cs_new:Npn \UseHook { \hook_use:n }
\cs_new:Npn \UseOneTimeHook { \hook_use_once:n }
+\cs_new:Npn \UseHookWithArguments { \hook_use:nnw }
+\cs_new:Npn \UseOneTimeHookWithArguments { \hook_use_once:nnw }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\UseHookWithArguments}
+ {Hooks~with~args}
+\cs_new:Npn \UseHookWithArguments #1 #2 { }
+\cs_new:Npn \UseOneTimeHookWithArguments #1 #2 { }
+\EndIncludeInRelease
\cs_new_protected:Npn \ShowHook { \hook_show:n }
\cs_new_protected:Npn \LogHook { \hook_log:n }
\cs_new_protected:Npn \DebugHooksOn { \hook_debug_on: }
@@ -6313,8 +7666,8 @@ of this package available from CTAN}
\__hook_initialize_all:
\cs_new_eq:NN \@expl@@@hook@curr@name@pop@@
\__hook_curr_name_pop:
-\IncludeInRelease{0000/00/00}%
- {lthooks}{The~hook~management}%
+\IncludeInRelease{0000/00/00}{lthooks}
+ {The~hook~management}%
\def \NewHook#1{}
\def \NewReversedHook#1{}
@@ -6343,13 +7696,48 @@ of this package available from CTAN}
\long\def \IfHookEmptyTF #1#2#3{#2}
\EndModuleRelease
+\cs:w __hook_rollback_tidying: \cs_end:
+\bool_lazy_and:nnT
+ { \int_compare_p:nNn { \sourceLaTeXdate } > { 20230600 } }
+ { \int_compare_p:nNn { \requestedLaTeXdate } < { 20230601 } }
+ {
+ \cs_gset_protected:Npn \__hook_rollback_tidying:
+ {
+ \@latex@error { Rollback~code~executed~twice }
+ {
+ Something~went~wrong~(unless~this~was~
+ done~on~purpose~in~a~testing~environment).
+ }
+ \use_none:nnnn
+ }
+ \cs_set:Npn \__hook_tmp:w #1 #2
+ {
+ \__hook_tl_gset:cx { __hook#1~#2 }
+ {
+ \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 } }
+ }
+ }
+ }
+ \seq_map_inline:Nn \g__hook_all_seq
+ {
+ \exp_after:wN \cs_gset_nopar:Npn
+ \cs:w g__hook_#1_code_prop \exp_args:NNo \exp_args:No
+ \cs_end: { \cs:w g__hook_#1_code_prop \cs_end: }
+ \__hook_tmp:w { _toplevel } {#1}
+ \__hook_tmp:w { _next } {#1}
+ }
+ }
\ExplSyntaxOff
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% File: ltcmdhooks.dtx (C) Copyright 2020-2021
-%% Frank Mittelbach, Phelype Oleinik, LaTeX Team
+%% File: ltcmdhooks.dtx
+%% Copyright (C) 2020-2023
+%% Frank Mittelbach, Phelype Oleinik, The LaTeX Project
%%% From File: ltcmdhooks.dtx
-\def\ltcmdhooksversion{v1.0f}
-\def\ltcmdhooksdate{2021/10/20}
+\def\ltcmdhooksversion{v1.0h}
+\def\ltcmdhooksdate{2023/05/21}
\ExplSyntaxOn
\NewModuleRelease{2021/06/01}{ltcmdhooks}
{The~hook~management~system~for~commands}
@@ -6358,7 +7746,8 @@ of this package available from CTAN}
\tl_new:N \l__hook_patch_prefixes_tl
\tl_new:N \l__hook_param_text_tl
\tl_new:N \l__hook_replace_text_tl
-\tl_const:Nn \c__hook_hash_tl { # # }
+\tl_const:Nn \c__hook_hash_tl { # }
+\tl_const:Nn \c__hook_hashes_tl { # # }
\cs_new_eq:NN \__hook_exp_not:NN ?
\cs_new_eq:NN \__hook_def_cmd:w ?
\quark_new:N \q__hook_recursion_tail
@@ -6500,6 +7889,8 @@ of this package available from CTAN}
\exp_args:NNc \__hook_patch_expand_redefine:NNnn \c_false_bool
{ \cs_to_str:N #1 ~ code }
}
+\IncludeInRelease{2023/06/01}{\__hook_patch_expand_redefine:NNnn}
+ {cmd~hooks~with~args}
\cs_new_protected:Npn \__hook_patch_expand_redefine:NNnn #1 #2 #3 #4
{
\__hook_patch_debug:x { ++~command~can~be~patched~without~rescanning }
@@ -6523,6 +7914,81 @@ of this package available from CTAN}
##1 \l__hook_replace_text_tl { \__hook_exp_not:n {##2} }
}
\bool_if:NTF #1
+ { \__hook_tmp:w \tl_set:Nx { [ \c__hook_hashes_tl 1 ] } }
+ { \__hook_tmp:w \tl_set:Nx { { \c__hook_hashes_tl 1 } } }
+ \int_step_inline:nnn { 2 } { \l__hook_patch_num_args_int }
+ { \__hook_tmp:w \tl_put_right:Nx { { \c__hook_hashes_tl ##1 } } }
+ \tl_set:Nx \l__hook_replace_text_tl
+ { \exp_not:N #2 \exp_not:V \l__hook_replace_text_tl }
+ \tl_set:Nx \l__hook_replace_text_tl
+ {
+ \token_if_eq_meaning:NNTF \__hook_exp_not:n \exp_not:n
+ { \exp_args:NNV \exp_args:No \__hook_double_hashes:n }
+ { \exp_args:NV \exp_not:o }
+ \l__hook_replace_text_tl
+ }
+ \cs_set_eq:NN \__hook_def_cmd:w \tex_gdef:D
+ \cs_set_eq:NN \__hook_exp_not:NN \prg_do_nothing:
+ }
+ {
+ \tl_clear:N \l__hook_param_text_tl
+ \tl_set_eq:NN \l__hook_replace_text_tl #2
+ \cs_set_eq:NN \__hook_def_cmd:w \tex_xdef:D
+ \cs_set:Npn \__hook_exp_not:NN ##1 { \exp_not:N ##1 \exp_not:N }
+ }
+ \group_begin:
+ \int_set:Nn \tex_escapechar:D { `\/ }
+ \use:x
+ {
+ \group_end:
+ \tl_set:Nx \exp_not:N \l__hook_patch_prefixes_tl
+ { \exp_not:N \__hook_make_prefixes:w \cs_prefix_spec:N #2 / / }
+ }
+ \__hook_disable:n { cmd / #3 / #4 }
+ \cs_undefine:c { c__hook_cmd / #3 / #4_parameter_tl }
+ \__hook_make_usable:nn { cmd / #3 / #4 } { \l__hook_patch_num_args_int }
+ \use:e
+ {
+ \__hook_redefine_with_hooks:Nnnn \exp_not:N #2
+ \str_if_eq:nnTF {#4} { after }
+ { \use_ii_i:nn }
+ { \use:nn }
+ { {
+ \__hook_exp_not:NN \exp_not:N \UseHookWithArguments
+ { cmd / #3 / #4 } { \int_use:N \l__hook_patch_num_args_int }
+ \__hook_braced_parameter:n { cmd / #3 / #4 }
+ } }
+ { { } }
+ { \__hook_exp_not:NN \exp_not:V \l__hook_replace_text_tl }
+ }
+ \__hook_update_hook_code:n { cmd / #3 / #4 }
+ }
+\EndIncludeInRelease
+\IncludeInRelease{2021/06/01}{\__hook_patch_expand_redefine:NNnn}
+ {cmd~hooks~with~args}
+\cs_gset_protected:Npn \__hook_patch_expand_redefine:NNnn #1 #2 #3 #4
+ {
+ \__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
+ \bool_if:NT #1 { -1 }
+ }
+ \int_compare:nNnTF { \l__hook_patch_num_args_int } > { \c_zero_int }
+ {
+ \tl_set:Nx \l__hook_tmpa_tl { \bool_if:NTF #1 { [ ] } { { } } }
+ \int_step_inline:nnn { 2 } { \l__hook_patch_num_args_int }
+ { \tl_put_right:Nn \l__hook_tmpa_tl { { } } }
+ \exp_args:NNo \exp_args:No \__hook_if_has_hash:nTF
+ { \exp_after:wN #2 \l__hook_tmpa_tl }
+ { \cs_set_eq:NN \__hook_exp_not:n \exp_not:n }
+ { \cs_set_eq:NN \__hook_exp_not:n \use:n }
+ \cs_set_protected:Npn \__hook_tmp:w ##1 ##2
+ {
+ ##1 \l__hook_param_text_tl { \use:n ##2 }
+ ##1 \l__hook_replace_text_tl { \__hook_exp_not:n {##2} }
+ }
+ \bool_if:NTF #1
{ \__hook_tmp:w \tl_set:Nx { [ \c__hook_hash_tl 1 ] } }
{ \__hook_tmp:w \tl_set:Nx { { \c__hook_hash_tl 1 } } }
\int_step_inline:nnn { 2 } { \l__hook_patch_num_args_int }
@@ -6564,6 +8030,7 @@ of this package available from CTAN}
{ \__hook_exp_not:NN \exp_not:V \l__hook_replace_text_tl }
}
}
+\EndIncludeInRelease
\cs_new_protected:Npn \__hook_redefine_with_hooks:Nnnn #1 #2 #3 #4
{
\l__hook_patch_prefixes_tl
@@ -6611,7 +8078,11 @@ of this package available from CTAN}
\if_meaning:w \q__hook_recursion_tail #1
\__hook_double_hashes_stop:w
\fi:
- \if_meaning:w \c__hook_hash_tl #1
+ \if:w ?
+ \if_meaning:w \c__hook_hash_tl #1 ! \fi:
+ \if_meaning:w \c__hook_hashes_tl #1 ! \fi:
+ ?
+ \else:
\use_i:nnnn
\fi:
\use:n
@@ -6633,10 +8104,10 @@ of this package available from CTAN}
{ ~ \__hook_double_hashes:w }
\cs_new_protected:Npn \__hook_retokenize_patch:Nnn #1 #2 #3
{
- \__hook_patch_debug:x { ..~command~can~only~be~patched~by~rescanning }
\str_if_eq:eeTF { \cs_argument_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 }
\tl_set:Nx \l__hook_tmpa_tl
{
\int_compare:nNnTF { \char_value_catcode:n {`\@ } } = { 12 }
@@ -6666,6 +8137,8 @@ of this package available from CTAN}
}
}
}
+\IncludeInRelease{2023/06/01}{\__hook_try_patch_with_catcodes:Nnnnw}
+ {cmd~hooks~with~args}
\cs_new_protected:Npn \__hook_try_patch_with_catcodes:Nnnnw #1 #2 #3 #4
{
\quark_if_recursion_tail_stop_do:nn {#4} { \use:n }
@@ -6674,6 +8147,25 @@ of this package available from CTAN}
{
\__hook_patch_debug:x { ++~macro~can~be~retokenized~cleanly }
\__hook_patch_debug:x { ==~retokenizing~macro~now }
+ \__hook_patch_retokenize:Nnnn #1 { cmd / #2 / #3 } {#3} {#4}
+ \use_i_delimit_by_q_recursion_stop:nw \use_none:n
+ }
+ {
+ \__hook_patch_debug:x { --~macro~cannot~be~retokenized~cleanly }
+ \__hook_try_patch_with_catcodes:Nnnnw #1 {#2} {#3}
+ }
+ }
+\EndIncludeInRelease
+\IncludeInRelease{2021/06/01}{\__hook_try_patch_with_catcodes:Nnnnw}
+ {cmd~hooks~with~args}
+\cs_gset_protected:Npn \__hook_try_patch_with_catcodes:Nnnnw #1 #2 #3 #4
+ {
+ \quark_if_recursion_tail_stop_do:nn {#4} { \use:n }
+ \__hook_patch_debug:x { ++~trying~to~patch~by~retokenization }
+ \__hook_cmd_if_scanable:NnTF {#1} {#4}
+ {
+ \__hook_patch_debug:x { ++~macro~can~be~retokenized~cleanly }
+ \__hook_patch_debug:x { ==~retokenizing~macro~now }
\__hook_patch_retokenize:Nnnn #1 {#2} {#3} {#4}
\use_i_delimit_by_q_recursion_stop:nw \use_none:n
}
@@ -6682,6 +8174,7 @@ of this package available from CTAN}
\__hook_try_patch_with_catcodes:Nnnnw #1 {#2} {#3}
}
}
+\EndIncludeInRelease
\cs_new_eq:NN \kerneltmpDoNotUse !
\cs_new_protected:Npn \__hook_patch_required_catcodes:
{
@@ -6709,8 +8202,86 @@ of this package available from CTAN}
{ \prg_return_true: }
{ \prg_return_false: }
}
+\IncludeInRelease{2023/06/01}{\__hook_guess_arg_count:NN}
+ {cmd~hooks~with~args}
+\cs_new_protected:Npn \__hook_guess_arg_count:NN #1
+ {
+ \exp_after:wN \__hook_guess_arg_count:wN
+ \token_to_meaning:N #1 \s__hook_mark
+ }
+\exp_last_unbraced:NNNNo
+\cs_new_protected:Npx \__hook_guess_arg_count:wN
+ #1 { \tl_to_str:n { macro: } } #2 \s__hook_mark #3
+ {
+ \int_set:Nn #3
+ {
+ \exp_not:N \__hook_guess_arg_count:nw { 0 } #2
+ \c_hash_str 0 \s__hook_mark
+ }
+ }
+\use:e
+ { \cs_new:Npn \exp_not:N \__hook_guess_arg_count:nw #1 #2 \c_hash_str #3 }
+ {
+ \int_compare:nNnTF { #1 + 1 } = {#3}
+ { \__hook_guess_arg_count:nw {#3} }
+ { #1 \__hook_use_none_delimit_by_s_mark:w }
+ }
+\EndIncludeInRelease
+\IncludeInRelease{2021/06/01}{\__hook_guess_arg_count:NN}
+ {cmd~hooks~with~args}
+\cs_undefine:N \__hook_guess_arg_count:NN
+\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}{\__hook_patch_retokenize:Nnnn}
+ {cmd~hooks~with~args}
\cs_new_protected:Npn \__hook_patch_retokenize:Nnnn #1 #2 #3 #4
{
+ \__hook_guess_arg_count:NN #1 \l__hook_patch_num_args_int
+ \__hook_disable:n {#2}
+ \cs_undefine:c { c__hook_#2_parameter_tl }
+ \__hook_make_usable:nn {#2} { \l__hook_patch_num_args_int }
+ \tl_set:Ne \l__hook_tmpa_tl
+ { \exp_args:Ne \tl_to_str:n { \__hook_braced_parameter:n {#2} } }
+ \use:x
+ {
+ \str_replace_all:Nnn \exp_not:N \l__hook_tmpa_tl
+ { #### } { \c_hash_str }
+ }
+ \cs_set_eq:NN \kerneltmpDoNotUse \scan_stop:
+ \cs_set_eq:NN \__hook_tmp:w \scan_stop:
+ \use:x
+ {
+ \cs_set:Npn \__hook_tmp:w
+ ####1 \tl_to_str:n { macro: } ####2 -> ####3 \s__hook_mark
+ {
+ ####1 \def \kerneltmpDoNotUse ####2
+ {
+ \str_if_eq:nnT {#3} { before }
+ {
+ \token_to_str:N \UseHookWithArguments {#2}
+ { \int_use:N \l__hook_patch_num_args_int }
+ \l__hook_tmpa_tl
+ }
+ ####3
+ \str_if_eq:nnT {#3} { after }
+ {
+ \token_to_str:N \UseHookWithArguments {#2}
+ { \int_use:N \l__hook_patch_num_args_int }
+ \l__hook_tmpa_tl
+ }
+ }
+ }
+ \tl_set:Nx \exp_not:N \l__hook_tmpa_tl
+ { \exp_not:N \__hook_tmp:w \token_to_meaning:N #1 \s__hook_mark }
+ }
+ \tl_rescan:nV { #4 \__hook_patch_required_catcodes: } \l__hook_tmpa_tl
+ \cs_gset_eq:NN #1 \kerneltmpDoNotUse
+ \__hook_update_hook_code:n {#2}
+ }
+\EndIncludeInRelease
+\IncludeInRelease{2021/06/01}{\__hook_patch_retokenize:Nnnn}
+ {cmd~hooks~with~args}
+\cs_gset_protected:Npn \__hook_patch_retokenize:Nnnn #1 #2 #3 #4
+ {
\cs_set_eq:NN \kerneltmpDoNotUse \scan_stop:
\cs_set_eq:NN \__hook_tmp:w \scan_stop:
\use:x
@@ -6733,6 +8304,7 @@ of this package available from CTAN}
\tl_rescan:nV { #4 \__hook_patch_required_catcodes: } \l__hook_tmpa_tl
\cs_gset_eq:NN #1 \kerneltmpDoNotUse
}
+\EndIncludeInRelease
\IncludeInRelease{2021/11/15}{wrong-cmd-hook}%
{Standardise~generic~hook~names}
\EndIncludeInRelease
@@ -6819,10 +8391,12 @@ of this package available from CTAN}
\let\@latex@note@no@line\@latex@info@no@line
\EndIncludeInRelease
%%% From File: ltpar.dtx
-%% File: ltpara.dtx (C) Copyright 2020-2021
+%% File: ltpara.dtx
+%% Copyright (C) 2020-2023
+%% Frank Mittelbach, The LaTeX Project
%%% From File: ltpara.dtx
-\def\ltparaversion{v1.0k}
-\def\ltparadate{2022/05/13}
+\def\ltparaversion{v1.0l}
+\def\ltparadate{2023/01/30}
\ExplSyntaxOn
@@ -6834,6 +8408,8 @@ of this package available from CTAN}
\let \@kernel@before@para@begin \@empty
\let \@kernel@after@para@end \@empty
\let \@kernel@after@para@after \@empty
+\IncludeInRelease{2023/06/01}
+ {\g__para_standard_everypar_tl}{minipage~ fix}
\tl_new:N \g__para_standard_everypar_tl
\tl_gset:Nn \g__para_standard_everypar_tl {
\box_gset_to_last:N \g_para_indent_box
@@ -6845,6 +8421,31 @@ of this package available from CTAN}
\hook_use:n {para/before}
\group_begin:
\tex_everypar:D {}
+ \skip_set:Nn \tex_parskip:D
+ { \if@minipage -\tex_parskip:D \else: \c_zero_skip \fi: }
+ \tex_noindent:D
+ \group_end:
+ \tex_everypar:D{\g__para_standard_everypar_tl}
+ \@kernel@before@para@begin
+ \hook_use:n {para/begin}
+ \if_mode_horizontal: \else:
+ \msg_error:nnnn { hooks }{ para-mode }{begin}{vertical} \fi:
+ \__para_handle_indent:
+}
+\EndIncludeInRelease
+\IncludeInRelease{2021/06/01}
+ {\g__para_standard_everypar_tl}{minipage~ fix}
+
+\tl_gset:Nn \g__para_standard_everypar_tl {
+ \box_gset_to_last:N \g_para_indent_box
+ \group_begin:
+ \tex_par:D
+ \group_end:
+ \tex_everypar:D { \msg_error:nnnn { hooks }{ para-mode }{before}{vertical} }
+ \@kernel@before@para@before
+ \hook_use:n {para/before}
+ \group_begin:
+ \tex_everypar:D {}
\skip_zero:N \tex_parskip:D
\tex_noindent:D
\group_end:
@@ -6855,6 +8456,14 @@ of this package available from CTAN}
\msg_error:nnnn { hooks }{ para-mode }{begin}{vertical} \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
\tex_everypar:D{\g__para_standard_everypar_tl}
\newtoks \everypar
@@ -6966,7 +8575,9 @@ of this package available from CTAN}
\EndModuleRelease
\ExplSyntaxOff
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% File: ltmeta.dtx (C) Copyright 2021, 2022
+%% File: ltmeta.dtx
+%% Copyright (C) 2021-2023
+%% Frank Mittelbach, The LaTeX Project
%%% From File: ltmeta.dtx
\def\ltmetaversion{v1.0b}
\def\ltmetadate{2022/05/18}
@@ -7013,6 +8624,7 @@ of this package available from CTAN}
\DeclareRobustCommand\linebreak{\@testopt{\@no@lnbk-}4}
\DeclareRobustCommand\nolinebreak{\@testopt\@no@lnbk4}
\DeclareRobustCommand\samepage{\interlinepenalty\@M
+ \predisplaypenalty\@M
\postdisplaypenalty\@M
\interdisplaylinepenalty\@M
\@beginparpenalty\@M
@@ -7401,6 +9013,7 @@ of this package available from CTAN}
\global\let\do\noexpand
\UseOneTimeHook{begindocument/end}%
\ignorespaces}
+\let\do\noexpand
\NewHook{begindocument}
\NewHook{begindocument/before}
\NewHook{begindocument/end}
@@ -7758,8 +9371,31 @@ of this package available from CTAN}
\reserved@a}
\EndIncludeInRelease
+\IncludeInRelease{2023/05/01}%
+ {\IfFileExists@}{IfFileExists}
+\long\def \IfFileExists@#1#2#3{%
+ \edef\@filef@und{\IfFileExists@@{#1}}%
+ \ifx\@filef@und\@empty
+ \if\relax\detokenize{#1}\relax
+ \let\reserved@a\@firstoftwo
+ \def\@filef@und{".tex" }%
+ \else
+ \let\reserved@a\@secondoftwo
+ \fi
+ \else
+ \let\reserved@a\@firstoftwo
+ \edef\@filef@und{"\@filef@und" }%
+ \fi
+ \expandafter\def\expandafter\reserved@a
+ \expandafter{\reserved@a{#2}{#3}}%
+\reserved@a}
+\ExplSyntaxOn
+\cs_new_eq:NN \IfFileExists@@ \file_full_name:n
+\ExplSyntaxOff
+\EndIncludeInRelease
\IncludeInRelease{2021/06/01}%
- {\IfFileExists@}{manage unbalanced conditionals}
+ {\IfFileExists@}{IfFileExists}
+
\long\def \IfFileExists@#1#2#3{%
\openin\@inputcheck"#1" %
\ifeof\@inputcheck
@@ -7776,9 +9412,11 @@ of this package available from CTAN}
\expandafter\def\expandafter\reserved@a
\expandafter{\reserved@a{#2}{#3}}%
\reserved@a}
+\let\IfFileExists@@\@undefined
\EndIncludeInRelease
+
\IncludeInRelease{2019/10/01}%
- {\IfFileExists@}{manage unbalanced conditionals}
+ {\IfFileExists@}{IfFileExists}
\long\def \IfFileExists@#1#2#3{%
\openin\@inputcheck"#1" %
@@ -7796,7 +9434,7 @@ of this package available from CTAN}
\reserved@a}
\EndIncludeInRelease
\IncludeInRelease{0000/00/00}%
- {\IfFileExists@}{manage unbalanced conditionals}
+ {\IfFileExists@}{IfFileExists}
\let\IfFileExists@\@undefined
@@ -11328,11 +12966,58 @@ of this package available from CTAN}
%%% From File: ltpageno.dtx
%%% From File: ltxref.dtx
+\IncludeInRelease{2023/06/01}%
+ {\@kernel@sref}{store five arguments}%
+\def\@setref#1#2#3{%
+ \ifx#1\relax
+ \protect\G@refundefinedtrue
+ \nfss@text{\reset@font\bfseries ??}%
+ \@latex@warning{Reference `#3' on page \thepage \space
+ undefined}%
+ \else
+ \expandafter#2#1\@empty\@empty\@empty\null
+ \fi}
+\long\def\@firstoffive#1#2#3#4#5{#1}
+\long\def\@secondoffive#1#2#3#4#5{#2}
+\def\@kernel@sref#1{\expandafter\@setref\csname r@#1\endcsname\@firstoffive{#1}}
+\def\@kernel@spageref#1{\expandafter\@setref\csname r@#1\endcsname
+ \@secondoffive{#1}}
+\EndIncludeInRelease
\IncludeInRelease{2022/06/01}%
- {\ref}{Add starred reference commands}%
+ {\@kernel@sref}{store five arguments}%
+\def\@setref#1#2#3{%
+ \ifx#1\relax
+ \protect\G@refundefinedtrue
+ \nfss@text{\reset@font\bfseries ??}%
+ \@latex@warning{Reference `#3' on page \thepage \space
+ undefined}%
+ \else
+ \expandafter#2#1\null
+ \fi}
+\let\@firstoffive\undefined
+\let\@secondoffive\undefined
\def\@kernel@sref#1{\expandafter\@setref\csname r@#1\endcsname\@firstoftwo{#1}}
\def\@kernel@spageref#1{\expandafter\@setref\csname r@#1\endcsname
\@secondoftwo{#1}}
+\EndIncludeInRelease
+\IncludeInRelease{0000/00/00}%
+ {\@kernel@sref}{store five arguments}%
+\def\@setref#1#2#3{%
+ \ifx#1\relax
+ \protect\G@refundefinedtrue
+ \nfss@text{\reset@font\bfseries ??}%
+ \@latex@warning{Reference `#3' on page \thepage \space
+ undefined}%
+ \else
+ \expandafter#2#1\null
+ \fi}
+\let\@firstoffive\undefined
+\let\@secondoffive\undefined
+\let\@kernel@sref\undefined
+\let\@kernel@spageref\undefined
+\EndIncludeInRelease
+\IncludeInRelease{2022/06/01}%
+ {\ref}{Add starred reference commands}%
\let\@kernel@ref\@kernel@sref
\let\@kernel@pageref\@kernel@spageref
\NewDocumentCommand\ref{s}
@@ -11351,6 +13036,21 @@ of this package available from CTAN}
\@secondoftwo{#1}}
\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}%
+ {\label}{store five label arguments}%
+\providecommand\@currentlabelname{}
+\providecommand\@currentHref{}
+\providecommand\@kernel@reserved@label@data{}
+\NewHookWithArguments{label}{1}
+\def\label#1{\@bsphack
+ \begingroup
+ \UseHookWithArguments{label}{1}{#1}%
+ \protected@write\@auxout{}%
+ {\string\newlabel{#1}{{\@currentlabel}{\thepage}%
+ {\@currentlabelname}{\@currentHref}{\@kernel@reserved@label@data}}}%
+ \endgroup
+ \@esphack}
+\EndIncludeInRelease
\IncludeInRelease{2022/06/01}%
{\Ref}{Add starred version}%
\def\@currentcounter{}
@@ -11367,6 +13067,16 @@ of this package available from CTAN}
\NewDocumentCommand\Ref{s}
{\IfBooleanTF{#1}{\@kernel@sRef}{\@kernel@Ref}}
\EndIncludeInRelease
+\IncludeInRelease{0000/00/00}%
+ {\label}{store five label arguments}%
+\let\@currenttitle\@undefined
+\let\@currenttarget\@undefined
+\let\@kernel@currentdata\@undefined
+\def\label#1{\@bsphack
+ \protected@write\@auxout{}%
+ {\string\newlabel{#1}{{\@currentlabel}{\thepage}}}%
+ \@esphack}
+\EndIncludeInRelease
\IncludeInRelease{2020/10/01}%
{\Ref}{Add starred version}%
\def\@currentcounter{}
@@ -11432,6 +13142,13 @@ of this package available from CTAN}
\NewHook{enddocument/end}
\AddToHook{enddocument/info}[kernel/filelist]{\@dofilelist}
\AddToHook{enddocument/info}[kernel/warnings]{\@enddocument@kernel@warnings}
+\AddToHook{enddocument/info}[kernel/release]{%
+ \let\show@release@info\wlog
+ \show@release@info{ ***********}%
+ \the\LaTeXReleaseInfo
+ \show@release@info{ ***********}}
+
+\DeclareHookRule{enddocument/info}{kernel/release}{before}{kernel/filelist}
\DeclareHookRule{enddocument/info}{kernel/filelist}{before}{kernel/warnings}
\def\@enddocument@kernel@warnings{%
\ifdim \font@submax >\fontsubfuzz\relax
@@ -12047,6 +13764,18 @@ of this package available from CTAN}
\noalign{\penalty\@eqpen\vskip\jot\vskip #1\relax}%
}
\EndIncludeInRelease
+\IncludeInRelease{2023/06/01}%
+ {\eqno}{add ignorespaces to eqno}%
+\let\@kernel@eqno\eqno
+\let\@kernel@leqno\leqno
+\protected\def\eqno{\@kernel@eqno\aftergroup\ignorespaces}
+\protected\def\leqno{\@kernel@leqno\aftergroup\ignorespaces}
+\EndIncludeInRelease
+\IncludeInRelease{0000/00/00}%
+ {\eqno}{add ignorespaces to eqno}%
+\let\eqno\@kernel@eqno
+\let\leqno\@kernel@leqno
+\EndIncludeInRelease
%%% From File: ltlists.dtx
%%% From File: ltboxes.dtx
\IncludeInRelease{2015/01/01}%
@@ -13393,7 +15122,9 @@ of this package available from CTAN}
\@esphack}
\EndIncludeInRelease
-%% File: ltmarks.dtx (C) Copyright 2022
+%% File: ltmarks.dtx
+%% Copyright (C) 2022-2023
+%% Frank Mittelbach, The LaTeX Project
%%% From File: ltmarks.dtx
\def\ltmarksversion{v1.0d}
\def\ltmarksdate{2022/06/01}
@@ -13880,12 +15611,14 @@ of this package available from CTAN}
\def\IfFormatAtLeastTF{\@ifl@t@r\fmtversion}
\let\IfPackageAtLeastTF\@ifpackagelater
\let\IfClassAtLeastTF\@ifclasslater
+\def\IfFileAtLeastTF#1{\expandafter\@ifl@t@r\csname ver@#1\endcsname}
\EndIncludeInRelease
\IncludeInRelease{0000/00/00}%
{\IfFormatAtLeastTF}{Test format date}%
\def\IfFormatAtLeastTF{\@ifl@t@r\fmtversion}
\let\IfPackageAtLeastTF\@ifpackagelater
\let\IfClassAtLeastTF\@ifclasslater
+\def\IfFileAtLeastTF#1{\expandafter\@ifl@t@r\csname ver@#1\endcsname}
\EndIncludeInRelease
\IncludeInRelease{2018/04/01}%
{\@ifl@t@r}{Guard against bad input}%
@@ -14312,7 +16045,7 @@ of this package available from CTAN}
\EndIncludeInRelease
\IncludeInRelease{2020/10/01}%
{\@onefilewithoptions}{Hooks and unused options issue}%
-\def\@onefilewithoptions#1[#2][#3]#4{%
+\def\load@onefilewithoptions#1[#2][#3]#4{%
\@expl@@@filehook@set@curr@file@@nNN{#1.#4}\reserved@a\reserved@b
\edef\reserved@c{\def\noexpand\reserved@c####1%
\detokenize\expandafter{\expanded{.#4}}%
@@ -14535,7 +16268,7 @@ of this package available from CTAN}
\csname filec@ntents@\reserved@a\endcsname
\else
\@latex@error{Unknown filecontents option \reserved@a}%
- {Valid options are force (or overwrite), nosearch, noheader}%
+ {Valid options are force (or overwrite), nosearch, noheader, nowarn}%
\fi}%
\filec@ntents
}
@@ -14547,6 +16280,10 @@ of this package available from CTAN}
\def\filec@ntents@where{in current directory}}
\let\filec@ntents@checkdir\@empty
\def\filec@ntents@where{exists on the system}
+\def\filec@ntents@nowarn{%
+ \let\filec@ntents@warning\@latex@note@no@line
+}
+\let\filec@ntents@warning\@latex@warning@no@line
\begingroup%
\@tempcnta=1
\loop
@@ -14591,8 +16328,8 @@ of this package available from CTAN}
write to the file you are reading from!\MessageBreak%
Data is written to screen instead.}%
\else%
- \@latex@warning@no@line%
- {Writing or overwriting file `\@currdir\@curr@file'}%
+ \filec@ntents@warning%
+ {Writing or overwriting file `\@curr@file'}%
\immediate\openout\reserved@c\q@curr@file\relax%
\fi%
\fi%
@@ -14871,8 +16608,8 @@ of this package available from CTAN}
\endgroup%
\EndIncludeInRelease
%%% From File: ltfilehook.dtx
-\providecommand\ltfilehookversion{v1.0n}
-\providecommand\ltfilehookdate{2022/08/18}
+\providecommand\ltfilehookversion{v1.0o}
+\providecommand\ltfilehookdate{2023/04/02}
\IncludeInRelease{2020/10/01}%
{\CurrentFile}{Hook management file}%
\ExplSyntaxOn
@@ -15211,7 +16948,7 @@ of this package available from CTAN}
\def\@kernel@make@file@csname#1#2#3{%
\xdef#1{\expandafter\@set@curr@file@aux
\csname\expandafter#2\@firstofone#3\@nil\endcsname}}
-\def\@set@curr@file@aux#1{%
+\long\def\@set@curr@file@aux#1{%
\expandafter\ifx\csname\endcsname#1%
.tex\else\string#1\fi}
\def\@filehook@set@CurrentFile{%
@@ -15356,12 +17093,12 @@ of this package available from CTAN}
\EndIncludeInRelease
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
-%% Copyright (C) 2020-2022
-%% Frank Mittelbach, LaTeX Team
+%% Copyright (C) 2020-2023
+%% Frank Mittelbach, The LaTeX Project
%%
%%% From File: ltshipout.dtx
-\providecommand\ltshipoutversion{v1.0m}
-\providecommand\ltshipoutdate{2022/08/26}
+\providecommand\ltshipoutversion{v1.0n}
+\providecommand\ltshipoutdate{2022/11/08}
\IncludeInRelease{2020/10/01}%
{\shipout}{Hook management (shipout)}%
\ExplSyntaxOn
@@ -15477,6 +17214,7 @@ of this package available from CTAN}
\bool_gset_true:N \g__shipout_lastpage_handled_bool
}
}
+ \hook_use:n {shipout}
\__shipout_finalize_box:
\cs_set_eq:NN \protect \exp_not:N
\tex_shipout:D \box_use:N \l_shipout_box
@@ -15508,6 +17246,7 @@ of this package available from CTAN}
\cs_gset_eq:NN \RawShipout \__shipout_execute_raw:
\cs_new_eq:NN \__shipout_saved_protect: \protect
\hook_new:n{shipout/before}
+\hook_new:n{shipout}
\hook_new:n{shipout/after}
\hook_new:n{shipout/foreground}
\hook_new:n{shipout/background}
@@ -17139,6 +18878,7 @@ of this package available from CTAN}
}
\tl_clear:N \l__latexrelease_restores_tl
\msg_redirect_name:nnn { hooks } { exists } { }
+\msg_redirect_name:nnn { mark } { class-already-defined } { }
\ExplSyntaxOff}%
\endinput
%%