[Tex/LaTex] pagebreak if only 1/4th of the page left

page-breaking

I have a document with some tabulars one after the other. I want the tabulars begin on a new page if there is very little room left on the actual page, like 1/4th. Otherwise, there should not be a pagebreak. So I need some kind of conditional \pagebreak, how can I do this?

Best Answer

The needspace package is very useful for that. Write for example:

\needspace{.25\textheight}
\begin{tabular}
...

If there's not enough space as requested, approximately, a page break would be inserted. There's further a command \Needspace which is exact but less efficient. A starred version \Needspace* works flush bottom instead of ragged bottom which is the behavior of the non-starred command.