3 ms·
There’s a similar problem with paragraphs ending with a very short line. IIRC, nothing special needs to be done about that because the squaring in the formula o
by Someone 4y ago
There’s a similar problem with paragraphs ending with a very short line. IIRC, nothing special needs to be done about that because the squaring in the formula of the penalty makes the penalty of such a line very high.
If so, nothing special needs to be done about widows and orphans either because
TeX first uses essentially the same algorithm to decide where to put page breaks between lines (with page breaks between paragraphs getting lower penalties than page breaks within paragraphs), and having a single line of a paragraph on the top or bottom of a page leads to a fairly high penalty.
- raphlinus 4y agoThe standard TeX algorithm doesn't penalize the length of the last line, so doesn't solve this. The implementation in Android, based on Minikin[1], applies some penalty to the last line by default, as it's especially unpleasant on mobile. It also has a "balanced" setting[2] which applies the full penalty, as that's often more aesthetically pleasing in UI contexts, though it would not be a good choice for a running text, as it would result in paragraphs of uneven width. [1]: https://raphlinus.github.io/text/2022/11/08/minikin.html https://raphlinus.github.io/text/2022/11/08/minikin.html [2]: https://developer.android.com/reference/android/widget/TextView#attr_android:breakStrategy https://developer.android.com/reference/android/widget/TextV...
- a_e_k 4y agoLast month, I submitted a patch to GNU Emacs with an implementation of line breaking inspired by Knuth-Plass and an option to enable it for paragraph filling. (I'm still iterating on the patch.) My approach to runts was to apply the full penalty to the last line, but only if the number of words was below a threshold (by default, only if it's a single word).