I know I can set \clubpenalty and \widowpenalty to 10 000 to make them “really bad”, but then TeX sees it equally bad to cut the page short when there is no vertical stretch (i.e. \parskip=0pt), and so I’m left with underfull pages often.
The question is: Would it somehow be possible in those cases to instruct TeX to re-do the whole page, for example, trying to get it one line shorter or longer? (Not the page as in \vsize, but the typeset texts space requirements)
Maybe this could be possible with LuaTeX? Or some clever output routine?
Update
OK so now, as per comments, I've played with the eTeX \club-/\widowpenalties. But either I don't understand how they work, or they do not help with the problem:
\font\bodyfont=cmr10 at 11bp \bodyfont
\frenchspacing
\parskip=0pt
\baselineskip=15bp
\topskip=15bp
\parindent=1em
\hsize=27pc
\vsize=525bp % 525 / 15 = 35, the number of lines
\clubpenalties=2 10000 0
\widowpenalties=2 10000 0
\looseness=1
\input a_novel
\bye
The pages are cut short when there would be a widow/orphan.
References
Jonathan Fines “Line breaking and page breaking” hints at a possible global optimisation via multiple passes.
David Salomon writes in his book “The Advanced TeXbook” about “A global page-break algorithm”, but I cannot find the reference (Ref. 37).
\widowpenaltyand\clubpenaltyparameters -- and yet (ii) seem to be willing to shorten (or lengthen...) a given page's text height to avoid widows and orphans. – Mico Apr 22 '13 at 18:14\vsize, but to make that text more sparse/tight so that the required space for it would be longer/shorter so that the pagebreak wouldn't occur at a place where it would create a widow/orphan and thereby not needing to cut the page short in trying to compensate that. – morbusg Apr 22 '13 at 18:39\usepackage[all]{nowidow}andlooseness=1? Surely a LuaTeX solution would be possible, but perhaps the current eTeX solutions are good enough? – topskip Apr 22 '13 at 20:10\vboxof\pagebodyis underfull already available at that point? Or is it only when it gets\unvboxed and\output? If so, couldn't that box just be dumped into another box with different, say, inter-word spacing settings and then\unvboxed? – morbusg Apr 22 '13 at 20:10\clubpenalties/\widowpenalties(plural, eTeX)? I need to play around with those, thanks! – morbusg Apr 22 '13 at 20:32\loosenesparameter. – topskip Apr 22 '13 at 20:34\loosenesson a per paragraph basis? It's not a global variable. – topskip Apr 23 '13 at 08:50