I often use an editor like OpenOffice Writer to build documentation. My documentation is usually technical, and it often includes commands for the terminal.

When I format a command, I will indent the command by 1/2 inch and I will change the font to Times Roman or Times New Roman.

The editors replace a hyphen with a dash (I think its called an em-dash). So a command like:

ls -al

will fail when copy/pasted into a terminal due to the errant character.

The problem comes to light after performing a "Save as PDF". No matter what I do, the PDF always ends up with the wrong dash or hyphen (even if the OO document seems correct).

How do I distinguish text that include a hyphen so that the dash is unchanged?

  • Just semantics, but isn't it the other way around... replacing a hyphen with a dash? Have you checked the AutoCorrect options... Format > AutoCorrect > AutoCorrect Options... (at least that is the menu item in LibreOffice). There are specific options for "Replace Dashes" as well as the usual "Replace" options. Although to be honest I don't think any of these options should be replacing a single hyphen with a dash (as in your example) - at least not in "LibreOffice". – MrWhite Mar 16 '14 at 16:59
  • The problem seems to be with "Export as PDF". They get munged in the final PDF. Let me get that added to the question. – jww Mar 16 '14 at 17:01
  • FWIW, I tried the "Export as PDF" option in LibreOffice and this worked OK for me (the hyphens stayed as hyphens). There are a few options related to PDF creation but I can't see how these would specifically relate to hyphen/dash replacement though. – MrWhite Mar 16 '14 at 17:15

Typographically speaking, what you are typing is a hyphen or minus, not a dash, and what OpenOffice Writer is replacing the hyphen with is a dash, either an e-dash or an em-dash, depending on the context in which OpenOffice Writer sees your hyphen.

This is explained in the OpenOffice Writer under replacement options. Look in the index.

You can change this behavior from the menu, Format -> AutoCorrect -> AutoCorrect Options... and uncheck either or both of the Replace dashes boxes. You can also access the relevant help topic by clicking Help in this dialog.

| improve this answer | |
  • Thank garyjohn. How do I inhibit it for a block of text like a command, while leaving it engaged for normal text? – jww Mar 16 '14 at 17:25
  • I don't know how to inhibit it for certain regions. The two methods I've used to fix such dashes after they've been expanded from hyphens are: 1) delete the dashes and replace them by hyphen(s); 2) use Find & Replace, copying a dash from your text into the Search for box and typing hyphen(s) into the Replace with box. – garyjohn Mar 16 '14 at 17:47

Not the answer you're looking for? Browse other questions tagged or ask your own question.