Am 01.10.24 um 00:17 schrieb Hans Hagen:
It’s a novel of ~650 pages with a big range of paragraph lengths (some
dialogues with short lines as well as paragraphs that span pages). “Of
course” you often get a 3-line paragraph over a page break – it’s hard
to avoid widows and orphans.
depends .. three liners can be made to work in fact one should then use
\widowpenalties and \clubpenalties with a high value for the first two
entries (and maybe disable them to overlap)
I have
\setpenalties\widowpenalties{2}{8000}
\setpenalties\clubpenalties{2}{10000}
Does this make sense? While I saw in your demonstrations that it’s
possible to set different penalties per line, I never tried.
Otherwise, I found out the easiest solution is a \vbox, VZ does the
rest. Should have thought of that earlier, would have saved me a few hours.
here is a teaser:
\permanent \specificationdef \lesswidowpenalties \widowpenalties
\plusthree options \numexpr\largestspecificationoptioncode+
\doublespecificationoptioncode\relax
\plusfivethousand \plusseventyfivehundred
\plustwohundredfifty \plusfivehundred
\zerocount \zerocount
\relax
\permanent \specificationdef \lessclubpenalties \clubpenalties
\plusthree options \numexpr\largestspecificationoptioncode+
\doublespecificationoptioncode\relax
\plusfivethousand \plusseventyfivehundred
\plustwohundredfifty \plusfivehundred
\zerocount \zerocount
\relax
used in upcoming new \setupalign options lesswidows and lessclubs
because the above is not something that users should nother about.
These set high penalties for the first and last line, somewhat lower for
the ones following and preceding.
We also have strictwidows and strictclubs that do your three thing.
Ok, I’m looking forward to it.
In case you wonder about the 'double' ... we can have different values
for left and right pages because (we think that) on a spread a widow or
club is less of a problem.
Fwiw, much of this of this already has been there for a while (as
discussed at the meeting) but we're now integrating it into \setupalign
and making sure that the overhead can be neglected.
Great!
I already do without grid, VZ works, HZ also should (I didn’t check
with a tracker, and it’s not so extreme that I’d see it), but it’s not
enough to automatically avoid single lines.
Indeed, so the stricter penalties combine well with vz
If a paragraph starts at page breaks, I can tweak the layout like
\page\setuplayout[narrow]. I defined narrow, normal, and wide versions
with 1 mm difference. Before I didn’t know you can call named layouts
like this, also relative page numbers like \definelayout[+1][wide] are
nice.
If that’s not enough, I’m using \letterspacing with tiny ± values.
So much about dirty tricks. ;)
parpasses will permit you to have steps with different solutions so
expansion can be delayed till it is really needed; interesting is that
even with (say 8) par passes, most time the solution is found in the
first (no hyphenation with 100 tolerance) or second pass (hyphenation
with 200 tolerance) and the number last pass can be counted on one hand
Yes, you demonstrated several times. I just didn’t dare or was too lazy
to delve into the “plain TeX” syntax to try.
(there are options to mark pararaphs and see what pass succeeded as well
as overviews in the logs so that one can go to problematic places but
that's for Keith to experiment with)
We're really surprised how well this all works on complex content (say
very math intense, read: demanding wrt where to break).
If it also works with code examples, It’ll be great for the ConTeXt
journal and my book.
Hraban
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : ntg-context@ntg.nl /
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________