20

You know, in SE markup language in the editor, a row of hyphens is useful. You can either make a headline by putting a row of hyphens under a short line, or you can create a horizontal rule with a line of hyphens separated by white space.

When I try that in iOS 12, I get this

———

Or this

Headline ———

Note that I have hit "hyphen" six times and gotten 3 dashes. And it does not work. No horizontal rule (all the way across). No headline.

The problem is, they're not real hyphen-minuses from 7-bit ASCII. They are some sort of typographical oddity - em space dash, en space dash, whatever. I see I can also hold the hyphen key and it will give me the options for em space dash and en space dash. None are a hyphen!

How do I tape a plain ASCII hyphen-minus in iOS 12?

I realize this is a bit of an XY, but I need plain hyphens for lots of other things too.

Edit: Forgot to mention, I need to do this on other people's iPads, so it is not my purview to arbitrarily and permanently reconfigure their iPad to my tastes. Besides I am not opposed to typographical features, I just need to use StackExchange from time to time.

4
  • 1
    FYI that is Unicode U+2014 "EM DASH"
    – wjandrea
    Commented Jun 10, 2019 at 13:39
  • 6
    The character you want to type is called a hyphen (or hyphen-minus, in Unicode nomenclature). Dashes (and there are several different types of dashes) are different characters with distinct uses. (They are not "oddities", predating ASCII by several hundred years.)
    – chepner
    Commented Jun 10, 2019 at 14:04
  • 3
    To clarify, the problem is not typing a single hyphen - for that you simply hit what looks like the hyphen ("HYPHEN MINUS" is the character on the front of the key). The problem is typing two or more hyphens. Every sequence of two hyphens that are typed are converted to "EM DASH". If you type 3 hyphens you get a single "EM DASH" followed by a "HYPHEN MINUS".
    – MrWhite
    Commented Jun 11, 2019 at 12:11
  • 1
    Note that you can get headings in SE markup with #Headline, ##Second-level headline, etc. Commented Jun 11, 2019 at 23:27

5 Answers 5

20

Turning off Smart Punctuation (in Settings → General → Keyboard) allows me to type multiple hyphens without them being converted to em-dashes.

(Side note: here's a post by the creator of Markdown about this feature.)


As far as I can tell, this setting has two effects:

  1. Change repeated hyphens to dashes
  2. Change quotes and apostrophes to smart, locale-aware quotes (e.g., "" will become «» when the language is set to French).

These can't be toggled independently. The Apple help article for Numbers on iPad explicitly says:

Numbers automatically converts double hyphens (--) to dashes (—) and converts straight quotation marks to curly quotation marks as you type. You can turn this setting off or on at any time.

Note: The setting affects both hyphens and quotation marks—they’re both either off or on.

[...]

Tip: To use different formatting for specific text, change the setting, type the text, then change the setting back.

(Even though it says "Numbers automatically converts [...]," the setting is the same: Settings → General → Keyboard → Smart Punctuation. It's not specific to Numbers.)

This blog post suggests developers can turn this off selectively:

A first step, if using a UITextInputTraits conforming control, would be to set smartQuotesType to UITextSmartQuotesTypeNo, and set smartDashesType to UITextSmartDashesTypeNo.


If it's only about Markdown, you don't need to change any settings. Alternate syntax is available for both headers and horizontal rules:

# Header 1
## Header 2

- - -
***
____

Gives:

Header 1

Header 2




That last uses underscores (_).

9
  • 1
    I can't complain about this answer, but it isn't my right to change permanent settings on any iPad I happen to be working with. Commented Jun 10, 2019 at 14:11
  • 2
    What else does Smart Punctuation affect? I'd love to turn this off, but you should probably include the full effects so future readers don't get any nasty surprises.
    – scohe001
    Commented Jun 10, 2019 at 16:05
  • 2
    @scohe001: Curly quotes (or feathers/guillemets, etc.) is the only other option that this affects, AFAIK. Commented Jun 10, 2019 at 22:39
  • 1
    Doesn’t it also convert three periods (...) into an ellipsis (…) ?
    – Josh
    Commented Jun 11, 2019 at 3:42
  • 5
    @Harper Why does it have to be permanent? Can't you turn off the Smart Punctuation while using it, then turn it back on when done?
    – Maxim
    Commented Jun 11, 2019 at 16:11
13

If you don't want to turn off Smart Punctuation as suggested in muru's answer, you can type a space between each hyphen then go back and delete the spaces. The hyphens will not be changed into typographic dashes.

The obvious suggestion would be to set up a text replacement in Settings > General > Keyboard > Text Replacement, so that (for example) typing 4dash gave you a sequence of four hyphens, but that doesn't seem to work either, at least on iOS 12.3.1. I tried a couple of different international keyboards and also dictating 'dash'es or 'hyphen's by voice, and none of those got the desired result.

The only other thing I can think of to suggest is to install a third-party keyboard, but I don't use any so I don't know how they interact with Smart Punctuation.

0
8

If you have the SE app, you can do it easily there, as it’s one of the shortcuts on the editing row.

Another option (that also works in-browser), possibly faster than deleting spaces, is:

  1. Type a hyphen
  2. Copy it
  3. Paste repeatedly

This will also sidestep the smart punctuation.

(As pointed out in comments...) For further efficiency, you can copy-paste increasingly longer blocks of hyphens until you get the length you need. Then, once you have a full set, you can copy it once and carry it with you in the clipboard, allowing you to reuse it easily throughout the answer.

4
  • 1
    If you copy/paste after each hyphen the string will grow exponentially. Might be a little quicker depending on how many hyphens you need.
    – JPhi1618
    Commented Jun 10, 2019 at 19:52
  • "Copy it" - although is there a quick way to copy a single (preceding) character? Long press + "select" selects the neighbouring block of text that I must then carefully reduce to the single hyphen. (?)
    – MrWhite
    Commented Jun 11, 2019 at 12:22
  • @MrWhite if you type a hyphen at the start of a new line, as in the OP's use case, then long press + select just selects the hyphen.
    – nekomatic
    Commented Jun 12, 2019 at 8:11
  • It would seem to depend on the application (at least in my case). Within the Stack Exchange editor, in a web browser (tested Chrome and Safari), or any textarea element for that matter, it selects too much. In other apps, it appears to correctly select just the hyphen.
    – MrWhite
    Commented Jun 12, 2019 at 10:19
3

In addition to what's been mentioned already, you can tap the microphone and say "hyphen hyphen hyphen hyphen hyphen hyphen".

7
  • I can I can I can I can - does this actually work for you?
    – nekomatic
    Commented Jun 12, 2019 at 8:07
  • 1
    ----- yes it does. Where are you from? Commented Jun 12, 2019 at 8:07
  • UK, with keyboard and Siri set to English (United Kingdom) and a fairly standard accent. I'll try out saying it different ways at some point when it won't make my colleagues think I'm crazy.
    – nekomatic
    Commented Jun 12, 2019 at 8:13
  • Apparently saying “dash” also works but the behavior is a bit weirder because it has to try to determine whether you meant the word “dash” or the symbol. Idk... do they use the word hyphen in the UK? Commented Jun 12, 2019 at 8:55
  • Saying "hyphen hyphen hyphen hyphen" works OK for me (UK) and inserts 4 contiguous hyphens. "Hyphen" is a common word in the UK. However, saying "dash" inserts an "EN DASH", not a "HYPHEN MINUS" and saying "dash dash dash dash" inserts "EN DASH + SPACE + EN DASH + SPACE + EN DASH + SPACE + EN DASH + SPACE" - not contiguous. (English UK)
    – MrWhite
    Commented Jun 12, 2019 at 11:25
1

To get line breaks in markdown, you can use the Keyboards -> Text Replacement to:

Replace —- with ___ 

That is: Replace em dash+dash that you’d get by typing dash thrice with three underscores.

enter image description here

Note that replacement to underscore works but if you try to replace to three dash, it gets passed through Auto Capitalization and auto-converts to the em dash+dash combo.

Here’s the final output, a little bit more convenient:

enter image description here

You must log in to answer this question.

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