[texhax] nopagebreak \hline in a longtable

Ulrike Fischer news2 at nililand.de
Thu Oct 16 17:31:49 CEST 2008

Am Thu, 16 Oct 2008 09:39:48 +0200 schrieb Nico Van Cleemput:

> I use the longtable package for some very long tables I have, however
> sometimes I want to rows to stay together even if it isn't ideal for
> the layout. This is possible by using the \\* or a \nopagebreak at the
> beginning of the row. This works fine if there is no \hline between
> the two rows. At first I thought I'll try \nopagebreak\hline, but this
> doesn't work. When I looked into the longtable package, it's seems
> that this isn't working because \hline in longtable actually adds two
> lines and the rows are split in between those two lines. So my guess
> was that the only solution was to add a sort of \hline* command that
> adds a line without the possibility of a pagebreak on that line. My
> TeX knowledge however is far from sufficient to tackle such a hack as
> I noticed. I was mostly guessing what would happen without any
> certainty that what I was doing was right. So it's no surprise that I
> didn't succeed.
> My question is if anyone knows how to this, or could give me some
> hints or knows a better way to achieve this effect.

a search google.groups ("hline longtable nopagebreak") gives this


\newcommand*{\nonbreakhline}{\cline{1-\LT at cols}} 
links & mitte links & mitte rechts & rechts \\\nonbreakhline 
links & mitte links & mitte rechts & rechts \\*\nonbreakhline 
links & mitte links & mitte rechts & rechts \\ 

Ulrike Fischer 

More information about the texhax mailing list