In Polish, we have a typesetting rule that single-letter conjunctions should not be left alone at the end of the line. The same applies in general to numbers (unless, of course, they are followed by a full stop). Therefore, a non-breaking space is used in such cases. However, the non-breaking space has a fixed width and it looks bad in justified text, so auto-inserting them is not the best option and the text must be visually checked for such cases. According to information from Claude AI, it’s not possible to create a Python script that would do exactly that as it’s only the text editing application that knows where the end of the text line is. Is there some workaround for this?
JFTR:
tdf#143380 (Polish language: Avoid putting conjunctions like “i” “a” “o” at the end of a line).
Unfortunately, it works only for LibreOffice - I opened a file with such spaces in MS Word and it sees such space as a non-breaking space preceded by two double-walled rectangles.
I think that MS Word is worse at opening .odt than Writer is at opening .docx. Save a copy as .docx and let Word manage the spacing there; when saved as .docx the gap is exported as a non-breaking space.
Or choose a font with the other types of spaces included, see comment 9 of the bug report in the release notes, 41652 – "NO-BREAK SPACE" (U+00A0) interpreted as fixed-width space
and the most commonly used word processor renders all spaces apart from U+0020 and U+00A0 as boxes if the font doesn’t define them (LibreOffice uses the glyphs from a substitution font)
There are other space characters with no-break property in Unicode. You could try U+202F NARROW NO-BREAK SPACE.
You can easily insert it with Insert
>Formatting Mark
>Narrow No-break Space
or Alt+Shift+Space. If under MacOS, check keyboard shortcut.
PS: when asking here, always mention OS name, exact LO version and save format (the latter is very important as most suggestions are only valid and stable for .odt).
EDIT: the post mentioned below by @PanTulipan is
You inspired me to look further and I found your post in a topic on the (non-existing) variable-width non-breaking space - the solution is to insert word joiners between the prepositions/numbers and ordinary spaces. Thank you!
EDIT: unfortunately, the set “character+word joiner+space” is not perfect - it does the job in most of, but not all cases. Adding e.g. zero-width or hairline non-breaking space does not help and currently it’s only the regular non-breaking space that seems to work there.