17

I understand that to be able to type en and em dashes I have to configure the COMPOSE key, or something like that, but I am not sure about that nor on how I get from there to be able to type en and em dashes in addition to the minus sign.

How do I type en and em dashes on Ubuntu GNOME 15.10 with GNOME 3.18?

I have now looked at this answer, so I would now also like to know the code for the en dash and how to assign other keyboard shortcuts to these Unicode characters, as I don't want to have to type something too long in order to get these.

apaderno
  • 289

3 Answers3

24

You need to learn the Unicode numbers of these two characters. They are not actually hard to remember, because they look like years. ;)

  • En dash: U+2013
  • Em dash: U+2014

To write a Unicode symbol, perform the following actions:

  • Press Ctrl+Shift+U (the display will show something like )
  • Type the code (e.g. 2014)
  • Press Enter

There you go: – —

For a complete reference to Unicode characters, run gucharmap.

  • 2
    I prefer @cipricus's answer below, using the 'compose' key, because those mnemonically chosen 2 or 3 character sequences are easier to remember than arbitrary four digit hex numbers, especially if one uses the same mechanism for other unicode characters as well. – Jonathan Hartley Sep 01 '23 at 19:54
  • Given the solution involves pressing Ctrl-Shift-u, then typing 2013 or 2014, then pressing Enter — what does the first part of the answer (U+2013 etc) mean? – cipricus Sep 06 '23 at 13:33
  • 1
    @JonathanHartley I am not sure if you are the one who downvoted the answer, but it was not necessary. My answer provides a method which is working, therefore it is correct. If you prefer someone else's answer of course you should upvote theirs. – Andrea Lazzarotto Sep 07 '23 at 13:40
  • 1
    @cipricus that's the Unicode notation for symbols. – Andrea Lazzarotto Sep 07 '23 at 13:41
  • @Andrea Lazzarotto You are right that my downvote is inappropriate. I reviewed the guidelines for "when to downvote" https://askubuntu.com/help/privileges/vote-down and they are exactly as you describe. A downvote should only be for answers that are not useful, not ones that are judged inferior to other answers. I will undo my downvote if I can (ie. if the question is edited.) – Jonathan Hartley Sep 07 '23 at 17:06
  • @JonathanHartley - I put my up-vote too (at least to compensate). – cipricus Sep 08 '23 at 06:50
  • 1
    @JonathanHartley no worries. I prefer when people who downvote do leave some kind of reasoning. You left a comment and that is appreciated. – Andrea Lazzarotto Sep 08 '23 at 20:32
  • @cipricus I upvoted yours as well, you made me learn something new after years of using Linux. – Andrea Lazzarotto Sep 08 '23 at 20:33
7

Compose key can be used like this: ­

  • Compose and then --. gives (en-dash).

  • Compose and then --- gives (em-dash).

The compose key can be set in the advanced keyboard settings

In LibreOffice Writer one can use :--: and :---:.

In LO there is also the method of using the LO auto-corrector and set -- to and --- to for example (but this has the limitation that the automatic corrector acts only after the end of a "word", that is, after Space is pressed, so that, in order to put the em dash close to a word —the way it's often done in English—, you have to delete that space manually etc).

— The compose solution seems the best, as it works everywhere, including in a browser and a terminal.

cipricus
  • 3,444
  • 2
  • 34
  • 85
3

When I look up "em dash" on the gnome 3 overview a result comes up that puts it on the clipboard. I think you need to have gnome-characters installed for it to work.