16

On Mac and some other systems, typing two hyphens quickly "--", would be automatically converted to an em dash "—" or an en dash "–" depending on the setting. But Stack Exchange fields are different, and this feature does not work.

Therefore, how to type dashes in Stack Exchange?

28

The HTML entities – and — work on all systems: in the rendered post, they will be shown as – resp. —.

On a Mac (and on iOS devices connected to a physical keyboard), you can use + - for an en-dash and ⇧ Shift + + - for an em-dash. ( is the Option or Alt key).

On iOS, you can hold the - button and a sub-menu will appear which allows you to choose between different types of dashes.

On Windows, if you have a numeric keypad, you can use Alt + 0150 resp. Alt + 0151.

8
  • Oh cool! I forgot about HTML entities... And the Mac shortcut seem to be more handy and as helpful as well!! Thanks! – jackxujh Dec 28 '17 at 14:12
  • @jackxujh thank you for spotting the mistake. I always mix them up; because the m precedes the n in the alphabet, my mind thinks the m must correspond to the shorter dash. – Glorfindel Mod Dec 28 '17 at 14:58
  • 4
    You are welcome! I got that too! I found it is easier to distinguish them by their widths – an em-dash has the width of an "m", which is wider than an en-dash, who has the width of an "n". Wish it help! – jackxujh Dec 28 '17 at 15:06
  • Why can't I get an — here? – HeWhoMustBeNamed Apr 23 '20 at 12:53
  • 2
    @HeWhoMustBeNamed HTML entities don't work in comments. – Glorfindel Mod Apr 23 '20 at 12:57
  • @Glorifindel Then is there any way to get an em-dash in comments, apart from copying and pasting? – HeWhoMustBeNamed Apr 23 '20 at 13:00
  • 1
    @HeWhoMustBeNamed No, not really. – Glorfindel Mod Apr 23 '20 at 13:01
  • @Glorfindel can't you use the other methods described in your answer (i.e. Windows and Mac key combinations)? Since they don't use html-encoded strings and instead use the actual unicode character edit: — it works for Mac. – Cave Johnson Oct 27 '20 at 15:51
6

On Chrome OS and some Linux distros, you can press Ctrl+Shift+U, then type:

  • 2013 for an en-dash, or
  • 2014 for an em-dash

(You can also type the hex code of any other Unicode character to enter it, too)

0
3

In Linux, if you set up a keyboard layout that includes a Compose key (e.g., there is an option to map it to the useless Windows menu key on standard PC keyboards), you can type an en-dash with Compose+--. and an em-dash with Compose+---.

2
  • 1
    ̣̣̣̣̣̣̣̣̣̣̣̣Well, for me, AltGr+Shift+- produces U+0323 Combining Dot Below. It would seem that AltGr shortcuts heavily depend on the keyboard layout in use. – Emil Jeřábek Jun 25 at 17:11
  • Indeed, that is depending on the layout. And setting AltGr as the Compose key, the above answer works with English US layout, but it doesn't work with the layout in which AltGr+Shift+- does work (one called Romanian Standard). – cipricus Jun 26 at 12:48
2

The system doesn't have a way to do this. People achieve it by having their own shortcuts or by copying and pasting them.

Shift plus dash becomes underscore because that's how QWERTY keyboards are set up. That's not a Stack Exchange customization.

1
  • 1
    Thanks for the reminder of the shortcut for underlines! – jackxujh Dec 28 '17 at 15:07
1

In addition to what @Glorfindel has mentioned about the use of

On a Mac (and on iOS devices connected to a physical keyboard), you can use + - for an en-dash and ⇧ Shift + + - for an em-dash. ( is the Option or Alt key).

On Windows, if you have a numeric keypad, you can use Alt + 0150 resp. Alt + 0151.

There's a great extension ChromeDash that solves this problem gracefully. I find this to be a much better solution than using the cumbersome commands. But note that this only works on Google Chrome.

Simple Instructions of use-case

Simply enter two dashes (hyphens) for an en–dash, and three for an em–dash! This can be changed, as can all other aliases you make!

This works nearly anywhere, in google, hangouts, messenger, facebook, etc.

3
  • thanks for the answer! I know my question was originally about typing dash in SE, but @Glorindel's answer is more general and is supported by OS, meaning it could be used wherever text is inputed. – jackxujh Nov 4 '20 at 22:21
  • Hey, thanks for your reply. I left this in the hope that it may help someone just searching around – AzyCrw4282 Nov 4 '20 at 22:23
  • 1
    thank you for the addition, I am sure some readers will find it useful! – jackxujh Nov 10 '20 at 0:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .