4 ms·
The 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
by raphlinus 4y ago
The 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).