% rsuperfloat.sty:  a tagtable of a long (multi-page)
% rotating version.
% 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{}
\def\tableendcommand{}
% 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\srfnumline  %
\newcount\srfmaxline %
\def\noautobreak{\gdef\calmaxlinea{\global\srfmaxline=10000}\global\srfmaxline=10000}
\def\calmaxlinea{\global\srfmaxline=\textwidth
\global\divide\srfmaxline by \baselineskip
\global\multiply\srfmaxline by 8
\global\divide\srfmaxline by 10
}
\def\@tablesep{\ }
\def\tablesep#1{\gdef\@tablesep{#1}}
\def\tablefont{\small}
\newenvironment{rfsupertabular}[1]{\tablefont%
%\breaktable should come after \nextline.
\gdef\breaktable{%
        \@tabletail   %
        \end{tabular}%
	\@tagrstablee
%        \clearpage   %
        \tableendcommand
	\@tagrstables\tablefont
        \begin{tabular}{\tableformat}%
        \@tablehead %
        \global\srfnumline=0 %
}
\gdef\nextline{\global\advance\srfnumline by 1 \\
\ifnum\srfnumline=\srfmaxline
        \@tabletail   %
        \end{tabular}%
	\@tagrstablee
%        \clearpage   %
	\@tagrstables\tablefont
        \begin{tabular}{\tableformat}%
        \@tablehead%
        \global\srfnumline=0%
\else\@tablesep%
\fi}%
\edef\tableformat{{#1}} %
\srfnumline=0       %
\tablefont\calmaxlinea
\@tagrstables\tablefont
\begin{tabular}{\tableformat}\@tablehead}{\@tabletail \end{tabular}\@tagrstablee}
%
%


% \tagrsupertable*[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\tagrsupertable{\@ifstar{\@stagrstable}{\@tagrstable}}
\def\@tagrstable{\@ifnextchar[{\@@tagrstable}{\@@tagrstable[t]}}
%\def\@stagrstable{\@ifnextchar[{\@@stagrstable}{\@@stagrstable[t]}}}

\def\@@tagrstable[#1]#2#3#4{%
    \gdef\@tagrstablecaption{\caption{#3}\label{#4}}
    \def\@tagrstables{
    \begin{table}[#1]
	% The hbox is needed because minipage exits to
	% paragraph mode, which screws things up.
	\begin{minipage}\textwidth\hspace*{\fill}\begin{rotbox}\hbox to\textheight%
	\bgroup\hss\noindent
	\noindent\begin{minipage}\textheight\hrule
	\vskip .5\baselineskip
	\begin{minipage}\textheight  % second needed for footnotes
	\begin{center}}
     \def\@tagrstablee{
	\end{center}
	\end{minipage}
	\vskip .5\baselineskip plus .5\baselineskip
	\@tagrstablecaption
	\gdef\@tagrstablecaption{\captcont{#3}}
	\vskip 2pt
	\hrule
	\end{minipage}\egroup\end{rotbox}\hspace*{\fill}\end{minipage}
    \end{table}}
	    \input{T#2}\relax
    \def\@tagrstables{}
    \def\@tagrstablee{}
}

