Revision 6f263eaeba3092200e1794713e2a37a21703eb25 authored by Joseph Wright on 19 June 2022, 21:45:26 UTC, committed by Joseph Wright on 19 June 2022, 21:45:40 UTC
1 parent 976c21e
ltmiscen.dtx
% \iffalse meta-comment
%
% Copyright (C) 1993-2022
% The LaTeX Project and any individual authors listed elsewhere
% in this file.
%
% This file is part of the LaTeX base system.
% -------------------------------------------
%
% It may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
% of this license or (at your option) any later version.
% The latest version of this license is in
% https://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions of LaTeX
% version 2008 or later.
%
% This file has the LPPL maintenance status "maintained".
%
% The list of all files belonging to the LaTeX base distribution is
% given in the file `manifest.txt'. See also `legal.txt' for additional
% information.
%
% The list of derived (unpacked) files belonging to the distribution
% and covered by LPPL is defined by the unpacking scripts (with
% extension .ins) which are part of the distribution.
%
% \fi
% \iffalse
%%% From File: ltmiscen.dtx
%
%<*driver>
% \fi
\ProvidesFile{ltmiscen.dtx}
[2021/06/05 v1.1z LaTeX Kernel (Misc. Environments)]
% \iffalse
\documentclass{ltxdoc}
\GetFileInfo{ltmiscen.dtx}
\title{\filename}
\date{\filedate}
\author{%
Johannes Braams\and
David Carlisle\and
Alan Jeffrey\and
Leslie Lamport\and
Frank Mittelbach\and
Chris Rowley\and
Rainer Sch\"opf}
\begin{document}
\MaintainedByLaTeXTeam{latex}
\maketitle
\DocInput{\filename}
\end{document}
%</driver>
% \fi
%
%
% \changes{v1.0c}{1994/03/28}{Improve Documentation}
% \changes{v1.0d}{1994/03/29}{Remove counter macros to ltcntlen}
% \changes{v1.0g}{1994/05/02}{Changed 91 to 1991 and moved some bits}
% \changes{v1.0i}{1994/05/05}{Removed braces from ifnextchar and
% ifstar arguments}
% \changes{v1.0m}{1994/05/20}{Use new warning commands}
% \changes{v1.0n}{1994/05/21}{Use new error commands}
% \changes{v1.0s}{1994/10/14}{Move math to other file}
% \changes{v1.0v}{1994/11/17}
% {\cs{@tempa} to \cs{reserved@a}}
% \changes{v1.0x}{1995/04/22}{Removed extra def of \cs{@gobble}}
% \changes{v1.0z}{1995/07/13}{Improve Documentation}
% \changes{v1.1c}{1996/04/22}{Improve Documentation}
% \changes{v1.1d}{1996/06/03}{Move setting of verbatim font and
% \cs{@noligs}.}
% \changes{v1.1g}{1998/08/17}{(RmS) Minor documentation fixes.}
% \changes{v1.1p}{2019/08/27}{Make various commands robust}
% \changes{v1.1v}{2020/08/21}{Integration of new hook management interface}
%
% \section{Miscellaneous Environments}
% This section implements the basic environment mechanism, and also
% a few specific environments including |document|, The math
% environments and related commands, the `flushing' environments,
% (|center|, |flushleft|, |flushright|), and |verbatim|.
%
% \MaybeStop{}
%
% \begin{macrocode}
%<*2ekernel>
\message{environments,}
% \end{macrocode}
%
% \subsection{Environments}
%
% |\begin{foo}| and |\end{foo}| are used to delimit environment |foo|.
%
% |\begin{foo}| starts a group and calls |\foo| if it is defined,
% otherwise it does nothing.
%
% |\end{foo}| checks to see that it matches the
% corresponding |\begin| and if so, it calls |\endfoo| and does an
% |\endgroup|. Otherwise, |\end{foo}| does nothing.
%
% If |\end{foo}| needs to ignore blanks after it, then |\endfoo| should
% globally set the |@ignore| switch true with |\@ignoretrue|
% (this will automatically be global).
%
%
% NOTE: |\@@end| is defined to be the |\end| command of \TeX82.
%
% |\enddocument| is the user's command for ending the manuscript file.
%
% |\stop| is a panic button --- to end \TeX\ in the middle.
%
% \begin{oldcomments}
% \enddocument ==
% BEGIN
% \@checkend{document} %% checks for unmatched \begin
% \clearpage
% \begingroup
% if @filesw = true
% then close file @mainaux
% if G@refundefined = true
% then LaTeX Warning: 'There are undefined references.' fi
% if @multiplelabels = true
% then LaTeX Warning:
% 'One or more label(s) multiply defined.'
% else
% \@setckpt {ARG1}{ARG2} == null
% \newlabel{LABEL}{VAL} ==
% BEGIN
% \reserved@a == VAL
% if def(\reserved@a) = def(\r@LABEL)
% else @tempswa := true fi
% END
% \bibcite{LABEL}{VAL} == null
% BEGIN
% \reserved@a == VAL
% if def(\reserved@a) = def(\g@LABEL)
% else @tempswa := true fi
% END
% @tempswa := false
% make @ a letter
% \input \jobname.AUX
% if @tempswa = true
% then LaTeX Warning: 'Label may have changed.
% Rerun to get cross-references right.'
% fi fi fi
% \endgroup
% finish up
% END
%
% \@writefile{EXT}{ENTRY} ==
% if tf@EXT undefined
% else \write\tf@EXT{ENTRY}
% fi
% \end{oldcomments}
%
% \begin{macro}{\@currenvir}
% The name of the current environment. Initialized to
% \texttt{document} to so that |\end{document}| works correctly.
% \begin{macrocode}
\def\@currenvir{document}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\if@ignore}
% \begin{macro}{\@ignoretrue}
% \begin{macro}{\@ignorefalse}
% \changes{v1.1e}{1996/07/26}{put \cs{global} into definition}
% \begin{macrocode}
\def\@ignorefalse{\global\let\if@ignore\iffalse}
\def\@ignoretrue {\global\let\if@ignore\iftrue}
\@ignorefalse
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
%
% \begin{macro}{\ignorespacesafterend}
% \changes{v1.1e}{1996/07/26}{user level macro added}
% \begin{macrocode}
\let\ignorespacesafterend\@ignoretrue
% \end{macrocode}
% \end{macro}
%
% \begin{environment}{document}
% \begin{macro}{\enddocument}
% \changes{LaTeX2.09}{1993/08/03}
% {Changed redefinition of \cs{global} to redefinition
% of \cs{@setckpt}.}
% \changes{LaTeX2.09}{1993/09/08}
% {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
% contain a |\clearpage| to output dangling floats first. In this
% position it can also contain something like |\end{foo}| so that
% the whole document effectively starts and ends with some special
% environment. However, this must be used with care, eg if two
% applications would use this without knowledge of each other the
% order of the environments will be wrong after all.
% |\AtEndDocument| is redefined
% at this point so that and such commands that get into the hook do
% not chase their tail\ldots
% \changes{v1.0y}{1995/04/27}{\cs{@checkend} moved after hook}
% \changes{v1.0z}{1995/07/13}{Set \cs{@setckpt} to \cs{@gobbletwo}
% instead of defining it by hand}
% \changes{v1.1i}{2000/05/19}
% {Reset \cs{AtEndDocument} for latex/3060}
% \begin{macrocode}
\@kernel@before@enddocument
\UseOneTimeHook{enddocument}%
\@kernel@after@enddocument
% \end{macrocode}
%
% \begin{macrocode}
\@checkend{document}%
\clearpage
\UseOneTimeHook{enddocument/afterlastpage}%
\@kernel@after@enddocument@afterlastpage
\begingroup
\if@filesw
\immediate\closeout\@mainaux
\let\@setckpt\@gobbletwo
\let\@newl@bel\@testdef
% \end{macrocode}
% \changes{v1.0z}{1995/07/13}{Shorten redefinition of \cs{bibcite} and
% \cs{newlabel}}
% The previous line is equiv to setting
%\begin{verbatim}
% \def\newlabel{\@testdef r}%
% \def\bibcite{\@testdef b}%
%\end{verbatim}
% \changes{v1.1k}{2010/08/17}{Use braces around \cs{input} arg (pr/4124)}
% \changes{v1.1l}{2010/08/17}{Change of plan: use \cs{@@input} instead
% (pr/4124)}
% \changes{v1.1w}{2020/10/23}{Make \texttt{enddocument/afteraux} one-time}
% We use |\@@input| to load the \texttt{.aux} file, so that it doesn't
% show up in the list of files produced by |\listfiles|.
% \begin{macrocode}
\@tempswafalse
\makeatletter \@@input\jobname.aux
\fi
\UseOneTimeHook{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}
%
% The public hooks used in \cs{enddocument}:
% \begin{macrocode}
\NewHook{enddocument}
\NewHook{enddocument/afterlastpage}
\NewHook{enddocument/afteraux}
\NewHook{enddocument/info}
\NewHook{enddocument/end}
% \end{macrocode}
%
% This is one of the few places where we already add data and rules
% to a hook already in the kernel.
% \changes{v1.0w}{1994/11/30}{(DPC) Use \cs{@dofilelist}}
% \begin{macrocode}
\AddToHook{enddocument/info}[kernel/filelist]{\@dofilelist}
\AddToHook{enddocument/info}[kernel/warnings]{\@enddocument@kernel@warnings}
\DeclareHookRule{enddocument/info}{kernel/filelist}{before}{kernel/warnings}
% \end{macrocode}
% \end{macro}
% \end{environment}
%
% \begin{macro}{\@enddocument@kernel@warnings}
%
% \begin{macrocode}
\def\@enddocument@kernel@warnings{%
% \end{macrocode}
% First we check for font size substitution bigger than
% |\fontsubfuzz|. The |\relax| is necessary because this is a macro
% not a register.
% \changes{v1.0w}{1994/11/30}
% {(DPC) Do warnings even for \cs{nofiles}}
% \begin{macrocode}
\ifdim \font@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@line.|
% that are added by |\@font@warning| at the end.
% \changes{v1.1j}{2000/07/11}{Fix typo in warning}
% \begin{macrocode}
\@font@warning{Size substitutions with differences\MessageBreak
up to \font@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
% \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
% \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
% since a rerun will not solve that problem (unless one uses a
% package like \texttt{varioref} that generates labels on the fly),
% we suppress this message.
% \changes{v1.0e}{1994/04/20}{Changed logic for producing
% warning messages}
% \changes{v1.1b}{1995/10/24}{Changed logic for producing
% warning messages and removed switch}
% \begin{macrocode}
\if@filesw
\ifx \@multiplelabels \relax
\if@tempswa
\@latex@warning@no@line{Label(s) may have changed.
Rerun to get cross-references right}%
\fi
\else
\@multiplelabels
\fi
\ifx \@extra@page@added \relax
\@latex@warning@no@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}
%
% \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@filesw
%<latexrelease> \immediate\closeout\@mainaux
%<latexrelease> \let\@setckpt\@gobbletwo
%<latexrelease> \let\@newl@bel\@testdef
%<latexrelease> \@tempswafalse
%<latexrelease> \makeatletter \@@input\jobname.aux
%<latexrelease> \fi
%<latexrelease> \@dofilelist
%<latexrelease> \ifdim \font@submax >\fontsubfuzz\relax
%<latexrelease> \@font@warning{Size substitutions with differences\MessageBreak
%<latexrelease> up to \font@submax\space have occurred.\@gobbletwo}%
%<latexrelease> \fi
%<latexrelease> \@defaultsubs
%<latexrelease> \@refundefined
%<latexrelease> \if@filesw
%<latexrelease> \ifx \@multiplelabels \relax
%<latexrelease> \if@tempswa
%<latexrelease> \@latex@warning@no@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\@enddocument@kernel@warnings\@undefined
%<latexrelease>
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
% \end{macrocode}
%
% \begin{macro}{\@kernel@before@enddocument}
% The \cs{@kernel@before@enddocument} hook is slightly different
% because we initialize it with \cs{par} so that \cs{enddocument} always
% returns to vertical mode as its first action.
% \changes{v1.1x}{2020/10/26}{\cs{enddocument} should always start out in
% vmode (gh/385)}
% \begin{macrocode}
%</2ekernel>
%<*2ekernel|latexrelease>
%<latexrelease>\IncludeInRelease{2021/06/01}%
%<latexrelease> {\@kernel@before@enddocument}{kernel before hook}%
\def\@kernel@before@enddocument{\par}
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
% \end{macrocode}
%
% The rollback code renders it harmless.
% \begin{macrocode}
%<latexrelease>\IncludeInRelease{0000/00/00}%
%<latexrelease> {\@kernel@before@enddocument}{kernel before hook}%
%<latexrelease>
%<latexrelease>\let\@kernel@before@enddocument\@empty
%<latexrelease>
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
% \end{macrocode}
% \end{macro}
%
%
%
%
% \begin{macro}{\@testdef}
% \begin{macrocode}
\def\@testdef #1#2#3{%
\def\reserved@a{#3}\expandafter \ifx \csname #1@#2\endcsname
\reserved@a \else \@tempswatrue \fi}
% \end{macrocode}
% \end{macro}
%
%
% Reading data from auxiliary files (like \texttt{.toc} normally
% happens in vertical mode and it therefore doesn't matter if line
% endings are converted to spaces by \TeX{} during that process.
%
% However, especially the \texttt{.toc} file might be read in L-R mode
% (in cases the \cs{tableofcontents} attempts to put, say a list of
% sub-sections as a paragraph. In that case the newlines after a line
% like
% \begin{verbatim}
% \contentsline {subsubsection}{\numberline {1.1.1}A C-head}{2}
% \end{verbatim}
% might result in spurious spaces (e.g., when that level is not
% included).
%
% That could be fixed by reading in the file using
% \cs{endlinechar}\texttt{=-1} but that has the danger that it drops
% some valid endlines that should be converted to spaces (for example
% when the user edited the TOC and then used \cs{nofiles} to preserve
% it.
%
% So the approach taken instead is this:
% \begin{itemize}
% \item \cs{addcontentsline} adds the command
% \cs{protected@file@percent} to the end of the second argument of
% \cs{@writefile} that is written to the \texttt{.aux}. As the name
% indicates this is a protected macro so it doesn't change if it is
% written out.
%
% \item When the \texttt{.aux} is read back in at the end of the run,
% \cs{@writefile} is executed and writes its second argument
% unmodified to the file with the extension given by its first
% argument. Or rather that was how it was in the past.
%
% \item Instead we change \cs{@writefile} slightly: basically it looks
% at the second argument and if the last token in there is
% \cs{protected@file@percent} then it is replaced by a percent
% character and that is then written out. If not (for example, if
% the data came from a user issued \cs{addtocontents}, or from some
% package that uses \cs{@writefile} for writing its own files) then
% the command behaves exactly as before.
% \end{itemize}
%
%
% \begin{macro}{\protected@file@percent}
% Dummy cs to be replaced by a percent sign inside
% \cs{@writefile}. If it survives (when used incorrectly) it will
% expand to nothing in a typsetting context.
% \changes{v1.1n}{2018/09/26}{Sometimes mask the endline char when
% writing to files (github/73)}
% \begin{macrocode}
%</2ekernel>
%<*2ekernel|latexrelease>
%<latexrelease>\IncludeInRelease{2018/12/01}%
%<latexrelease> {\protected@file@percent}{Mask line endings}%
\protected\def\protected@file@percent{}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\add@percent@to@temptokena}
% Helper function which is used to inspect a sequence of tokens
% (the second argument of \cs{@writefile} and it the last token is
% \cs{protected@file@percent} it will replace it by a harmless
% percent. The result is saved in \cs{@temptokena} for later use.
% \changes{v1.1n}{2018/09/26}{Sometimes mask the endline char when
% writing to files (github/73)}
%
% \begin{macrocode}
\catcode`\^^A=9
\long\gdef\add@percent@to@temptokena
#1\protected@file@percent#2\add@percent@to@temptokena
% \end{macrocode}
% When we call this macro in |\@writefile| we stick in |\@empty| at
% the beginning, so that in case the tokenlist consists of a single brace
% group the braces aren't stripped. The |\expandafter| then expands
% this extra token away again.
% \changes{v1.1q}{2019/10/25}{Allow unbalanced conditionals in \texttt{\#1} (gh/202)}
% \changes{v1.1r}{2019/11/10}{fix to special comment catcodes (gh/202)}
% \begin{macrocode}
{\expandafter\ifx\expandafter X\detokenize{#2}X\expandafter\dont@add@percent@to@temptokena\else
\expandafter\do@add@percent@to@temptokena\fi{#1}}
% \end{macrocode}
%
% \begin{macrocode}
\long\def\dont@add@percent@to@temptokena#1{%
\@temptokena\expandafter{#1}}
% \end{macrocode}
% \texttt{latexrelease} will read this code in high-speed
% mode in certain situations. During that it will only look for
% \cs{if} tests but not actually execute the \cs{catcode} change
% above. As a result it will drop anything after the |%| character
% in the definition. Therefore the |\fi| needs to be on the next
% line and we need locally another comment character to avoid
% getting spaces into the definition---a weird problem :-)
%
% \begin{macrocode}
\begingroup
\catcode`\%=12
\catcode`\^^A=14
\long\gdef\do@add@percent@to@temptokena#1{\@temptokena\expandafter{#1%^^A
% \end{macrocode}
% Can't be on the same line as the |%| --- see above.
% \begin{macrocode}
}}
\endgroup
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@writefile}
% \changes{v1.0l}{1994/05/20}{Added correct setting of \cs{protect}.}
% \changes{v1.0t}{1994/11/04}{Removed setting of \cs{protect}. ASAJ.}
% \changes{v1.0z}{1995/07/13}{Added missing percent and use \cs{relax}
% in the THEN case}
% \changes{v1.1n}{2018/09/26}{Sometimes mask the endline char when
% writing to files (github/73)}
% \begin{macrocode}
\long\def\@writefile#1#2{%
\@ifundefined{tf@#1}\relax
{%
% \end{macrocode}
% If we write to the file we first prepare |#2| using
% \cs{add@percent@to@temptokena} and then write the token register
% out.
% \begin{macrocode}
\add@percent@to@temptokena
\@empty#2\protected@file@percent
\add@percent@to@temptokena
\immediate\write\csname tf@#1\endcsname{\the\@temptokena}%
}%
}
% \end{macrocode}
%
% \begin{macrocode}
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{0000/00/00}%
%<latexrelease> {\protected@file@percent}{Mask line endings}%
%<latexrelease>\let\protected@file@percent\@undefined
%<latexrelease>\let\add@percent@to@temptokena\@undefined
%<latexrelease>\let\do@add@percent@to@temptokena\@undefined
%<latexrelease>\let\dont@add@percent@to@temptokena\@undefined
%<latexrelease>\long\def\@writefile#1#2{%
%<latexrelease> \@ifundefined{tf@#1}\relax
%<latexrelease> {\@temptokena{#2}%
%<latexrelease> \immediate\write\csname tf@#1\endcsname{\the\@temptokena}%
%<latexrelease> }%
%<latexrelease>}
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\stop}
% \begin{macrocode}
\def\stop{\clearpage\deadcycles\z@\let\par\@@par\@@end}
% \end{macrocode}
% \end{macro}
%
%
% \begin{oldcomments}
%
% \begin{macrocode}
\everypar{\@nodocument} %% To get an error if text appears before the
\nullfont %% \begin{document}
% \end{macrocode}
%
% \begin, \end, and \@checkend changed so \end{document} will catch
% an unmatched \begin. Changed 24 May 89 as suggested by
% Frank Mittelbach and Rainer Sch\"opf.
%
% \begin{NAME} ==
% BEGIN
% IF \NAME undefined THEN \reserved@a == BEGIN report error END
% ELSE \reserved@a ==
% (\@currenvir :=L NAME) \NAME
% FI
% @ignore :=G F %% Added 30 Nov 88
% \begingroup
% \@endpe := F
% \@currenvir :=L NAME
% \NAME
% END
%
% \end{NAME} ==
% BEGIN
% \endNAME
% \@checkend{NAME}
% \endgroup
% IF @endpe = T %% @endpe set True by \@endparenv
% THEN \@doendpe %% \@doendpe redefines \par and \everypar
% %% to suppress paragraph indentation in
% FI %% immediately following text
% IF @ignore = T
% THEN @ignore :=G F
% \ignorespaces
% FI
% END
%
% \@checkend{NAME} ==
% BEGIN
% IF \@currenvir = NAME
% ELSE \@badend{NAME}
% FI
% END
%
% \end{oldcomments}
%
%
% \begin{macro}{\begin}
% \changes{LaTeX2.09}{1992/03/18}{Changed \cs{@ignoretrue} to
% \cs{@ignorefalse} (as documented)}
% \changes{LaTeX2.09}{1992/08/24}{Added code to \cs{begin} to
% remember line number. Used by \cs{@badend} to display
% position of non-matching \cs{begin}.}
% \changes{v1.1e}{1996/07/26}{remove \cs{global} before \cs{@ignore...}}
% \changes{v1.1p}{2019/08/27}{Make command robust}
% \begin{macrocode}
%</2ekernel>
%<*2ekernel|latexrelease>
%<latexrelease>\IncludeInRelease{2020/10/01}%
%<latexrelease> {\begin}{Use hook system}%
\DeclareRobustCommand*\begin[1]{%
\UseHook{env/#1/before}%
\@ifundefined{#1}%
{\def\reserved@a{\@latex@error{Environment #1 undefined}\@eha}}%
{\def\reserved@a{\def\@currenvir{#1}%
\edef\@currenvline{\on@line}%
\@execute@begin@hook{#1}%
\csname #1\endcsname}}%
\@ignorefalse
\begingroup\@endpefalse\reserved@a}
% \end{macrocode}
%
% Before the \cs{document} code is executed we have to first undo
% the \cs{endgroup} as there should be none for this environment to
% avoid that changes on top-level unnecessarily go to \TeX's
% savestack, and we have to initialize all hooks in the hook system.
% So we need to test for this environment name. But once it has be
% found all this testing is no longer needed and so we redefine
% \cs{@execute@begin@hook} to simply use the hook.
% \begin{macrocode}
\def\@execute@begin@hook #1{%
\expandafter\ifx\csname #1\endcsname\document
\endgroup
\gdef\@execute@begin@hook##1{\UseHook{env/##1/begin}}%
\@expl@@@initialize@all@@
\fi
% \end{macrocode}
% If this is an environment before \verb=\begin{document}= we just
% run the hook so this can be outside the test.
% \begin{macrocode}
\UseHook{env/#1/begin}%
}
% \end{macrocode}
%
% The top level definition for \cs{end}. for an explanation see
% below (this is the same as the 2019 version where it was
% introduced, but for rollback we have to repeat it).
% \begin{macrocode}
\edef\end
{\unexpanded{%
\romannumeral
\ifx\protect\@typeset@protect
\expandafter %1
\expandafter %2
\expandafter %1
\expandafter %3 expands the \csname inside \end<space>
\expandafter %1
\expandafter %2 expands \end<space>
\expandafter %1 expands the \else
\z@
\else
\expandafter\z@\expandafter\protect
\fi
}%
\expandafter\noexpand\csname end \endcsname
}
% \end{macrocode}
% Version that adds hooks (so different from the 2019 version). It
% fixes tlb3722 but the change should perhaps be made in
% \texttt{tabularx} instead.
% \begin{macrocode}
\@namedef{end }#1{%
\romannumeral
\IfHookEmptyTF{env/#1/end}%
{\expandafter\z@}%
{\z@\UseHook{env/#1/end}}%
\csname end#1\endcsname\@checkend{#1}%
\expandafter\endgroup\if@endpe\@doendpe\fi
\UseHook{env/#1/after}%
\if@ignore\@ignorefalse\ignorespaces\fi
}
% \end{macrocode}
% Version without the fix for tlb3722 for the record:
% \begin{macrocode}
%\@namedef{end }#1{%
% \UseHook{env/#1/end}%
% \csname end#1\endcsname\@checkend{#1}%
% \expandafter\endgroup\if@endpe\@doendpe\fi
% \UseHook{env/#1/after}%
% \if@ignore\@ignorefalse\ignorespaces\fi}%
% \end{macrocode}
%
% \begin{macrocode}
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
% \end{macrocode}
%
% \begin{macrocode}
%<latexrelease>\IncludeInRelease{2019/10/01}%
%<latexrelease> {\begin}{Making \begin/\end robust}%
%<latexrelease>\DeclareRobustCommand\begin[1]{%
%<latexrelease> \@ifundefined{#1}%
%<latexrelease> {\def\reserved@a{\@latex@error{Environment #1 undefined}\@eha}}%
%<latexrelease> {\def\reserved@a{\def\@currenvir{#1}%
%<latexrelease> \edef\@currenvline{\on@line}%
%<latexrelease> \csname #1\endcsname}}%
%<latexrelease> \@ignorefalse
%<latexrelease> \begingroup\@endpefalse\reserved@a}
% \end{macrocode}
% A version that doesn't start out with \cs{relax} when in
% typesetting mode would be the following, but since \cs{begin}
% issues a \cs{begingroup} it wouldn't help much with respect to
% allowing things like \cs{noalign} or \cs{multicolumn} inside.
% \begin{macrocode}
%\edef\begin
% {\unexpanded{%
% \ifx\protect\@typeset@protect
% \expandafter\@gobble
% \fi
% \protect
% }%
% \expandafter\noexpand\csname begin \endcsname
% }
%\@namedef{begin }#1{%
% \@ifundefined{#1}%
% {\def\reserved@a{\@latex@error{Environment #1 undefined}\@eha}}%
% {\def\reserved@a{\def\@currenvir{#1}%
% \edef\@currenvline{\on@line}%
% \csname #1\endcsname}}%
% \@ignorefalse
% \begingroup\@endpefalse\reserved@a}
% \end{macrocode}
%
% \begin{macro}{\end}
% While \cs{begin} was made robust simply by using
% \cs{DeclareRobustCommand} we need to be a bit more subtle with
% \cs{end} as there are packages out there that try to look into
% the top-level contents of \verb=\end{foo}= (that is at the expansion
% of \verb=\endfoo=) to see if it contains certain macros. This is
% done by hitting \verb=\end{foo}= with three \cs{expandafter}s,
% the first to get
%\begin{verbatim}
% \csname endfoo\endcsname \@checkend{foo}% etc.
%\end{verbatim}
% the second to expand the \cs{csname}, i.e., to get to
%\begin{verbatim}
% \endfoo \@checkend{foo}% etc.
%\end{verbatim}
% and the third to finally get to the top-level content of
% \verb=\endfoo=, i.e.
%\begin{verbatim}
% <top-level content of \endfoo> \@checkend{foo}% etc.
%\end{verbatim}
% Therefore a robust replacement should produce the same results
% after three expansions (there first is obviously different).
%
% Basically the definition of \cs{end} should either produce
% \verb*=\protect\end = (when not doing typesetting) or it should
% produce \verb*=\end = (without the \cs{protect}) when doing typesetting.
% Furthermore, it should (when in typesetting mode) show exactly the
% same result as
% \verb*=\end = (which is the original fragile definition
% of \cs{end}) when you expand either of them twice, i.e.,
%\begin{verbatim}
% \endfoo \@checkend{foo}% etc.
%\end{verbatim}
% That is achieved with the code below (which is worth studying
% carefully).
%
% There is some trickery involved here: in particular we use
% \cs{romannumeral} to change a single expansion into three
% successive expansions in one go. That primitive expands until it
% has scanned a number (0 in this case, so it doesn't produce any
% output) and so it allows us to place arbitrary many
% \cs{expandafter}s inside that are all going to be executed when
% \cs{romannumeral} is hit by a single \cs{expandafter}.
%
% \changes{v1.1e}{1996/07/26}{remove \cs{global} before \cs{@ignore...}}
% \changes{v1.1p}{2019/08/27}{Make command robust}
%
% \begin{macrocode}
%<latexrelease>\edef\end
%<latexrelease> {\unexpanded{%
%<latexrelease> \romannumeral
%<latexrelease> \ifx\protect\@typeset@protect
%<latexrelease> \expandafter %1
%<latexrelease> \expandafter %2
%<latexrelease> \expandafter %1
%<latexrelease> \expandafter %3 expands the \csname inside \end<space>
%<latexrelease> \expandafter %1
%<latexrelease> \expandafter %2 expands \end<space>
%<latexrelease> \expandafter %1 expands the \else
%<latexrelease> \z@
%<latexrelease> \else
%<latexrelease> \expandafter\z@\expandafter\protect
%<latexrelease> \fi
%<latexrelease> }%
%<latexrelease> \expandafter\noexpand\csname end \endcsname
%<latexrelease> }
% \end{macrocode}
% And here is the original definition of \cs{end} the way it was in
% \LaTeX{} for several decades now hidden in \verb*=\end =.
% \begin{macrocode}
%<latexrelease>\@namedef{end }#1{%
%<latexrelease> \csname end#1\endcsname\@checkend{#1}%
%<latexrelease> \expandafter\endgroup\if@endpe\@doendpe\fi
%<latexrelease> \if@ignore\@ignorefalse\ignorespaces\fi}
%<latexrelease>\EndIncludeInRelease
% \end{macrocode}
% An here the rollback in case that is ever needed.
% \begin{macrocode}
%<latexrelease>\IncludeInRelease{0000/00/00}%
%<latexrelease> {\begin}{Making \begin/\end robust}%
%<latexrelease>\def\begin#1{%
%<latexrelease> \@ifundefined{#1}%
%<latexrelease> {\def\reserved@a{\@latex@error{Environment #1 undefined}\@eha}}%
%<latexrelease> {\def\reserved@a{\def\@currenvir{#1}%
%<latexrelease> \edef\@currenvline{\on@line}%
%<latexrelease> \csname #1\endcsname}}%
%<latexrelease> \@ignorefalse
%<latexrelease> \begingroup\@endpefalse\reserved@a}
%<latexrelease>\def\end#1{%
%<latexrelease> \csname end#1\endcsname\@checkend{#1}%
%<latexrelease> \expandafter\endgroup\if@endpe\@doendpe\fi
%<latexrelease> \if@ignore\@ignorefalse\ignorespaces\fi}
%<latexrelease>
% \end{macrocode}
% Also undo the internal commands as some packages unfortunately test
% for their existence instead of using \cs{IfFormatAtLeastTF}.
% \changes{v1.1y}{2021/02/08}{Undo the internals for robust \cs{begin}
% and \cs{end} in rollback (gh/494)}
% \begin{macrocode}
%<latexrelease>\expandafter\let\csname begin \endcsname\@undefined
%<latexrelease>\expandafter\let\csname end \endcsname\@undefined
%<latexrelease>
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
% \end{macrocode}
% \end{macro}
% \end{macro}
%
%
%
%
%
% \begin{macro}{\@checkend}
% \begin{macrocode}
\def\@checkend#1{\def\reserved@a{#1}\ifx
\reserved@a\@currenvir \else\@badend{#1}\fi}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@currenvline}
% We do need a default value for |\@currenvline| on top-level since
% the document environment cancels the brace group. This means that
% a mismatch with |\begin|\allowbreak|{document}| will not produce
% a line number. Thus the outer default must be |\@empty| or we
% will end up with two spaces.
% \changes{v1.0q}{1994/05/24}{Use \cs{@empty} as outer default}
% \begin{macrocode}
\let\@currenvline\@empty
% \end{macrocode}
% \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}%
% \end{macrocode}
%
% \begin{macrocode}
\newcommand\AtBeginEnvironment[2][.] {\AddToHook{env/#2/begin}[#1]}
\newcommand\AtEndEnvironment[2][.] {\AddToHook{env/#2/end}[#1]}
\newcommand\BeforeBeginEnvironment[2][.]{\AddToHook{env/#2/before}[#1]}
\newcommand\AfterEndEnvironment[2][.] {\AddToHook{env/#2/after}[#1]}
% \end{macrocode}
%
% \begin{macrocode}
%</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}
\message{center,}
% \end{macrocode}
%
% \begin{oldcomments}
%
% \center, \flushright and \flushleft set
% \rightskip = 0pt or \@flushglue (as appropriate)
% \leftskip = 0pt or \@flushglue (as appropriate)
% \parindent = 0pt
% \parfillskip = 0pt. (except \flushleft)
% \\ == \par \vskip -\parskip
% \\[LENGTH] == \\ \vskip LENGTH
% \\* == \par \penalty 10000 \vskip -\parskip
% \\*[LEN] == \\* \vskip LENGTH
%
% They invoke the trivlist environment to handle vertical spacing before
% and after them.
%
% \centering, \raggedright and \raggedleft are the declaration analogs
% of the above.
%
% \raggedright has a more universal effect, however. It sets
% \@rightskip := flushglue. Every environment, like the list
% environments,
% that set \rightskip to its 'normal' value set it to \@rightskip
%
% \end{oldcomments}
%
% \begin{macro}{\@centercr}
% \changes{v1.0h}{1994/05/03}{\cs{@badcrerr} replaced by \cs{@nolnerr}}
% \changes{v1.0z}{1995/07/13}{Use \cs{nobreak}}
% \changes{v1.1s}{2019/11/02}{Make \cs{@centercr} robust (gh/203)}
% \begin{macrocode}
%</2ekernel>
%<*2ekernel|latexrelease>
%<latexrelease>\IncludeInRelease{2020/02/02}%
%<latexrelease> {\@centercr}{Make robust}%
\protected\def\@centercr{\ifhmode \unskip\else \@nolnerr\fi
\par\@ifstar{\nobreak\@xcentercr}\@xcentercr}
%</2ekernel|latexrelease>
% \end{macrocode}
%
% \begin{macrocode}
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{0000/00/00}%
%<latexrelease> {\@centercr}{Make robust}%
%<latexrelease>
%<latexrelease>\def\@centercr{\ifhmode \unskip\else \@nolnerr\fi
%<latexrelease> \par\@ifstar{\nobreak\@xcentercr}\@xcentercr}
%<latexrelease>
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@xcentercr}
% \begin{macrocode}
\def\@xcentercr{\addvspace{-\parskip}\@ifnextchar
[\@icentercr\ignorespaces}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@icentercr}
% \changes{v1.1t}{2020/04/21}{Support calc syntax (gh/152)}
% \begin{macrocode}
%</2ekernel>
%<*2ekernel|latexrelease>
%<latexrelease>\IncludeInRelease{2020/10/01}%
%<latexrelease> {\@icentercr}{centering, etc support calc}%
\def\@icentercr[#1]{\@vspace@calcify{#1}\ignorespaces}
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
% \end{macrocode}
%
% \begin{macrocode}
%<latexrelease>\IncludeInRelease{0000/00/00}%
%<latexrelease> {\@icentercr}{centering, etc support calc}%
%<latexrelease>
%<latexrelease>\def\@icentercr[#1]{\vskip #1\ignorespaces}
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
% \end{macrocode}
% \end{macro}
%
%
% \begin{environment}{center}
% \changes{v0.9h}{1993/12/13}{Removed optional argument of \cs{item}}
% \changes{v1.0u}{1994/11/12}{Changed end macro to \cs{def}: safer and
% consistent}
% We use |\relax| to prevent |\item| scanning too far.
% \begin{macrocode}
\def\center{\trivlist \centering\item\relax}
% \end{macrocode}
%
% \begin{macrocode}
\def\endcenter{\endtrivlist}
% \end{macrocode}
% \end{environment}
%
%
% \begin{macrocode}
%</2ekernel>
%<*2ekernel|latexrelease>
%<latexrelease>\IncludeInRelease{2020/10/01}%
%<latexrelease> {\centering}{Set finaldhypendemerits}%
% \end{macrocode}
%
% \begin{macro}{\centering}
% \changes{v1.1u}{2020/05/31}{Added \cs{finalhyphendemerits} setting (gh/247)}
% \begin{macrocode}
\DeclareRobustCommand\centering{%
\let\\\@centercr
\rightskip\@flushglue\leftskip\@flushglue
\finalhyphendemerits=\z@
\parindent\z@\parfillskip\z@skip}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\raggedright}
% \changes{v1.1u}{2020/05/31}{Added \cs{finalhyphendemerits} setting (gh/247)}
% \begin{macrocode}
\DeclareRobustCommand\raggedright{%
\let\\\@centercr\@rightskip\@flushglue \rightskip\@rightskip
\finalhyphendemerits=\z@
\leftskip\z@skip
\parindent\z@}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\raggedleft}
% \changes{v1.1u}{2020/05/31}{Added \cs{finalhyphendemerits} setting (gh/247)}
% \begin{macrocode}
\DeclareRobustCommand\raggedleft{%
\let\\\@centercr
\rightskip\z@skip\leftskip\@flushglue
\finalhyphendemerits=\z@
\parindent\z@\parfillskip\z@skip}
% \end{macrocode}
% \end{macro}
%
% \begin{macrocode}
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{2019/10/01}%
%<latexrelease> {\centering}{Make commands robust}%
%<latexrelease>
%<latexrelease>\DeclareRobustCommand\centering{%
%<latexrelease> \let\\\@centercr
%<latexrelease> \rightskip\@flushglue\leftskip\@flushglue
%<latexrelease> \parindent\z@\parfillskip\z@skip}
%<latexrelease>\DeclareRobustCommand\raggedright{%
%<latexrelease> \let\\\@centercr\@rightskip\@flushglue \rightskip\@rightskip
%<latexrelease> \leftskip\z@skip
%<latexrelease> \parindent\z@}
%<latexrelease>\DeclareRobustCommand\raggedleft{%
%<latexrelease> \let\\\@centercr
%<latexrelease> \rightskip\z@skip\leftskip\@flushglue
%<latexrelease> \parindent\z@\parfillskip\z@skip}
%<latexrelease>\EndIncludeInRelease
%<latexrelease>
%<latexrelease>\IncludeInRelease{0000/00/00}%
%<latexrelease> {\centering}{Make commands robust}%
%<latexrelease>
%<latexrelease>\kernel@make@fragile\centering
%<latexrelease>\kernel@make@fragile\raggedright
%<latexrelease>\kernel@make@fragile\raggedleft
%<latexrelease>
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
% \end{macrocode}
%
%
%
% \begin{macro}{\@rightskip}
% \begin{macrocode}
\newskip\@rightskip \@rightskip \z@skip
% \end{macrocode}
% \end{macro}
%
% \begin{environment}{flushleft}
% \changes{v0.9h}{1993/12/13}{Removed optional argument of \cs{item}}
% \changes{v1.0u}{1994/11/12}{Changed end macro to \cs{def}: safer and
% consistent}
% We use |\relax| to prevent |\item| scanning too far.
% \begin{macrocode}
\def\flushleft{\trivlist \raggedright\item\relax}
% \end{macrocode}
%
% \begin{macrocode}
\def\endflushleft{\endtrivlist}
% \end{macrocode}
% \end{environment}
%
%
% \begin{environment}{flushright}
% \changes{v0.9h}{1993/12/13}{Removed optional argument of \cs{item}}
% \changes{v1.0u}{1994/11/12}{Changed end macro to \cs{def}: safer and
% consistent}
% We use |\relax| to prevent |\item| scanning too far.
% \begin{macrocode}
\def\flushright{\trivlist \raggedleft\item\relax}
% \end{macrocode}
%
% \begin{macrocode}
\def\endflushright{\endtrivlist}
% \end{macrocode}
% \end{environment}
%
%
% \subsection{Verbatim}
%
% \begin{macrocode}
\message{verbatim,}
% \end{macrocode}
%
% The verbatim environment uses the fixed-width |\ttfamily| font, turns
% blanks into spaces, starts a new line for each carriage return (or
% sequence of consecutive carriage returns), and interprets
% \emph{every} character literally.
% I.e., all special characters |\, {, $|, etc.
% are |\catcode|'d to 'other'.
%
% The command |\verb| produces in-line verbatim text, where the argument
% is delimited by any pair of characters. E.g., |\verb #...#| takes
% `|...|' as its argument, and sets it verbatim in |\ttfamily| font.
%
% The *-variants of these commands are the same, except that spaces
% print as the \TeX{}book's space character instead of as blank spaces.
%
% \begin{macro}{\@vobeyspaces}
% \begin{macrocode}
{\catcode`\ =\active%
\gdef\@vobeyspaces{\catcode`\ \active\let \@xobeysp}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@xobeysp}
% \changes{v1.0z}{1995/07/13}{Use \cs{nobreak}}
% \changes{v1.1f}{1996/09/28}{Moved to ltspace.dtx}
% \end{macro}
%
%
% \begin{macro}{\@xverbatim}
% \begin{macro}{\@sxverbatim}
% \begin{macrocode}
\begingroup \catcode `|=0 \catcode `[= 1
\catcode`]=2 \catcode `\{=12 \catcode `\}=12
\catcode`\\=12 |gdef|@xverbatim#1\end{verbatim}[#1|end[verbatim]]
|gdef|@sxverbatim#1\end{verbatim*}[#1|end[verbatim*]]
|endgroup
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\@verbatim}
% \changes{LaTeX2.09}{1991/07/24}{Added \cs{penalty}\cs{interlinepenalty}
% to definition of \cs{par} so that \cs{samepage} works}
% \changes{v0.9h}{1993/12/13}{Removed optional argument of \cs{item}}
% Real start of verbatim environment
% We use |\relax| to prevent |\item| scanning too far.
% \changes{v0.9p}{1994/01/18}
% {Add \cs{global}\cs{@inlabelfalse}}
% \changes{v1.0b}{1994/03/16}
% {Remove \cs{global}\cs{@inlabelfalse} again.}
% \begin{macrocode}
%</2ekernel>
%<*2ekernel|latexrelease>
%<latexrelease>\IncludeInRelease{2017-04-15}{\@verbatim}%
%<latexrelease> {Disable hyphenation in verbatim}%
\def\@verbatim{\trivlist \item\relax
\if@minipage\else\vskip\parskip\fi
\leftskip\@totalleftmargin\rightskip\z@skip
\parindent\z@\parfillskip\@flushglue\parskip\z@skip
% \end{macrocode}
% \changes{LaTeX2.09}{1991/08/26}{\cs{@@par} added}
% Added |\@@par| to clear possible |\parshape| definition
% from a surrounding list (the verbatim guru says).
% \changes{v0.9p}{1994/01/18}
% {Only add \cs{penalty} if in hmode}
% Switch language when in vertical mode.
% \begin{macrocode}
\@@par
% \end{macrocode}
% Set |\language| here to suppress hyphenation. Done this way rather
% than setting |\hyphenchar| as that is a global setting.
% \begin{macrocode}
\language\l@nohyphenation
\@tempswafalse
\def\par{%
\if@tempswa
% \end{macrocode}
% A |\leavevmode| added: needed if, for example, a blank verbatim
% line is the first thing in a list item (wow!).
% \changes{v1.0f}{1994/04/29}{\cs{leavevmode} added}
% \begin{macrocode}
\leavevmode \null \@@par\penalty\interlinepenalty
\else
\@tempswatrue
\ifhmode\@@par\penalty\interlinepenalty\fi
\fi}%
% \end{macrocode}
% To allow customization we hide the font used in a separate macro.
% \changes{v0.9a}{1993/11/21}{use \cs{verbatim@font} instead of \cs{tt}}
% \changes{v0.9h}{1993/12/13}{Readded \cs{@noligs}}
% \changes{v1.1d}{1996/06/03}{Exchanged the following two code lines
% so that \cs{dospecials} cannot reset the category code
% of characters handled by \cs{@noligs}.}
% \changes{v1.1h}{2000/01/07}{Disable hyphenation even if the font allows it.}
% \changes{v1.1m}{2017-03-09}{Use \cs{language} not \cs{hyphenchar}}
% \begin{macrocode}
\let\do\@makeother \dospecials
\obeylines \verbatim@font \@noligs
% \end{macrocode}
% To avoid a breakpoint after the labels box, we remove the penalty
% put there by the list macros: another use of |\unpenalty|!
% \changes{v1.0f}{1994/04/29}{Change to \cs{everypar} added}
% \begin{macrocode}
\everypar \expandafter{\the\everypar \unpenalty}%
}
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{0000-00-00}{\@verbatim}%
%<latexrelease> {Disable hyphenation in verbatim}%
%<latexrelease>\def\@verbatim{\trivlist \item\relax
%<latexrelease> \if@minipage\else\vskip\parskip\fi
%<latexrelease> \leftskip\@totalleftmargin\rightskip\z@skip
%<latexrelease> \parindent\z@\parfillskip\@flushglue\parskip\z@skip
%<latexrelease> \@@par
%<latexrelease> \@tempswafalse
%<latexrelease> \def\par{%
%<latexrelease> \if@tempswa
%<latexrelease> \leavevmode \null \@@par\penalty\interlinepenalty
%<latexrelease> \else
%<latexrelease> \@tempswatrue
%<latexrelease> \ifhmode\@@par\penalty\interlinepenalty\fi
%<latexrelease> \fi}%
%<latexrelease> \let\do\@makeother \dospecials
%<latexrelease> \obeylines \verbatim@font \@noligs
%<latexrelease> \hyphenchar\font\m@ne
%<latexrelease> \everypar \expandafter{\the\everypar \unpenalty}%
%<latexrelease>}
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
% \end{macrocode}
% \end{macro}
%
% \begin{environment}{verbatim}
% \begin{macro}{\verbatim}
% \begin{macro}{\endverbatim}
% (RmS 93/09/19) Protected against `missing item' error message
% triggered by empty verbatim environment.
% \begin{macrocode}
\def\verbatim{\@verbatim \frenchspacing\@vobeyspaces \@xverbatim}
\def\endverbatim{\if@newlist \leavevmode\fi\endtrivlist}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{environment}
%
% \begin{macro}{\verbatim@font}
% \changes{v0.9a}{1993/11/21}{Macro added}
% Macro to select the font used for verbatim typesetting.
% It also does other work if necessary for the font used.
% \changes{v0.9s}{1994/01/21}{Removed unnecessary category code
% hackery.}
% \begin{macrocode}
\def\verbatim@font{\normalfont\ttfamily}
% \end{macrocode}
% \end{macro}
%
%
% \begin{macrocode}
%</2ekernel>
%<*2ekernel|latexrelease>
%<latexrelease>\IncludeInRelease{2018/12/01}%
%<latexrelease> {\verbvisiblespace}{Setup visible space for \verb}%
% \end{macrocode}
%
%
% \begin{macro}{\asciispace}
% The character in slot 32, in typewriter fonts (historically) a
% visible space but in other fonts a real space or something else
% \changes{v1.1o}{2018/10/11}
% {Provide visible space in \cs{verb*} also for XeTeX and LuaTeX (github/69)}
% \begin{macrocode}
\DeclareRobustCommand\asciispace{\char 32 }
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\verbvisiblespace}
% This defines how to get a visible space in
% |\verb*| and friends. In classic \TeX{} this is just the
% slot 32, but in TU encoded fonts we switch fonts and take the
% character from cmtt.
% \changes{v1.1o}{2018/10/11}
% {Provide visible space in \cs{verb*} also for XeTeX and LuaTeX (github/69)}
% \changes{v1.1o}{2018/10/11}
% {Provide \cs{verbvisiblespace} such that it is usable in normal text (github/70)}
% \begin{macrocode}
\ifx\Umathcode\@undefined
\let\verbvisiblespace\asciispace % Pdftex version
\else
\DeclareRobustCommand\verbvisiblespace
{\leavevmode{\usefont{OT1}{cmtt}{m}{n}\asciispace}} % xetex/luatex version
\fi
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@setupverbvisiblespace}
%
% In pdf\TeX{} a catcode 12 space will produce the character in
% slot 32 which is assumed to be a visible space character (in a
% typewriter font in OT1 or T1 encoding). In Xe\TeX{} or Lua\TeX{} a
% font in TU encoding is normally used and that has a real space in
% this slot. So what we do in this case is this: we check the
% definition of
% |\verbvisiblespace| and if it is |\asciispace| we assume that the
% char32 can be used (e.g., in pdf\TeX{}). We then redefine
% |\@xobeysp| so that after running |\@vobeyspaces| we get
% characters from slot 32 for each active space.
%
% \changes{v1.1o}{2018/10/11}
% {Provide visible space in \cs{verb*} also for XeTeX and LuaTeX (github/69)}
% \begin{macrocode}
\def\@setupverbvisiblespace{%
\ifx\verbvisiblespace\asciispace
\let\@xobeysp\asciispace
\else
% \end{macrocode} Otherwise we measure the width of a character in
% the mon-spaced current font and place a
% |\verbvisiblespace| into a box of the right width which we are then
% using as the character for a space. By default this will be the space
% character from OT1 cmtt but by changing
% |\verbvisiblespace| one could use, for example, the |\textvisiblespace|
% of the current typewriter font.
% \begin{macrocode}
\setbox\z@\hbox{x}%
\setbox\@verbvisiblespacebox\hbox to\wd\z@{\hss\verbvisiblespace\hss}%
\def\@xobeysp{\leavevmode\copy\@verbvisiblespacebox}%
\fi
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@verbvisiblespacebox}
% The box to hold the visible space character if it isn't in slot
% 32 in the current typewriter font.
% \changes{v1.1o}{2018/10/11}
% {Provide visible space in \cs{verb*} also for XeTeX and LuaTeX (github/69)}
% \begin{macrocode}
\newbox\@verbvisiblespacebox
% \end{macrocode}
% \end{macro}
%
%^^A \@sverb was here
%
% \begin{environment}{verbatim*}
% For \texttt{verbatim*} we also set up the correct visible space
% character definition and then run |\@vobeyspaces|. As this code
% is not called as part of the normal verbatim environment (the
% method is done the other way around this time) we don't have to
% check if space is already active---it shouldn't be.
% \changes{v1.1o}{2018/10/11}
% {Provide visible space in \cs{verb*} also for XeTeX and LuaTeX (github/69)}
% \begin{macrocode}
\@namedef{verbatim*}{\@verbatim
\@setupverbvisiblespace
\frenchspacing\@vobeyspaces\@sxverbatim}
\expandafter\let\csname endverbatim*\endcsname =\endverbatim
% \end{macrocode}
% \end{environment}
%
%
%
% \begin{macrocode}
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{0000/00/00}%
%<latexrelease> {\verbvisiblespace}{Setup visible space for \verb}%
%<latexrelease>
%<latexrelease>\@namedef{verbatim*}{\@verbatim\@sxverbatim}
%<latexrelease>
%<latexrelease>\let\asciispace \@undefined
%<latexrelease>\let\verbvisiblespace \@undefined
%<latexrelease>\let\@setupverbvisiblespace\@undefined
%<latexrelease>\let\@verbvisiblespacebox \@undefined
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
% \end{macrocode}
%
%
%
% \begin{macro}{\@sverb}
% \begin{macro}{\@@sverb}
% \changes{v1.0j}{1994/05/10}{Slight change in error message text.}
% Definitions of |\@sverb| and |\@verb| changed so |\verb+ foo+|
% does not lose leading blanks when it comes at the beginning of a line.
% Change made 24 May 89. Suggested by Frank Mittelbach and Rainer
% Sch\"opf.
% \begin{macrocode}
%</2ekernel>
%<*2ekernel|latexrelease>
%<latexrelease>\IncludeInRelease{2020/10/01}%
%<latexrelease> {\@sverb}{Drop spaces before \verb delimiter}%
% \end{macrocode}
%
% If the users types \verb=\verb !~! foo= then surprisingly we would
% get the space as the delimiter and thus
% ``\verb=!~!foo='' in the output.
% To avoid this scenario we check if \verb=#1= has the character
% code of a space, if so we recurse otherwise we call \cs{@@sverb}
% (which is the original definition of \cs{@sverb}.
% \changes{v1.1u}{2020/04/22}{Drop spaces before \cs{verb} delimiter (gh/327)}
% \begin{macrocode}
\def\@sverb#1{\if\noexpand#1 \expandafter\@sverb\else\@@sverb{#1}\fi}
% \end{macrocode}
%
% \changes{v1.1z}{2021/06/05}{Normalize error message}
% \begin{macrocode}
\def\@@sverb#1{%
\catcode`#1\active
\lccode`\~`#1%
\gdef\verb@balance@group{\verb@egroup
\@latex@error{\noexpand\verb illegal in argument}\@ehc}%
\aftergroup\verb@balance@group
\lowercase{\let~\verb@egroup}%
% \end{macrocode}
% If |\@sverb| is called from |\@verb| then space is already active
% and supposed to produce a real space. In this case we do
% nothing. Otherwise we run |\@setupverbvisiblespace| to setup the
% right visible space char and afterwards |\@vobeyspaces| to make
% it the definition for the active space character.
% \changes{v1.1o}{2018/10/11}
% {Provide visible space in \cs{verb*} also for XeTeX and LuaTeX (github/69)}
% \begin{macrocode}
\ifnum\catcode`\ =\active
\else \@setupverbvisiblespace \@vobeyspaces \fi
}
% \end{macrocode}
%
% \begin{macrocode}
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{2018/12/01}%
%<latexrelease> {\@sverb}{Setup visible space for \verb}%
%<latexrelease>
%<latexrelease>\def\@sverb#1{%
%<latexrelease> \catcode`#1\active
%<latexrelease> \lccode`\~`#1%
%<latexrelease> \gdef\verb@balance@group{\verb@egroup
%<latexrelease> \@latex@error{\noexpand\verb illegal in command argument}\@ehc}%
%<latexrelease> \aftergroup\verb@balance@group
%<latexrelease> \lowercase{\let~\verb@egroup}%
%<latexrelease> \ifnum\catcode`\ =\active
%<latexrelease> \else \@setupverbvisiblespace \@vobeyspaces \fi
%<latexrelease>}
%<latexrelease>\let\@@sverb\@undefined
%<latexrelease>\EndIncludeInRelease
%<latexrelease>
%<latexrelease>\IncludeInRelease{0000/00/00}%
%<latexrelease> {\@sverb}{Setup visible space for \verb}%
%<latexrelease>\def\@sverb#1{%
%<latexrelease> \catcode`#1\active
%<latexrelease> \lccode`\~`#1%
%<latexrelease> \gdef\verb@balance@group{\verb@egroup
%<latexrelease> \@latex@error{\noexpand\verb illegal in command argument}\@ehc}%
%<latexrelease> \aftergroup\verb@balance@group
%<latexrelease> \lowercase{\let~\verb@egroup}}%
%<latexrelease>
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
% \end{macrocode}
% \end{macro}
% \end{macro}
%
%
% \begin{macro}{\@makeother}
% \begin{macrocode}
\def\@makeother#1{\catcode`#112\relax}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\verb@balance@group}
% \changes{LaTeX2.09}{1993/09/07}
% {(RmS) Changed definition of \cs{verb} so that it detects a
% missing second delimiter.}
% \begin{macrocode}
\let\verb@balance@group\@empty
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\verb@egroup}
% \begin{macrocode}
\def\verb@egroup{\global\let\verb@balance@group\@empty\egroup}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\verb@eol@error}
% \begin{macrocode}
\begingroup
\obeylines%
\gdef\verb@eol@error{\obeylines%
\def^^M{\verb@egroup\@latex@error{%
\noexpand\verb ended by end of line}\@ehc}}%
\endgroup
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\verb}
% \changes{LaTeX2.09}{1992/08/24}
% {Changed \cs{verb} and \cs{@sverb} to work correctly
% in math mode}
% \changes{v0.9a}{1993/11/21}{Use \cs{verbatim@font} instead of
% \cs{tt}.}
% \changes{v1.1a}{1995/09/19}{Put \cs{@noligs} after
% \cs{verbatim@font} where it belongs.}
% Typesetting a small piece verbatim.
% \changes{v1.1d}{1996/06/03}{Put setting of verbatim font after
% \cs{dospecials}
% so that \cs{dospecials} cannot reset the category code
% of characters handled by \cs{@noligs}.}
% \changes{v1.1m}{2017/03/09}
% {Use \cs{language} to stop hyphenation}
% \begin{macrocode}
%</2ekernel>
%<*2ekernel|latexrelease>
%<latexrelease>\IncludeInRelease{2017-04-15}{\verb}%
%<latexrelease> {Disable hyphenation in verb}%
\def\verb{\relax\ifmmode\hbox\else\leavevmode\null\fi
\bgroup
\verb@eol@error \let\do\@makeother \dospecials
\verbatim@font\@noligs
% \end{macrocode}
% Set |\language| here to suppress hyphenation. Done this way rather
% than setting |\hyphenchar| as that is a global setting.
% \begin{macrocode}
\language\l@nohyphenation
\@ifstar\@sverb\@verb}
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{0000-00-00}{\verb}%
%<latexrelease> {Disable hyphenation in verb}%
%<latexrelease>\def\verb{\relax\ifmmode\hbox\else\leavevmode\null\fi
%<latexrelease> \bgroup
%<latexrelease> \verb@eol@error \let\do\@makeother \dospecials
%<latexrelease> \verbatim@font\@noligs
%<latexrelease> \@ifstar\@sverb\@verb}
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
% \end{macrocode}
% \end{macro}
%
%
%
% \begin{macro}{\@verb}
% \begin{macrocode}
\def\@verb{\@vobeyspaces \frenchspacing \@sverb}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\verbatim@nolig@list}
% \changes{LaTeX2.09}{1993/09/03}
% {Replaced \cs{@noligs} by extensible list}
% \begin{macrocode}
\def\verbatim@nolig@list{\do\`\do\<\do\>\do\,\do\'\do\-}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\do@noligs}
% \begin{macrocode}
\def\do@noligs#1{%
\catcode`#1\active
\begingroup
\lccode`\~`#1\relax
\lowercase{\endgroup\def~{\leavevmode\kern\z@\char`#1}}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@noligs}
% To stay compatible with packages that use |\@noligs| we keep it.
% \changes{v0.9h}{1993/12/13}{Readded \cs{@noligs}}
% \begin{macrocode}
\def\@noligs{\let\do\do@noligs \verbatim@nolig@list}
% \end{macrocode}
% \end{macro}
%
% \changes{v0.9i}{1993/12/16}{\cs{literal} added}
% \changes{v1.0r}{1994/05/26/16}{\cs{literal} removed}
% \begin{macrocode}
%</2ekernel>
% \end{macrocode}
%
% \Finale
%
Computing file changes ...