[latex3-commits] [git/LaTeX3-latex3-latex2e] lthooks2: \document and \enddocument integrated (2709b835)

Frank Mittelbach frank.mittelbach at latex-project.org
Sat Aug 15 22:34:34 CEST 2020


Repository : https://github.com/latex3/latex2e
On branch  : lthooks2
Link       : https://github.com/latex3/latex2e/commit/2709b83569b7f91dd5a0e8659296b820cb3790a6

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

commit 2709b83569b7f91dd5a0e8659296b820cb3790a6
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date:   Sat Aug 15 22:34:34 2020 +0200

    \document and \enddocument  integrated


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

2709b83569b7f91dd5a0e8659296b820cb3790a6
 base/ltfiles.dtx  |  50 ++++++++-------
 base/ltfinal.dtx  |  94 +---------------------------
 base/lthooks.dtx  | 178 +++---------------------------------------------------
 base/ltmiscen.dtx | 165 +++++++++++++++++++++++++++++++++++++++++++-------
 4 files changed, 183 insertions(+), 304 deletions(-)

diff --git a/base/ltfiles.dtx b/base/ltfiles.dtx
index 60b6a23e..f7aff852 100644
--- a/base/ltfiles.dtx
+++ b/base/ltfiles.dtx
@@ -32,7 +32,7 @@
 %<*driver>
 % \fi
 \ProvidesFile{ltfiles.dtx}
-             [2020-06-05 v1.2h LaTeX Kernel (File Handling)]
+             [2020/08/15 v1.2i LaTeX Kernel (File Handling)]
 % \iffalse
 \documentclass{ltxdoc}
 \GetFileInfo{ltfiles.dtx}
@@ -234,22 +234,28 @@
 % \changes{v0.9e}{1993/12/09}{Hook added}
 %    \begin{macrocode}
 %</2ekernel>
-%<latexrelease>\IncludeInRelease{2020/06/05}%
+%<latexrelease>\IncludeInRelease{2020/10/01}%
 %<latexrelease>  {\document}{Added hook to load l3backend code}%
 %<*2ekernel|latexrelease>
