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

Donald Arseneau asnd at triumf.ca
Fri Nov 12 20:32:44 CET 2010

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

> > I think a minimal example showing what you want to do would be
> > better, because I for one really can't picture your problem.
> Yes, I've thought so. ;-) Well, I'll try.

I don't have a good picture, and didn't do the meticulous 
review of the existing code, but I will take a stab anyway.

Until there is a possible breakpoint, \pagetotal may not
include the most recent contributions.  You have to give
a breakpoint, even \penalty9999, to get an accurate 

Since you are worried about being after section titles,
I recommend a heuristic:  

Record \pagetotal (call it \subtotal)
check \if at nobreak to see if breaks are forbidden
For no-break case, choose to introduce a \penalty9999
only if \subtotal is well short of a page, say .75\pagegoal
For the else case, always give \penalty9999
Finally, check the real pagetotal.

Donald Arseneau                          asnd at triumf.ca

More information about the texhax mailing list