% Float Support
% w/0 the LABEL arguement, they are assumed to be continued figure,
% and use the capcont command.
% cfloat:  adds centering.
\def\topfraction{0.90}
\def\textfraction{0.10} 
\def\floatpagefraction{0.50}
\def\dbltopfraction{0.90}
\def\dblfloatpagefraction{0.85}
\def\topline{\hrule\vskip 0.5\baselineskip}
\def\bottomline{\vskip 2pt\hrule}
\input captcont.sty
\def\inputverbatim#1{%
\begingroup \catcode``=13 \@noligs \tt \let\do\@makeother \dospecials
\obeylines \obeyspaces \frenchspacing \input{#1} \endgroup }

%% \tagfigure*[FLOAT]{FILE}{CAPTION}{LABEL}
%%    *		optional
%%    FLOAT	float options
%%    FILE	reads TPIC output in file figureFILE
%%    CAPTION	for list of figures
%%    LABEL	for \ref and \pageref
%\def\tagfigure{\@ifstar{\@stagfigure}{\@tagfigure}}
%\def\@tagfigure{\@ifnextchar[{\@@tagfigure}{\@@tagfigure[t]}}
%\def\@stagfigure{\@ifnextchar[{\@@stagfigure}{\@@stagfigure[t]}}
%
%\def\@@tagfigure[#1]#2{%
%    \@@@tagfigure[#1]{\input{figure#2}\relax\centerline{\box\graph}}}
%\def\@@stagfigure[#1]#2{%
%    \@@@stagfigure[#1]{\input{figure#2}\relax\centerline{\box\graph}}}
%

% \tagdiagram*[FLOAT]{FILE}{CAPTION}{LABEL}
%    *		optional
%    FLOAT	float options
%    FILE	reads LaTeX input in file Dfile
%    CAPTION	for list of figures
%    LABEL	for \ref and \pageref
\def\tagdiagram{\@ifstar{\@stagdiagram}{\@tagdiagram}}
\def\@tagdiagram{\@ifnextchar[{\@@tagdiagram}{\@@tagdiagram[t]}}
\def\@stagdiagram{\@ifnextchar[{\@@stagdiagram}{\@@stagdiagram[t]}}

\def\@@tagdiagram[#1]#2{\@@@tagfigure[#1]{\input{D#2}\relax}}
\def\@@stagdiagram[#1]#2{\@@@stagfigure[#1]{\input{D#2}\relax}}


% \tagverbatim*[FLOAT]{FILE}{CAPTION}{LABEL}
%    *		optional
%    FLOAT	float options
%    FILE	reads LaTeX input in file FILE and inserts in in verbatim mode.
%    CAPTION	for list of figures
%    LABEL	for \ref and \pageref
\def\tagverbatim{\@ifstar{\@stagverbatim}{\@tagverbatim}}
\def\@tagverbatim{\@ifnextchar[{\@@tagverbatim}{\@@tagverbatim[t]}}
\def\@stagverbatim{\@ifnextchar[{\@@stagverbatim}{\@@stagverbatim[t]}}

\def\@@tagverbatim[#1]#2{\@@@tagfigure[#1]{\inputverbatim{#2}}}
\def\@@stagverbatim[#1]#2{\@@@stagfigure[#1]{\inputverbatim{#2}}}


\def\@@@tagfigure[#1]#2#3#4{%
    \begin{figure}[#1]
        \protect\topline
	\begin{minipage}\columnwidth%
	\begin{center}%
	    \small#2%
	\end{center}%
	\end{minipage}%
	\vskip .5\baselineskip plus .5\baselineskip
	\begingroup
	    \setbox\z@=\hbox{#4}%
	    \ifdim\wd\z@>\z@
		\caption{#3}%
		\label{#4}%
	    \else
		\captcont{#3}%
	    \fi
	\endgroup
	\protect\bottomline
    \end{figure}
}

\def\@@@stagfigure[#1]#2#3#4{%
    \begin{figure*}[#1]
        \protect\topline
	\begin{minipage}\textwidth%
	 \begin{center}%
	    \small#2%
	 \end{center}%
	\end{minipage}
	\vskip .5\baselineskip plus .5\baselineskip
	\begingroup
	    \setbox\z@=\hbox{#4}%
	    \ifdim\wd\z@>\z@
		\caption{#3}%
		\label{#4}%
	    \else
		\captcont{#3}%
	    \fi
	\endgroup
	\protect\bottomline
    \end{figure*}
}


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

\def\@@tagtable[#1]#2#3#4{%
    \begin{table}[#1]
        \protect\topline
	\begin{minipage}\columnwidth%
	\begin{center}%
	    \small\input{T#2}\relax%
	\end{center}%
	\end{minipage}
	\vskip .5\baselineskip plus .5\baselineskip
	\begingroup
	    \setbox\z@=\hbox{#4}%
	    \ifdim\wd\z@>\z@
		\caption{#3}%
		\label{#4}%
	    \else
		\captcont{#3}%
	    \fi
	\endgroup
	\protect\bottomline
    \end{table}
}

\def\@@stagtable[#1]#2#3#4{%
    \begin{table*}[#1]
        \protect\topline
	\begin{minipage}\textwidth%
	\begin{center}%
	    \small\input{T#2}\relax
	\end{center}%
	\end{minipage}
	\vskip .5\baselineskip plus .5\baselineskip
	\begingroup
	    \setbox\z@=\hbox{#4}%
	    \ifdim\wd\z@>\z@
		\caption{#3}%
		\label{#4}%
	    \else
		\captcont{#3}%
	    \fi
	\endgroup
	\protect\bottomline
    \end{table*}
}

