[latex3-commits] [git/LaTeX3-latex3-latex2e] ltcmdhooks: ltnews draft for cmd hooks (a9a939b4)

Frank Mittelbach frank.mittelbach at latex-project.org
Tue Apr 20 00:01:08 CEST 2021


Repository : https://github.com/latex3/latex2e
On branch  : ltcmdhooks
Link       : https://github.com/latex3/latex2e/commit/a9a939b468d5dd15b24e9850ce58e8aa838f576e

>---------------------------------------------------------------

commit a9a939b468d5dd15b24e9850ce58e8aa838f576e
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date:   Tue Apr 20 00:01:08 2021 +0200

    ltnews draft for cmd hooks


>---------------------------------------------------------------

a9a939b468d5dd15b24e9850ce58e8aa838f576e
 base/doc/ltnews33.tex | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/base/doc/ltnews33.tex b/base/doc/ltnews33.tex
index 56b8b626..b154eda1 100644
--- a/base/doc/ltnews33.tex
+++ b/base/doc/ltnews33.tex
@@ -40,6 +40,8 @@
 \usepackage{csquotes}
 \usepackage{multicol}
 
+\providecommand\hook[1]{\texttt{#1}}
+
 \providecommand\meta[1]{$\langle$\textrm{\itshape#1}$\rangle$}
 \providecommand\option[1]{\texttt{#1}}
 \providecommand\env[1]{\texttt{#1}}
@@ -137,6 +139,36 @@ full kernel documentation in \file{source2e.pdf}.
 
 
 
+\section{Extending the hook concept to commands}
+
+Up to now the hook management covered hooks for a few core areas, such
+as hooks for the \cs{shipout} process or those in the \env{document}
+environment, as well as generic hooks for file loading (helpful for
+patching) and for abitrary environments (executed by \cs{begin} and
+\cs{end}).
+
+This has now been extended to add \hook{/before} and \hook{/after}
+hooks to any (document-level) command---in theory at that is.  In
+practice the new generic \hook{cmd} hooks, especially the
+\hook{cmd/.../after} hooks may fail with commands that are too complex
+to be automatically patched. If that is the case it will be detected
+and an appropriate error is generated. The restrictions are documented
+in \texttt{ltcmdhooks-doc.pdf}.
+
+However, given that these hooks are mainly meant for package
+developers to provide a better interoperability between different
+packages and between packages and the \LaTeX{} kernel, these
+restrictions are of minor importance: for commands where the mechanism
+can't be applied, one is in the same situation as before and for all
+others there will be a noticable improvement.  This is especially
+important for our big project providing acessible and tagged PDF
+output~\cite{33:blueprint}, because for this we will eventually have
+to patch many third-party packages and this is only feasible, if it can
+be done in controlled and standardized ways.
+
+
+
+
 \section{Other changes to the \LaTeX{} kernel}
 
 \subsection{Adjusting \env{itemize} labels with \cs{labelitemfont}}





More information about the latex3-commits mailing list.