summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/ltxmisc/topcapt.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-01-12 23:58:22 +0000
committerKarl Berry <karl@freefriends.org>2006-01-12 23:58:22 +0000
commitc6b827c6f5aab4beff40b7bef80e869c6815d826 (patch)
tree1ed61d883ba88897fbf68a71547b4a7286e57368 /Master/texmf-dist/tex/latex/ltxmisc/topcapt.sty
parent7f9543ffaf295484b99beae71350a519562df613 (diff)
ltxmisc
git-svn-id: svn://tug.org/texlive/trunk@1056 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/ltxmisc/topcapt.sty')
-rw-r--r--Master/texmf-dist/tex/latex/ltxmisc/topcapt.sty61
1 files changed, 61 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/ltxmisc/topcapt.sty b/Master/texmf-dist/tex/latex/ltxmisc/topcapt.sty
new file mode 100644
index 00000000000..c5b7d8ddcb0
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/ltxmisc/topcapt.sty
@@ -0,0 +1,61 @@
+\@ifundefined{ProvidesPackage}{\def\ProvidesPackage#1[#2]{}}{}
+\ProvidesPackage{topcapt}[2004/12/11 v1.2 Caption at top of float]
+
+% Copyright 1994, 1998, 1999, 2004 Robin Fairbairns
+%
+% This program can redistributed and/or modified under the terms
+% of the LaTeX Project Public License Distributed from CTAN
+% archives in directory macros/latex/base/lppl.txt; either
+% version 1 of the License, or (at your option) any later version.
+%
+% This is a jiffy LaTeX package that enables coherent setting
+% of the caption _above_ a figure or table
+%
+% Author: Robin Fairbairns 1994/11/18
+% Bugfix from Bernd Schandl incorporated 1998/12/31
+% First stab at hyperref interworking 2004/12/11
+% Copyright statement incorporated 1999/03/03
+%
+% 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{%
+ \@ifundefined{H@refstepcounter}%
+ {\refstepcounter}{\H@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}