I want to replicate the table in this image but without the second column:
However the problem is that I'm unable to find out how to make a horizontal space between each two columns (N=2, N=3 … etc). Also I'm not able to find out how to make a vertical space between the first row and the second row (N=2 and Avg. Pos … etc) because the text is too close to the upperline.
Here is my version and code:
\begin{table}[h]
\begin{tabular}{@{}lrrrrrr@{}}
\toprule
& \multicolumn{2}{c}{N = 2} & \multicolumn{2}{c}{N = 3} & \multicolumn{2}{c}{N = 4} \\ \cline{2-3} \cline{4-5} \cline{6-7}
Network Name & \multicolumn{1}{c}{Avg. Pos.} & \multicolumn{1}{c}{Avg. Neg.} & \multicolumn{1}{c}{Avg. Pos.} & \multicolumn{1}{c}{Avg. Neg.} & \multicolumn{1}{c}{Avg. Pos.} & \multicolumn{1}{c}{Avg. Neg.} \\ \midrule
X & 4895 & 135639 & 77 & 109622 & 5 & 16360 \\
Y & 5426 & 183685 & 196 & 204801 & 9 & 39977 \\
Z & 8959 & 80669 & 38 & 109362 & 4 & 43329 \\ \bottomrule
\end{tabular}
\end{table}
Best Answer
For first, use
\cmidrule(lr){2-3}
, note(lr)
. For details, consult thebooktabs
manual. For second, use somestrut
likeChange
2.5ex
as you want.