I am working on a table where I need to add extra space between groups of rows. I have currently been doing this by ending all but the last row within a group with \\*
(which prevents a page break at the end of the row on which it is used). The last row in each group ends with \\[\ExtraRowSpace]
where \ExtraRowSpace
is some length (e.g., 2cm
).
The only problem with this approach is that, at the end of every page of the table (except the last one), there is an annoying gap between the last row of data and the \bottomrule
. Is there any way that I can conditionally insert extra space between groups of rows in my table so that the space is not added just before a page break?
The following document gives a simple demonstration of the problem:
\documentclass[12pt]{article}
\usepackage{longtable}
\usepackage{booktabs}
\newcommand{\ExtraRowSpace}{2cm}
\begin{document}
\begin{center}
\begin{longtable}{cccc}
\toprule
\textbf{A} & \textbf{B} & \textbf{C} & \textbf{D} \\
\midrule
\endfirsthead
\toprule
\textbf{A} & \textbf{B} & \textbf{C} & \textbf{D} \\
\midrule
\endhead
\bottomrule
\endfoot
\bottomrule
\endlastfoot
a & b & c & d \\* a & b & c & d \\* a & b & c & d \\* a & b & c & d \\[\ExtraRowSpace]
a & b & c & d \\* a & b & c & d \\* a & b & c & d \\* a & b & c & d \\[\ExtraRowSpace]
a & b & c & d \\* a & b & c & d \\* a & b & c & d \\* a & b & c & d \\[\ExtraRowSpace]
a & b & c & d \\* a & b & c & d \\* a & b & c & d \\* a & b & c & d \\[\ExtraRowSpace]
a & b & c & d \\* a & b & c & d \\* a & b & c & d \\* a & b & c & d \\[\ExtraRowSpace]
a & b & c & d \\* a & b & c & d \\* a & b & c & d \\* a & b & c & d \\[\ExtraRowSpace]
a & b & c & d \\* a & b & c & d \\* a & b & c & d \\* a & b & c & d \\[\ExtraRowSpace]
a & b & c & d \\* a & b & c & d \\* a & b & c & d \\* a & b & c & d \\[\ExtraRowSpace]
a & b & c & d \\* a & b & c & d \\* a & b & c & d \\* a & b & c & d \\[\ExtraRowSpace]
a & b & c & d \\* a & b & c & d \\* a & b & c & d \\* a & b & c & d \\[\ExtraRowSpace]
a & b & c & d \\* a & b & c & d \\* a & b & c & d \\* a & b & c & d \\[\ExtraRowSpace]
a & b & c & d \\* a & b & c & d \\* a & b & c & d \\* a & b & c & d
\end{longtable}
\end{center}
\end{document}