# [texhax] Calculate remaining space after a page break and a \penalty of 10000

Paul Isambert zappathustra at free.fr
Fri Nov 12 00:38:36 CET 2010

Hello Wolfgang,

I think a minimal example showing what you want to do would be better, because I
for one really can't picture your problem. Using \pagetotal and \pagegoal to
compute available space is a good solution, assuming there is no vertical rubber
glue, but I can't see what's wrong. And actually I don't understand what "as
little vertical space" means, nor that "page breaks are left up to TeX", since
that's the default behavior.

Best,
Paul

Selon Wolfgang Lorenz <wl-chmw at gmx.de>:

> Hello List,
>
> I'm writing on a package that places the lyrics of a song block wise on
> a page, so that as little vertical space as possible is occupied. The
> calculations are based on \pagetotal and \pagegoal (resp. \vsize, if
> \pagegoal is not yet given).
>
> This is working rather well, except for one thing. Page breaks are not
> done using \eject, but are left up to TeX, by simply assuming, that the
> whole page is unused and thus using enough vertical space, so that TeX
> is ejecting the page, while respecting all \penaltys. This leaves the
> problem, that the assumed free space may be incorrect, e.g. if the
> lyrics block is following a section head.
>
> Now, is there a way to tell TeX to remove the "\nobreak-content" from
> main vertical list, put it back to the list of recent contributions and
> do an eject? Or, if this is not possible, is there a way to calculate
> the vertical size of the recently contributed boxes, that would be
> taken to the next page?
>
>
> Greetings,
>   Wolfgang Lorenz
>
>
> PS: I've had some difficulties finding the right words, to explain
>     this problem. I hope what you understood is what I meant.
>