# Prevent longtable to split cells while using \hline

although the question seems to be trivial and to be answered several times, I have not found a solution yet :-( I'm using a longtable to describe a set of computer benchmarks. Each benchmark entry consists of rows, a "headline" (name, references), and a "description". Now I do not want longtable to split the headline row and the description row, but print them on the same page. This can be done using \\*. Now the problem is that I want to have a \hline between the headline and the description, but both potential options do not work:

• \\\hline * : Latex compile error
• \\*\hline : The headline and the description are split

Is there a way to achieve this? Thank you!

• Is there anything that resembls a MWE? – user11232 Jul 31 '14 at 9:59
• easiest way is to ignore it unless it happens and if it does happen, force a page break after the previous row – David Carlisle Jul 31 '14 at 10:37
• you could make a feature request for longtable v5 but it's been 18 years since longtable v4 came out.... – David Carlisle Jul 31 '14 at 10:40

You can put your headline and description inside a separate tabular inside the same row of longtable. You can even make a macro for it like:

\newcommand{\benchmark}[2]{%
\begin{tabular}{@{}p{\linewidth}@{}}
#1 \\ \midrule
#2
\end{tabular}%
}


The full code:

\documentclass{article}
\usepackage{longtable,booktabs}
\usepackage[textheight=3cm]{geometry}   %% 3cm only for demo
\newcommand{\benchmark}[2]{%
\begin{tabular}{@{}p{\linewidth}@{}}
#1 \\ \midrule
#2
\end{tabular}%
}
\begin{document}
\begin{longtable}{@{}l@{}}\toprule[1pt]
\toprule[1pt]