There are multiple ways to force a table caption on top of the tables.
You could use the float
package and use the following code:
\usepackage{float}
\floatstyle{plaintop}
\restylefloat{table}
A drawback of this is that you can't have more than one caption per table
, i.e. you can't have two different tabular
s with two captions side-by-side.
If your table caption are already forced to be below the table (normally they are placed where the \caption
macro is used), some part of your thesis, maybe a custom package, might already use float
with different settings.
You can also set the table caption position to the top using:
\usepackage[tableposition=top]{caption}
However, this should only influence the vertical skip around the caption. Without this line the caption in your example should be already placed on top, just not with the correct distance.
Finally you can define a \captionabove
macro and place this at the begin of the table
environment. This macro uses the normal \caption
but uses the correct vertical spacing for top-captions (by compensating the spacing added by \caption
and adding the correct one).
(It would also be possible to swap the values of the \abovecaptionskip
and \belowcaptionskip
registers, but this requires grouping which has a negative impact on a \label
which follows.)
\makeatletter
\newcommand{\captionabove}[2][]{%
\vskip-\abovecaptionskip
\vskip+\belowcaptionskip
\ifx\@nnil#1\@nnil
\caption{#2}%
\else
\caption[#1]{#2}%
\fi
\vskip+\abovecaptionskip
\vskip-\belowcaptionskip
}
% If \captionof is required:
% Usage: \captionaboveof[<short caption>]{table}{<caption>}
\newcommand{\captionaboveof}[3][]{%
\vskip-\abovecaptionskip
\vskip+\belowcaptionskip
\def\@captype{#2}%
\ifx\@nnil#1\@nnil
\caption{#3}%
\else
\caption[#1]{#3}%
\fi
\vskip+\abovecaptionskip
\vskip-\belowcaptionskip
}
\makeatother
You can use the floatrow package to do this.
\documentclass{article}
\usepackage[capbesideposition=right]{floatrow}
\begin{document}
\begin{figure}
\fcapside
{\caption{A nice figure.}}
{\rule{4cm}{4cm}} %Replace with image
\end{figure}
\end{document}
Which yields:
Best Answer
You can use the
floatrow
package; a little example:Another option is the
sidecap
package: