% \iffalse meta-comment
%
% Copyright 1994 the LaTeX3 project and the individual authors.
% All rights reserved. For further copyright information see the file
% legal.txt, and any other copyright indicated in this file.
% 
% This file is part of the LaTeX2e system.
% ----------------------------------------
% 
%  This system is distributed in the hope that it will be useful,
%  but WITHOUT ANY WARRANTY; without even the implied warranty of
%  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
% 
% 
% IMPORTANT NOTICE:
% 
% For error reports in case of UNCHANGED versions see bugs.txt.
% 
% Please do not request updates from us directly.  Distribution is
% done through Mail-Servers and TeX organizations.
% 
% You are not allowed to change this file.
% 
% You are allowed to distribute this file under the condition that
% it is distributed together with all files mentioned in manifest.txt.
% 
% If you receive only some of these files from someone, complain!
% 
% You are NOT ALLOWED to distribute this file alone.  You are NOT
% ALLOWED to take money for the distribution or use of either this
% file or a changed version, except for a nominal charge for copying
% etc.
% \fi
% \iffalse
%%% File: ltmiscen
%
%<*driver>
% \fi
\ProvidesFile{ltmiscen.dtx}
             [1994/05/26 v1.0r 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}
\maketitle
 \DocInput{\filename}
\end{document}
%</driver>
% \fi
%
% \CheckSum{750}
%
% \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}
%
% \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|.
%
% \StopEventually{}
%
%    \begin{macrocode}
%<*2ekernel>
\message{environments,}
%    \end{macrocode}
%
% \subsection{Environments}
%
% \begin{oldcomments}
%  \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 \global\@ignoretrue.
%
%  \@currenvir : the name of the current environment.  Initialized to
%                'document' to make \end{document} work right.
%
%  \@preamblecmds : a list of commands that can be used only in the
%                   preamble (before the \begin{document}), in the
%                   form  \do \CMDA \do \CMDB ... .   These commands
%                   are redefined to \@notprerr by \begin{document}
%                   to save space.  They include the following:
%                       \document \documentstyle \@documentstyle
%                       \@options \@preamblecmds \@optionlist
%                       \@optionfiles \nofiles \includeonly \makeindex
%                       \makeglossary
%                   The document style can add any other commands to
%                   this list by
%                      \def\do{\noexpand\do\noexpand}
%                      \edef\@preamblecmds{\@preamblecmds \do ...}
%
%  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.
%
% \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
%                      \@tempa == VAL
%                      if def(\@tempa) = def(\r@LABEL)
%                        else @tempswa := true          fi
%                    END
%                \bibcite{LABEL}{VAL} == null
%                    BEGIN
%                      \@tempa == VAL
%                      if def(\@tempa) = 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
%
%    \begin{macrocode}
\def\@currenvir{document}
%    \end{macrocode}
%
%    \begin{macrocode}
\@onlypreamble\document 
\@onlypreamble\documentstyle 
\@onlypreamble\@documentstyle
   
\@onlypreamble\@options 
\@onlypreamble\@preamblecmds 
\@onlypreamble\@optionlist 
\@onlypreamble\@optionfiles
   
