%
% This is a jiffy LaTeX package that enables coherent setting
% of the caption _above_ a figure or table
%
% Author: Robin Fairbairns (rf@cl.cam.ac.uk) 1994/11/18
%
% Works under 2e or 2.09
%
% Usage:  \usepackage{...,topcapt,...}                    (2e)
%         \documentstyle[...,topcapt,...]{whateverclass}  (2.09)
%
% defines a \topcaption command that sets a caption as if above the
% table (i.e., with the abovecaptionskip and the belowcaptionskip
% exchanged)

\@ifundefined{abovecaptionskip}{% in 2.09
  \newlength\abovecaptionskip
  \newlength\belowcaptionskip
  \setlength\abovecaptionskip{10pt}
  \setlength\belowcaptionskip{0pt}
  \long\def\@makecaption#1#2{%
    \vskip\abovecaptionskip
    \sbox\@tempboxa{#1: #2}%
    \ifdim \wd\@tempboxa >\hsize
      #1: #2\par
    \else
      \hbox to\hsize{\hfil\box\@tempboxa\hfil}%
    \fi
    \vskip\belowcaptionskip}
  }{% in 2e; everything's already set up as above
}

% \topcaption simply advances the caption count, sorts out the
% arguments and passes on to \@topcaption
\newcommand\topcaption{\refstepcounter\@captype
  \@dblarg{\@topcaption\@captype}} 

% \@topcaption swaps above and below caption skips and the relays its
% arguments to \@caption
\def\@topcaption#1[#2]#3{\@tempskipa\abovecaptionskip
  \abovecaptionskip\belowcaptionskip
  \belowcaptionskip\@tempskipa
  \@caption{#1}[#2]{#3}%
  \@tempskipa\abovecaptionskip
  \abovecaptionskip\belowcaptionskip
  \belowcaptionskip\@tempskipa}
