# Reduce the penalty for underfull pages?

I am aware that most people seem to suggest using minipages or boxes, but minipages have numerous pathological problems in this context, and most other solutions don't accomodate equations.

I'm unwilling to use \raggedbottom because it messes with the positioning of my footers and page numbers, and also, I don't really like it. I only want underfull pages to happen when it's really important that some content stays together and there's no other way.

So, I'm wondering if it's possible to reduce the penalty for underfull pages so that it's never the maximum penalty, and thus \nopagebreak and \begin{samepage} can actually function as they should.

• if \raggedbottom is affecting the position of page numbers and the page foot, then something seems very wrong with your page setup, that shouldn't happen. – David Carlisle Feb 28 '18 at 0:23

Possibly you could use a version of \raggedbottom that has \def\@textbottom{\vskip \z@ \@plus 1sp} (or perhaps something a bit bigger) but any finite stretch will over-stretch giving graduated badness for underfull pages. as opposed to the standard \raggedbottom that has \def\@textbottom{\vskip \z@ \@plus.0001fil} so no penalty having short content, or the standard \flushbottom which has \let\@textbottom\relax so maximumn 10000 penalty for a page being short unless the page content supplies stretch glue.
• Could you explain please how to patch \raggedbottom? – Alexey Jul 7 '19 at 13:26