I'm trying to use the booktabs
package, and I'm trying to make tables with "column groups" that are delimited by extra space. In the following, I am doing this using the @{}
syntax in the tabular
environment header. Unfortunately, however, this seems to ruin the alignment of the multicolumns
and the cmidrules
. Any ideas how I can fix this?
\documentclass{article}
\usepackage{booktabs}
\begin{document}
\begin{table}
\centering
\begin{tabular}{cc @{\hskip 4\tabcolsep}
*{2}{c} @{\hskip 4\tabcolsep}
*{2}{c} @{\hskip 4\tabcolsep}
*{2}{c} }
\toprule
& & \multicolumn{2}{c}{A} & \multicolumn{2}{c}{B} &
\multicolumn{2}{c}{C}\\
\cmidrule(lr){3-4} \cmidrule(lr){5-6}
\cmidrule(lr){7-8}
& D & E & F & E & F & E & F\\
\midrule
G & 4.6 & 1.7 & 0.35 & 0.30 & 0.5 & 0.21 & 0.24\\
H & 6.5 & 2.7 & 1.4 & 1.2 & 1.3 & 0.30 & 5\\
I & 8.7 & 7.3 & 4.6 & 8.5 & 89.3 & 3.7 & 2\\
J & 1.4 & 13 & 9.7 & 13 & 8.7 & 8.2 & 4\\
K & 5 & 2 & 85 & 18 & 74 & 2.9 & 0.24\\
\bottomrule
\end{tabular}
\end{table}
\end{document}
Best Answer
Two things help, in conjunction:
\multicolumn
s to@{}c@{\hskip 4\tabcolsep}
--- this deals with the alignment\cmidline
:(lr{\dimexpr 4\tabcolsep+0.5em})
--- this deals with line lengthsThe full code of the upper part of the table is thus:
I suspect you will want to further tweak the line lenghts and/or use decimal point alignment...