% superfloat.sty:  a tagtable of a long (multi-page)
% table with page conyinuation.  requires loading
% of capcont.sty and supertab.sty.
% Set tablehead and tabletail before 
% tagsupertable call.
%
%
% don't interfere with supertabular.
\def\@tagstablee{}
\def\@tagstables{}
% The following are repeated from supertab
\def\@tablehead{\ }
\def\tablehead#1{\gdef\@tablehead{#1}}
\def\@tabletail{\ }
\def\tabletail#1{\gdef\@tabletail{#1}}
% The following are distinct names from supertab
\newcount\sfnumline  %
\newcount\sfmaxline %

\def\calmaxlinea{\global\sfmaxline=\textheight
\global\divide\sfmaxline by \baselineskip
\global\multiply\sfmaxline by 8
\global\divide\sfmaxline by 10
}
\def\@tablesep{\ }
\def\tablesep#1{\gdef\@tablesep{#1}}
\newenvironment{fsupertabular}[1]{  %
%\breaktable should come after \nextline.
\gdef\breaktable{%
        \@tabletail   %
        \end{tabular}%
	\@tagstablee
%        \clearpage   %
	\@tagstables
        \begin{tabular}{\tableformat}%
        \@tablehead %
        \global\sfnumline=0 %
}
\gdef\nextline{\global\advance\sfnumline by 1 \\
\ifnum\sfnumline=\sfmaxline
        \@tabletail   %
        \end{tabular}%
	\@tagstablee
%        \clearpage   %
	\@tagstables
        \begin{tabular}{\tableformat}%
        \@tablehead%
        \global\sfnumline=0%
\else\@tablesep%
\fi}%
\edef\tableformat{{#1}} %
\sfnumline=0       %
\calmaxlinea
\@tagstables
\begin{tabular}{\tableformat}\@tablehead}{\@tabletail \end{tabular}\@tagstablee}
%
%


% \tagsupertable*[FLOAT]{FILE}{CAPTION}{LABEL}
%    *		optional
%    FILE	read LaTeX input in file Tfile
%    FLOAT	float options
%    CAPTION	for list of tables
%    LABEL	for \ref and \pageref
\def\tagsupertable{\@ifstar{\@stagstable}{\@tagstable}}
\def\@tagstable{\@ifnextchar[{\@@tagstable}{\@@tagstable[t]}}
%\def\@stagstable{\@ifnextchar[{\@@stagstable}{\@@stagstable[t]}}

\def\@@tagstable[#1]#2#3#4{%
    \gdef\@tagstablecaption{\caption{#3}\label{#4}}
    \def\@tagstables{
    \begin{table}[#1]
	\hrule
	\vskip .5\baselineskip
	\begin{minipage}\textwidth
	\begin{center}}
     \def\@tagstablee{
	\end{center}
	\end{minipage}
	\vskip .5\baselineskip plus .5\baselineskip
	\@tagstablecaption
	\gdef\@tagstablecaption{\captcont{#3}}
	\vskip 2pt
	\hrule
    \end{table}}
	    \small\input{T#2}\relax
    \def\@tagstables{}
    \def\@tagstablee{}
}

