[latex3-commits] [git/LaTeX3-latex3-latex2e] gh239: Add ltnews entry for \DeclareCommandCopy (597594fe)
PhelypeOleinik
tex.phelype at gmail.com
Sat May 9 05:35:27 CEST 2020
Repository : https://github.com/latex3/latex2e
On branch : gh239
Link : https://github.com/latex3/latex2e/commit/597594fe0e366b46f8d12746d85cb11bec4fccae
>---------------------------------------------------------------
commit 597594fe0e366b46f8d12746d85cb11bec4fccae
Author: PhelypeOleinik <tex.phelype at gmail.com>
Date: Sat May 9 00:35:27 2020 -0300
Add ltnews entry for \DeclareCommandCopy
>---------------------------------------------------------------
597594fe0e366b46f8d12746d85cb11bec4fccae
base/doc/ltnews32.tex | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/base/doc/ltnews32.tex b/base/doc/ltnews32.tex
index b04f2d03..b902d70c 100644
--- a/base/doc/ltnews32.tex
+++ b/base/doc/ltnews32.tex
@@ -386,6 +386,46 @@ are ignored as elsewhere.
\githubissue{327}
+\subsection{Provide a way to copy commands}
+
+With the previous \LaTeXe{} release, several user-level commands were
+made robust, so the need for a way to create copies of these commands
+(often to redefine them) increased, and the \LaTeXe{} kernel didn't have
+a way to do so. Previously this functionality was provided in part by
+Heiko Oberdiek's \pkg{letltxmacro} package, which allows a robust
+command \verb=\foo= to be copied to \verb=\bar= with
+\verb=\LetLtxMacro\bar\foo=.
+
+From this release onwards, the \LaTeXe{} kernel provides
+\cs{NewCommandCopy} (and \verb=\Renew...=, \verb=\Declare...=, and
+\verb=\Provide...= variants) which functions almost like
+\verb=\LetLtxMacro=. To the end user, both should work the same way,
+and one shouldn't need to worry about the definition of the command:
+\cs{NewCommandCopy} should do the hard work.
+
+For developers, lower level macros \cs{CopyKernelRobustCommand} and
+\cs{CopyKernelCmdWithOptArg} are provided to copy commands defined with
+\cs{DeclareRobustCommand} and commands defined with an optional
+argument, respectively. Conditionals \cs{IfKernelRobustCommand} and
+\cs{IfKernelCmdWithOptArg} are provided to check these cases if
+necessary. These macros are faster than the generic \cs{NewCommandCopy}
+because they don't have to test for all possibilities.
+
+Also, at an even lower level, developers can add their own types of
+macros to the list of tests done by \cs{NewCommandCopy}. A hook
+\cs{@declarecommandcopylisthook} whose items are pair of control
+sequences which test if a macro is of a given type, and copy that type
+of macro. For instance, \pkg{etoolbox} provides a different type of
+robust command defined with \cs{newrobustcmd}. This can be added to the
+list of tests with:
+\begin{verbatim}
+\g at addto@macro\@declarecommandcopylisthook
+ {\ifrobustcmd\letrobustcmd}
+\end{verbatim}
+then \cs{NewCommandCopy} will support macros defined with
+\cs{newrobustcmd}.
+
+\githubissue{239}
\section{Changes to packages in the \pkg{graphics} category}
More information about the latex3-commits
mailing list.