\@onlypreamble\nofiles 
\@onlypreamble\includeonly 
\@onlypreamble\makeindex 
\@onlypreamble\makeglossary
%    \end{macrocode}
%
%    \begin{macrocode}
\newif\if@ignore
%    \end{macrocode}
%
% \end{oldcomments}
%
%  \begin{macro}{\enddocument}
% \changes{LaTeX2.09}{1993/08/03}
%         {Changed redefinition of \cmd\global to redefinition
%               of \cmd{\@setckpt}.}
% \changes{LaTeX2.09}{1993/09/08}
%         {Added warning in case of undefined references.}%    
% \changes{v0.9e}{1993/12/09}{Hook added}
%    \begin{macrocode}
\def\enddocument{%
   \@checkend{document}%
%    \end{macrocode}
%    The |\end{document}| hook is executed first. If necessary it can
%    contain a |\clearpage| to output dangling floats first.
%    \begin{macrocode}
   \@enddocumenthook
   \clearpage
   \begingroup
     \if@filesw
       \immediate\closeout\@mainaux
       \def\@setckpt##1##2{}%
       \def\newlabel{\@testdef r}%
       \def\bibcite{\@testdef b}%
       \@tempswafalse 
       \makeatletter \input\jobname.aux
%    \end{macrocode}
%    First we check for font size substitution bigger than
%    |\fontsubfuzz|. The |\relax| is necessary because this is a macro
%    not a register.
%    \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.
%    \begin{macrocode}
         \@font@warning{Size substitutions with differences\MessageBreak
                    up to \font@submax\space have occured.\@gobbletwo}%
       \fi
       \ifG@defaultsubs
         \@font@warning{Some font shapes were not available, defaults 
                       substituted.\@gobbletwo}%
       \fi
       \ifG@refundefined\@latex@warning@no@line{There were 
                         undefined references}\fi
%    \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}
%    \begin{macrocode}
       \if@multiplelabels
         \@latex@warning@no@line{There were multiply-defined labels}%
       \else
         \if@tempswa 
           \@latex@warning@no@line{Label(s) may have changed.  
                Rerun to get cross-references right}%
         \fi
       \fi
     \fi
  \endgroup\deadcycles\z@\@@end}
%    \end{macrocode}
%  \end{macro}
%
% \begin{oldcomments}
%    \begin{macrocode}
\def\@testdef #1#2#3{%
  \def\@tempa{#3}\expandafter \ifx \csname #1@#2\endcsname
 \@tempa  \else \@tempswatrue \fi}
%    \end{macrocode}
%
% \changes{v1.0l}{1994/05/20}{Added correct setting of \cs{protect}.}
%    \begin{macrocode}
\long\def\@writefile#1#2{\@ifundefined{tf@#1}{}{%
   \let\protect\@unexpandable@protect
   \immediate\write\csname tf@#1\endcsname{#2}%
   \let\protect\relax}}
 % \long added 8 Feb 90, as suggested by Chris Rowley
