| 1 |
\@ifundefined{ProvidesPackage}{\def\ProvidesPackage#1[#2]{}}{} |
| 2 |
\ProvidesPackage{topcapt}[2004/12/11 v1.2 Caption at top of float] |
| 3 |
|
| 4 |
% Copyright 1994, 1998, 1999, 2004 Robin Fairbairns |
| 5 |
% |
| 6 |
% This program can redistributed and/or modified under the terms |
| 7 |
% of the LaTeX Project Public License Distributed from CTAN |
| 8 |
% archives in directory macros/latex/base/lppl.txt; either |
| 9 |
% version 1 of the License, or (at your option) any later version. |
| 10 |
% |
| 11 |
% This is a jiffy LaTeX package that enables coherent setting |
| 12 |
% of the caption _above_ a figure or table |
| 13 |
% |
| 14 |
% Author: Robin Fairbairns 1994/11/18 |
| 15 |
% Bugfix from Bernd Schandl incorporated 1998/12/31 |
| 16 |
% First stab at hyperref interworking 2004/12/11 |
| 17 |
% Copyright statement incorporated 1999/03/03 |
| 18 |
% |
| 19 |
% Works under 2e or 2.09 |
| 20 |
% |
| 21 |
% Usage: \usepackage{...,topcapt,...} (2e) |
| 22 |
% \documentstyle[...,topcapt,...]{whateverclass} (2.09) |
| 23 |
% |
| 24 |
% defines a \topcaption command that sets a caption as if above the |
| 25 |
% table (i.e., with the abovecaptionskip and the belowcaptionskip |
| 26 |
% exchanged) |
| 27 |
|
| 28 |
\@ifundefined{abovecaptionskip}{% in 2.09 |
| 29 |
\newlength\abovecaptionskip |
| 30 |
\newlength\belowcaptionskip |
| 31 |
\setlength\abovecaptionskip{10pt} |
| 32 |
\setlength\belowcaptionskip{0pt} |
| 33 |
\long\def\@makecaption#1#2{% |
| 34 |
\vskip\abovecaptionskip |
| 35 |
\sbox\@tempboxa{#1: #2}% |
| 36 |
\ifdim \wd\@tempboxa >\hsize |
| 37 |
#1: #2\par |
| 38 |
\else |
| 39 |
\hbox to\hsize{\hfil\box\@tempboxa\hfil}% |
| 40 |
\fi |
| 41 |
\vskip\belowcaptionskip} |
| 42 |
}{% in 2e; everything's already set up as above |
| 43 |
} |
| 44 |
|
| 45 |
% \topcaption simply advances the caption count, sorts out the |
| 46 |
% arguments and passes on to \@topcaption |
| 47 |
\newcommand\topcaption{% |
| 48 |
\@ifundefined{H@refstepcounter}% |
| 49 |
{\refstepcounter}{\H@refstepcounter}\@captype |
| 50 |
\@dblarg{\@topcaption\@captype}% |
| 51 |
} |
| 52 |
|
| 53 |
% \@topcaption swaps above and below caption skips and the relays its |
| 54 |
% arguments to \@caption |
| 55 |
\def\@topcaption#1[#2]#3{\@tempskipa\abovecaptionskip |
| 56 |
\abovecaptionskip\belowcaptionskip |
| 57 |
\belowcaptionskip\@tempskipa |
| 58 |
\@caption{#1}[{#2}]{#3}% |
| 59 |
\@tempskipa\abovecaptionskip |
| 60 |
\abovecaptionskip\belowcaptionskip |
| 61 |
\belowcaptionskip\@tempskipa} |