% \iffalse meta-comment
%
% Copyright 1993-1995 the LaTeX3 project and any individual authors
% listed elsewhere in this file.  All rights reserved.
% 
% For further copyright information see the file legal.txt, and any
% other copyright notices 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.
% 
%   For error reports concerning UNCHANGED versions of this file no more
%   than one year old, see bugs.txt.
% 
%   Please do not request updates from us directly.  Primary
%   distribution is through the CTAN archives.
% 
% 
% IMPORTANT COPYRIGHT NOTICE:
% 
% You are NOT ALLOWED to distribute this file alone.
% 
% You are allowed to distribute this file under the condition that it is
% distributed together with all the files listed in manifest.txt.
% 
% If you receive only some of these files from someone, complain!
% 
% Permission is granted to copy this file to another file with a clearly
% different name and to customize the declarations in that copy to serve
% the needs of your installation, provided that you comply with
% the conditions in the file legal.txt.
% 
% However, NO PERMISSION is granted to produce or to distribute a
% modified version of this file under its original name.
%  
% You are NOT ALLOWED to change this file.
% 
% 
% \fi
%
% \iffalse
%%% File: lttab
%<def>\begingroup
%<def>\makeatletter
%<def>\nfss@catcodes
%<def>\ProvidesFile{autotabg.sty}
%<def>                  [1995/06/14 v1.1b tabbing autoload file]
%<*driver>
% \fi
\ProvidesFile{lttab.dtx}[1995/06/14 v1.1b LaTeX Kernel (Columns)]
% \iffalse
\documentclass{ltxdoc}
\GetFileInfo{lttab.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{1134}
%
% \changes{v1.0l}{1995/05/07}{Use \cs{hb@xt@}}
% \changes{v1.1a}{1995/05/22}{Support autoloading feature}
% \changes{v1.1b}{1995/06/14}{Use \cs{ProvidesFile} in autoload}
%
% \section{Tabbing, Tabular and Array Environments}
% This section deals with `Lining It Up in Columns'. First the
% |tabbing| environment is defined, and then in second part, |tabular|
% together with its variants, |tabular*| and |array|.
%
% Note that the |tabular| defined here is essentially the original
% \LaTeX~2.09 version, not the extended version described in \emph{The
% \LaTeX\ Companion}. Use the |array| package to obtain the extended
% version.
%
% \StopEventually{}
%
%
% \changes{v1.0a}{1994/03/04}{Initial version, split from latex.dtx}
% \changes{v1.0a}{1994/03/07}{Long lines wrapped to 72 columns}
% \changes{v1.0b}{1994/03/28}{Improve documentation}
% \changes{v1.0c}{1994/05/07}{Removed definition of \cs{+}}
% \changes{v1.0c}{1994/05/07}{Removed surplus braces from
%                             \cs{@ifnextchar} constructs}
% \changes{v1.0f}{1994/05/21}{Use new error commands}
% \changes{v1.0j}{1994/11/17}
%         {\cs{@tempa} to \cs{reserved@a}}
% 
% \subsection{tabbing}
%
% \begin{oldcomments}
%
%  \dimen(\@firsttab + i) = distance of tab stop i from left margin
%         0 <= i <= 15 (?).
%
%  \dimen\@firsttab is initialized to \@totalleftmargin, so it starts
%      at the prevailing left margin.
%
%  \@maxtab          = number of highest defined tab register
%                       probably = \@firsttab + 12
%  \@nxttabmar = tab stop number of next line's left margin
%  \@curtabmar = tab stop number of current line's left margin
%  \@curtab    = number of the current tab. At start of line,
%                      it equals \@curtabmar
%  \@hightab   = largest tab number currently defined.
%  \@tabpush   = depth of \pushtab's
%
%  \box\@curline     = contents of current line, excluding left margin
%                       skip, and excluding contents of current field
%  \box\@curfield    = contents of current field
%
%  @rjfield          = switch: T iff the last field of the line should
%                       be right-justified at the right margin.
%
%  \tabbingsep          = distance left by the \' command between the
%                       current position and the field that is 
%                       ``left-shifted''.
%
%  UTILITY MACROS
%   \@stopfield  : closes the current field
%   \@addfield   : adds the current field to the current line.
%   \@contfield  : continues the current field
%   \@startfield : begins the next field
%   \@stopline   : closes the current line and outputs it
%   \@startline  : starts the next line
%   \@ifatmargin : an \if that is true iff the current line.
%                  has width zero
%
% \@startline ==
%  BEGIN
%   \@curtabmar :=G \@nxttabmar
%   \@curtab :=G \@curtabmar
%   \box\@curline :=G null
%   \@startfield
%   \strut
%  END
%
% \@stopline ==
%  BEGIN
%   \unskip
%   \@stopfield
%   if @rjfield = T
%     then  @rjfield :=G F
%           \@tempdima := \@totalleftmargin + \linewidth
%           \hb@xt@ \@tempdima{\@itemfudge
%                               \hskip \dimen\@curtabmar
%                               \box\@curline
%                               \hfil
%                               \box\@curfield}
%     else \@addfield
%          \hbox {\@itemfudge
%                 \hskip \dimen\@curtabmar
%                 \box\@curline}
%   fi
%  END
%
% \@startfield ==
%  BEGIN
%    \box\@curfield :=G \hbox {
%  END
%
% \@stopfield ==
%  BEGIN
%     }
%  END
%
% \@contfield ==
%  BEGIN
%   \box\@curfield :=G \hbox { \unhbox\@currfield  %%} brace matching
%  END
% \@addfield ==
%  BEGIN
%   \box\@curline :=G \unbox\@curline * \unbox\@curfield
%  END
%
% \@ifatmargin ==
%  BEGIN
%   if  dim of box\@curline = 0pt  then
%  END
%
%
% \tabbing ==
%  BEGIN
%   \lineskip :=L 0pt
%   \> == \@rtab
%   \< == \@ltab
%   \= == \@settab
%   \+ == \@tabplus
%   \- == \@tabminus
%   \` == \@tabrj
%   \' == \@tablab
%   \\ == BEGIN \@stopline \@startline END
%   \\[DIST] == BEGIN 
%                \@stopline \vskip DIST \@startline\ignorespaces END
%   \\* == BEGIN \@stopline \penalty 10000 \@startline END
%   \\*[DIST] == BEGIN \@stopline \penalty 10000 \vskip DIST
%                      \@startline\ignorespaces               END
%   \@hightab :=G \@nxttabmar :=G \@firsttab
%   \@tabpush :=G 0
%   \dimen\@firsttab := \@totalleftmargin
%   @rjfield :=G F
%   \trivlist  \item\relax
%   if @minipage = F then \vskip \parskip fi
%   \box\@tabfbox = \rlap{\indent\the\everypar}
%                             % note: \the\everypar sets @inlabel :=G F
%   \@itemfudge == BEGIN \box\@tabfbox END  
%   \@startline
%   \ignorespaces
%  END
%
% \@endtabbing ==
%  BEGIN
%   \@stopline
%   if \@tabpush > 0 then error message: ''unmatched \poptabs'' fi
%   \endtrivlist
%  END
%
% \@rtab ==
%  BEGIN
%   \@stopfield
%   \@addfield
%   if \@curtab < \@hightab
%     then \@curtab :=G \@curtab + 1
%     else error message ``Undefined Tab''   fi
%   \@tempdima := \dimen\@curtab - \dimen\@curtabmar
%                        - width of box \@curline
%   \box\@curline :=G \hbox{\unhbox\@curline + \hskip\@tempdima}
%   \@startfield
%  END
%
% \@settab ==
%  BEGIN
%   \@stopfield
%   \@addfield
%   if \@curtab < \@maxtab
%     then \@curtab :=G \@curtab+1
%     else error message: ``Too many tabs''    fi
%   if \@curtab > \@hightab
%     then \@hightab :=L \@curtab    fi
%   \dimen\@curtab :=L \dimen\@curtabmar + width of \box\@curline
%   \@startfield
%  END
%
% \@ltab ==
%  BEGIN
%   \@ifatmargin
%     then if \@curtabmar > \@firsttab
%            then \@curtab :=G \@curtab - 1
%                 \@curtabmar :=G \@curtabmar - 1
%            else error message ``Too many untabs''      fi
%     else error message ``Left tab in middle of line''
%   fi
%  END
%
% \@tabplus ==
%  BEGIN
%        if  \@nxttabmar < \@hightab
%           then \@nxttabmar :=G \@nxttabmar+1
%           else error message ``Undefined tab''
%        fi
%  END
%
% \@tabminus ==
%  BEGIN
%        if \@nxttabmar > \@firsttab
%           then \@nxttabmar :=G \@nxttabmar-1
%           else error message ``Too many untabs''
%        fi
%  END
%
% \@tabrj ==
%  BEGIN \@stopfield
%        \@addfield
%        @rjfield :=G T
%        \@startfield
%  END
%
% \@tablab ==
%  BEGIN \@stopfield
%        \box\@curline G:= \hbox{ \box\@curline %% `G' added 17 Jun 86
%                                \hskip - width of \box\@curfield
%                                \hskip -\tabbingsep
%                                \box\@curfield
%                                \hskip \tabbingsep }
%        \@startfield
%  END
%
% \pushtabs ==
%   BEGIN
%     \@stopfield
%     \@tabpush :=G \@tabpush + 1
%     \begingroup
%     \@contfield
%   END
%
% \poptabs ==
%  BEGIN
%    \@stopfield
%    if \@tabpush > 0
%      then \endgroup
%           \@tabpush :=G \@tabpush - 1
%      else error message: ``Too many \poptabs''
%    fi
%    \@contfield
%  END
%
% \end{oldcomments}
%
% \begin{macro}{\a}
% The accents |\`| , |\'| , and |\=| that have been redefined inside a
% tabbing environment can be called by typing |\a`| , |\a'| , and |\a=|.
% The macro |\a| is defined in |ltoutenc.dtx|.
% \changes{v1.0d}{1994/05/13}
%         {moved to ltoutenc}
% \end{macro}
%
%
% The `2ekernel' code ensures that a |\usepackage{autotabg}| is
% essentially ignored if a `full' format is being used that has
% picture mode already in the format.
%    \begin{macrocode}
%<defx>\begingroup
%<defx>\makeatletter
%<defx>\nfss@catcodes
%<2ekernel>\expandafter\let\csname ver@autotabg.sty\endcsname\fmtversion
%    \end{macrocode}
%
% \changes{v1.0c}{1994/05/07}{Changed \cs{@firsttab} to \cs{chardef}}
% \changes{v1.0c}{1994/05/07}{Changed \cs{@maxtab} to \cs{chardef}}
%    \begin{macrocode}
%<*2ekernel|autoload>
\newdimen\@gtempa 
\chardef\@firsttab=\the\allocationnumber
\newdimen\@gtempa\newdimen\@gtempa\newdimen\@gtempa\newdimen\@gtempa
\newdimen\@gtempa\newdimen\@gtempa\newdimen\@gtempa\newdimen\@gtempa
\newdimen\@gtempa\newdimen\@gtempa\newdimen\@gtempa\newdimen\@gtempa
\newdimen\@gtempa 
\chardef\@maxtab=\the\allocationnumber
\dimen\@firsttab=0pt
\newcount\@nxttabmar
\newcount\@curtabmar
\newcount\@curtab
\newcount\@hightab
\newcount\@tabpush
\newbox\@curline
\newbox\@curfield
\newbox\@tabfbox
%</2ekernel|autoload>
%    \end{macrocode}
%
%    \begin{macrocode}
%<*2ekernel|def>
\newif\if@rjfield
%<def>\global\let\if@rjfield\if@rjfield
%<def>\global\let\@rjfieldtrue\@rjfieldtrue
%<def>\global\let\@rjfieldfalse\@rjfieldfalse
%    \end{macrocode}
%
%    \begin{macrocode}
\gdef\@startline{\global\@curtabmar\@nxttabmar
   \global\@curtab\@curtabmar\global\setbox\@curline\hbox
%                                missing \global added 17 Jun 86
    {}\@startfield\strut}
