# Help adding row space for some rows, and adjusting \cmidrule and \multicolumn accordingly

The following table has two rows of headers, with the top row organizing categories over the second row using \multirow. The goal is to add blank space between the first group (columns 1-2) and the second group (columns 3-4), but not in between any other columns.

Minimum working example (may have added an extra package or two – sorry if so), with the same alignments as in my actual example, before I try any possible solutions:

\usepackage[margin=0.8in]{geometry}
\usepackage{amsmath}
\usepackage{tabularx}
\usepackage{booktabs}
\begin{document}
\begin{tabular}{clcl}
\toprule
\multicolumn{2}{c}{GG} & \multicolumn{2}{c}{GS} \\\cmidrule(lr){1-2}\cmidrule(lr){3-4}
ID & \multicolumn{1}{c}{$P$} & ID & \multicolumn{1}{c}{$P$} \\
\midrule
1 & 1 & 33 & 2.5 \\
2 & 0.9 & 34 & 2.25 \\
\bottomrule
\end{tabular}
\end{document}

Output:

I've tried a variety of solutions to no avail. They all have basically the same problem. Consider this attempt, and then look at the output below.

\usepackage[margin=0.8in]{geometry}
\usepackage{amsmath}
\usepackage{tabularx}
\usepackage{booktabs}
\begin{document}
\begin{tabular}{cl@{\hspace{2em}}cl}
\toprule
\multicolumn{2}{c}{GG} & \multicolumn{2}{c}{GS} \\\cmidrule(lr){1-2}\cmidrule(lr){3-4}
ID & \multicolumn{1}{c}{$P$} & ID & \multicolumn{1}{c}{$P$} \\
\midrule
1 & 1 & 33 & 2.5 \\
2 & 0.9 & 34 & 2.25 \\
\bottomrule
\end{tabular}
\end{document}

Output:

Notice that the second column is now wider than before. The \cmidrule on the left side now extends too far to the right, and the "P" in the second row, second column is also too far to the right. This seems to be actually extending the second column rather than adding space after it.

I've also tried adding a space before/after the @{\hspace{2em}} portion, using \hrule instead, using \qquad instead, and probably a few others. Also, I have a very, very tall table, so adding another "invisible" column in between columns 2 and 3 would be a huge pain. I'd really prefer to avoid that solution. Any other suggestions out there?

Thanks,

Matt

EDIT: The best solution without adding an extra column is as follows, from the answers below.

\usepackage[margin=0.8in]{geometry}
\usepackage{amsmath}
\usepackage{tabularx}
\usepackage{booktabs}

\begin{document}

\begin{tabular}{cl<{\hspace{2cm}}cl}
\toprule
\multicolumn{2}{c<{\hspace{2cm}}}{GG}
& \multicolumn{2}{c}{GS}
\\
\cmidrule(lr{2cm}){1-2}\cmidrule(lr){3-4}
ID & \multicolumn{1}{c<{\hspace{2cm}}}{$P$}
& ID & \multicolumn{1}{c}{$P$} \\
\midrule
1 & 1 & 33 & 2.5 \\
2 & 0.9 & 34 & 2.25 \\
\bottomrule
\end{tabular}

\end{document}

One way to is to add extra space at the right of the second column and remember to include this in the relevant \multicolumn format specifications and the trimming of the corresponding cmidrule:

\usepackage[margin=0.8in]{geometry}
\usepackage{amsmath}
\usepackage{tabularx}
\usepackage{booktabs}

\begin{document}

\begin{tabular}{cl<{\hspace{2cm}}cl}
\toprule
\multicolumn{2}{c<{\hspace{2cm}}}{GG}
& \multicolumn{2}{c}{GS}
\\
\cmidrule(lr{2cm}){1-2}\cmidrule(lr){3-4}
ID & \multicolumn{1}{c<{\hspace{2cm}}}{$P$}
& ID & \multicolumn{1}{c}{$P$} \\
\midrule
1 & 1 & 33 & 2.5 \\
2 & 0.9 & 34 & 2.25 \\
\bottomrule
\end{tabular}

\end{document}

I use the < specification from the array package (which you already load via tabularx) instead of an @-expression to add additional space between columns, rather than replacing the standard separation.

for more space between the second and third group i would insert empty column, than make cmidrule slightly wider and for setting of numbers use S column type from siunitx package:

\documentclass[12pt,fullpage]{article}
\usepackage[margin=0.8in]{geometry}
\usepackage{amsmath}
\usepackage{booktabs, tabularx}
\usepackage{siunitx}

\begin{document}
\begin{tabular}{*{2}{S[table-format=2.2,
table-column-width=5ex]}
c
*{2}{S[table-format=2.2,
table-column-width=5ex]}
}
\toprule
\multicolumn{2}{c}{GG}  &&  \multicolumn{2}{c}{GS}  \\
\cmidrule(l{2pt}r{2pt}){1-2}
\cmidrule(l{2pt}r{2pt}){4-5}
{ID}    &    {$P$}      &&  {ID}    &  {$P$}        \\
\midrule
1       &   1           &&  33      &   2.5         \\
2       &   0.9         &&  34      &   2.25        \\
\bottomrule
\end{tabular}
\end{document}

result:

if you like more space between groups GG and GS, you can add for example @{\hspace{2e}} after c:

\begin{tabular}{*{2}{S[table-format=2.2,
table-column-width=5ex]}
c@{\hspace{2em}}
*{2}{S[table-format=2.2,
table-column-width=5ex]}
}

column and obtain:

An easy solution is to add an additional column between columns 2 and 3. Add a \phantom entry to add whatever width you want.

\usepackage[margin=0.8in]{geometry}
\usepackage{amsmath}
\usepackage{tabularx}
\usepackage{booktabs}
\begin{document}
\begin{tabular}{clccl}
\toprule
\multicolumn{2}{c}{GG} &\phantom{mm}& \multicolumn{2}{c}{GS} \\\cmidrule(lr){1-2}\cmidrule(lr){4-5}
ID & \multicolumn{1}{c}{$P$} && ID & \multicolumn{1}{c}{$P$} \\
\midrule
1 & 1 && 33 & 2.5 \\
2 & 0.9 && 34 & 2.25 \\
\bottomrule
\end{tabular}
\end{document}

• It's not a perfect solution, but it's doable. I also learned the \phantom command, so that you for that! I implemented this, and it works well enough, though copy/pasting the extra ampersand throughout the table was a pain. Thank you! – Matt McMahon Nov 3 '17 at 3:14