How to force table caption on top?
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
Even with the \caption
command placed after the tabular
environment, you may force the caption on top of the table by using the floatrow
package and its \floatsetup
macro.
\documentclass[12pt]{article}
\usepackage{floatrow}
\floatsetup[table]{capposition=top}
\begin{document}
\begin{table}[t]
\begin{tabular}{lclclclc}
\hline
\hline
Month & Week & Programme\\
\hline
May & 3-4 & Cycle Tour\\
June & 1-2 & DCP Project\\
July & 1-2 & Clean Energy\\
August & 3-4 & Interim Report\\
\hline
\end{tabular}
\caption{Four months plan: where,what how}
\end{table}
\end{document}
The location of the caption is traditionally underneath the float. However, it is up to you to therefore insert the caption command after the actual contents of the float (but still within the environment). If you place it before, then the caption will appear above the float. example:
\begin{figure}
\caption{A picture of a tucan.}
\begin{center}
\includegraphics{tucan.eps}
\end{center}
\end{figure}
Source: http://www.andy-roberts.net/writing/latex/floats_figures_captions