On Thu, Aug 18, 2022 at 06:57:21PM +0100, Gavin Smith wrote: > One possible fix is to replace the \vtop with vertical glue:
It wasn't as simple as that but I've made the change to use vertical glue and penalties only (following LaTeX 'needspace'). I've committed it and will upload shortly. It seems to fix the footnote test case you sent as well! Now when @need does not have enough space, there is a gap left at the bottom of the page, which is preferable to the rest of the page being stretched down to fit. I concluded that the approach with a vbox couldn't be made to work perfectly. I tried an approach with ending with a special penalty value and checking for this value elsewhere, which nearly worked, but wasn't perfect (although satisfactory) because \strut could be slightly too small when the font changed.
