[latex3-commits] [latex3/latex2e] cmd-args: Add ltnews37 entry (1192fb7e)
github at latex-project.org
github at latex-project.org
Mon May 22 03:36:16 CEST 2023
Repository : https://github.com/latex3/latex2e
On branch : cmd-args
Link : https://github.com/latex3/latex2e/commit/1192fb7e756c42f1f78e0f5b3ee8beddad33f4a0
>---------------------------------------------------------------
commit 1192fb7e756c42f1f78e0f5b3ee8beddad33f4a0
Author: PhelypeOleinik <phelype.oleinik at latex-project.org>
Date: Sun May 21 22:36:16 2023 -0300
Add ltnews37 entry
>---------------------------------------------------------------
1192fb7e756c42f1f78e0f5b3ee8beddad33f4a0
base/doc/ltnews37.tex | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/base/doc/ltnews37.tex b/base/doc/ltnews37.tex
index e2a2ab45..cb253967 100644
--- a/base/doc/ltnews37.tex
+++ b/base/doc/ltnews37.tex
@@ -253,6 +253,27 @@ the \pkg{expl3} conterparts of the commands discussed in this section
were also added. The complete documentation can be found in the
\pkg{lthooks} documentation \cite{37:lthooks-doc}.
+\subsubsection{Generic \texttt{cmd} hooks with arguments}
+
+Along with the possibility to pass arguments to a regular hook as
+discussed above, generic \hook{cmd} hooks now can access the arguments
+of the command they are patched into using the interface described in
+the previous section.
+
+For example, if you were to add some code to the \cs{title} command
+using hooks, you could access the actual title given in the argument.
+For example, to write the title of the document in the terminal you
+could use:
+\begin{verbatim}
+ \AddToHookWithArguments{cmd/title/before}
+ {\typeout{Document title: #1}}
+\end{verbatim}
+
+As with regular hooks, code added to a \hook{cmd} hook using
+\cs{AddToHook} will not be able to access the command's arguments. This
+means that, as with regular hooks, this change is completely backwards
+compatible, so previous usages of \hook{cmd} hooks will work exactly as
+they did before.
\subsection{Providing copy and show functions for environments}
More information about the latex3-commits
mailing list.