[Tex/LaTex] More space between certain rows in a table

tables

So my problem is this: some variables in my table have multiple categories, while others do not. However, I'd like to have more space between the separate variables, but not between the rows which have the different categories of a variable. As an example, I'd like there to be a bigger gap between "Students registered" and "Gender(%)", but a small gap between "Male and Female". Likewise, I'd like a gap (same as between "Students registered and Gender") between "Female" and "Race(%), but a smaller one (same as between Male & Female) between White/Black/Coloured/Indian/Asia. Then a bigger gap (same as between Students Registered/Gender & Gender/Race) between Indian/Asian with Financial Aid.

enter image description here

My MWE (don't worry about the column widths looking funny, I can change those myself!)

\documentclass{article}
\usepackage{booktabs}
\usepackage[flushleft]{threeparttable}
\usepackage{verbatim}  % Needed for the "comment" environment to make LaTeX comments
\renewcommand\arraystretch{1.4}
\begin{document}
\begin{table}[H]
\renewcommand\arraystretch{1.4}
\begin{threeparttable}
\caption{Summary Statistics}
\label{table:ssna}
\begin{tabular}{p{0.30\textwidth} p{0.15\textwidth} p{0.15\textwidth} p{0.15\textwidth} p{0.15\textwidth} p{0.15\textwidth}}
\toprule
& \multicolumn{5}{c}{\bfseries Cohort} \\
\cmidrule(l){2-6}
& 2006 & 2007 & 2008 & 2009 & 2010 \\
\midrule
{\bfseries Students registered} & 1535 & 1584 & 1767 & 2037 & 1518 \\
{\bfseries Gender (\%)} & & & & & \\
Male & 61.1 & 64.5 & 57.7 & 55.5 & 55.3 \\
Female & 38.9 & 35.5 & 42.3 & 44.5 & 44.7 \\
{\bfseries Race (\%)} & & & & & \\
White & 43.3 & 43.4 & 40.6 & 36 & 39.8 \\
Black & 29.8 & 33.4 & 34.8 & 38 & 35.4 \\
Coloured & 16 & 13 & 13.8 & 12.9 & 11.5 \\
Indian/Asian & 10.8 & 10.1 & 10.8 & 13.1 & 13.4 \\
{\bfseries Financial Aid (\%)} & 19.5 & 22.3 & 25.2 & 29.9 & 24.5 \\
{\bfseries AD Programme (\%)} & 24 & 20.3 & 18.6 & 20.6 & 21.9 \\
\bottomrule
\end{tabular}
\begin{tablenotes}
\small
\item Source: UCT Institutional Planning Department
\end{tablenotes}
\end{threeparttable}
\end{table}
\end{document} 

Best Answer

I think it's wrong to have \arraystretch set to 1.4 to begin with. The table is too spread out and adding vertical space between different groups will not help. Also the columns should be as wide as they need to be, not wider.

Without setting \arraystretch you can either use \addlinespace or add a \midrule:

\documentclass{article}
\usepackage{booktabs,siunitx}
\usepackage[flushleft]{threeparttable}

\begin{document}
\begin{table}

\begin{threeparttable}

\caption{Summary Statistics}
\label{table:ssna}

\begin{tabular}{
  l
  *{5}{S[table-format=2.1]}
}

\toprule
& \multicolumn{5}{c}{\bfseries Cohort} \\
\cmidrule(l){2-6}
& {2006} & {2007} & {2008} & {2009} & {2010} \\
\midrule
\bfseries Students registered & {1535} & {1584} & {1767} & {2037} & {1518} \\
  \addlinespace
\bfseries Gender (\%) \\
Male                         & 61.1 & 64.5 & 57.7 & 55.5 & 55.3 \\
Female                       & 38.9 & 35.5 & 42.3 & 44.5 & 44.7 \\
  \addlinespace
\bfseries Race (\%) \\
White                        & 43.3 & 43.4 & 40.6 & 36   & 39.8 \\
Black                        & 29.8 & 33.4 & 34.8 & 38   & 35.4 \\
Coloured                     & 16   & 13   & 13.8 & 12.9 & 11.5 \\
Indian/Asian                 & 10.8 & 10.1 & 10.8 & 13.1 & 13.4 \\
  \addlinespace
\bfseries Financial Aid (\%) & 19.5 & 22.3 & 25.2 & 29.9 & 24.5 \\
  \addlinespace
\bfseries AD Programme (\%)  & 24   & 20.3 & 18.6 & 20.6 & 21.9 \\
\bottomrule
\end{tabular}
\begin{tablenotes}
\small
\item Source: UCT Institutional Planning Department
\end{tablenotes}
\end{threeparttable}
\end{table}
\end{document} 

enter image description here

This is what you'd get with \midrule in place of \addlinespace:

enter image description here

If you want to have the table as wide as the text width, you can use tabular*:

\documentclass{article}
\usepackage{booktabs,siunitx,array}
\usepackage[flushleft]{threeparttable}

\usepackage{lipsum} % just for the example

\begin{document}
\lipsum[2]

\begin{table}[htp]

\begin{threeparttable}

\caption{Summary Statistics}
\label{table:ssna}

\begin{tabular*}{\textwidth}{
  !{\extracolsep{\fill}}
  l
  *{5}{S[table-format=2.1]}
}

\toprule
& \multicolumn{5}{c}{\bfseries Cohort} \\
\cmidrule(l){2-6}
& {2006} & {2007} & {2008} & {2009} & {2010} \\
\midrule
\bfseries Students registered & {1535} & {1584} & {1767} & {2037} & {1518} \\
  \midrule
\bfseries Gender (\%) \\
Male                         & 61.1 & 64.5 & 57.7 & 55.5 & 55.3 \\
Female                       & 38.9 & 35.5 & 42.3 & 44.5 & 44.7 \\
  \midrule
\bfseries Race (\%) \\
White                        & 43.3 & 43.4 & 40.6 & 36   & 39.8 \\
Black                        & 29.8 & 33.4 & 34.8 & 38   & 35.4 \\
Coloured                     & 16   & 13   & 13.8 & 12.9 & 11.5 \\
Indian/Asian                 & 10.8 & 10.1 & 10.8 & 13.1 & 13.4 \\
  \midrule
\bfseries Financial Aid (\%) & 19.5 & 22.3 & 25.2 & 29.9 & 24.5 \\
  \midrule
\bfseries AD Programme (\%)  & 24   & 20.3 & 18.6 & 20.6 & 21.9 \\
\bottomrule
\end{tabular*}
\begin{tablenotes}
\small
\item Source: UCT Institutional Planning Department
\end{tablenotes}
\end{threeparttable}
\end{table}
\end{document} 

Note that \lipsum is used just to provide some context. I'm certain that this is worse than having the table at its “natural” width.

enter image description here

Related Question