# How to calibrate memoir's \sloppybottom and \flushbottom behavior?

Memoir provides the command `\sloppybottom` which "lets TeX put an extra line at the bottom of a page to avoid a widow on the following page." [1] However it also seems to set `\raggedbottom` which is not something I want. If I add a `\flushbottom` after the `\sloppybottom` command I get the somewhat strange behavior of TeX adding an extra line at the top of a page to avoid a widow. Is there a way to get TeX to fill the page like with `\flushbottom` when using `\sloppybottom` but still having the top of all pages aligning?

(That is, the bottoms would align to except when one extra line is need to avoid widows)

-
How about use `\enlargethispage[*]{\baselineskip}`? It's manual, but such things can be done during the end of your document production. –  Werner Nov 24 '11 at 16:59
I really wish they'd settled on something other than `\sloppybottom` for the name of this command… eww –  Seamus Nov 24 '11 at 17:03
@Werner: Yea, I guess. But it would be very nice to get an automagic solution... :) –  jonalv Nov 24 '11 at 17:04

`\sloppybottom` does its work by setting `\topskip` to a non standard value:

``````\topskip=1\topskip plus 0.625\topskip minus .95\topskip
``````

This glue is inserted before the first box on the page, but the natural length is shortened by the height of the first box (or set to zero if that value would be negative).

Let's make an example. Suppose that `\topskip=10pt` (the usual value for ten point document size); if the first line on a page contains as the highest character an `A', which is 6.83331pt high, the glue inserted is 3.16669pt.

When `\sloppybottom` is in force, the glue inserted would be

``````3.16669pt plus 6.25pt minus 9.5pt
``````

and so the page gets a stretchability of 6.25pt and a shrinkability of 9.5pt, which allows for possibly squeezing into it an additional line.

However, when the page is being shipped out, memoir puts other glue at the top and bottom of the page:

``````\vskip 0pt plus -0.625\topskip minus -0.95\topskip
``````

is put at the top and

``````\vskip 0pt plus.0001fil minus .95\topskip
``````

is put at the bottom. The effect of the glue in front of the page is to cancel out the stretch and shrink components of `\topskip`, so that the first line will go into its normal place. The glue at the bottom is necessary to compensate the line possibly added, because the output routine always wants to say something similar to

``````\vbox to \vsize{<what's to be output}
``````

in order to put the footer in the same position on all pages. If you say `\flushbottom` you make TeX not to insert the two glues on the top and the bottom, but the non standard `\toskip` glue is already there and so there's nothing for compensating it: the result is that the first line is moved away from its usual position.

`\enlargethispage` does its work in a very different way, but it needs to be specified explicitly on the page we wish to enlarge.

-
Wow, thanks for explaining all that. I feel full of information but quite unsure as to whether it would be possible to easily get the behavior I would like. So the `\flushbottom` command does in fact not toggle extra glue between things on the page in order to fill the entire page but the difference is that there is extra glue at the bottom on a `\raggedbottom` page? Would it not be possible to add extra space to the top of the page in order to make my extra line end up at the bottom somehow? –  jonalv Nov 28 '11 at 13:05
@jonalv This is not possible without intervening on the output routine and I assure you this is something nobody is willing to do without substantial financing. :) –  egreg Nov 28 '11 at 13:12