I would like to have a table that looks like the image below.
\documentclass{article}
\begin{document}
\begin{table*}
\begin{tabular}{|l|l|l|l|l|l|l|} \hline
&\multicolumn{3}{c|}{A} &\multicolumn{3}{c|}{B} \\ \cline{2-7}
1 & a & b & c & d & e & f \\ \hline
2 & g & h & i & j & k & l \\ \hline
\end{tabular}
\end{table*}
\end{document}
However, I cannot obtain the table with an entire empty row, like the cold cache, written in its center. Is there some way to do so?
I also want the caption below the table.
Best Answer
In the following code, I've provided two ways of reproducing the table that you're after. The first table aims to produce things as you requested. You were on the right track with
\multicolumn
. Note that I've made the default cell alignmentr
rather thanl
, as it looks as if most of the cells are right-aligned in the image that you've posted. For those that are left-aligned (i.e., those things in the first column), I've used a\multicolumn{1}{l}{...}
command to change the alignment of these particular cells.Finally, I would strongly recommend against creating a table like the way that you have requested. In particular, I would recommend reading the
booktabs
documentation (particularly section 2) for some recommendations about good typographical practices for typesetting tables.