%    \end{macrocode}
%
%    \begin{macrocode}
\gdef\@stopline{\unskip\@stopfield\if@rjfield \global\@rjfieldfalse
   \@tempdima\@totalleftmargin \advance\@tempdima\linewidth
 \hb@xt@\@tempdima{\@itemfudge\hskip\dimen\@curtabmar
   \box\@curline\hfil\box\@curfield}\else\@addfield
   \hbox{\@itemfudge\hskip\dimen\@curtabmar\box\@curline}\fi}
%    \end{macrocode}
%
%
% \begin{macro}{\@startfield}
% \changes{v1.0d}{1994/05/13}
%         {Colour support}
%    \begin{macrocode}
\gdef\@startfield{%
  \global\setbox\@curfield\hbox\bgroup\color@begingroup}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@stopfield}
% \changes{v1.0d}{1994/05/13}
%         {Colour support}
%    \begin{macrocode}
\gdef\@stopfield{%
  \color@endgroup\egroup}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@contfield}
% \changes{v1.0d}{1994/05/13}
%         {Colour support}
%    \begin{macrocode}
\gdef\@contfield{%
  \global\setbox\@curfield\hbox\bgroup\color@begingroup
  \unhbox\@curfield}
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
\gdef\@addfield{\global\setbox\@curline\hbox{\unhbox
     \@curline\unhbox\@curfield}}
