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.
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.
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. (Formatting Aids - LibreOffice Help)
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.