[Tex/LaTex] How to force table caption on top

captionsfloatspositioningtables

I have a table which works ok…as per example below. But in the thesis, the right column is centered and caption forced to below table. Is there a way I can make it look like?

\documentclass[12pt]{article} 
\begin{document}
\begin{table}[t]
\caption{Four months plan: where,what how}
\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}
\end{table}
\end{document}

Best Answer

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 tabulars 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