\gdef\@ifatmargin{\ifdim \wd\@curline =\z@}
%    \end{macrocode}
%
%    \begin{macrocode}
\gdef\@tabcr{\@stopline \@ifstar{\penalty \@M \@xtabcr}\@xtabcr}
%    \end{macrocode}
%
%    \begin{macrocode}
\gdef\@xtabcr{\@ifnextchar[\@itabcr{\@startline\ignorespaces}}
%    \end{macrocode}
%
%    \begin{macrocode}
\gdef\@itabcr[#1]{\vskip #1\@startline\ignorespaces}
%    \end{macrocode}
%
%    \begin{macrocode}
\gdef\kill{\@stopfield\@startline\ignorespaces}
%    \end{macrocode}
%
%
% \changes{latex2e}{1993/12/13}{Removed optional argument of \cmd\item}
%    We use |\relax| to prevent |\item| to scan too far.
%    \begin{macrocode}
\gdef\tabbing{\lineskip \z@skip\let\>\@rtab\let\<\@ltab\let\=\@settab
     \let\+\@tabplus\let\-\@tabminus\let\`\@tabrj\let\'\@tablab
     \let\\=\@tabcr
     \global\@hightab\@firsttab
     \global\@nxttabmar\@firsttab
     \dimen\@firsttab\@totalleftmargin
     \global\@tabpush\z@ \global\@rjfieldfalse
     \trivlist \item\relax
     \if@minipage\else\vskip\parskip\fi
     \setbox\@tabfbox\hbox{\rlap{\indent\hskip\@totalleftmargin
       \the\everypar}}\def\@itemfudge{\box\@tabfbox}%
     \@startline\ignorespaces}
%    \end{macrocode}
% \begin{oldcomments}
%
%    \begin{macrocode}
\gdef\endtabbing{%
  \@stopline\ifnum\@tabpush >\z@ \@badpoptabs \fi\endtrivlist}
%    \end{macrocode}
%
%    \begin{macrocode}
\gdef\@rtab{\@stopfield\@addfield\ifnum \@curtab<\@hightab
      \global\advance\@curtab \@ne \else\@badtab\fi
      \@tempdima\dimen\@curtab
      \advance\@tempdima -\dimen\@curtabmar
      \advance\@tempdima -\wd\@curline
      \global\setbox\@curline\hbox{\unhbox\@curline\hskip\@tempdima}%
      \@startfield\ignorespaces}
%    \end{macrocode}
% Omitted \global added to \@rtab 17 Jun 86
%
%    \begin{macrocode}
\gdef\@settab{\@stopfield\@addfield\ifnum \@curtab <\@maxtab
      \global\advance\@curtab \@ne \else
         \@latex@error{Tab overflow}\@ehd\fi
      \ifnum\@curtab >\@hightab
      \@hightab\@curtab\fi
      \dimen\@curtab\dimen\@curtabmar
      \advance\dimen\@curtab \wd\@curline\@startfield\ignorespaces}
\gdef\@ltab{\@ifatmargin\ifnum\@curtabmar >\@firsttab
      \global\advance\@curtab \m@ne \global\advance\@curtabmar\m@ne\else
      \@badtab\fi\else
      \@latex@error{\string\<\space in mid line}\@ehd\fi\ignorespaces}
\gdef\@tabplus {\ifnum \@nxttabmar <\@hightab
      \global\advance\@nxttabmar \@ne \else
      \@badtab\fi\ignorespaces}
\gdef\@tabminus{\ifnum\@nxttabmar >\@firsttab
      \global\advance\@nxttabmar \m@ne \else
      \@badtab\fi\ignorespaces}
\gdef\@tabrj{%
  \@stopfield\@addfield\global\@rjfieldtrue\@startfield\ignorespaces}
%    \end{macrocode}
%
%    \begin{macrocode}
\gdef\@tablab{\@stopfield\global\setbox\@curline\hbox{\box\@curline
     \hskip -\wd\@curfield \hskip -\tabbingsep \box\@curfield
      \hskip \tabbingsep}\@startfield\ignorespaces}
%    \end{macrocode}
% \setbox\@curline made \global in \@tablab. 17 Jun 86
%
%    \begin{macrocode}
\gdef\pushtabs{%
  \@stopfield\@addfield\global\advance\@tabpush \@ne \begingroup
       \@contfield}
\gdef\poptabs{\@stopfield\@addfield\ifnum\@tabpush >\z@ \endgroup
     \global\advance\@tabpush \m@ne \else
     \@badpoptabs\fi\@contfield}
%</2ekernel|def>
%    \end{macrocode}
%
%    \begin{macrocode}
%<*2ekernel|autoload>
\newdimen\tabbingsep
%</2ekernel|autoload>
%    \end{macrocode}
%
%    \begin{macrocode}
%<*def>
\endgroup
%</def>
%    \end{macrocode}
%
%    \begin{macrocode}
%<*autoload>
\def\tabbing{\input{autotabg.sty}\tabbing}
%</autoload>
%    \end{macrocode}
%
% \end{oldcomments}
%
% \subsection{array and tabular environments}
%
% \begin{oldcomments}
%
% ARRAY PARMETERS:
%  \arraycolsep    
%       : half the width separating columns in an array environment
%  \tabcolsep
%       : half the width separating columns in a tabular environment
%  \arrayrulewidth
%       : width of rules
%  \doublerulesep
%       : space between adjacent rules in array or tabular
%  \arraystretch
%       : line spacing in array and tabular environments is done by
%         placing a strut in every row of height and depth
%         \arraystretch times the height and depth of the strut
%         produced by an ordinary \strut commmand.
%
% PREAMBLE:
%  The PREAMBLE argument of an array or tabular environment can contain
%  the following:
%    l,r,c  : indicate where entry is to be placed.
%    |      : for vertical rule
%    @{EXP} : inserts the text EXP in every column.
%              \arraycolsep or \tabcolsep  spacing is suppressed.
%    *{N}{PRE} : equivalent to writing N copies of PRE in the preamble.
%                PRE may contain *{N'}{EXP'} expressions.
%    p{LEN} : makes entry in parbox of width LEN.
%
% SPECIAL ARRAY COMMANDS:
%   \multicolumn{N}{FORMAT}{ITEM} : replaces the next N column items by
%       ITEM, formatted according to FORMAT.  FORMAT should contain at
%       most one l,r or c.  If it contains none, then ITEM is ignored.
%
%   \vline : draws a vertical line the height of the current row.  May
%            appear in an array element entry.
%   \hline : draws a horizontal line between rows.  Must appear either
%            before the first entry (to appear above the first row) or
%             right after a \\ command.  If followed by another \hline,
%             then adds a \vskip of \doublerulesep.
%
%   \cline[i-j] : draws horizontal lines between rows covering columns
%                 i through j, inclusive.  Multiple commands may follow
%                 one another to provide lines covering several disjoint
%                 columns
%   \extracolsep{WIDTH} : for use inside an @ in the preamble.  Causes a
%                WIDTH space to be added between columns for the rest of
%                the columns.  This is in addition to the ordinary
%                intercolumn space.
%
%  \array ==
%    BEGIN
%      \@acol    == \@arrayacol
%      \@classz  == \@arrayclassz
%      \@classiv == \@arrayclassiv
%      \\        == \@arraycr
%      \@halignto == NULL
%      \@tabarray
%    END
%
%  \endarray{NAME} ==  BEGIN  \crcr }}  END
%
%  \tabular  ==
%    BEGIN
%      \@halignto == NULL
%      \@tabular
%    END
%
%  \tabular*{WIDTH} ==
%    BEGIN
%      \@halignto == to WIDTH
%      \@tabular
%    END
%
%  \@tabular ==
%    BEGIN
%      \leavevmode
%      \hbox { $
%         \@acol    == \@tabacol
%         \@classz  == \@tabclassz
%         \@classiv == \@tabclassiv
%         \\        == \@tabularcr
%         \@tabarray
%    END
%
%  \endtabular == BEGIN \crcr}} $} END
%
%  \@tabarray == if next char = [ then \@array else \@array[c] fi
%
%  \@array[POS]{PREAMBLE} ==
%    BEGIN
%      define \@arstrutbox to make \@arstrut produce strut of height
%        and depth \arraystretch times the height and
%        depth of a normal strut.
%      \@mkpream{PREAMBLE}
%      \@preamble == \halign \@halignto {\tabskip=0pt\@arstrut
%                              eval{\@preamble}\tabskip = 0pt\cr  %% }
%      \@startpbox == \@@startpbox
%      \@endpbox == \@@endpbox
%      if POS = t then \vtop
%                 else if POS = b then \vbox
%                                 else \vcenter
%      fi              fi
%     {
%      \par          ==L {} % changed 92/09/18
%      \@sharp       == #
%      \protect      == \relax
%      \lineskip     :=L 0pt
%      \baselineskip :=L 0pt
%      \@preamble
%    END
%
%
%  \@arraycr ==
%   BEGIN
%     $              %% Prevents extra space at end of row's last entry.
%     if next char = [
%      then  \@argarraycr
%      else  $ \cr         %% Needed to balance $
%   END
%
%  \@argarraycr[LENGTH] ==
%   BEGIN
%     $                    %% Needed to balance $ of \@arraycr
%     if LENGTH > 0
%       then  \@tempdima := depth of \@arstrutbox + LENGTH
%             \vrule height 0pt width 0pt depth \@tempdima
%             \cr
%       else  \cr \noalign{\vskip LENGTH}
%   END
%
%  \@tabularcr and \@argtabularcr  same as \@arraycr and \@argarraycr
%  except without the extra $'s.
%
%    \begin{macrocode}
%<*2ekernel|autoload>
\def\extracolsep#1{\tabskip #1\relax}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\array{\let\@acol\@arrayacol \let\@classz\@arrayclassz
 \let\@classiv\@arrayclassiv
 \let\\\@arraycr\let\@halignto\@empty\@tabarray}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\endarray{\crcr\egroup\egroup}
\def\endtabular{\crcr\egroup\egroup $\egroup}
\expandafter \let \csname endtabular*\endcsname = \endtabular
%    \end{macrocode}
%
%    \begin{macrocode}
\def\tabular{\let\@halignto\@empty\@tabular}
%    \end{macrocode}
%
% RmS 93/08/05: Replaced \expandafter\def... by \@namedef
%    \begin{macrocode}
\@namedef{tabular*}#1{\def\@halignto{to#1}\@tabular}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@tabular{\leavevmode \hbox \bgroup $\let\@acol\@tabacol
   \let\@classz\@tabclassz
   \let\@classiv\@tabclassiv \let\\\@tabularcr\@tabarray}
%    \end{macrocode}
%
% RmS 91/11/04 added \m@th
%    \begin{macrocode}
\def\@tabarray{\m@th\@ifnextchar[\@array{\@array[c]}}
%    \end{macrocode}
%
% RmS 93/11/03 changed \halign to \ialign and removed superfluous
%              \tabskip assignment
%
% \end{oldcomments}
% \changes{v1.0h}{1994/11/04}{(ASAJ) added \cs{set@typeset@protect}.}
%
% \begin{macro}{\array}
%    \begin{macrocode}
\def\@array[#1]#2{\setbox\@arstrutbox\hbox{\vrule
     \@height\arraystretch \ht\strutbox
     \@depth\arraystretch \dp\strutbox
     \@width\z@}\@mkpream{#2}\edef\@preamble{\ialign \noexpand\@halignto
      \bgroup \@arstrut \@preamble \tabskip\z@skip \cr}%
      \let\@startpbox\@@startpbox \let\@endpbox\@@endpbox
%    \end{macrocode}
% \changes{1994/12/08}{v1.0k}{add \cs{tabularnewline}}
%    \begin{macrocode}
      \let\tabularnewline\\%
      \if #1t\vtop \else \if#1b\vbox \else \vcenter \fi\fi
%    \end{macrocode}
% \changes{1992/09/18}{LaTeX209}
%     {Canged \cs{par} to \cs{@empty} to avoid starting new row
%               e.g. after \cs{hline}}
%    \begin{macrocode}
      \bgroup \let\par\@empty
       \let\@sharp##\let\protect\relax
       \lineskip\z@skip\baselineskip\z@skip\@preamble}
%    \end{macrocode}
% \end{macro}
%
%  \begin{macro}{\@arraycr}
% array version of |\\|.
%    \begin{macrocode}
\def\@arraycr{%
  ${\ifnum0=`}\fi\@ifstar\@xarraycr\@xarraycr}
%    \end{macrocode}
% \end{macro}
%
%  \begin{macro}{\@arraycr}
%    \begin{macrocode}
\def\@xarraycr{\@ifnextchar[\@argarraycr{\ifnum0=`{\fi}${}\cr}}
%    \end{macrocode}
% \end{macro}
%
%  \begin{macro}{\@argarraycr}
%    \begin{macrocode}
\def\@argarraycr[#1]{%
  \ifnum0=`{\fi}${}\ifdim #1>\z@ \@xargarraycr{#1}\else
   \@yargarraycr{#1}\fi}
%    \end{macrocode}
% \end{macro}
%
%  \begin{macro}{\tabularnewline}
% \changes{v1.0i}{1994/11/14}{(DPC) Macro added}
% \changes{v1.0k}{1994/12/08}{(DPC) made \cs{relax}}
%  \begin{macro}{\@tabularcr}
% tabular version of |\\|.
%    \begin{macrocode}
\def\@tabularcr{%
  {\ifnum0=`}\fi\@ifstar\@xtabularcr\@xtabularcr}
\let\tabularnewline\relax
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{oldcomments}
%
%    \begin{macrocode}
\def\@xtabularcr{\@ifnextchar[\@argtabularcr{\ifnum0=`{\fi}\cr}}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@argtabularcr[#1]{\ifnum0=`{\fi}\ifdim #1>\z@
   \unskip\@xargarraycr{#1}\else \@yargarraycr{#1}\fi}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@xargarraycr#1{\@tempdima #1\advance\@tempdima \dp \@arstrutbox
   \vrule \@height\z@ \@depth\@tempdima \@width\z@ \cr}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@yargarraycr#1{\cr\noalign{\vskip #1}}
%    \end{macrocode}
%
% \multicolumn{NUMBER}{FORMAT}{ITEM} ==
%  BEGIN
%  \multispan{NUMBER}
%  \begingroup
%  \@addamp == null
%  \@mkpream{FORMAT}
%  \@sharp == ITEM
%  \protect == \relax
%  \@startpbox == \@@startpbox
%  \@endpbox == \@@endpbox
%  \@arstrut
%  \@preamble
%  \endgroup
%  END
%
% The command \def\@addamp{} was removed from \multicolumn on 6 Dec 86
% because it caused embedded array environments not to work.  I think
% that it was included originally to prevent an error message if
% the 2nd argument to the \multicolumn command had two column
% specifiers.
%
% 8 Feb 89 - \hbox{} added after \@preamble to correct bug that
%            occurred if \multicolumn preceded \\[D] with D > 0,
%            caused by \\[] command doing an \unskip, which removed
%            \tabcolsep glue inserted by \multicolumn
%
% \end{oldcomments}
% \changes{v1.0h}{1994/11/04}{(ASAJ) added \cs{set@typeset@protect}.} 
% \begin{oldcomments}
%
%    \begin{macrocode}
\def\multicolumn#1#2#3{\multispan{#1}\begingroup
  \@mkpream{#2}%
  \def\@sharp{#3}\set@typeset@protect
  \let\@startpbox\@@startpbox\let\@endpbox\@@endpbox
  \@arstrut \@preamble\hbox{}\endgroup\ignorespaces}
%    \end{macrocode}
%
% Codes for classes and character numbers of array, tabular and
% multicolumn arguments.
%
%    Character     Class       Number
%    ---------     -----       ------
%        c           0           0
%        l           0           1
%        r           0           2
%
%        |           1           -
%        @           2           -
%        p           3           -
%      {@-exp}       4           -
%      {p-arg}       5           -
%
% \@testpach \foo : expands \foo, which should be an array parameter
%           token, and sets \@chclass and \@chnum to its class and
%           number. Uses \@lastchclass to distinguish 4 and 5
%
% Preamble error codes
%    0: 'illegal character'
%    1: 'Missing @-exp'
%    2: 'Missing p-arg'
%
% \@addamp ==
%   BEGIN if @firstamp = true then @firstamp := false
%                             else &                     fi
%   END
%
% \@mkpream TOKENLIST ==
%   BEGIN
%    @firstamp     := T
%    \@lastchclass := 6
%    \@preamble    == null
%    \@sharp       == \relax
%    \protect      == BEGIN \noexpand\protect\noexpand END
%    \@startpbox   == \relax
%    \@endpbox     == \relax
%    \@expast{TOKENLIST}
%    for \@nextchar := expand(\reserved@a)
%      do  \@testpach{\@nextchar}
%          case of \@chclass
%            0 -> \@classz
%            1 -> \@classi
%              ...
%            5 -> \@classv
%          end case
%          \@lastchclass := \@chclass
%      od
%      case of \@lastchclass
%         0 -> \hskip \arraycolsep             % lrc
%         1 ->                                  % |
%         2 -> \@preamerr1 % 'Missing @-exp'    % @
%         3 -> \@preamerr2 % 'Missing p-arg'    % p
%         4 ->                                  % @-exp
%         5 -> \hskip \arraycolsep             % p-exp
%      end case
%   END
%
%  \@arrayclassz ==
%    BEGIN
%      \@preamble := \@preamble *
%               case of \@lastchclass
%                  0 -> \hskip \arraycolsep \@addamp \hskip \arraycolsep
%                  1 -> \@addamp \hskip \arraycolsep
%                  2 ->  % impossible
%                  3 ->  % impossible
%                  4 -> \@addamp
%                  5 -> \hskip \arraycolsep \@addamp \hskip \arraycolsep
%                  6 -> \@addamp \hskip \arraycolsep
%                end case
%              * case of \@chnum
%                   0 -> \hfil$\relax\@sharp$\hfil
%                   1 -> $\relax\@sharp$\hfil
%                   2 -> \hfil$\relax\@sharp$
%                end case
%    END
%
% \@tabclassz == similar to \@arrayclassz
%
% \@classi ==
%  BEGIN
%    \@preamble := \@preamble *
%                  case of \@lastchclass
%                     0 -> \hskip \arraycolsep \@arrayrule
%                     1 -> \hskip \doublerulesep \@arrayrule
%                     2 -> % impossible
%                     3 -> % impossible
%                     4 -> \@arrayrule
%                     5 -> \hskip \arraycolsep \@arrayrule
%                     6 -> \@arrayrule
%                  end case
%  END
%
% \@classii ==
%  BEGIN
%    \@preamble := \@preamble *
%                  case of \@lastchclass
%                     0    ->
%                     1    -> \hskip .5\arrayrulewidth
%                     2    -> % impossible
%                     else ->
%                  end case
%  END
%
% \@classiii ==
%  BEGIN
%    \@preamble := \@preamble *
%               case of \@lastchclass
%                  0 -> \hskip \arraycolsep \@addamp \hskip \arraycolsep
%                  1 -> \@addamp \hskip \arraycolsep
%                  2 -> % impossible
%                  3 -> % impossible
%                  4 -> \@addamp
%                  5 -> \hskip \arraycolsep \@addamp \hskip \arraycolsep
%                  6 -> \@addamp \hskip \arraycolsep
%                end case
%  END
%
% \@arrayclassiv  ==  
%      BEGIN  \@preamble := \@preamble * $ \@nextchar$  END
%
% \@tabclassiv   == same as \@arrayclassv except without the $ ... $
%
% \@classv ==
%   BEGIN
%    \@preamble := 
%        \@preamble * \@startpbox{\@nextchar}\ignorespaces\@sharp
%                               \@endpbox
%   END
%
% \@expast{S}: Sets \reserved@a := S with all instances of *{N}{STRING}
%              replaced by N copies of STRING, where N > 0.  An *
%              appearing inside braces is ignored, but *-expressions
%              inside STRING are expanded, so nested *-expressions are
%              handled properly.
%
% \@expast{S} == BEGIN  \@xexpast S *0x\@@  END
%
% \@xexpast S1 *{N}{S2} S3 \@@ ==
%  BEGIN
%    \reserved@a   := S1
%    \@tempcnta := N
%    if \@tempcnta > 0
%      then  while \@tempcnta > 0 do \reserved@a   := \reserved@a S2
%                                   \@tempcnta := \@tempcnta - 1 od
%            \reserved@b == \@xexpast
%      else  \reserved@b == \@xexnoop
%    fi
%    \expandafter \reserved@b \reserved@a S3 \@@
%  END
%
%
%    \begin{macrocode}
\def\@xexnoop #1\@@{}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@expast#1{\@xexpast #1*0x\@@}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@xexpast#1*#2#3#4\@@{\edef\reserved@a{#1}\@tempcnta#2\relax
    \ifnum\@tempcnta >\z@ \@whilenum\@tempcnta >\z@\do
       {\edef\reserved@a{\reserved@a#3}\advance\@tempcnta \m@ne}%
       \let\reserved@b\@xexpast
      \else \let\reserved@b\@xexnoop\fi
    \expandafter\reserved@b \reserved@a #4\@@}
%    \end{macrocode}
%
%    \begin{macrocode}
\newif\if@firstamp
\def\@addamp{\if@firstamp \@firstampfalse \else
    \edef\@preamble{\@preamble &}\fi}
\def\@arrayacol{\edef\@preamble{\@preamble \hskip \arraycolsep}}
\def\@tabacol{\edef\@preamble{\@preamble \hskip \tabcolsep}}
\def\@ampacol{\@addamp \@acol}
\def\@acolampacol{\@acol\@addamp\@acol}
%    \end{macrocode}
%
% \changes{v1.0h}{1994/11/04}{(ASAJ) Added \cs{@unexpandable@protect}
%    to \cs{@mkpream}.}
%    \begin{macrocode}
\def\@mkpream#1{\@firstamptrue\@lastchclass6
  \let\@preamble\@empty
  \let\protect\@unexpandable@protect
  \let\@sharp\relax
  \let\@startpbox\relax\let\@endpbox\relax
  \@expast{#1}%
  \expandafter\@tfor \expandafter
    \@nextchar \expandafter:\expandafter=\reserved@a\do
       {\@testpach\@nextchar
    \ifcase \@chclass \@classz \or \@classi \or \@classii \or \@classiii
      \or \@classiv \or\@classv \fi\@lastchclass\@chclass}%
  \ifcase \@lastchclass \@acol
      \or \or \@preamerr \@ne\or \@preamerr \tw@\or \or \@acol \fi}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@arrayclassz{\ifcase \@lastchclass \@acolampacol \or \@ampacol \or
   \or \or \@addamp \or
   \@acolampacol \or \@firstampfalse \@acol \fi
\edef\@preamble{\@preamble
  \ifcase \@chnum
     \hfil$\relax\@sharp$\hfil \or $\relax\@sharp$\hfil
    \or \hfil$\relax\@sharp$\fi}}
%    \end{macrocode}
%
% RmS 91/08/14 inserted extra braces around entry for NFSS
%    \begin{macrocode}
\def\@tabclassz{\ifcase \@lastchclass \@acolampacol \or \@ampacol \or
   \or \or \@addamp \or
   \@acolampacol \or \@firstampfalse \@acol \fi
\edef\@preamble{\@preamble{%
  \ifcase \@chnum
     \hfil\ignorespaces\@sharp\unskip\hfil
     \or \ignorespaces\@sharp\unskip\hfil
     \or \hfil\hskip\z@skip \ignorespaces\@sharp\unskip\fi}}}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@classi{\ifcase \@lastchclass \@acol \@arrayrule \or
   \@addtopreamble{\hskip \doublerulesep}\@arrayrule\or
   \or \or \@arrayrule \or
   \@acol \@arrayrule \or \@arrayrule \fi}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@classii{\ifcase \@lastchclass \or
   \@addtopreamble{\hskip .5\arrayrulewidth}\fi}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@classiii{\ifcase \@lastchclass \@acolampacol \or
   \@addamp\@acol \or
   \or \or \@addamp \or
   \@acolampacol \or \@ampacol \fi}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@tabclassiv{\@addtopreamble\@nextchar}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@arrayclassiv{\@addtopreamble{$\@nextchar$}}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@classv{\@addtopreamble{\@startpbox{\@nextchar}\ignorespaces
\@sharp\@endpbox}}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@addtopreamble#1{\edef\@preamble{\@preamble #1}}
%    \end{macrocode}
%
%    \begin{macrocode}
\newcount\@chclass
\newcount\@lastchclass
\newcount\@chnum
%    \end{macrocode}
%
%    \begin{macrocode}
\newdimen\arraycolsep
\newdimen\tabcolsep
\newdimen\arrayrulewidth
\newdimen\doublerulesep
%    \end{macrocode}
%
%    \begin{macrocode}
\def\arraystretch{1}    % Default value.
%    \end{macrocode}
%
%    \begin{macrocode}
\newbox\@arstrutbox
\def\@arstrut{%
  \relax\ifmmode\copy\@arstrutbox\else\unhcopy\@arstrutbox\fi}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@arrayrule{\@addtopreamble{\hskip -.5\arrayrulewidth
   \vrule \@width \arrayrulewidth\hskip -.5\arrayrulewidth}}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@testpach#1{\@chclass \ifnum \@lastchclass=\tw@ 4 \else
    \ifnum \@lastchclass=3 5 \else
     \z@ \if #1c\@chnum \z@ \else
                              \if #1l\@chnum \@ne \else
                              \if #1r\@chnum \tw@ \else
          \@chclass \if #1|\@ne \else
                    \if #1@\tw@ \else
                    \if #1p3 \else \z@ \@preamerr 0\fi
  \fi  \fi  \fi  \fi  \fi  \fi
\fi}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\hline{%
  \noalign{\ifnum0=`}\fi\hrule \@height \arrayrulewidth \futurelet
   \reserved@a\@xhline}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@xhline{\ifx\reserved@a\hline
               \vskip\doublerulesep
%    \end{macrocode}
% \end{oldcomments}
%    Measure from the middle of the rules.
% \changes{latex2e}{1993/12/16}{Measure from middle of vertical rules}
%
%    \begin{macrocode}
               \vskip-\arrayrulewidth
             \fi
      \ifnum0=`{\fi}}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\vline{\vrule \@width \arrayrulewidth}
%    \end{macrocode}
%
%    \begin{macrocode}
\newcount\@cla
\newcount\@clb
%    \end{macrocode}
%
%    \begin{macrocode}
\def\cline#1{\@cline[#1]}
\def\@cline[#1-#2]{\noalign{\global\@cla#1\relax
\global\advance\@cla\m@ne
\ifnum\@cla>\z@\global\let\@gtempa\@clinea\else
  \global\let\@gtempa\@clineb\fi
\global\@clb#2\relax
\global\advance\@clb-\@cla}\@gtempa
\noalign{\vskip-\arrayrulewidth}}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@clinea{\multispan\@cla&\multispan\@clb
\unskip\leaders\hrule \@height \arrayrulewidth \hfill
\cr}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@clineb{\multispan\@clb
\unskip\leaders\hrule \@height \arrayrulewidth \hfill
\cr}
%    \end{macrocode}
%

%
% \begin{macro}{\@startpbox}
% \begin{macro}{\@endpbox}
% Helper macros for `p' columns.
%
% |\@startpbox|\marg{width} \emph{text} |\egroup| is essentially
% |\parbox|\marg{width}\marg{text}
%
% |\@endpbox| is essentially  |\unskip \strut \par \egroup\hfil|
%  (Changed 14 Jan 89) (changed again 1994/05/13)
%
% \changes{v1.0d}{1994/05/03}
%     {Use \cs{@finalstrut} based on depth of \cs{@arstrutbox}}
%    \begin{macrocode}
\def\@startpbox#1{\vtop\bgroup \hsize #1\@arrayparboxrestore}
\def\@endpbox{\@finalstrut\@arstrutbox\par\egroup\hfil}
%    \end{macrocode}
%
% 14 Jan 89: Def of |\@endpbox| changed from\\
%    |\def\@endpbox{\par\vskip\dp\@arstrutbox\egroup\hfil}|\\
% so vertical spacing works out right if the last line of a `p' entry
% has a descender.
%
%    \begin{macrocode}
\let\@@startpbox=\@startpbox
\let\@@endpbox=\@endpbox
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%    \begin{macrocode}
%</2ekernel|autoload>
%    \end{macrocode}
%
% \Finale
%
