Soft line breaks don't work for forwards slashes in table cells when they follow a space

Soft line breaks don’t seem to work in Writer for forward slashes in table cells - in particular when they follow a space.

It’s simple to reproduce:

  • File > New > Text Document
  • Table > Insert Table (5 cols 2 rows)
  • Type into the first cell: 1 test1/test2/test3/test4

For me it wraps as follows:

1 test1/test2/test3/test 4

I would expect it to wrap:

1 test1/test2/test3/ test4

or possibly:

1 test1/test2/test3/ test4

If I leave out the space after the initial 1 then the slashes appear at the end of lines as expected.

I don’t have control over the contents of the cell (it’s part of generic print server code) but I could change the paragraph style if this would help.

A similar issue was reported here (soft line break with forward slash?)
but it seems that one couldn’t be reproduced.

I’m on Ubuntu 20.04, Libre Office version 7.0.2.2 but the same thing occurs on Ubuntu 16.04.

You’re entering a special area in Writer.

Ordinary linewrapping without hyphenation occurs primary between “words”, i.e. sequences of characters delimited by spaces. Some characters like dash open the possibility to create a “weak” word boundary. It is not used if spaces can be shrinked to accommodate an exceptionally wide “word”.

However slashes are not such characters. This is particularly embarrassing when you have a long URL with Writer breaking it at clumsy locations.

The manual workaround is to tell Writer where such long “words” can be wrapped. This is always a manual process.

Put the cursor where you define a candidate wrap location (there may be several in a word to account for later formatting update in your document). Type U+200b then simultaneously Alt+X.

U+200B is ZERO WIDTH SPACE, i.e. it has the same property as a space but has no width. It makes your “long” word a sequence of shorter “words”. Writer has then more opportunities to wrap lines at ordinary spaces and zero-width spaces.

To show the community your question has been answered, click the ✓ next to the correct answer, and “upvote” by clicking on the ^ arrow of any helpful answers. These are the mechanisms for communicating the quality of the Q&A on this site. Thanks!

In case you need clarification, edit your question (not an answer which is reserved for solutions) or comment the relevant answer.

Thank you very much for the quick and detailed answer. It sounds like what I want to do may be impossible without manipulating the text… Maybe in this instance I can do a programmatic find-and-replace on the text to add the zero-width space - I’ll give that a go.

The above worked and wasn’t too clunky in the end. Thanks again ajlittoz :slight_smile:

I would say don’t abuse the trick. Don’t use in ordinary text because it could break standard words without hyphenation coming into play. This means no dash is ever added at line end to tell you “hyphenation” or rather word split took place.