# tabular can't caption is separated

I'm creating a table like this:

\captionof{table}{caption}
\begin{tabular}{@{} *5l @{}}\toprule
item1 & v1  & v2   \\
item2 & v1  & v2   \\
item2 & v1  & v2   \\
\hline
\label{table:label}
\end{tabular}


This way the caption gets separated from the table and if it reaches the end of the page the table might go to the next page while its caption remains on the previous page. If I move the caption inside tabular I get an error:

You can't use \hrule' here except with leaders.
\caption@hrule ->\hrule


and if I use \caption instead:

Package caption Error: \caption outside float


I've added these lines to use caption for my tables:

\usepackage[hypcap]{caption}
\captionsetup[table]{name=table}


Have you considered using the booktabs package?

This is your example a little re-arranged:

\documentclass{article}
\usepackage{booktabs}
\usepackage{caption}

\captionsetup[table]{position=top,labelfont={sc},textfont={sl}}

\renewcommand{\thetable}{\Roman {table}}

\begin{document}

\begin{table}
\centering
\caption{Table's caption}\label{tab:label}
\begin{tabular}{lll}
\toprule
\midrule
item1 & v1  & v2   \\
item2 & v1  & v2   \\
item2 & v1  & v2   \\
\bottomrule
\end{tabular}
\end{table}

\end{document}


• He's already using booktabs, partially at least. (Note the \toprule.) – Torbjørn T. Jun 6 '14 at 14:50
• I didn't noticed, I saw the \hline at the end. – Mario S. E. Jun 6 '14 at 14:54
• yea I forgot to mention I'm using booktabs as well. But this one works fine. Just one more thing. My doc is not in english but I want numerals in my table to be latin. How can I do that? – soroosh.strife Jun 6 '14 at 15:02
• You can do it with \renewcommand{\thetable}{\Roman{table}}`. See my updated answer – Mario S. E. Jun 6 '14 at 15:34