# longtable: how to avoid duplicated midrules below table title?

I want to typeset a longtable which is structured by midrules, as the rows are divided in groups.

If it happens (which is in general desirable!) that a group is not split by a page break, in other words a new page of the table starts with a new group, I have duplicated midrules as there is one from the headline definition and one from the table code.

See following example:

\documentclass{scrbook}

\usepackage{booktabs, longtable}

\begin{document}

here comes the table with the pagebreak

\vspace{0.6\textheight}

\begin{longtable}{p{2cm}p{2cm}p{2cm}l}

\toprule
A & B & C & D\\
\midrule

\mbox{table continued from last page}\\
\toprule
A & B & C & D\\
\midrule
\bottomrule
\mbox{to be continued on following page}
\endfoot
\bottomrule
\endlastfoot

a & b & c & d\\
& b & c & d\\
& b & c & d\\
\midrule
a & b & c & d\\
& b & c & d\\
& b & c & d\\
\midrule
a & b & c & d\\
& b & c & d\\
& b & c & d\\
\midrule
a & b & c & d\\
& b & c & d\\
& b & c & d\\
\midrule
a & b & c & d\\
& b & c & d\\
& b & c & d\\
\midrule
a & b & c & d\\
& b & c & d\\
& b & c & d\\
\midrule
a & b & c & d\\
& b & c & d\\
& b & c & d\\
\midrule
a & b & c & d\\
& b & c & d\\
& b & c & d\\
\midrule
a & b & c & d\\
& b & c & d\\
& b & c & d\\
\midrule
a & b & c & d\\
& b & c & d\\
& b & c & d\\
\end{longtable}

\end{document}

## Questions:

• Is there a way to make LaTeX automatically ignore a second midrule?
• another way could be to define the table head without midrule and only allow pagebreaks before the midrules - how could I do that?
-

no need to be ashamed!! Thank you very much for this elegant and easy solution (I did not know about the star version \\* and it makes thinks very easy, as in those tables with grouped rows I just have to replace \ by \* and let the ˚\midrules` allow pagebreaks. –  MostlyHarmless Jul 16 '11 at 8:56