%    \end{macrocode}
%
%    \begin{macrocode}
\def\stop{\clearpage\deadcycles\z@\let\par\@@par\@@end}
%    \end{macrocode}
%
%    \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  \@tempa == BEGIN report error END
%                        ELSE  \@tempa ==  (\@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
%
% RmS 92/03/18: changed \@ignoretrue to \@ignorefalse (as documented)
% RmS 92/08/24: added code to \begin to remember line number. Used by
%               \@badend to display position of non-matching \begin.
%    \begin{macrocode}
\def\begin#1{\@ifundefined{#1}{\def\@tempa{\@latex@error{Environment #1
  undefined}\@eha}}{\def\@tempa{\def\@currenvir{#1}%
  \edef\@currenvline{\on@line}%
  \csname #1\endcsname}}\global\@ignorefalse %% \global...added 2 May 90
     \begingroup\@endpefalse\@tempa}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\end#1{\csname end#1\endcsname\@checkend{#1}%
  \expandafter\endgroup \if@endpe \@doendpe \fi
  \if@ignore \global\@ignorefalse \ignorespaces\fi}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@checkend#1{\def\@tempa{#1}\ifx
      \@tempa\@currenvir \else\@badend{#1}\fi}
%    \end{macrocode}
% \end{oldcomments}
%
%  \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 missmatch 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 \cmd\@empty as outer default}
%    \begin{macrocode}
\let\@currenvline\empty
%    \end{macrocode}
%  \end{macro}
%
%
% \begin{oldcomments}
%    \begin{macrocode}
\message{math,}
%    \end{macrocode}
%
% \end{oldcomments}
%
% \subsection{Math Environments}
%
% \begin{oldcomments}
%
%
% \( ==  BEGIN  if math mode
%                 then error: '\( in math mode'
%                 else $
%               fi
%        END
%
% \) ==  BEGIN  if math mode
%                 then if inner mode
%                        then $
%                        else error ``\[ closed with \)''
%                 else error 'unmatched \)'
%               fi
%        END
%
% \[ ==  BEGIN  if math mode
%                 then error: '\[ in math mode'
%                 else $$
%               fi
%        END
%
% \] ==  BEGIN  if math mode
%                 then if inner mode
%                        then error '\( closed with \]'
%                        else $$
%                 else error 'unmatched \]'
%               fi
%        END
%
% \equation      ==  BEGIN \refstepcounter{equation} $$ END
%
% \endequation   ==  BEGIN \eqno (\theequation) $$\ignorespaces END
%
% NOTE: The document style must define \theequation etc., and do
% the appropriate \@addtoreset.  It should also redefine \@eqnnum
% if another format for the equation number is desired other than the
% standard (...), or to move the equation numbers to the flushleft.
% (See comment on the \def of \@eqnnum.)
%
% \stackrel{TOP}{BOT} == PLAIN TeX's \buildrel {TOP} \over {BOT}
%
% \frac{TOP}{BOT} == {TOP \over BOT}
%
% \sqrt[N]{EXP} produces an Nth root of EXP formula.
%
%  \: == \>  (medium space)
%
%    \begin{macrocode}
\def\({\relax\ifmmode\@badmath\else$%%$BRACE MATCH HACK
\fi}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\){\relax\ifmmode\ifinner$\else\@badmath%%$ BRACE MATCH HACK
\fi\else \@badmath\fi}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\[{\relax\ifmmode\@badmath\else
    \ifvmode
      \nointerlineskip \makebox[.6\linewidth]\fi$$%%$$ BRACE MATCH HACK
\fi}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\]{\relax\ifmmode\ifinner\@badmath\else$$\fi%%$$ BRACE MATCH HACK
        \else \@badmath \fi\ignorespaces}
%    \end{macrocode}
%
%    \begin{macrocode}
\let\math=\(
\let\endmath=\)
\def\displaymath{\[}
\def\enddisplaymath{\]\global\@ignoretrue}
%    \end{macrocode}
%
%    \begin{macrocode}
\@definecounter{equation}
\def\equation{$$ % $$ BRACE MATCHING HACK
\refstepcounter{equation}}
%    \end{macrocode}
%
% RmS 92/01/10: put \hbox around \@eqnnum to typeset the equation
%               number in text mode (as in the eqnarray env.).
%    \begin{macrocode}
\def\endequation{\eqno \hbox{\@eqnnum}% $$ BRACE MATCHING HACK
$$\global\@ignoretrue}
%    \end{macrocode}
%
%  \@eqnnum: Produces the equation number for equation and
%     eqnarray environments.  The following definition is for
%     flushright numbers; for flushleft numbers, see leqno.doc.
%     The {\rmfamily ... } puts the equation number in roman type even
%     if an eqnarray environment appears in an italic environment.
%
% RmS 91/09/29: \reset@font added.
%    \begin{macrocode}
\def\@eqnnum{{\reset@font\rmfamily (\theequation)}}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\stackrel#1#2{\mathrel{\mathop{#2}\limits^{#1}}}
%    \end{macrocode}
% \end{oldcomments}
%
%
%  \begin{macro}{\frac}
%    Added a group around the first argument of |\frac| to prevent
%    changes (for example font changes) to modify the contents of the
%    second argument.
% \changes{v0.9g}{1993/12/11}{Added group around first arg}
%    \begin{macrocode}
\def\frac#1#2{{\begingroup#1\endgroup\over#2}}
%    \end{macrocode}
%  \end{macro}
%
% \begin{oldcomments}
%    \begin{macrocode}
\let\@@sqrt=\sqrt
\def\sqrt{\@ifnextchar[\@sqrt\@@sqrt}
\def\@sqrt[#1]{\root #1\of}
%    \end{macrocode}
%
%    \begin{macrocode}
\let\:=\>
%    \end{macrocode}
%
% 93/11/02 RmS: Corrected description of \@eqnsel, moved \@eqnsel
%               accordingly and removed extra \tabskip assignment.
%
% Here's the eqnarray environment:
%  Default is for left-hand side of equations to be flushright.
%  To make them flushleft, \let\@eqnsel = \hfil
%    \begin{macrocode}
\newcount\@eqcnt
\newcount\@eqpen
\newif\if@eqnsw\@eqnswtrue
%    \end{macrocode}
%
% Changed 1985/11/04 to produce warning message if line extends into
% margin.  Doesn't warn about formula overprinting equation number. 
%    \begin{macrocode}
\@centering = 0pt plus 1000pt 
%    \end{macrocode}
%
% \end{oldcomments}
% \begin{environment}{eqnarray}
% \changes{LaTeX2e}{1993/11/03}{(RmS) Initialized \cs{everycr} to empty}
%    To get a proper |\@currentlabel| we have to redefine it for the
%    whole display. Note that we can't use |\refstepcounter| as this
%    results in |\@currentlabel| getting restored at the wrong and
%    thus always writing the first label to the \texttt{.aux} file.
% \changes{v0.9i}{1993/12/16}{use `refstepcounter instead of shortcut}
% \changes{v0.9o}{1994/01/13}{correcting 0.9i}
%    \begin{macrocode}
\def\eqnarray{\stepcounter{equation}%
\def\@currentlabel{\p@equation\theequation}%
\global\@eqnswtrue\m@th
\global\@eqcnt\z@\tabskip\@centering\let\\\@eqncr
$$\everycr{}\halign to\displaywidth\bgroup\hskip\@centering
  $\displaystyle\tabskip\z@skip{##}$\@eqnsel&\global\@eqcnt\@ne
  \hskip \tw@\arraycolsep \hfil${##}$\hfil
  &\global\@eqcnt\tw@ \hskip \tw@\arraycolsep
  $\displaystyle{##}$\hfil
   \tabskip\@centering&\global\@eqcnt\thr@@
       \hbox to\z@\bgroup\hss##\egroup\tabskip\z@skip\cr}

\def\endeqnarray{\@@eqncr\egroup
      \global\advance\c@equation\m@ne$$\global\@ignoretrue}

\let\@eqnsel=\relax
%    \end{macrocode}
% \end{environment}
% \begin{oldcomments}
%
%    \begin{macrocode}
\def\nonumber{\global\@eqnswfalse}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@eqncr{{\ifnum0=`}\fi\@ifstar{\global\@eqpen\@M
    \@yeqncr}{\global\@eqpen\interdisplaylinepenalty \@yeqncr}}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@yeqncr{\@ifnextchar [\@xeqncr{\@xeqncr[\z@skip]}}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@xeqncr[#1]{\ifnum0=`{\fi}\@@eqncr
   \noalign{\penalty\@eqpen\vskip\jot\vskip #1\relax}}
%    \end{macrocode}
%
%  \begin{macro}{\@@eqncr}
% \changes{v0.9i}{1993/12/16}{use `refstepcounter instead of shortcut}
% \changes{v0.9o}{1994/01/13}{correcting 0.9i}
%    
%    \begin{macrocode}
\def\@@eqncr{\let\@tempa\relax
    \ifcase\@eqcnt \def\@tempa{& & &}\or \def\@tempa{& &}%
     \or \def\@tempa{&}\else
       \let\@tempa\@empty
       \@latex@error{Too many columns in eqnarray environment}\@ehc\fi
     \@tempa \if@eqnsw\@eqnnum\stepcounter{equation}\fi
     \global\@eqnswtrue\global\@eqcnt\z@\cr}
%    \end{macrocode}
%  \end{macro}
%
% Here's the eqnarray* environment:
%    \begin{macrocode}
\let\@seqncr=\@eqncr
\@namedef{eqnarray*}{\def\@eqncr{\nonumber\@seqncr}\eqnarray}
\@namedef{endeqnarray*}{\nonumber\endeqnarray}
%    \end{macrocode}
%
% \lefteqn{FORMULA} typesets FORMULA in display math style
%  flushleft in a box of width zero.
%
%    \begin{macrocode}
\def\lefteqn#1{\hbox to\z@{$\displaystyle #1$\hss}}
%    \end{macrocode}
% \end{oldcomments}
%
%
% \begin{macro}{\ensuremath}
%   In math mode, |\ensuremath{text}| is equivalent to text; in LR or
%   paragraph mode, it is equivalent to |$|text|$|. |\relax| not needed
%   in front of the |\ifmmath| as |\protect| will be |\let| to |\relax|.
% \changes{v1.0k}{1994/05/16}
%     {Use \cs{DeclareRobustCommand} and add extra braces in math mode}
%    \begin{macrocode}
\DeclareRobustCommand\ensuremath[1]{\ifmmode{#1}\else$#1$\fi}
%    \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
% \changes{v1.0h}{1994/05/03}{\cmd\@badcrerr replaced by \cmd\@nolnerr}
%    \begin{macrocode}
\def\@centercr{\ifhmode \unskip\else \@nolnerr\fi
       \par\@ifstar{\penalty \@M\@xcentercr}\@xcentercr}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@xcentercr{\addvspace{-\parskip}\@ifnextchar
    [\@icentercr\ignorespaces}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@icentercr[#1]{\vskip #1\ignorespaces}
%    \end{macrocode}
%
% \end{oldcomments}
%
% \begin{environment}{center}
% \changes{v0.9h}{1993/12/13}{Removed optional argument of \cs{item}}
%    We use |\relax| to prevent |\item| to scan too far.
%    \begin{macrocode}
\def\center{\trivlist \centering\item\relax}
\def\centering{\let\\\@centercr\rightskip\@flushglue\leftskip\@flushglue
\parindent\z@\parfillskip\z@skip}
\let\endcenter=\endtrivlist
%    \end{macrocode}
% \end{environment}
%
%    \begin{macrocode}
\newskip\@rightskip \@rightskip \z@skip
%    \end{macrocode}
%
% \begin{environment}{flushleft}
% \changes{v0.9h}{1993/12/13}{Removed optional argument of \cs{item}}
%    We use |\relax| to prevent |\item| to scan too far.
%    \begin{macrocode}
\def\flushleft{\trivlist \raggedright\item\relax}
\def\raggedright{%
  \let\\\@centercr\@rightskip\@flushglue \rightskip\@rightskip
  \leftskip\z@skip
  \parindent\z@}
\let\endflushleft=\endtrivlist
%    \end{macrocode}
% \end{environment}
%
% \begin{environment}{flushright}
% \changes{v0.9h}{1993/12/13}{Removed optional argument of \cs{item}}
%    We use |\relax| to prevent |\item| to scan too far.
%    \begin{macrocode}
\def\flushright{\trivlist \raggedleft\item\relax}
\def\raggedleft{\let\\\@centercr\rightskip\z@skip\leftskip\@flushglue
  \parindent\z@\parfillskip\z@skip}
\let\endflushright=\endtrivlist
%    \end{macrocode}
% \end{environment}
%
%    \begin{macrocode}
\message{verbatim,}
%    \end{macrocode}
%
% \subsection{Verbatim}
%
% \begin{oldcomments}
%
%  The verbatim environment uses the fixed-width \ttfamily font, turns
%  blanks into spaces, starts a new line for each carrige return (or
%  sequence of consecutive carriage returns), and interprets 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 is the same, except that spaces
%  print as the TeXbook's space character instead of as blank spaces.
%    \begin{macrocode}
{\catcode`\^^M=13 \gdef\@gobblecr{\@ifnextchar
\@gobble\ignorespaces}}
%    \end{macrocode}
%
%    \begin{macrocode}
{\catcode`\ =\active%
\gdef\@vobeyspaces{\catcode`\ \active\let \@xobeysp}}
%    \end{macrocode}
%
% Definition of \@xobeysp chaned on 19 Nov 86 from
% \def\@xobeysp{\leavevmode{} }
% to prevent line breaks at spaces.  Change suggested by
% Nelson Beebe
%
%    \begin{macrocode}
\def\@xobeysp{\leavevmode\penalty10000\ }
%    \end{macrocode}
%
%    \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}
%
% \@sverbatim obsolete -- removed 24 May 89, as suggested by
% Rainer Sch\"opf and Frank Mittelbach
% \def\@sverbatim{\obeyspaces\@verbatim}
%    \begin{macrocode}
\def\@gobble#1{}
%    \end{macrocode}
%
% \end{oldcomments}
%
%  \begin{macro}{\@verbatim}
% \changes{LaTeX2.09}{1991/07/24}{Added `penalty`interlinepenalty 
%               to definition of `par so that `samepage works}
% \changes{v0.9h}{1993/12/13}{Removed optional argument of `item}
%    Real start of verbatim environment
%    We use |\relax| to prevent |\item| to scan too far.
% \changes{v0.9p}{1994/01/18}
%         {Add \cmd\global\cmd{\@inlabelfalse}}
% \changes{v1.0b}{1994/03/16}
%         {Remove \cmd\global\cmd{\@inlabelfalse} again.}
%    \begin{macrocode}
\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}{\cmd{\@@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 \cmd\penalty if in hmode}
%    \begin{macrocode}
  \@@par
  \@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}{\cmd\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 `verbatim@font instead of `tt}
%  \changes{v0.9h}{1993/12/13}{Readded `@noligs}
%    \begin{macrocode}
  \obeylines \verbatim@font \@noligs
  \let\do\@makeother \dospecials
%    \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 \cmd\everypar added}
%    \begin{macrocode}
  \everypar \expandafter{\the\everypar \unpenalty}%
}
%    \end{macrocode}
%  \end{macro}
%  
%  \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}
%
%  \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}
\@namedef{verbatim*}{\@verbatim\@sxverbatim}
\expandafter\let\csname endverbatim*\endcsname =\endverbatim
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@makeother#1{\catcode`#1=12\relax}
%    \end{macrocode}
%
% \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