+\def\document{%
 %    \end{macrocode}
-%    Cancel the |\begingroup| from |\begin|.
+%    We do cancel the grouping as part of the \cs{begin} handling
+%    (this is now done inside \cs{begin} instead) so that the
+%    \hook{env/\meta{env}/begin} hook is not hidden inside \cs{begingroup}
+%    \texttt{...} \cs{endgroup}.
 %    \begin{macrocode}
-\def\document{\endgroup
+%  \endgroup
 %    \end{macrocode}
-% \changes{v1.2h}{2020/06/05}{Added hook to load \textsf{l3backend} code}
+%    
 %    \begin{macrocode}
-  \@expl at sys@load at backend@@
+  \UseOneTimeHook{begindocument/before}%
+  \@kernel at after@begindocument at before
 %    \end{macrocode}
-%    If some options on |\documentclass| haven't been used by any
-%    package we will now give a warning since this is most certainly a
-%    misspelling.
+%
+% Added hook to load \textsf{l3backend} code:
+% \changes{v1.2h}{2020/06/05}{Added hook to load \textsf{l3backend} code}
 %    \begin{macrocode}
+  \@expl at sys@load at backend@@
   \ifx\@unusedoptionlist\@empty\else
     \@latex at warning@no at line{Unused global option(s):^^J%
             \@spaces[\@unusedoptionlist]}%
@@ -318,14 +324,6 @@
       \let\normalsfcodes\nonfrenchspacing
     \fi
   \fi
-%    \end{macrocode}
-% For similar reasons also save the default language, this will be reset
-% locally in the output routine. In particular it allows hyphenation
-% in the page head even if the page break happens in verbatim.
-% If this has already been set by a package, set to the value of |\language|
-% at this spoint.
-% \changes{v1.1n}{2017/03/10}{Save language default}
-%    \begin{macrocode}
   \ifx\document at default@language\m at ne
     \chardef\document at default@language\language
   \fi
@@ -352,9 +350,12 @@
 % \changes{v1.1e}{1996/04/24}
 %            {(DPC) Reset \cs{AtBeginDocument} eg for latex/1297}
 %    \begin{macrocode}
-  \let\AtBeginDocument\@firstofone
-  \@begindocumenthook
+%  \let\AtBeginDocument\@firstofone
+%  \@begindocumenthook
+  \UseOneTimeHook{begindocument}%
+  \@kernel at after@begindocument
 %    \end{macrocode}
+%    
 %    Most of the following assignments will be done globally in case
 %    the user adds something like |\begin{multicols}| to the document
 %    hook, i.e. starts are group in |\begin{document}|.
@@ -403,16 +404,23 @@
 %    \begin{macrocode}
   \global\let\do\noexpand
 %    \end{macrocode}
+%    
+%    \begin{macrocode}
+  \UseOneTimeHook{begindocument/end}%
+%    \end{macrocode}
 % \changes{v1.1c}{1995/12/05}{\cs{ignorespaces} added for latex/1933}
-%    Use of |\AtBeginDocument| hook might mean that we are already in
+%    Use of the hook might mean that we are already in
 %    horizontal mode, so ignore the space after |\begin{document}|.
 %    \begin{macrocode}
   \ignorespaces}
 %</2ekernel|latexrelease>
 %<latexrelease>\EndIncludeInRelease
-%<latexrelease>
+%    \end{macrocode}
+%    
+%    \begin{macrocode}
 %<latexrelease>\IncludeInRelease{2017/04/15}%
 %<latexrelease>  {\document}{Save language for hyphenation}%
+%<latexrelease>
 %<latexrelease>\def\document{\endgroup
 %<latexrelease>  \ifx\@unusedoptionlist\@empty\else
 %<latexrelease>    \@latex at warning@no at line{Unused global option(s):^^J%
diff --git a/base/ltfinal.dtx b/base/ltfinal.dtx
index 21f3872e..a704362f 100644
--- a/base/ltfinal.dtx
+++ b/base/ltfinal.dtx
@@ -1179,11 +1179,6 @@
 %<latexrelease>\def \IfHookEmptyTF #1#2#3{#2}
 %<latexrelease>
 %<latexrelease>
-%<latexrelease>\let\AtBeginEnvironment \@undefined
-%<latexrelease>\let\AtEndEnvironment \@undefined
-%<latexrelease>\let\BeforeBeginEnvironment \@undefined
-%<latexrelease>\let\AfterEndEnvironment \@undefined
-%<latexrelease>
 %<latexrelease>\def\@pushfilename{%
 %<latexrelease>  \@expl at push@filename@@
 %<latexrelease>  \xdef\@currnamestack{%
@@ -1196,93 +1191,6 @@
 %<latexrelease>  \@expl at pop@filename@@}
 %<latexrelease>
 %<latexrelease>
-%<latexrelease>\def\document{\endgroup
-%<latexrelease>  \@expl at sys@load at backend@@
-%<latexrelease>  \ifx\@unusedoptionlist\@empty\else
-%<latexrelease>    \@latex at warning@no at line{Unused global option(s):^^J%
-%<latexrelease>            \@spaces[\@unusedoptionlist]}%
-%<latexrelease>  \fi
-%<latexrelease>  \@colht\textheight
-%<latexrelease>  \@colroom\textheight \vsize\textheight
-%<latexrelease>  \columnwidth\textwidth
-%<latexrelease>  \@clubpenalty\clubpenalty
-%<latexrelease>  \if at twocolumn
-%<latexrelease>    \advance\columnwidth -\columnsep
-%<latexrelease>    \divide\columnwidth\tw@ \hsize\columnwidth \@firstcolumntrue
-%<latexrelease>  \fi
-%<latexrelease>  \hsize\columnwidth \linewidth\hsize
-%<latexrelease>  \begingroup\@floatplacement\@dblfloatplacement
-%<latexrelease>    \makeatletter\let\@writefile\@gobbletwo
-%<latexrelease>    \global \let \@multiplelabels \relax
-%<latexrelease>    \@input{\jobname.aux}%
-%<latexrelease>  \endgroup
-%<latexrelease>  \if at filesw
-%<latexrelease>    \immediate\openout\@mainaux\jobname.aux
-%<latexrelease>    \immediate\write\@mainaux{\relax}%
-%<latexrelease>  \fi
-%<latexrelease>  \process at table
-%<latexrelease>  \let\glb at currsize\@empty  % Force math initialization.
-%<latexrelease>  \normalsize
-%<latexrelease>  \everypar{}%
-%<latexrelease>  \ifx\normalsfcodes\@empty
-%<latexrelease>    \ifnum\sfcode`\.=\@m
-%<latexrelease>      \let\normalsfcodes\frenchspacing
-%<latexrelease>    \else
-%<latexrelease>      \let\normalsfcodes\nonfrenchspacing
-%<latexrelease>    \fi
-%<latexrelease>  \fi
-%<latexrelease>  \ifx\document at default@language\m at ne
-%<latexrelease>    \chardef\document at default@language\language
-%<latexrelease>  \fi
-%<latexrelease>  \@noskipsecfalse
-%<latexrelease>  \let \@refundefined \relax
-%<latexrelease>  \let\AtBeginDocument\@firstofone
-%<latexrelease>  \@begindocumenthook
-%<latexrelease>  \ifdim\topskip<1sp\global\topskip 1sp\relax\fi
-%<latexrelease>  \global\@maxdepth\maxdepth
-%<latexrelease>  \global\let\@begindocumenthook\@undefined
-%<latexrelease>  \ifx\@listfiles\@undefined
-%<latexrelease>    \global\let\@filelist\relax
-%<latexrelease>    \global\let\@addtofilelist\@gobble
-%<latexrelease>  \fi
-%<latexrelease>  \gdef\do##1{\global\let ##1\@notprerr}%
-%<latexrelease>  \@preamblecmds
-%<latexrelease>  \global\let \@nodocument \relax
-%<latexrelease>  \global\let\do\noexpand
-%<latexrelease>  \ignorespaces}
-%<latexrelease>
-%<latexrelease>\def\enddocument{%
-%<latexrelease>   \let\AtEndDocument\@firstofone
-%<latexrelease>   \@enddocumenthook
-%<latexrelease>   \@checkend{document}%
-%<latexrelease>   \clearpage
-%<latexrelease>   \begingroup
-%<latexrelease>     \if at filesw
-%<latexrelease>       \immediate\closeout\@mainaux
-%<latexrelease>       \let\@setckpt\@gobbletwo
-%<latexrelease>       \let\@newl at bel\@testdef
-%<latexrelease>       \@tempswafalse
-%<latexrelease>       \makeatletter \@@input\jobname.aux
-%<latexrelease>     \fi
-%<latexrelease>     \@dofilelist
-%<latexrelease>     \ifdim \font at submax >\fontsubfuzz\relax
-%<latexrelease>       \@font at warning{Size substitutions with differences\MessageBreak
-%<latexrelease>                  up to \font at submax\space have occurred.\@gobbletwo}%
-%<latexrelease>     \fi
-%<latexrelease>     \@defaultsubs
-%<latexrelease>     \@refundefined
-%<latexrelease>     \if at filesw
-%<latexrelease>       \ifx \@multiplelabels \relax
-%<latexrelease>         \if at tempswa
-%<latexrelease>           \@latex at warning@no at line{Label(s) may have changed.
-%<latexrelease>               Rerun to get cross-references right}%
-%<latexrelease>         \fi
-%<latexrelease>       \else
-%<latexrelease>         \@multiplelabels
-%<latexrelease>       \fi
-%<latexrelease>     \fi
-%<latexrelease>   \endgroup
-%<latexrelease>   \deadcycles\z@\@@end}
 %<latexrelease>
 %<latexrelease>\expandafter\let\csname ver at atveryend.sty\endcsname\@undefined
 %<latexrelease>\let\AfterLastShipout \@undefined
@@ -1344,7 +1252,7 @@
 %    This initializes the 2020/02/02 extensions to NFSS after any changes
 %    in the preamble.
 %    \begin{macrocode}
-\g at addto@macro\@kernel at after@env at document@begin
+\g at addto@macro\@kernel at after@begindocument at before
               {\reinstall at nfss@defs\init at series@setup}
 %    \end{macrocode}
 %
diff --git a/base/lthooks.dtx b/base/lthooks.dtx
index 1cd27a81..d79229ed 100644
--- a/base/lthooks.dtx
+++ b/base/lthooks.dtx
@@ -17,8 +17,8 @@
 % for those people who are interested or want to report an issue.
 %
 %    \begin{macrocode}
-\providecommand\lthooksversion{v0.9f}
-\providecommand\lthooksdate{2020/08/15}
+\def\lthooksversion{v0.9f}
+\def\lthooksdate{2020/08/15}
 %    \end{macrocode}
 %
 %<*driver>
@@ -3556,7 +3556,7 @@
 % \end{macro}
 
 
-
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
 
 
 %  \subsection{Set up existing \LaTeXe{} hooks}
@@ -3609,16 +3609,11 @@
 %
 %
 %    
+%  \begin{macro}{\AtBeginEnvironment,\AtEndEnvironment,
+%                \BeforeBeginEnvironment,\AfterEndEnvironment}
 %
-%    We provide 4 high-level hook interfaces directly, the others only when
-%    etoolbox is loaded
-%    \begin{macrocode}
-\newcommand\AtBeginEnvironment[1]    {\AddToHook{env/#1/begin}}
-\newcommand\AtEndEnvironment[1]      {\AddToHook{env/#1/end}}
-\newcommand\BeforeBeginEnvironment[1]{\AddToHook{env/#1/before}}
-\newcommand\AfterEndEnvironment[1]   {\AddToHook{env/#1/after}}
-%    \end{macrocode}
-%    
+%  Needs documenting above
+%  \end{macro}
 %    
 %    
 %    
@@ -3656,105 +3651,19 @@
 %    \end{macrocode}
 %
 %
-
 %  \begin{macro}{\document}
 %    
 %    \begin{macrocode}
-\def\document{%
-%    \end{macrocode}
-%    We do cancel the grouping as part of the \cs{begin} handling
-%    (this is now done inside \cs{begin} instead) so that the
-%    \hook{env/\meta{env}/begin} hook is not hidden inside \cs{begingroup}
-%    \texttt{...} \cs{endgroup}.
-%    \begin{macrocode}
-%  \endgroup
-%    \end{macrocode}
-%    
-%    \begin{macrocode}
-  \UseOneTimeHook{begindocument/before}%
-%    \end{macrocode}
-%    
-%    \begin{macrocode}
-  \@kernel at after@env at document@begin
-%    \end{macrocode}
-%
-% Added hook to load \textsf{l3backend} code:
-%    \begin{macrocode}
-  \@expl at sys@load at backend@@
-  \ifx\@unusedoptionlist\@empty\else
-    \@latex at warning@no at line{Unused global option(s):^^J%
-            \@spaces[\@unusedoptionlist]}%
-  \fi
-  \@colht\textheight
-  \@colroom\textheight \vsize\textheight
-  \columnwidth\textwidth
-  \@clubpenalty\clubpenalty
-  \if at twocolumn
-    \advance\columnwidth -\columnsep
-    \divide\columnwidth\tw@ \hsize\columnwidth \@firstcolumntrue
-  \fi
-  \hsize\columnwidth \linewidth\hsize
-  \begingroup\@floatplacement\@dblfloatplacement
-    \makeatletter\let\@writefile\@gobbletwo
-    \global \let \@multiplelabels \relax
-    \@input{\jobname.aux}%
-  \endgroup
-  \if at filesw
-    \immediate\openout\@mainaux\jobname.aux
-    \immediate\write\@mainaux{\relax}%
-  \fi
-  \process at table
-  \let\glb at currsize\@empty  % Force math initialization.
-  \normalsize
-  \everypar{}%
-  \ifx\normalsfcodes\@empty
-    \ifnum\sfcode`\.=\@m
-      \let\normalsfcodes\frenchspacing
-    \else
-      \let\normalsfcodes\nonfrenchspacing
-    \fi
-  \fi
-  \ifx\document at default@language\m at ne
-    \chardef\document at default@language\language
-  \fi
-  \@noskipsecfalse
-  \let \@refundefined \relax
-%    \end{macrocode}
-%    
-%    \begin{macrocode}
-%  \let\AtBeginDocument\@firstofone
-%  \@begindocumenthook
-  \UseOneTimeHook{begindocument}%
-  \@kernel at after@begindocument
-%    \end{macrocode}
-%    
-%    \begin{macrocode}
-  \ifdim\topskip<1sp\global\topskip 1sp\relax\fi
-  \global\@maxdepth\maxdepth
-  \global\let\@begindocumenthook\@undefined
-  \ifx\@listfiles\@undefined
-    \global\let\@filelist\relax
-    \global\let\@addtofilelist\@gobble
-  \fi
-  \gdef\do##1{\global\let ##1\@notprerr}%
-  \@preamblecmds
-  \global\let \@nodocument \relax
-  \global\let\do\noexpand
-%    \end{macrocode}
-%    
-%    \begin{macrocode}
-  \UseOneTimeHook{begindocument/end}%
-  \ignorespaces}
 %    \end{macrocode}
 %    
 %  \end{macro}
 %
 %
-%  \begin{macro}{\@kernel at after@env at document@begin,\@kernel at after@begindocument}
+%  \begin{macro}{\@kernel at after@begindocument at before,\@kernel at after@begindocument}
 %
 %    \fmi{the name is wrong --- fix}
 %    \begin{macrocode}
-\edef \@kernel at after@env at document@begin{%
+\edef \@kernel at after@begindocument at before{%
   \let\expandafter\noexpand\csname
        g__hook_env/document/begin_code_tl\endcsname
   \noexpand\@empty}
@@ -3786,77 +3695,10 @@
 %    
 %    
 %    \begin{macrocode}
-\def\enddocument{%
-   \UseOneTimeHook{enddocument}%
-   \@kernel at after@enddocument
-   \@checkend{document}%
-   \clearpage
-   \UseOneTimeHook{enddocument/afterlastpage}%
-   \@kernel at after@enddocument at afterlastpage
-   \begingroup
-     \if at filesw
-       \immediate\closeout\@mainaux
-       \let\@setckpt\@gobbletwo
-       \let\@newl at bel\@testdef
-       \@tempswafalse
-       \makeatletter \@@input\jobname.aux
-     \fi
-     \UseHook{enddocument/afteraux}%
-%    \end{macrocode}
-%    Next hook is expect to contain only code for writing info
-%    messages on the terminal.
-%    \begin{macrocode}
-     \UseOneTimeHook{enddocument/info}%
-   \endgroup
-   \UseOneTimeHook{enddocument/end}%
-   \deadcycles\z@\@@end}
-%    \end{macrocode}
-%  \end{macro}
-%
-%
-%  \begin{macro}{\@kernel at after@enddocument,
-%                \@kernel at after@enddocument at afterlastpage}
-%    
-%    The two kernel hooks above are used by the shipout code.   
-%    \begin{macrocode}
-\let\@kernel at after@enddocument\@empty
-\let\@kernel at after@enddocument at afterlastpage\@empty
-%    \end{macrocode}
-%  \end{macro}
-%
-%  \begin{macro}{\@enddocument at kernel@warnings}
-%    
-%    \begin{macrocode}
-\def\@enddocument at kernel@warnings{%
-   \ifdim \font at submax >\fontsubfuzz\relax
-     \@font at warning{Size substitutions with differences\MessageBreak
-                up to \font at submax\space have occurred.\@gobbletwo}%
-   \fi
-   \@defaultsubs
-   \@refundefined
-   \if at filesw
-     \ifx \@multiplelabels \relax
-       \if at tempswa
-         \@latex at warning@no at line{Label(s) may have changed.
-             Rerun to get cross-references right}%
-       \fi
-     \else
-       \@multiplelabels
-     \fi
-     \ifx \@extra at page@added \relax
-         \@latex at warning@no at line{Temporary extra page added at the end.
-             Rerun to get it removed}%
-     \fi
-%    \end{macrocode}
-%    We could think of adding a warning that nothing can be corrected
-%    while \cs{nofiles} is in force. In the past the warnings related
-%    to the \texttt{aux} file are simply suppressed in this case. 
-%    \begin{macrocode}
-   \fi
-}
 
 %    \end{macrocode}
 %    
+% \changes{v1.0w}{1994/11/30}{(DPC) Use \cs{@dofilelist}}
 %    \begin{macrocode}
 \AddToHook{enddocument/info}[kernel/filelist]{\@dofilelist}
 \AddToHook{enddocument/info}[kernel/warnings]{\@enddocument at kernel@warnings}
diff --git a/base/ltmiscen.dtx b/base/ltmiscen.dtx
index 427ae56b..fc57715d 100644
--- a/base/ltmiscen.dtx
+++ b/base/ltmiscen.dtx
@@ -191,6 +191,10 @@
 %         {Added warning in case of undefined references.}%
 % \changes{v0.9e}{1993/12/09}{Hook added}
 %    \begin{macrocode}
+%</2ekernel>
+%<*2ekernel|latexrelease>
+%<latexrelease>\IncludeInRelease{2020/10/01}%
+%<latexrelease>                 {\enddocument}{Use Hooks}%
 \def\enddocument{%
 %    \end{macrocode}
 %    The |\end{document}| hook is executed first. If necessary it can
@@ -209,10 +213,15 @@
 % \changes{v1.1i}{2000/05/19}
 %            {Reset \cs{AtEndDocument} for latex/3060}
 %    \begin{macrocode}
-   \let\AtEndDocument\@firstofone
-   \@enddocumenthook
+   \UseOneTimeHook{enddocument}%
+   \@kernel at after@enddocument
+%    \end{macrocode}
+%    
+%    \begin{macrocode}
    \@checkend{document}%
    \clearpage
+   \UseOneTimeHook{enddocument/afterlastpage}%
+   \@kernel at after@enddocument at afterlastpage
    \begingroup
      \if at filesw
        \immediate\closeout\@mainaux
@@ -235,11 +244,34 @@
        \@tempswafalse
        \makeatletter \@@input\jobname.aux
      \fi
+     \UseHook{enddocument/afteraux}%
 %    \end{macrocode}
-% \changes{v1.0w}{1994/11/30}
-%         {(DPC) Use \cs{@dofilelist}}
+%    Next hook is expect to contain only code for writing info
+%    messages on the terminal.
 %    \begin{macrocode}
-     \@dofilelist
+     \UseOneTimeHook{enddocument/info}%
+   \endgroup
+   \UseOneTimeHook{enddocument/end}%
+   \deadcycles\z@\@@end}
+%    \end{macrocode}
+%  \end{macro}
+%  \end{environment}
+%
+%
+%  \begin{macro}{\@kernel at after@enddocument,
+%                \@kernel at after@enddocument at afterlastpage}
+%    
+%    The two kernel hooks above are used by the shipout code.   
+%    \begin{macrocode}
+\let\@kernel at after@enddocument\@empty
+\let\@kernel at after@enddocument at afterlastpage\@empty
+%    \end{macrocode}
+%  \end{macro}
+%
+%  \begin{macro}{\@enddocument at kernel@warnings}
+%    
+%    \begin{macrocode}
+\def\@enddocument at kernel@warnings{%
 %    \end{macrocode}
 %    First we check for font size substitution bigger than
 %    |\fontsubfuzz|. The |\relax| is necessary because this is a macro
@@ -247,29 +279,29 @@
 % \changes{v1.0w}{1994/11/30}
 %         {(DPC) Do warnings even for \cs{nofiles}}
 %    \begin{macrocode}
-     \ifdim \font at submax >\fontsubfuzz\relax
+   \ifdim \font at submax >\fontsubfuzz\relax
 %    \end{macrocode}
 %    In case you wonder about the |\@gobbletwo| inside the message
 %    below, this is a horrible hack to remove the tokens |\on at line.|
 %    that are added by |\@font at warning| at the end.
 % \changes{v1.1j}{2000/07/11}{Fix typo in warning}
 %    \begin{macrocode}
-       \@font at warning{Size substitutions with differences\MessageBreak
-                  up to \font at submax\space have occurred.\@gobbletwo}%
-     \fi
+     \@font at warning{Size substitutions with differences\MessageBreak
+                up to \font at submax\space have occurred.\@gobbletwo}%
+   \fi
 %    \end{macrocode}
 %    The macro |\@defaultsubs| is initially |\relax| but gets redefined
 %    to produce
 %    a warning if there have been some default font substitutions.
 % \changes{v1.0z}{1995/07/13}{Use \cs{@defaultsubs} instead of switch}
 %    \begin{macrocode}
-     \@defaultsubs
+   \@defaultsubs
 %    \end{macrocode}
 %    The macro |\@refundefined| is initially |\relax| but gets redefined
 %    to produce a warning if there are undefined refs.
 % \changes{v1.1b}{1995/10/24}{Use \cs{@refundefined} instead of switch}
 %    \begin{macrocode}
-     \@refundefined
+   \@refundefined
 %    \end{macrocode}
 %    If a label is defined more than once, |\@tempswa| will always be
 %    true and thus produce a ``Label(s) may \ldots'' warning. But
@@ -281,21 +313,75 @@
 % \changes{v1.1b}{1995/10/24}{Changed logic for producing
 %                             warning messages and removed switch}
 %    \begin{macrocode}
-     \if at filesw
-       \ifx \@multiplelabels \relax
-         \if at tempswa
-           \@latex at warning@no at line{Label(s) may have changed.
-               Rerun to get cross-references right}%
-         \fi
-       \else
-         \@multiplelabels
+   \if at filesw
+     \ifx \@multiplelabels \relax
+       \if at tempswa
+         \@latex at warning@no at line{Label(s) may have changed.
+             Rerun to get cross-references right}%
        \fi
+     \else
+       \@multiplelabels
      \fi
-   \endgroup
-   \deadcycles\z@\@@end}
+     \ifx \@extra at page@added \relax
+         \@latex at warning@no at line{Temporary extra page added at the end.
+             Rerun to get it removed}%
+     \fi
+%    \end{macrocode}
+%    We could think of adding a warning that nothing can be corrected
+%    while \cs{nofiles} is in force. In the past the warnings related
+%    to the \texttt{aux} file are simply suppressed in this case. 
+%    \begin{macrocode}
+   \fi
+}
 %    \end{macrocode}
 %  \end{macro}
-%  \end{environment}
+%
+%    \begin{macrocode}
+%</2ekernel|latexrelease>
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{0000/00/00}%
+%<latexrelease>                 {\enddocument}{Use Hooks}%
+%<latexrelease>
+%<latexrelease>\def\enddocument{%
+%<latexrelease>   \let\AtEndDocument\@firstofone
+%<latexrelease>   \@enddocumenthook
+%<latexrelease>   \@checkend{document}%
+%<latexrelease>   \clearpage
+%<latexrelease>   \begingroup
+%<latexrelease>     \if at filesw
+%<latexrelease>       \immediate\closeout\@mainaux
+%<latexrelease>       \let\@setckpt\@gobbletwo
+%<latexrelease>       \let\@newl at bel\@testdef
+%<latexrelease>       \@tempswafalse
+%<latexrelease>       \makeatletter \@@input\jobname.aux
+%<latexrelease>     \fi
+%<latexrelease>     \@dofilelist
+%<latexrelease>     \ifdim \font at submax >\fontsubfuzz\relax
+%<latexrelease>       \@font at warning{Size substitutions with differences\MessageBreak
+%<latexrelease>                  up to \font at submax\space have occurred.\@gobbletwo}%
+%<latexrelease>     \fi
+%<latexrelease>     \@defaultsubs
+%<latexrelease>     \@refundefined
+%<latexrelease>     \if at filesw
+%<latexrelease>       \ifx \@multiplelabels \relax
+%<latexrelease>         \if at tempswa
+%<latexrelease>           \@latex at warning@no at line{Label(s) may have changed.
+%<latexrelease>               Rerun to get cross-references right}%
+%<latexrelease>         \fi
+%<latexrelease>       \else
+%<latexrelease>         \@multiplelabels
+%<latexrelease>       \fi
+%<latexrelease>     \fi
+%<latexrelease>   \endgroup
+%<latexrelease>   \deadcycles\z@\@@end}
+%<latexrelease>
+%<latexrelease>\let\@kernel at after@enddocument\@undefined
+%<latexrelease>\let\@kernel at after@enddocument at afterlastpage\@undefined
+%<latexrelease>\let\@enddocument at kernel@warnings\@undefined
+%<latexrelease>
+%<latexrelease>\EndIncludeInRelease
+%<*2ekernel>
+%    \end{macrocode}
 %
 % \begin{macro}{\@testdef}
 %    \begin{macrocode}
@@ -775,6 +861,41 @@
 %  \end{macro}
 %
 %
+%
+%  \begin{macro}{\AtBeginEnvironment,\AtEndEnvironment,
+%                \BeforeBeginEnvironment,\AfterEndEnvironment}
+%    
+%    We provide 4 high-level hook interfaces directly, the others only when
+%    etoolbox is loaded
+%    \begin{macrocode}
+%</2ekernel>
+%<*2ekernel|latexrelease>
+%<latexrelease>\IncludeInRelease{2020/10/01}%
+%<latexrelease>                 {\AtBeginEnvironment}{Hooks for environments}%
+\newcommand\AtBeginEnvironment[1]    {\AddToHook{env/#1/begin}}
+\newcommand\AtEndEnvironment[1]      {\AddToHook{env/#1/end}}
+\newcommand\BeforeBeginEnvironment[1]{\AddToHook{env/#1/before}}
+\newcommand\AfterEndEnvironment[1]   {\AddToHook{env/#1/after}}
+%</2ekernel|latexrelease>
+%<latexrelease>\EndIncludeInRelease
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+%<latexrelease>\IncludeInRelease{0000/00/00}%
+%<latexrelease>                 {\AtBeginEnvironment}{Hooks for environments}%
+%<latexrelease>
+%<latexrelease>\let\AtBeginEnvironment\@undefined
+%<latexrelease>\let\AtEndEnvironment\@undefined
+%<latexrelease>\let\BeforeBeginEnvironment\@undefined
+%<latexrelease>\let\AfterEndEnvironment\@undefined
+%<latexrelease>
+%<latexrelease>\EndIncludeInRelease
+%<*2ekernel>
+%    \end{macrocode}
+%  \end{macro}
+%    
+%
+%
 % \subsection{Center, Flushright, Flushleft}
 %
 %    \begin{macrocode}





More information about the latex3-commits mailing list.