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

Paul Isambert zappathustra at free.fr
Sat Nov 13 02:15:41 CET 2010


Selon Wolfgang Lorenz <w-lo at gmx.de>:

>   This is also working. Now here comes the problem. If there is not
> enough space left, for putting even one verse on the current page AND
> the last box in TeX's main vertical list is a section head I must not
> simply \eject the current page, because that would break an unbreakable
> \penalty. So I could simply assume, that the whole page is unused,
> which would result in a box too high for the current page and TeX would
> eject the page BEFORE the section head. This is working in most cases,
> since most songs are not that long. But there may be cases (and I've
> already had some) where the resulting lyrics box is using up the whole
> space. Now TeX stands there with a section head to place and a box in
> the main vertical list, which is (again) too high to be placed under
> the section head.
>
>    -------------- current position
>
>    -------------- page end/next page
>     section head
>       1... 5...
>       2... 6...
>       3... 7...
>    ---4...------- page end


Ok. I kind of see what you mean. Now, the first problem is of course as
mentioned by Donald: after a section, or any \penalty10000, you don't have the
real \pagetotal, so you can't properly build the song. I can see two solutions:
solution one is LuaTeX. Solution two is: when using columns, don't make one big
box, but small ones instead, with penalties inbetween, as follows:

penalty
box: 1... 5...
penalty
box: 2... 6...
penalty
box: 3... 7...
penalty
box: 4...

and TeX will break (in your example) after "3... 7...".

Best,
Paul


More information about the texhax mailing list