[Tex/LaTex] Caption on tabular environment

captionstables

I have got codes like the following (generated by Kile). How can I add a caption. I guess I should have used the table environment. Is there any solution now?

\newcommand{\mc}[3]{\multicolumn{#1}{#2}{#3}}
\begin{center}
\begin{tabular}{rccll}
     &   & \mc{3}{c}{Colin}\\
     &   & a & \mc{1}{c}{b} & \mc{1}{c}{c}\\\cline{3-5}
Rose & \mc{1}{c|}{A} & \mc{1}{c|}{(1,2)} & \mc{1}{c|}{(2,5)} & \mc{1}{c|}{(4,4)}\\\cline{3-5}
     & \mc{1}{c|}{B} & \mc{1}{c|}{(7,4)} & \mc{1}{c|}{(3,5)} & \mc{1}{c|}{(0,6)}\\\cline{3-5}
\end{tabular}
\end{center}

Best Answer

If you don't want to use a table environment, then you could use

\captionof{table}{Your caption here} 

from the caption package.

\documentclass{article}
\usepackage{caption}
\newcommand{\mc}[3]{\multicolumn{#1}{#2}{#3}}

\begin{document}
\begin{center}
\captionof{table}{Your caption here}
\begin{tabular}{rccll}
   &   & \mc{3}{c}{Colin}\\
   &   & a & \mc{1}{c}{b} & \mc{1}{c}{c}\\\cline{3-5}
Rose & \mc{1}{c|}{A} & \mc{1}{c|}{(1,2)} & \mc{1}{c|}{(2,5)} & \mc{1}   {c|}{(4,4)}\\\cline{3-5}
   & \mc{1}{c|}{B} & \mc{1}{c|}{(7,4)} & \mc{1}{c|}{(3,5)} & \mc{1}{c|}{(0,6)}  \\\cline{3-5}
\end{tabular}
\end{center}

 \end{document}

Of course, using this approach means that your tables do not float- depending on the size of your document, and how many tables & figures it contains, this could be a serious issue.

Related Question