\def\verb@egroup{\global\let\verb@balance@group\@empty\egroup}

\begingroup
  \obeylines%
  \gdef\verb@eol@error{\obeylines%
    \def^^M{\verb@egroup\@latex@error{%
            \noexpand\verb ended by end of line}\@ehc}}%
\endgroup
%    \end{macrocode}
%
%  \begin{macro}{\verb}
% \changes{LaTeX2.09}{1992/08/24}
%         {Changed \cmd\verb and \cmd{\@sverb} to work correctly 
%            in math mode}
% \changes{v0.9a}{1993/11/21}{use `verbatim@font instead of `tt}
%    Typesetting a small piece verbatim.
%    \begin{macrocode}
\def\verb{\relax\ifmmode\hbox\else\leavevmode\null\fi
  \bgroup \@noligs
    \verbatim@font \verb@eol@error \let\do\@makeother \dospecials
    \@ifstar\@sverb\@verb}
%    \end{macrocode}
%  \end{macro}
%
%
% \changes{v1.0j}{1994/05/10}{Slight change in error message text.}
% \begin{oldcomments}
% 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}
\def\@sverb#1{%
  \catcode`#1\active
  \lccode`\~`#1%
  \gdef\verb@balance@group{\verb@egroup
     \@latex@error{\noexpand\verb illegal in command argument}\@ehc}%
  \aftergroup\verb@balance@group
  \lowercase{\let~\verb@egroup}}%
%    \end{macrocode}
%
% \end{oldcomments}
%
%    \begin{macrocode}
\def\@verb{\@vobeyspaces \frenchspacing \@sverb}
%    \end{macrocode}
%
%  \begin{macro}{\verbatim@nolig@list}
%    
% \changes{LaTeX2.09}{1993/09/03}
%         {Replaced \cmd{\@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 \cmd{\@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
%
