[Tex/LaTex] How to i insert a big table in IEEE template

ieee-styletables

I am using IEEE template for my paper writing. Now i want to insert a table which is 11×12. So it needs to stretch to the two columns format in the IEEE format. I did like this:

\documentclass[conference]{IEEEtran}
\setlength{\extrarowheight}{1pt}
\begin{table}
 \caption{CIFAR-10 Confusion Matrix}
\label{my-label}
\begin{tabular}{|*{12}{p{1.11cm}|}}
\hline
labels     & airplane & automobile & bird & cat & deer & dog & frog & horse & ship & truck & accuracy \\ \hline
airplane   & 915      & 4          & 17   & 19  & 3    & 1   & 0    & 2     & 27   & 12    & 91.50\%  \\ \hline
automobile & 8        & 934        & 3    & 4   & 0    & 0   & 3    & 0     & 10   & 38    & 93.40\%  \\ \hline
bird       & 60       & 1          & 813  & 37  & 19   & 23  & 30   & 10    & 7    & 0     & 81.30\%  \\ \hline
cat        & 18       & 1          & 34   & 746 & 25   & 113 & 37   & 18    & 8    & 0     & 74.60\%  \\ \hline
deer       & 24       & 1          & 38   & 33  & 809  & 19  & 44   & 29    & 2    & 1     & 80.90\%  \\ \hline
dog        & 4        & 0          & 37   & 106 & 23   & 792 & 9    & 26    & 2    & 1     & 79.20\%  \\ \hline
frog       & 2        & 5          & 19   & 35  & 1    & 20  & 912  & 2     & 3    & 1     & 91.20\%  \\ \hline
horse      & 14       & 0          & 26   & 20  & 18   & 28  & 4    & 886   & 3    & 1     & 88.60\%  \\ \hline
ship       & 35       & 10         & 3    & 2   & 0    & 2   & 1    & 0     & 936  & 11    & 93.60\%  \\ \hline
truck      & 23       & 37         & 4    & 10  & 1    & 2   & 2    & 0     & 15   & 906   & 90.60\%  \\ \hline
\end{tabular}
\end{table}

and the output is:
enter image description here

The problem is that the caption is not centering between the two columns. How to do that??

How to center the table automatically between the two columns of IEEE format??

Best Answer

You need to use a table* environment instead of a table environment, to allow the float to take up the space of both columns.

In addition, you need to do something to reduce the width of the table. I suggest you use a tabularx environment instead of the tabular environment and that you use a centered version of the X column type for columns 2 thru 11. Use an l column type for the first column and a c column type for the final column. (If you really want to left-align all cell contents, use the X column type for columns 2 thru 11.)

Oh, and to try to give your table a more "open" look, say, by getting rid of all vertical lines and most horizontal lines and by generating well-spaced horizontal rules with the help of the booktabs package.

enter image description here

\documentclass[conference]{IEEEtran}
\usepackage{tabularx,booktabs}
\newcolumntype{C}{>{\centering\arraybackslash}X} % centered version of "X" type
\setlength{\extrarowheight}{1pt}
\usepackage{lipsum}
\begin{document}
\lipsum[1] % filler text
\begin{table*}
 \caption{CIFAR-10 Confusion Matrix}
\label{my-label}
\begin{tabularx}{\textwidth}{@{}l*{10}{C}c@{}}
\toprule
labels     & airplane & automobile & bird & cat & deer & dog & frog & horse & ship & truck & accuracy \\ 
\midrule
airplane   & 915      & 4          & 17   & 19  & 3    & 1   & 0    & 2     & 27   & 12    & 91.50\%  \\ 
automobile & 8        & 934        & 3    & 4   & 0    & 0   & 3    & 0     & 10   & 38    & 93.40\%  \\ 
bird       & 60       & 1          & 813  & 37  & 19   & 23  & 30   & 10    & 7    & 0     & 81.30\%  \\ 
cat        & 18       & 1          & 34   & 746 & 25   & 113 & 37   & 18    & 8    & 0     & 74.60\%  \\ 
deer       & 24       & 1          & 38   & 33  & 809  & 19  & 44   & 29    & 2    & 1     & 80.90\%  \\ 
\addlinespace
dog        & 4        & 0          & 37   & 106 & 23   & 792 & 9    & 26    & 2    & 1     & 79.20\%  \\ 
frog       & 2        & 5          & 19   & 35  & 1    & 20  & 912  & 2     & 3    & 1     & 91.20\%  \\ 
horse      & 14       & 0          & 26   & 20  & 18   & 28  & 4    & 886   & 3    & 1     & 88.60\%  \\ 
ship       & 35       & 10         & 3    & 2   & 0    & 2   & 1    & 0     & 936  & 11    & 93.60\%  \\ 
truck      & 23       & 37         & 4    & 10  & 1    & 2   & 2    & 0     & 15   & 906   & 90.60\%  \\ 
\bottomrule
\end{tabularx}
\end{table*}
\lipsum[2-15] % more filler text
\end{document}