spam
spam

Reputation: 1993

How to force single/orphan letters to next line?

I want to automatically change:

blah blah blah b
blah blah blah

into:

blah blah blah 
b blah blah blah

in the whole document and keep it like that.

I could insert a hard space before each and every single/orphan letter at the end of the line, but it would take lots of time and also, after slightly modifying text, it would shuffle and cause the same problem again.

Is it possible to automatically force those letters to the next line?

Upvotes: 1

Views: 2025

Answers (1)

Jim K
Jim K

Reputation: 13819

Rather than inserting a space before the character, select the space following the character instead. Press Ctrl+Shift+Space to prevent a line break in that location.

insert non-breaking space

The result:

b is wrapped to next line

To do this for all occurrences in the document:

  • Edit -> Find and Replace.
  • Find: ([:space:][:alnum:])[:space:]
  • Replace: $1\u00a0. However, \u syntax does not currently work for replace, so where it says \u00a0, copy and paste a non-breaking space character instead.
  • Enable Other Options -> Regular Expressions.
  • Replace All.

Related: https://ask.libreoffice.org/en/question/134113/how-to-detect-non-breakable-space-when-iterating-document-via-uno/

Upvotes: 1

Related Questions