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
\endfirsthead
\mbox{table continued from last page}\\
\toprule
A & B & C & D\\
\midrule
\endhead
\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
LaTeXautomatically ignore a secondmidrule? - another way could be to define the table head without
midruleand only allow pagebreaks before themidrules- how could I do that?