I'm trying to display a fairly complex table using Latex. Here is what I want it to look like (formatting, alignment, borders, columnspan, and rowspan). I would also like the columns to be fixed width (or at least have all the columns after the first one be the same width). Here is what I want it to look like:
Here is what I have so far:
And here is the code for it:
\begin{figure}[H]
\centerline{
{\small
\begin{tabular}{|p{1in}|p{.5in}|p{.5in}|p{.5in}|p{.5in}|}
\hline
\multirow{3}{*}{\textbf{A}} & \multicolumn{2}{c}{\textbf{B}} & \multicolumn{2}{c|}{\textbf{C}} \\
& Wrap Text 1 & Wrap Text 2 & Wrap Text 1 & Wrap Text 2 \\
\hline
\textbf{Heading 1} & 1 & 2 & 3 & 4 \\
\hline
\textbf{Heading 2} & 2 & 3 & 4 & 5 \\
\hline
\textbf{Heading 3} & 3 & 4 & 5 & 6 \\
\hline
\textbf{Total} & 6 & 9 & 12 & 15 \\
\hline
\end{tabular}
}
}
\caption{Still Not Working}
\end{figure}
I'm pretty stuck at this point. Whenever I fix one issue it seems to make it impossible to fix the others. Any help would be greatly appreciated.
Best Answer
Replicating your image:
The clue is to check the |'s in the
multicolumn
format specifiers carefully, to fix any missing rules.However, I prefer the layout below, it contains no vertical rules, and less horizontal rules. In general, I find it to be preferable to use as few rules as possible in tables. The example uses the
booktabs
package, for better-looking rules in tables.