# How to “glue” the caption to the table (stay on the same page as the table)

Normally, my captions stay with the table
(cannot remember my exact example - couldn't replicate it - but I am now using the booktabs package anyway so let us take this one just in case this one is easy to solve...)

Can you see any reason here why the caption may not be "glued" to the table?
I want the caption to definitely stay on the same page (and in this case above the table)

\documentclass[a4paper,10pt]{scrartcl}
\usepackage{booktabs}
\usepackage{array}
\usepackage{dcolumn}
\begin{document}
\begin{table}
\caption{Investment overview}\label{tab:Invest}
\centering
\begin{tabular}{@{\raggedright}p{4.5cm}@{\kern-30pt}*{6}{>{\small}r}@{}}\toprule
\textit{Alternative 1}  &  Time of     & Year\\[-2pt]
&  investment  & 2006 & 2007 & 2008 & 2008 & 2010 \\ \bottomrule
\end{tabular}
\end{table}
\end{document}
-
When you say you "couldn't replicate it", does that mean you could not replicate any example where the described behaviour appears? In that case, it will be very difficult to help, I think. Also, with problems like this it's really important to add what documentclass you are using (that line is missing in your example). –  Jake Mar 23 '11 at 16:28
Might be an idea to also include the class. As it stands here any normal class would not break this across a page break. BTW: why do you use \hline as well? replace it with \bottomrule. You the following might also be useful \usepackage[tablelocation=top]{caption} (or something like that) –  daleif Mar 23 '11 at 16:30
@daleif @Jake just added \documentclass[a4paper,10pt]{scrartcl} –  user3992 Mar 23 '11 at 16:37
@daleif now using \bottomrule instead of \hline - thanks –  user3992 Mar 23 '11 at 16:39