I have a document typeset using the memoir class and the content is primarily divided using sections. (I'm targeting an A5 paper and so I chose sections instead of chapters since they are more space-economical.)

I would like to generally insert a page break before each section (which is easy enough), but sometimes a section is very short and might fit on the rest of the current page well. Inserting a page break in such cases creates an awkward amount of blank space both on the current and next page.

Is it at all possible in LaTeX to detect when a section would fit on the rest of the page and not \clearpage in that case?


1 Answer 1


Instead of \clearpage you could substitute

\FloatBlock % was \FloatBarrier from placeins.sty

That will usually fill the rest of the page with white space, but will forego the fill if some later page break with equally or more favorable (more negative) "penalty" can fit on the page.

And \filbreak is pretty much the same as \vfil \pagebreak[2]\vfilneg, so it can be simplified. If the document does not use floats the whole thing can be reduced to \filbreak.

It is best to put this into the definition of \section.

  • Thanks, I'll try this...
    – kralyk
    Mar 29, 2020 at 18:18
  • Brilliant, this seems to do exactly what I wanted. Thank you! Edit: I should now read up on some of those commands to undertand what's going on...
    – kralyk
    Mar 29, 2020 at 18:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .