diff options
author | Norbert Preining <norbert@preining.info> | 2024-06-02 03:03:43 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2024-06-02 03:03:43 +0000 |
commit | d751a6e51be81d6c1ba797cd91d4079e7e2e407b (patch) | |
tree | 30738f61076dd0b1543343a753941b74ad1b07d7 /macros/latex/base/ltcmdhooks.dtx | |
parent | c4af6b71665be2eeee42e63d081e50debde63162 (diff) |
CTAN sync 202406020303
Diffstat (limited to 'macros/latex/base/ltcmdhooks.dtx')
-rw-r--r-- | macros/latex/base/ltcmdhooks.dtx | 46 |
1 files changed, 30 insertions, 16 deletions
diff --git a/macros/latex/base/ltcmdhooks.dtx b/macros/latex/base/ltcmdhooks.dtx index 73bd7f6351..f8a8699d7e 100644 --- a/macros/latex/base/ltcmdhooks.dtx +++ b/macros/latex/base/ltcmdhooks.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% File: ltcmdhooks.dtx +%% From File: ltcmdhooks.dtx %% Copyright (C) 2020-2024 %% Frank Mittelbach, Phelype Oleinik, The LaTeX Project % @@ -12,16 +12,20 @@ % https://www.latex-project.org/lppl.txt % % -%%% From File: ltcmdhooks.dtx -% -\def\ltcmdhooksversion{v1.0i} -\def\ltcmdhooksdate{2023/06/16} -% +% \fi % +% \iffalse +%%% From File: lthooks.dtx % %<*driver> +% \fi +\ProvidesFile{ltcmdhooks.dtx} + [2024/04/17 v1.0j LaTeX Kernel (Command hooks)] +% \iffalse +% \documentclass{l3doc} -%\usepackage{ltcmdhooks} +\GetFileInfo{ltcmdhooks.dtx} +% \usepackage{ltcmdhooks} \EnableCrossrefs \CodelineIndex \begin{document} @@ -38,7 +42,7 @@ % \providecommand\phoinline[1]{\begin{quote}\itshape\footnotesize PhO: #1\end{quote}} % % \title{The \texttt{ltcmdhooks} module\thanks{This file has version -% \ltcmdhooksversion\ dated \ltcmdhooksdate, \copyright\ \LaTeX\ +% \fileversion\ dated \filedate, \copyright\ \LaTeX\ % Project.}} % \author{Frank Mittelbach \and Phelype Oleinik} % @@ -125,8 +129,8 @@ % \item % % that code can be prepended or appended (i.e., added to the -% hooks) even if the command itself is not defined, because the -% defining package has not yet been loaded; +% hooks) even if the command itself is not (yet) defined, because the +% defining package has not been loaded at this point; % % \item % @@ -214,6 +218,14 @@ % optional and mandatory arguments. By adding code to the % \hook{cmd/section/after} hook, you get in the way of that scanning. % +% In such a case, where it is known that a specific generic command +% hook does not work if code is added to it, the package author can +% add a \cs{DisableGenericHook}\footnote{Please use +% \cs{DisableGenericHook} if at all, only on hooks that you +% \enquote{own}, i.e., for commands your package or class defines and +% not second guess whether or not hooks of other packages should get +% disabled!} declaration to prevent this from happening in user +% documents and thereby avoiding obscure errors. % % % \section{Package Author Interface} @@ -394,6 +406,8 @@ % \end{macrocode} % % \changes{v1.0b}{2021/05/24}{Use \cs{msg_...} instead of \cs{__kernel_msg...}} +% \changes{v1.0j}{2024/04/17}{Use \cs{__kernel_cs_parameter_spec:N} instead +% of \cs{cs_argument_spec:N}/\cs{cs_parameter_spec:N}} % % \begin{macrocode} %<*2ekernel|latexrelease> @@ -643,7 +657,7 @@ } } % \end{macrocode} -% and a conditional \cs{@@_if_public_command:N} to check if a command +% and a conditional \cs{@@_if_public_command:NTF} to check if a command % has |__| in its name (no other checking is performed). Primitives % with |:D| in their name could be included here, but they are already % discarded in the \cs{token_if_macro:NTF} test above. @@ -838,14 +852,14 @@ \@@_patch_debug:x { ++~command~can~be~patched~without~rescanning } % \end{macrocode} % We'll start by counting the number of arguments in the command by -% counting the number of characters in the \cs{cs_argument_spec:N} of +% counting the number of characters in the \cs{cs_parameter_spec:N} of % the macro, divided by two, and subtracting one if the command has an % optional argument (that is, an extra |[]| in its % \meta{parameter text}). % \begin{macrocode} \int_set:Nn \l_@@_patch_num_args_int { - \exp_args:Nf \str_count:n { \cs_argument_spec:N #2 } / 2 + \exp_args:Nf \str_count:n { \__kernel_cs_parameter_spec:N #2 } / 2 \bool_if:NT #1 { -1 } } % \end{macrocode} @@ -998,7 +1012,7 @@ %<latexrelease> \@@_patch_debug:x { ++~command~can~be~patched~without~rescanning } %<latexrelease> \int_set:Nn \l_@@_patch_num_args_int %<latexrelease> { -%<latexrelease> \exp_args:Nf \str_count:n { \cs_argument_spec:N #2 } / 2 +%<latexrelease> \exp_args:Nf \str_count:n { \__kernel_cs_parameter_spec:N #2 } / 2 %<latexrelease> \bool_if:NT #1 { -1 } %<latexrelease> } %<latexrelease> \int_compare:nNnTF { \l_@@_patch_num_args_int } > { \c_zero_int } @@ -1248,12 +1262,12 @@ % top-level macro with no arguments, so testing this first would % short-circuit \tn{robust@command@act} and the top-level macros would % be incorrectly patched. In that case, we just check if the -% \cs{cs_argument_spec:N} is empty, and call +% \cs{cs_parameter_spec:N} is empty, and call % \cs{@@_patch_expand_redefine:NNnn}. % \begin{macrocode} \cs_new_protected:Npn \@@_retokenize_patch:Nnn #1 #2 #3 { - \str_if_eq:eeTF { \cs_argument_spec:N #1 } { } + \str_if_eq:eeTF { \__kernel_cs_parameter_spec:N #1 } { } { \@@_patch_expand_redefine:NNnn \c_false_bool #1 {#2} {#3} } { \@@_patch_debug:x { ..~command~can~only~be~patched~by~rescanning } |