This question led to a new feature in a package:
impnattypo
I come from Poland and I'm writing some text in my native language. One of our typography standards is that we do not leave one-letter words at the end of a line. For example:
Mietek poszedl do sklepu i
kupil jabola
is illegal, and correctly it should be as follows:
Mietek poszedl do sklepu
i kupil jabola
I don't know if there is such a rule in US/English typography also, but I cannot find any latex setting that would fix such errors.
The only solution I've found so far is to add the "~" character, which seems to work as whitespace, but also prevents to break connected words between lines.
So I have to write:
Mietek poszedl do sklepu i~kupil jabola
Is there any other way to do so? I've tried with
\widowpenalty10000
\clubpenalty10000
which prevents orphans, but it seems that 'orphans' for us (Polish) is something different than for Americans 😉 In the US orphan is the first line of a paragraph on the last line of a page (at least I think so), but for us, 'orphan' is such a single-letter word at the end of a line.
Best Answer
This is a LuaLaTeX solution. It is a function that gets called just before TeX breaks the text into lines. It inserts ties
~
(only the penalty of 10000, the glue is already there) after the single letter word. Words will still hyphenate (see example below) - as far as I can see (after the w).[Edit: I have added a check in the code that only letters (L* unicode character class) will be taken into account when preventing a line break after the glyph.]
BTW: the small hyphenation marks are made with the package
showhyphens
.