We will be migrating from Ask to Discourse on the first week of August, read the details here

Ask Your Question

how do i change the hyphenation symbol [closed]

asked 2017-05-18 00:05:38 +0200

Jlovick gravatar image

updated 2021-06-14 21:26:22 +0200

Alex Kemp gravatar image

I have the unfortunate need to include computer code in my document, occasionally the lines are longer than the width of the page, I turn on automatic hyphenation through format-->paragraph-->text flow,,, etc and this works great, but it uses the "-" as a hyphenation marker, I would like to change that to a symbol not used in my code, such as U+21B2 (↲) to make it clear the line is wrapped.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2020-10-04 18:01:43.939209

2 Answers

Sort by » oldest newest most voted

answered 2017-05-18 12:20:37 +0200

Lupp gravatar image

First of all I would use a dedicated paragraph style for code (using a monospace font and setting a right aligned tabstop at the end of the line, e.g.) The paragraph style be 'psCode' now.

For lines of code not soft hyphenated in advance: After the hyphenation I can search for paragraph styles with psCode and then switch the 'F&R' back to RegEx search and enable 'Current selection only'. Now I can search for the inserted SOFT_HYPHEN characters with \u00AD and replace them with whatever I want (\t e.g. in my example) . You may vary this, of course, as you need it.

edit flag offensive delete link more

answered 2017-05-18 11:03:14 +0200

librebel gravatar image

updated 2017-05-18 11:08:39 +0200

Hello Jlovick, I'm afraid that the hyphenation symbol can not be changed using the GUI. I also looked around in the LibreOffice API, but couldn't find any method to change the hyphenation symbol. In the source files there are several hyphen characters defined:.

0x2011 NON-BREAKING HYPHEN ( = CHAR_HARDHYPHEN in swtypes.hxx )

0x00AD SOFT HYPHEN ( = CHAR_SOFTHYPHEN in swtypes.hxx )

0x002D HYPHEN-MINUS ( = CUR_HYPH_POS_CHAR in hyphen.cxx )

As an alternative to hyphens in your code text, you could use "soft hyphens" instead.

Soft hyphens can be entered within a word by pressing Ctrl+Minus(-).

Words with soft hyphens are only separated at the end of a line at the point where a soft hyphen has been inserted, irrespective of whether the automatic hyphenation is activated or deactivated. (https://help.libreoffice.org/Common/F...)

The soft hyphen is automatically hidden when the word does not need to be hyphenated, unless the option "Display of Soft Hyphens" is set to True via the menu "Tools : Options : LibreOffice Writer : Formatting Aids". In that case it is shown in a grey box.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2017-05-18 00:05:38 +0200

Seen: 463 times

Last updated: May 18 '17