%%
%% This is file `mdwtab.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% mdwtab.dtx  (with options: `mdwtab')
%% footnote.dtx  (with options: `macro')
%% doafter.dtx  (with options: `macro')
%% 
%% IMPORTANT NOTICE
%%
%% mdwtab package -- another rewrite of the tabular environment, etc.
%% Copyright (c) 1996 Mark Wooding
%%
%% This program is free software; you can redistribute it and/or modify
%% it under the terms of the GNU General Public License as published by
%% the Free Software Foundation; either version 2 of the License, or
%% (at your option) any later version.
%%
%% This program 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.  See the
%% GNU General Public License for more details.
%%
%% You should have received a copy of the GNU General Public License
%% along with this program; if not, write to the Free Software
%% Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{mdwtab}
                [1998/04/28 1.9 Table typesetting with style]
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%%
%%
\newcount\tab@state
\newcount\tab@columns
\newtoks\tab@preamble
\newtoks\tab@shortline
\toksdef\tab@pretext 4
\toksdef\tab@posttext 6
\toksdef\tab@userpretext 8
\newdimen\extrarowheight
\newdimen\tabextrasep
\newdimen\arrayextrasep
\newdimen\smarraycolsep
\newdimen\smarrayextrasep
\newdimen\tab@width
\newdimen\col@sep
\newdimen\tab@endheight
\newskip\tab@leftskip
\newskip\tab@rightskip
\newif\iftab@firstcol
\newif\iftab@initrule
\newif\iftab@rule
\newif\iftab@vgap
\tabextrasep\z@
\arrayextrasep\jot
\smarraycolsep\thr@@\p@
\smarrayextrasep\z@
\let\tab@extrasep\tabextrasep
\let\tab@penalty\relax
\def\@maybe@unskip{\ifhmode\hskip\m@ne\lastskip\relax\fi}
\def\q@delim{\q@delim}
\chardef\tab@startstate 0
\chardef\tab@loopstate 1
\chardef\tab@rulestate 1
\chardef\tab@prespcstate 2
\chardef\tab@prestate 3
\chardef\tab@colstate 4
\chardef\tab@poststate 5
\chardef\tab@postspcstate 6
\chardef\tab@limitstate 7
\def\tab@append#1#2{#1\expandafter{\the#1#2}}
\def\tab@prepend#1#2{%
  \toks@{#2}#1\expandafter{\the\expandafter\toks@\the#1}%
}
\def\tab@commit{%
  \iftab@firstcol\else%
    \expandafter\tab@append\expandafter\tab@preamble%
      \expandafter{\tab@tabtext}%
  \fi%
  \toks@\expandafter{\tab@midtext}%
  \tab@preamble\expandafter{%
    \the\expandafter\tab@preamble%
    \the\expandafter\tab@pretext%
    \the\expandafter\tab@userpretext%
    \the\expandafter\toks@%
    \the\tab@posttext%
  }%
  \tab@firstcolfalse%
  \tab@pretext{}%
  \tab@userpretext{}%
  \tab@posttext{}%
}
\def\tab@setstate#1{%
  \ifnum#1=\tab@state\else%
    \def\@tempa{\tab@setstate@i{#1}}%
    \@tempa%
  \fi%
}
\def\tab@setstate@i#1{%
  \global\advance\tab@state\@ne%
  \ifnum\tab@state>\tab@limitstate%
    \global\tab@state\tab@loopstate%
  \fi%
  \ifnum\tab@state=\tab@prespcstate%
    \iftab@initrule%
      \tab@initrulefalse%
    \else%
      \tab@looped%
      \tab@commit%
      \tab@append\tab@shortline{&\omit}%
    \fi%
  \fi%
  \ifnum#1=\tab@state%
    \let\@tempa\relax%
  \else%
    \csname tab@default@\number\tab@state\endcsname%
  \fi%
  \@tempa%
}
\@namedef{tab@default@2}{%
  \iftab@rule%
    \tab@append\tab@pretext{\hskip\col@sep}%
  \fi%
}
\@namedef{tab@default@4}{%
  \tab@err@misscol%
  \tab@append\tab@pretext{\tab@bgroup\relax}%
  \tab@append\tab@posttext{\relax\tab@egroup\hfil}%
  \tab@append\tab@shortline{\hfil}%
  \advance\tab@columns\@ne%
}
\@namedef{tab@default@6}{%
  \tab@append\tab@posttext{\hskip\col@sep}%
  \tab@ruletrue%
}
\def\tab@extracol#1#2{\tab@extracol@i#1#2\extracolsep{}\extracolsep\end}
\def\tab@extracol@i#1#2\extracolsep#3#4\extracolsep#5\end{%
  \ifx @#3@%
    \def\@tempa{#1{#2}}%
  \else%
    \def\@tempa{#1{#2\tabskip#3\relax#4}}%
  \fi%
  \@tempa%
}
\def\tabruletype#1{\tab@extracol\tabruletype@i{#1}}%
\def\tabruletype@i#1{%
  \iftab@initrule%
    \let\tab@tok\tab@pretext%
  \else%
    \let\tab@tok\tab@posttext%
  \fi%
  \ifnum\tab@state=\tab@rulestate%
    \tab@append\tab@tok{\hskip\doublerulesep\begingroup#1\endgroup}%
    \expandafter\tab@append\expandafter\tab@shortline\expandafter{%
      \expandafter\hskip\expandafter\doublerulesep%
      \expandafter\tab@ckr\expandafter{\the\tab@columns}%
        {\begingroup#1\endgroup}%
    }%
  \else%
    \tab@setstate\tab@rulestate%
    \tab@append\tab@tok{\begingroup#1\endgroup}%
    \expandafter\tab@append\expandafter\tab@shortline\expandafter{%
      \expandafter\tab@ckr\expandafter{\the\tab@columns}%
        {\begingroup#1\endgroup}%
    }%
  \fi%
  \tab@ruletrue%
}
\def\tabspctype#1{\tab@extracol\tabspctype@i{#1}}%
\def\tabspctype@i#1{%
  \tab@rulefalse%
  \ifnum\tab@state>\tab@prespcstate%
    \tab@setstate\tab@postspcstate%
    \let\tab@tok\tab@posttext%
  \else%
    \tab@setstate\tab@prespcstate%
    \let\tab@tok\tab@pretext%
  \fi%
  \tab@append\tab@tok{\begingroup#1\endgroup}%
}
\def\tabcoltype#1#2{%
  \ifnum\tab@state=\tab@colstate%
    \global\advance\tab@state\@ne%
  \fi%
  \advance\tab@columns\@ne%
  \tab@setstate\tab@colstate%
  \tab@append\tab@pretext{#1}%
  \tab@append\tab@posttext{#2}%
  \tab@append\tab@shortline{\hfil}%
}
\def\tabuserpretype#1{%
  \tab@setstate\tab@prestate%
  \tab@prepend\tab@userpretext{#1}%
}
\def\tabuserposttype#1{%
  \tab@setstate\tab@poststate%
  \tab@prepend\tab@posttext{#1}%
}
\def\tab@push#1#2{%
  \toks@{{#2}}%
  \expandafter\def\expandafter#1\expandafter{\the\expandafter\toks@#1}%
}
\def\tab@pop#1{\expandafter\def\expandafter#1\expandafter{\@gobble#1}}
\def\tab@head#1{\expandafter\tab@head@i#1\relax}
\def\tab@head@i#1#2\relax{#1}
\def\tab@colstack{{tabular}}
\def\colset{\colpop\colpush}
\def\colpush{\tab@push\tab@colstack}
\def\colpop{\tab@pop\tab@colstack}
\def\tab@colset{\tab@head\tab@colstack}
\def\tab@initread{%
  \global\tab@state\tab@startstate%
  \tab@preamble{}%
  \tab@shortline{}%
  \def\tab@tabtext{&}%
  \def\tab@midtext{\ignorespaces####\@maybe@unskip}%
  \tab@pretext{}%
  \tab@userpretext{}%
  \tab@posttext{}%
  \let\tab@multicol\@empty%
  \def\tab@startpause{\penalty\postdisplaypenalty\medskip}%
  \def\tab@endpause{\penalty\predisplaypenalty\medskip}%
  \tab@columns\z@%
  \let\tab@looped\relax%
  \tab@ruletrue%
  \tab@initruletrue%
  \tab@firstcoltrue%
}
\def\tab@readpreamble#1{%
  \tab@doreadpream{#1}%
  \iftab@initrule\global\tab@state\tab@prespcstate\fi%
  \tab@setstate\tab@rulestate%
  \tab@commit%
}
\def\tab@doreadpream#1{\tab@mkpreamble#1\q@delim}
\def\tab@mkpreamble{\futurelet\@let@token\tab@mkpreamble@i}
\def\tab@mkpreamble@i{%
  \ifx\@let@token\@sptoken%
    \expandafter\tab@mkpreamble@spc%
  \else%
    \expandafter\tab@mkpreamble@ii%
  \fi%
}
\def\tab@mkpreamble@ii{%
  \ifx\@let@token\q@delim%
    \def\@tempa{\let\@let@token}%
  \else%
    \ifcat\bgroup\noexpand\@let@token%
      \tab@err@oddgroup%
      \def\@tempa##1{\tab@mkpreamble}%
    \else%
      \let\@tempa\tab@mkpreamble@iii%
    \fi%
  \fi%
  \@tempa%
}
\def\tab@mkpreamble@iii#1{%
  \@ifundefined{\tab@colset!col.\string#1}{%
    \tab@err@undef{#1}\tab@mkpreamble%
  }{%
    \@nameuse{\tab@colset!col.\string#1}%
  }%
}
\@namedef{tab@mkpreamble@spc} {%
  \@ifundefined{\tab@colset!col. }{%
    \tab@mkpreamble%
  }{%
    \@nameuse{\tab@colset!col. }%
  }%
}
\def\coldef{\@ifnextchar[\coldef@i{\coldef@i[\tab@colset]}}
\def\coldef@i[#1]#2#3#{\coldef@ii[#1]{#2}{#3}}
\def\coldef@ii[#1]#2#3#4{%
  \expandafter\def\csname#1!col.\string#2\endcsname#3{%
    #4\tab@mkpreamble%
  }%
}
\def\collet{\@ifnextchar[\collet@i{\collet@i[\tab@colset]}}
\def\collet@i[#1]#2{%
  \@ifnextchar=%
    {\collet@ii[#1]{#2}}%
    {\collet@ii[#1]{#2}=}%
}
\def\collet@ii[#1]#2={%
  \@ifnextchar[%
    {\collet@iii[#1]{#2}}%
    {\collet@iii[#1]{#2}[\tab@colset]}%
}
\def\collet@iii[#1]#2[#3]#4{%
  \expandafter\let\csname#1!col.\string#2\expandafter\endcsname%
                  \csname#3!col.\string#4\endcsname%
}
\def\newcolumntype#1{\@ifnextchar[{\nct@i{#1}}{\nct@i#1[0]}}
\def\nct@i#1[#2]{\@ifnextchar[{\nct@ii{#1}[#2]}{\nct@iii{#1}{[#2]}}}
\def\nct@ii#1[#2][#3]{\nct@iii{#1}{[#2][#3]}}
\def\nct@iii#1#2#3{%
  \expandafter\let\csname\tab@colset!col.\string#1\endcsname\relax%
  \expandafter\newcommand\csname\tab@colset!col.\string#1\endcsname#2{%
    \tab@deepmagic{#1}%
    \tab@mkpreamble%
    #3%
  }%
}
\def\newcol@#1[#2]{\nct@iii{#1}{[#2]}}
\def\tab@deepmagic#1{%
  \csname NC@rewrite@\string#1\endcsname\NC@find\tab@@magic@@%
}
\def\NC@find#1\tab@@magic@@{}
\colset{tabular}
\coldef l{\tabcoltype{\kern\z@\tab@bgroup}{\tab@egroup\hfil}}
\coldef c{\tabcoltype{\hfil\tab@bgroup}{\tab@egroup\hfil}}
\coldef r{\tabcoltype{\hfil\tab@bgroup}{\tab@egroup}}
\coldef T#1{\tab@aligncol{#1}{\tab@btext}{\tab@etext}}
\coldef M#1{\tab@aligncol{#1}{\tab@bmaths}{\tab@emaths}}
\def\tab@aligncol#1#2#3{%
  \if#1l\tabcoltype{\kern\z@#2}{#3\hfil}\fi%
  \if#1c\tabcoltype{\hfil#2}{#3\hfil}\fi%
  \if#1r\tabcoltype{\hfil#2}{#3}\fi%
}
\coldef |{\tabruletype{\vrule\@width\arrayrulewidth}}
\coldef !#1{\tabruletype{#1}}
\coldef @#1{\tabspctype{#1}}
\coldef p#1{\tabcoltype%
             {\savenotes\vtop\tab@bpar{#1}}%
             {\tab@epar\spewnotes\hfil}}
\coldef m#1{\tabcoltype%
             {\savenotes$\vcenter\tab@bpar{#1}}%
             {\tab@epar$\spewnotes\hfil}}
\coldef b#1{\tabcoltype%
             {\savenotes\vbox\tab@bpar{#1}}%
             {\tab@epar\spewnotes\hfil}}
\coldef >#1{\tabuserpretype{#1}}
\coldef <#1{\tabuserposttype{#1}}
\coldef ##1#2{\tabcoltype{#1}{#2}}
\coldef *#1#2{%
  \count@#1%
  \loop\ifnum\count@>0\relax%
    \tab@doreadpream{#2}%
    \advance\count@\m@ne%
  \repeat%
}
\def\tab@bpar#1{%
  \bgroup%
  \hsize#1\relax%
  \@arrayparboxrestore%
  \setbox\z@\vtop\bgroup
  \global\@minipagetrue%
  \everypar{%
    \global\@minipagefalse%
    \everypar{}%
  }%
}
\def\tab@epar{%
  \ifhmode\@maybe@unskip\par\fi%
  \unskip%
  \ifdim\prevdepth>-\@m\p@\ifdim\prevdepth<\dp\@arstrutbox%
    \kern-\prevdepth%
    \nointerlineskip%
    \vtop to\dp\@arstrutbox{}%
  \fi\fi%
  \egroup%
  \ifdim\ht\z@<\ht\@arstrutbox%
    \vbox to\ht\@arstrutbox{}%
    \kern-\ht\z@%
  \fi%
  \unvbox\z@%
  \egroup%
}
\def\@mkpream#1{%
  \endgroup%
  \colset{tabular}%
  \tab@initread%
  \def\tab@multicol{\@arstrut}%
  \tab@preamble{\tab@multicol}%
  \def\tab@midtext{\ignorespaces\@sharp\@sharp\@maybe@unskip}%
  \tab@readpreamble{#1}%
  \gdef\@preamble{\the\tab@preamble}%
  \let\tab@bgroup\begingroup%
  \let\tab@egroup\endgroup%
  \begingroup%
}
\def\showpream#1{%
  \tab@initread%
  \tab@readpreamble{#1}%
  \showthe\tab@preamble%
  \showthe\tab@shortline%
}
\def\showcol#1{%
  \expandafter\show\csname\tab@colset!col.\string#1\endcsname%
}
\def\tab@array{%
  \tab@width\z@%
  \let\tab@bgroup\tab@bmaths%
  \let\tab@egroup\tab@emaths%
  \@tabarray%
}
\def\tab@btext{\begingroup}
\def\tab@bmaths{$}
\def\tab@etext{\endgroup}
\def\tab@emaths{\m@th$}
\def\array{%
  \col@sep\arraycolsep%
  \let\tab@extrasep\arrayextrasep%
  \tab@normalstrut%
  \tab@array%
}
\def\endarray{%
  \crcr%
  \egroup%
  \tab@right%
  \tab@restorehlstate%
}
\def\smarray{%
  \extrarowheight\z@%
  \col@sep\smarraycolsep%
  \let\tab@extrasep\smarrayextrasep%
  \def\tab@bmaths{$\scriptstyle}%
  \def\tab@btext{\begingroup\scriptsize}%
  \setbox\z@\hbox{\scriptsize\strut}%
  \dimen@\ht\z@\dimen\tw@\dp\z@\tab@setstrut%
  \tab@array%
}
\let\endsmarray\endarray
\providecommand\tabstyle{}
\def\@tabular#1{%
  \tabstyle%
  \tab@width#1%
  \let\tab@bgroup\tab@btext%
  \let\tab@egroup\tab@etext%
  \col@sep\tabcolsep%
  \let\tab@extrasep\tabextrasep%
  \tab@normalstrut%
  \@tabarray%
}
\def\tabular{\@tabular\z@}
\expandafter\let\csname tabular*\endcsname\@tabular
\let\endtabular\endarray
\expandafter\let\csname endtabular*\endcsname\endarray
\def\tab@setstrut{%
  \setbox\@arstrutbox\hbox{%
    \vrule%
      \@height\arraystretch\dimen@%
      \@depth\arraystretch\dimen\tw@%
      \@width\z@%
  }%
}
\def\tab@normalstrut{%
  \dimen@\ht\strutbox\advance\dimen@\extrarowheight%
  \dimen\tw@\dp\strutbox%
  \tab@setstrut%
}
\let\@arrayleft\relax%
\let\@arrayright\relax%
\def\@tabarray{%
  \let\@arrayleft\relax%
  \let\@arrayright\relax%
  \@ifnextchar[\@array{\@array[c]}%
}
\def\@array[#1]#2{%
  \edef\tab@restorehlstate{%
    \global\tab@endheight\the\tab@endheight%
    \gdef\noexpand\tab@hlstate{\tab@hlstate}%
  }%
  \def\tab@hlstate{n}%
  \colset{tabular}%
  \tab@initread%
  \def\tab@midtext{\tab@setcr\ignorespaces####\@maybe@unskip}%
  \def\tab@multicol{\@arstrut\tab@startrow}%
  \tab@preamble{\tab@multicol\tabskip\z@skip}%
  \tab@readpreamble{#2}%
  \tab@leftskip\z@skip%
  \tab@rightskip\z@skip%
  \tab@setposn{#1}%
  \ifdim\tab@width=\z@%
    \def\tab@halign{}%
  \else%
    \def\tab@halign{to\tab@width}%
  \fi%
  \lineskip\z@\baselineskip\z@%
  \m@th%
  \def\tabularnewline{\tab@arraycr\tab@penalty}%
  \tab@setcr%
  \let\par\@empty%
  \everycr{}\tabskip\tab@leftskip%
  \tab@left\halign\tab@halign\expandafter\bgroup%
    \the\tab@preamble\tabskip\tab@rightskip\cr%
}
\def\tab@setposn#1{%
  \def\tab@left{%
    \savenotes%
    \leavevmode\hbox\bgroup$\@arrayleft\vcenter\bgroup%
  }%
  \def\tab@right{%
    \egroup%
    \m@th\@arrayright$\egroup%
    \spewnotes%
  }%
  \global\tab@endheight\z@%
  \@tempswafalse%
  \let\tab@penalty\relax%
  \if#1t%
    \def\tab@left{%
      \savenotes%
      \leavevmode\setbox\z@\hbox\bgroup$\@arrayleft\vtop\bgroup%
    }%
    \def\tab@right{%
      \egroup%
      \m@th\@arrayright$\egroup%
      \tab@raisebase%
      \spewnotes%
    }%
    \gdef\tab@hlstate{t}%
    \global\tab@endheight\ht\@arstrutbox%
  \else\if#1b%
    \def\tab@left{%
      \savenotes%
      \leavevmode\setbox\z@\hbox\bgroup$\@arrayleft\vbox\bgroup%
    }%
    \def\tab@right{%
      \egroup%
      \m@th\@arrayright$\egroup%
      \tab@lowerbase%
      \spewnotes%
    }%
    \gdef\tab@hlstate{b}%
  \else%
    \if#1L\@tempswatrue\fi%
    \if#1C\@tempswatrue\fi%
    \if#1R\@tempswatrue\fi%
  \fi\fi%
  \if@tempswa\ifhmode%
    \ifinner\tab@err@unbrh\@tempswafalse\else\par\fi%
  \fi\fi%
  \if@tempswa\ifmmode\tab@err@unbmm\@tempswafalse\fi\fi%
  \if@tempswa\ifx\@arrayleft\relax\else%
    \tab@err@unbext\@tempswafalse%
  \fi\fi%
  \if@tempswa%
    \def\tab@left{\vskip\parskip\medskip}%
    \def\tab@right{\par\@endpetrue\global\@ignoretrue}%
    \tab@leftskip\@totalleftmargin%
    \tab@rightskip\hsize%
    \advance\tab@rightskip-\linewidth%
    \advance\tab@rightskip-\@totalleftmargin%
    \ifdim\tab@width=\z@%
      \if#1L\else\advance\tab@leftskip\z@\@plus10000fill\fi%
      \if#1R\else\advance\tab@rightskip\z@\@plus10000fill\fi%
    \else%
      \dimen@\linewidth%
      \advance\dimen@-\tab@width%
      \if#1L\advance\tab@rightskip\dimen@\fi%
      \if#1R\advance\tab@leftskip\dimen@\fi%
      \if#1C%
        \advance\tab@leftskip.5\dimen@%
        \advance\tab@rightskip.5\dimen@%
      \fi%
    \fi%
    \def\tab@penalty{\penalty\@M}%
    \tab@width\hsize%
  \fi%
}
\def\tab@hlstate{n}
\def\tab@addruleheight#1{%
  \if\tab@hlstate n\else%
    \global\advance\tab@endheight#1\relax%
  \fi%
}
\def\tab@startrow{%
  \if\tab@hlstate t%
    \gdef\tab@hlstate{n}%
  \else\if\tab@hlstate b%
    \global\tab@endheight\dp\@arstrutbox%
  \fi\fi%
}
\def\tab@raisebase{%
  \global\advance\tab@endheight-\ht\z@%
  \raise\tab@endheight\box\z@%
}
\def\tab@lowerbase{%
  \global\advance\tab@endheight-\dp\z@%
  \lower\tab@endheight\box\z@%
}
\def\tabpause#{%
  \noalign{\ifnum0=`}\fi%
  \@parboxrestore%
  \tab@startpause%
  \vskip-\parskip%
  \parshape\@ne\@totalleftmargin\linewidth%
  \noindent%
  \doafter\tabpause@i%
}
\def\tabpause@i{%
  \nobreak%
  \tab@endpause%
  \ifnum0=`{\fi}%
}
\long\def\multicolumn#1#2#3{%
  \multispan{#1}%
  \begingroup%
    \tab@multicol%
    \tab@initread%
    \tab@preamble{}%
    \long\def\tab@midtext{#3}%
    \let\tab@looped\tab@err@multi%
    \tab@readpreamble{#2}%
    \the\tab@preamble%
  \endgroup%
  \ignorespaces%
}
\def\ranges#1#2{%
  \gdef\ranges@temp{#1}%
  \begingroup%
  \ranges@i#2 \q@delim%
}
\def\ranges@i{%
  \@ifnextchar\q@delim\ranges@done{\afterassignment\ranges@ii\count@}%
}
\def\ranges@ii{%
  \@ifnextchar-\ranges@iii{\ranges@do\count@\count@\ranges@v}%
}
\def\ranges@iii-{\afterassignment\ranges@iv\@tempcnta}
\def\ranges@iv{\ranges@do\count@\@tempcnta\ranges@v}
\def\ranges@v{%
  \@ifnextchar,%
    \ranges@vi%
    {%
      \@ifnextchar\q@delim%
        \ranges@done%
        {\tab@err@range\ranges@vi,}%
    }%
}
\def\ranges@vi,{\afterassignment\ranges@ii\count@}
\def\ranges@do#1#2{%
  \ifnum#1>#2\else%
    \expandafter\endgroup%
    \expandafter\ranges@temp%
    \expandafter{%
    \the\expandafter#1%
    \expandafter}%
    \expandafter{%
    \the#2%
    }%
    \begingroup%
  \fi%
}
\def\ranges@done\q@delim{\endgroup}
\def\ifinrange#1#2{%
  \@tempswafalse%
  \count@#1%
  \ranges\ifinrange@i{#2}%
  \if@tempswa%
    \expandafter\@firstoftwo%
  \else%
    \expandafter\@secondoftwo%
  \fi%
}
\def\ifinrange@i#1#2{%
  \ifnum\count@<#1 \else\ifnum\count@>#2 \else\@tempswatrue\fi\fi%
}
\def\hline{%
  \tab@dohline%
  \noalign{\ifnum0=`}\fi%
  \tab@penalty%
  \futurelet\@let@token\hline@i%
}
\def\hline@i{%
  \ifx\@let@token\hline%
    \vskip\doublerulesep%
    \tab@addruleheight\doublerulesep%
  \fi%
  \ifnum0=`{\fi}%
}
\def\tab@dohline{%
  \multispan{\tab@columns}%
  \leaders\hrule\@height\arrayrulewidth\hfil%
  \tab@addruleheight\arrayrulewidth%
  \cr%
}
\renewcommand\vline[1][\arrayrulewidth]{\vrule\@width#1\relax}
\def\cline#1{%
  \noalign{\kern-.5\arrayrulewidth\tab@penalty}%
  \omit%
  \global\tab@state\@ne%
  \ranges\cline@i{#1}%
  \cr%
  \noalign{\kern-.5\arrayrulewidth\tab@penalty}%
}
\def\cline@i#1#2{%
  \ifnum#1<\tab@state\relax%
    \tab@@cr%
    \noalign{\kern-\arrayrulewidth\tab@penalty}%
    \omit%
    \global\tab@state\@ne%
  \fi%
  \@whilenum\tab@state<#1\do{%
    \hfil\tab@@tab@omit%
    \global\advance\tab@state\@ne%
  }%
  \ifnum\tab@state>\@ne%
    \kern-\arrayrulewidth%
  \fi%
  \@whilenum\tab@state<#2\do{%
    \tab@@span@omit%
    \global\advance\tab@state\@ne%
  }%
  \leaders\hrule\@height\arrayrulewidth\hfill%
}
\def\tab@@cr{\cr}
\def\tab@@tab@omit{&\omit}
\def\tab@@span@omit{\span\omit}
\def\tab@checkrule#1{%
  \count@#1\relax%
  \expandafter\ifinrange%
  \expandafter\count@%
  \expandafter{\tab@xcols}%
    {\tab@checkrule@i}%
    {}%
}
\def\tab@checkrule@i#1{\setbox\z@\hbox{#1}\hb@xt@\wd\z@{}}
\def\vgap{%
  \noalign{\nobreak}%
  \omit%
  \global\let\vgap@after\@empty%
  \iffalse{\fi\ifnum0=`}\fi%
  \@ifnextchar[\vgap@i\vgap@simple%
}
\def\vgap@i[#1]{\vgap@spec{#1}}
\def\vgap@spec#1#2{%
  \gdef\tab@xcols{#1}%
  \global\let\tab@ckr\tab@checkrule%
  \vgap@do{#2}%
}
\def\vgap@simple#1{%
  \global\let\tab@ckr\@gobble%
  \vgap@do{#1}%
}
\def\vgap@do#1{%
  \ifnum0=`{}\fi%
  \global\tab@vgaptrue%
  \the\tab@shortline%
    \vrule\@height#1\@width\z@%
    \global\tab@vgapfalse
    \tab@addruleheight{#1}%
    \cr%
  \noalign{\nobreak}%
  \vgap@after%
}
\def\hlx#1{\hlx@loop#1\q@delim}
\def\hlx@loop#1{%
  \ifx#1\q@delim\else%
    \@ifundefined{hlx@cmd@\string#1}{%
      \expandafter\hlx@loop%
    }{%
      \csname hlx@cmd@\string#1\expandafter\endcsname%
    }%
  \fi%
}
\def\hlxdef#1{\@namedef{hlx@cmd@#1}}
\hlxdef h#1{%
  \noalign{%
    \ifx#1h%
      \def\@tempa{\hline\hline\hlx@loop}%
    \else%
      \def\@tempa{\hline\hlx@loop#1}%
    \fi%
    \expandafter
  }%
  \@tempa%
}
\hlxdef b{\noalign{\kern-\arrayrulewidth}\hlx@loop}
\hlxdef /{%
  \noalign{\ifnum0=`}\fi%
  \@ifnextchar[\hlx@cmd@break@i{\hlx@cmd@break@i[0]}%
}
\def\hlx@cmd@break@i[#1]{\ifnum0=`{\fi}\pagebreak[0]\hlx@loop}
\hlxdef v{%
  \noalign{\nobreak}%
  \omit%
  \iffalse{\fi\ifnum0=`}\fi%
  \global\let\vgap@after\hlx@loop%
  \@ifnextchar[\hlx@vgap@i{\hlx@vgap@ii\vgap@simple}%
}
\def\hlx@vgap@i[#1]{%
  \ifx!#1!%
    \def\@tempa{\hlx@vgap@ii\vgap@simple}%
  \else%
    \def\@tempa{\hlx@vgap@ii{\vgap@spec{#1}}}%
  \fi%
  \@tempa%
}
\def\hlx@vgap@ii#1{%
  \@ifnextchar[{\hlx@vgap@iii{#1}}{\hlx@vgap@iii{#1}[\doublerulesep]}%
}
\def\hlx@vgap@iii#1[#2]{#1{#2}}
\hlxdef s{%
  \noalign{\ifnum0=`}\fi%
  \nobreak%
  \@ifnextchar[\hlx@space@i{\hlx@space@i[\doublerulesep]}%
}
\def\hlx@space@i[#1]{%
  \vskip#1%
  \tab@addruleheight{#1}%
  \ifnum0=`{\fi}%
  \hlx@loop%
}
\hlxdef c#1{\cline{#1}\hlx@loop}
\hlxdef .#1\q@delim{%
  \ifx @#1@\else%
    \PackageWarning{mdwtab}{%
      Ignoring \protect\hlx\space command characters following a
      `.'\MessageBreak command%
    }%
  \fi%
  \ignorespaces%
}
\def\@arraycr{\tab@arraycr{}}
\def\tab@arraycr#1{\tab@cr{\tab@tabcr{#1}}{}{}}
\def\tab@tabcr#1#2{%
  \dimen@#2%
  \advance\dimen@\tab@extrasep%
  \ifdim\dimen@>\z@%
    \ifvmode%
      \unskip\ifdim\prevdepth>-\@m\p@\kern-\prevdepth\fi%
      \nointerlineskip\expandafter\hbox%
    \else%
      \@maybe@unskip\expandafter\@firstofone%
    \fi%
    {\advance\dimen@\dp\@arstrutbox\vrule\@depth\dimen@\@width\z@}%
  \fi%
  \global\dimen\@ne\dimen@%
  \cr%
  \noalign{%
    #1%
    \ifdim\dimen\@ne<\z@\vskip\dimen\@ne\relax\fi%
  }%
  \@gobble%
}
\def\tab@setcr{\let\\\tabularnewline}
\def\tab@cr#1#2#3{%
  \relax%
  \iffalse{\fi\ifnum0=`}\fi%
  \@ifstar{\tab@cr@i{#1}{#3}}{\tab@cr@i{#1}{#2}}%
}
\def\tab@cr@i#1#2{%
  \@ifnextchar[{\tab@cr@ii{#1}{#2}}{\tab@cr@ii{#1}{#2}[\z@]}%
}
\def\tab@cr@ii#1#2[#3]{%
  \ifnum0=`{}\fi%
  #1{#3}{#2}%
}
\begingroup
\catcode`.=11
\def\@tempa#1 #2 #3\@@{#1 #2}
\xdef\ver@array.sty
  {1995/11/19 [mdwtab.sty \expandafter\@tempa\ver@mdwtab.sty\@@]}
\endgroup
\def\tab@error{\PackageError{mdwtab}}
\def\tab@err@misscol{%
  \tab@error{Missing column type}{%
    I'm lost.  I was expecting something describing^^J%
    the type of the current column, but you seem to^^J%
    have missed it out.  I've inserted a type `l'^^J%
    column here in the hope that this makes sense.%
  }%
}
\def\tab@err@oddgroup{%
  \tab@error{Misplaced group in table preamble}{%
    I've found an open brace character in your preamble^^J%
    when I was expecting a specifier character.  I'm^^J%
    going to gobble the whole group and carry on as if^^J%
    I'd never seen it.%
  }%
}
\def\tab@err@undef#1{%
  \tab@error{Unknown `\tab@colset' preamble character `\string#1'}{%
    I don't understand what you meant by typing this^^J%
    character.  Anyway, I'll ignore it this time around.^^J%
    Just don't you do it again.%
  }%
}
\def\tab@err@unbrh{%
  \tab@error{Can't use unboxed tabular in LR mode}{%
    You've asked for a tabular or array environment with^^J%
    `L', `C' or `R' as the position specifier, but you're^^J%
    in LR (restricted horizontal) mode, so it won't work.^^J%
    I'll assume you really meant `c' and soldier on.%
  }%
}
\def\tab@err@unbmm{%
  \tab@error{Can't use unboxed tabular in maths mode}{%
    You've asked for a tabular or array environment with^^J%
    `L', `C' or `R' as the position specifier, but you're^^J%
    in maths mode, so it won't work.  I'll pretend that^^J%
    you really typed `c', and that this is all a bad dream.%
  }%
}
\def\tab@err@unbext{%
  \tab@error{Can't extend unboxed tabulars}{%
    You're trying to use kludgy extensions (e.g.,^^J%
    `delarray') on an array or tabular with `L', `C'^^J%
    or `R' as the position specifier.  I'll assume you^^J%
    subconsciously wanted a `c' type all along.%
  }%
}
\def\tab@err@multi{%
  \tab@error{More than one column in a \protect\multicolumn}{%
    You've put more than one column into a \string\multicolumn^^J%
    descriptor.  It won't work.  I have no idea what^^J%
    will happen, although it won't be pleasant.  Hold^^J%
    on tight now...%
  }%
}
\def\tab@err@range{%
  \tab@error{Expected `,' or `<end>' in range list}{%
    I was expecting either the end of the range list,^^J%
    or a comma, followed by another range.  I've^^J%
    inserted a comma to try and get me back on track.^^J%
    Good luck.%
  }%
}
%%
%% footnote package -- Save footnotes around boxing environments
%% Copyright (c) 1996 Mark Wooding
%%
\ifx\fn@notes\@@undefined%
  \newbox\fn@notes%
\fi
\newdimen\fn@width
\let\fn@colwidth\columnwidth
\newif\if@savingnotes
\def\fn@startnote{%
  \hsize\fn@colwidth%
  \interlinepenalty\interfootnotelinepenalty%
  \reset@font\footnotesize%
  \floatingpenalty\@MM% Is this right???
  \@parboxrestore%
  \protected@edef\@currentlabel{\csname p@\@mpfn\endcsname\@thefnmark}%
  \color@begingroup%
}
\let\fn@endnote\color@endgroup
\def\fn@fntext#1{%
  \ifx\ifmeasuring@\@@undefined%
    \expandafter\@secondoftwo\else\expandafter\@iden%
  \fi%
  {\ifmeasuring@\expandafter\@gobble\else\expandafter\@iden\fi}%
  {%
    \global\setbox\fn@notes\vbox{%
      \unvbox\fn@notes%
      \fn@startnote%
      \@makefntext{%
        \rule\z@\footnotesep%
        \ignorespaces%
        #1%
        \@finalstrut\strutbox%
      }%
      \fn@endnote%
    }%
  }%
}
\def\savenotes{%
  \begingroup%
  \if@savingnotes\else%
    \@savingnotestrue%
    \let\@footnotetext\fn@fntext%
    \let\@mpfootnotetext\fn@fntext%
    \fn@width\columnwidth%
    \let\fn@colwidth\fn@width%
    \global\setbox\fn@notes\box\voidb@x%
    \let\fn@thempfn\thempfn%
    \let\fn@mpfn\@mpfn%
    \ifx\@minipagerestore\relax\let\@minipagerestore\@empty\fi%
    \expandafter\def\expandafter\@minipagerestore\expandafter{%
      \@minipagerestore%
      \let\thempfn\fn@thempfn%
      \let\@mpfn\fn@mpfn%
    }%
  \fi%
}
\def\spewnotes{%
  \endgroup%
  \if@savingnotes\else\ifvoid\fn@notes\else\begingroup%
    \let\@makefntext\@empty%
    \let\@finalstrut\@gobble%
    \let\rule\@gobbletwo%
    \@footnotetext{\unvbox\fn@notes}%
  \endgroup\fi\fi%
}
\let\endsavenotes\spewnotes
%%
%% doafter package -- insert a token really after a group
%% Copyright (c) 1996 Peter Schmitt and Mark Wooding
%%
\let\@@aftergroup\aftergroup
\def\doafter#1{%
  \def\@tempa{\@@aftergroup#1}%
  \afterassignment\doafter@i\let\@let@token%
}
\def\doafter@i{%
  \@let@token%
  \let\aftergroup\@my@aftergroup%
  \@@aftergroup\@prepare@after\@tempa%
}
\def\ag@cnt@local{0 }
\let\ag@cnt@global\ag@cnt@local
\def\@my@aftergroup{%
  \begingroup%
    \count@\ag@cnt@local%
    \advance\count@\@ne%
    \xdef\ag@cnt@global{\the\count@\space}%
  \endgroup%
  \let\ag@cnt@local\ag@cnt@global%
  \@@aftergroup\@after@token\@@aftergroup%
}
\def\@after@token{%
  \@start@after@group%
  \@after@token%
}
\def\@start@after@group{%
  \begingroup%
  \count@\ag@cnt@global%
  \clubpenalty\ag@cnt@local%
  \let\@after@token\@after@token@i%
}
\def\@after@token@i{%
  \advance\count@\m@ne%
  \ifnum\count@=\clubpenalty%
    \global\let\ag@cnt@global\ag@cnt@local%
    \expandafter\@after@aftertoken\expandafter\@after@all%
  \else%
    \expandafter\@@aftergroup%
  \fi%
}
\let\@after@all\endgroup
\def\@prepare@after{%
  \ifx\ag@cnt@local\ag@cnt@global\else%
    \expandafter\@prepare@after@i%
  \fi%
}
\def\@prepare@after@i#1{%
  \@start@after@group%
  \def\@after@all{\@@aftergroup#1\endgroup}%
}
\def\@after@aftertoken#1{%
  \let\bgroup\relax\let\egroup\relax%
  \toks@{#1}%
  \futurelet\@let@token\@after@aftertoken@i%
}
\def\@after@aftertoken@i{%
  \ifcat\noexpand\@let@token{%
    \@@aftergroup{%
  \else\ifcat\noexpand\@let@token}%
    \@@aftergroup}%
  \else%
    \def\@tempa##1{\@@aftergroup##1\the\toks@}%
    \expandafter\expandafter\expandafter\@tempa%
  \fi\fi%
}
\endinput
%%
%% End of file `mdwtab.sty'.
