[latex3-commits] [git/LaTeX3-latex3-latex2e] develop: fix for 975 (ab2a8064)

Frank Mittelbach frank.mittelbach at latex-project.org
Thu Jan 5 12:42:08 CET 2023


Repository : https://github.com/latex3/latex2e
On branch  : develop
Link       : https://github.com/latex3/latex2e/commit/ab2a8064bd2f915a53665e0e16994b871c4c19f8

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

commit ab2a8064bd2f915a53665e0e16994b871c4c19f8
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date:   Thu Jan 5 12:42:08 2023 +0100

    fix for 975


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

ab2a8064bd2f915a53665e0e16994b871c4c19f8
 base/doc/ltnews37.tex                                     | 15 +++++++++++++++
 base/ltfiles.dtx                                          | 14 ++++++++++++--
 .../testfiles/github-0975.lvt                             |  8 +++++++-
 base/testfiles/{github-0587.tlg => github-0975.tlg}       |  9 +++++----
 4 files changed, 39 insertions(+), 7 deletions(-)

diff --git a/base/doc/ltnews37.tex b/base/doc/ltnews37.tex
index 4ce8fccc..453379cf 100644
--- a/base/doc/ltnews37.tex
+++ b/base/doc/ltnews37.tex
@@ -190,6 +190,21 @@ following output:
 \githubissue{943}
 
 
+\subsection{Default definition for \cs{do}}
+
+The command \cs{do} with its nice public name is in reality an
+internal command inherited from plain \TeX{} for list
+processing. However, it only got a definition when
+\verb=\begin{document}= was executed, with a result that a user
+definition in the preamble was unconditionally overwritten at this
+point. To properly alert the user that this command is not freely
+available we now already provide a definition in the format so that
+\cs{newcommand} and friends produce a proper error message instead of
+providing a definition that doesn't last.
+%
+\githubissue{975}
+
+
 \subsection{\pkg{doc}: Support the \pkg{upquote} package}
 
 The default quote and backquote characters in typewriter fonts are
diff --git a/base/ltfiles.dtx b/base/ltfiles.dtx
index d99dfdcd..04256529 100644
--- a/base/ltfiles.dtx
+++ b/base/ltfiles.dtx
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright (C) 1993-2022
+% Copyright (C) 1993-2023
 % The LaTeX Project and any individual authors listed elsewhere
 % in this file.
 %
@@ -32,7 +32,7 @@
 %<*driver>
 % \fi
 \ProvidesFile{ltfiles.dtx}
-             [2022/05/27 v1.2r LaTeX Kernel (File Handling)]
+             [2023/01/05 v1.2s LaTeX Kernel (File Handling)]
 % \iffalse
 \documentclass{ltxdoc}
 \GetFileInfo{ltfiles.dtx}
@@ -417,6 +417,16 @@
   \ignorespaces}
 %    \end{macrocode}
 %
+%    Provide a global definition for \cs{do} as well, so that it is
+%    already defined in the preamble and not late as
+%    \verb=\begin{document}= overwriting some definition given by the
+%    unsuspecting user in the preamble.
+% \changes{v1.2s}{2023/01/05}{\cs{do} now with default definition in
+%    the kernel (gh/975)}
+%    \begin{macrocode}
+\let\do\noexpand
+%    \end{macrocode}
+%
 %    The \hook{begindocument} hook already existed in the kernel since
 %    1994 under the name \cs{atbegindocumenthook} the 
 %    additional ones are originally from the \pkg{etoolbox}
diff --git a/required/amsmath/testfiles/tlb-amsmath-load.lvt b/base/testfiles/github-0975.lvt
similarity index 60%
copy from required/amsmath/testfiles/tlb-amsmath-load.lvt
copy to base/testfiles/github-0975.lvt
index fe720de4..653937b0 100644
--- a/required/amsmath/testfiles/tlb-amsmath-load.lvt
+++ b/base/testfiles/github-0975.lvt
@@ -1,11 +1,17 @@
+
 \documentclass{article}
+
 \input{test2e}
 
 \START
 
-\usepackage{amsmath}
+\newcommand{\do}{hello}
 
+\OMIT
 \begin{document}
+\TIMO
+
+\show\do
 
 \END
 
diff --git a/base/testfiles/github-0587.tlg b/base/testfiles/github-0975.tlg
similarity index 68%
copy from base/testfiles/github-0587.tlg
copy to base/testfiles/github-0975.tlg
index a7efce6b..5ed873ec 100644
--- a/base/testfiles/github-0587.tlg
+++ b/base/testfiles/github-0975.tlg
@@ -1,12 +1,13 @@
 This is a generated file for the LaTeX2e validation system.
 Don't change this file in any respect.
-! LaTeX Error: \begin{foo} on input line ... ended by \end{\myenvname }.
+! LaTeX Error: Command \do already defined.
+               Or name \end... illegal, see p.192 of the manual.
 See the LaTeX manual or LaTeX Companion for explanation.
 Type  H <return>  for immediate help.
  ...                                              
-l. ...\end{nokidding?}
+l. ...\newcommand{\do}{hello}
 Your command was ignored.
 Type  I <command> <return>  to replace it with another command,
 or  <return>  to continue without it.
-[1
-] (github-0587.aux)
+> \do=\noexpand.
+l. ...\show\do





More information about the latex3-commits mailing list.