Automatically place en (not em) dashes between numbers

When two hyphens (–) are placed between two numbers, LibreOffice changes them into an em dash, as it does between two words. The problem is that I use the Chicago style for all my work, which stipulates that an en, not em, dash should be used between numbers (like pages numbers and dates).

I want it to create an en dash instead.

I found this answer which shows how to convert them all, but it would be wonderful if it was automatic so I didn’t have to periodically run that command. My workaround is to type number, space, --, number, and then go back and delete the space, but that’s getting pretty tiring!

Note that the em dash should still be placed between two words (the default is correct here), so:
word(em dash)word / number(en dash)number.

Thanks!

Re: commenting, you needed more karma…

@qubit1 hits you with his karma wand

Aaaand there you go :slight_smile:

(A full list of the karma levels required to perform certain actions on the site is available via the faq link at the bottom of the page)

Ah, gotcha. Thanks!

Fixed problem: now autocorrect replacement uses en dash between digits, see fdo#62923 and the updated help page. Thanks for your suggestion!

You can also define new key combinations in autocorrect. E.g. “–” for en-dash and “—” for em-dash.

slick idea!

That works only for detached en-/em-dashes – the replacement table lists the entries for automatically replacing words or abbreviations. You can’t type “1–2” without an additional space after the first number, when you want to use AutoCorrect → Replace, or ...Options → Replace dashes.

[For a better understanding of the issue]

How to use "AutoCorrect Options → Replace dashes"

Replace Dashes

Replaces one or two hyphens with a long dash (see the following table).
Text will be replaced after you type a trailing white space (space, tab, or return). In the following table, the A and B represent text consisting of letters A to z or digits 0 to 9.

replace_dashes

Source: Options - LibreOffice Help

Source (new): Options - LibreOffice Help

Alternative solutions (shortcut keys)

  1. CSC: -. LO writer: insert special characters by shortcut keys - #7 by manj_k
  2. Macro: U+2013 Special characters - #3 by manj_k

It is unfortunate, but it looks like manually inserting en and em dashes is the best option. Those options look good, though I found what was easiest was to just set a compose key in my OS instead, so it works across all programs (Ubuntu 12.04: System settings → Keyboard layout → Options).

BTW: I’ve modified my default keyboard layout (on WinXP) with MSKLC:

Ctrl+Alt± = – (en-dash)

Ctrl+Alt+Shift± = — (em-dash).

@manj_k how do you find this cool stuff?

@horst – See the link "MSKLC" above.

I think the best solution for you is to download and install from here. Define a control character (e.g. Alt+Ctrl+B) and then you can enter both en-dash(.-) or em-dash(–) plus Control Character without leading or trailing blanks.

I hope we did not confuse you completely :).

You may tweak the default replacement under AutoCorrect Options:

Navigate to Tools → AutoCorrect Options and click on the “Replace” tab. The first item in the list (at least for me) is

 "--" -> "–"

Change the character in the “With” field from an em-dash to an en-dash and the replacement will work.

Note that this will change all replacements, not just ones for numbers.

Also take a look at fdo#56307 - “Grammar checker insists on em dash, inconsistent with Auto-correct”

Thank you, but my AutoCorrect options are the same as yours. This help page notes the rules LibreOffice uses for converting hyphens to dashes, which apparently trump that option (it would do me little good anyhow, since I need both en & em dashes).