27

On Stackexchange sites I quite often have to use the backtic which can be got at usually as the key beside 1 (left side ) however when I press it the first time the ` doesn't appear until I press it again (at which point I get `` (2) or if I press another key such as a space.

Is there a historical reason for this or is it just my keyboard?

Toby Allen
  • 3,015
  • 5
  • 31
  • 46
  • 4
    Might be a [keyboard layout thing](https://en.wikipedia.org/wiki/Dead_key). – u1686_grawity May 09 '14 at 13:45
  • Note: I had an issue on Android with a Samsung keyboard where pressing backtick followed by space / right arrow on a US international style keyboard layout created `'MODIFIER LETTER GRAVE ACCENT' (U+02CB)` which *shows* as a backtick, but isn't one. This is likely a bug, but it took me some time to figure out why my inline code suddenly wasn't rendered anymore. Change to US layout, is what I'm telling you! – Maarten Bodewes May 18 '19 at 12:06
  • Note that pressing ` then `SPACE` does not insert a space but only `, so it may help to get around this inconvenience. [source](https://superuser.com/a/1504422) – Gabriel Devillers Jan 04 '23 at 11:33

3 Answers3

30

This is either your keyboard or the software you are using (we can't see that from here). So it is not specific to StackExchange sites.

This is done because the software supports another feature: pressing the apostroph or the backtick followed by another letter (most common a vowel) is an easy way to write diacritical characters like é and è.

Because of this feature the software cannot immediately display the apostroph or backtick, it has to wait for the next character to determine what your intention is. Only when you press the next backtick it knows that you intended to enter a backtick.

This is not bad in itself: just remember to type the backtick twice, then press cursor left, then type what comes between them. That way you won't forget the closing backtick.

This is akin to typing the { } brackets in the C programming language first before entering the code that goes in between. There, having a closing bracket at the correct location is much more important.

This is not only done with apostroph and backtick, but e.g. also with double quotation marks (" and e gives ë) and even with consonants (, and C gives Ç).

Jan Doggen
  • 4,108
  • 10
  • 36
  • 51
  • 10
    This is indeed very likely to be the keyboard layout setting. By default there are 2 layouts set per language and a simple `CTRL` + `SHIFT` changes the layout. Additionally if you add a language, `ALT` + `SHIFT` changes between keyboard language settings. By using US International, you indeed get the behavior from the question. Setting it to United States will remove it. – LPChip May 09 '14 at 14:24
  • The apostrophe (') and the "backtick" (`) are two different symbols. The former is an actual symbol that is supposed to stand for itself, the latter is what could be called *misuse* of a diacritic mark that normally appears exclusively in combination with other characters. The apostrophe key is often not configured as a dead key, as an apostrophe can perfectly stand for itself, (though certain keyboard layouts that need to accommodate many accented characters might vary) and thus pressing the apostrophe key immediately writes an apostrophe. – O. R. Mapper May 09 '14 at 20:21
  • @O.R.Mapper: Are there any keyboard layouts available which behave normally for ASCII characters, but still allow accented characters to be typed sensibly? Macintosh could do it 30 years ago using Option+grave as a "grave" dead key, Option+apostrophe as an "aigu" dead key, and Option+shift+apostrophe as an "umlaut" dead key, among others; would something so sensible be beyond Microsoft's comprehension? – supercat May 09 '14 at 23:22
  • @supercat: I don't understand what you mean. Having the apostrophe as a non-dead-key that does not combine with characters and an acute and grave accent both as dead keys that do combine with characters *is* a sensible way to allow accented characters, is it not? That said, nothing stops you from [creating your own keyboard layouts for Windows](http://msdn.microsoft.com/en-us/goglobal/bb964665.aspx). – O. R. Mapper May 19 '14 at 06:47
  • @O.R.Mapper: On the classic Macintosh keyboard layout (don't know if it's changed), option+apostrophe, option+shift+apostrophe, and option+grave are dead keys, but the keys without option just type their normal ASCII codes. – supercat May 19 '14 at 15:27
  • @supercat: Isn't that somewhat broken? I mean, accents are almost exclusively used for combination with characters. Why make it more cumbersome to write accented characters than it already is? Also ... what kind of a dead key is option+apostrophe? An apostrophe is not something that could be combined with another character. – O. R. Mapper May 19 '14 at 15:49
  • @O.R.Mapper: Option+Apostrophe = aigu; Option+Shift+Apostrophe = umlaut/dieresis. As for the grave character being used only as an accent, a lot of programmers use it more often for other things, `like this` [previous two words surrounded by grave characters] As for the cumbersomeness of accented characters, I think option+apostrophe e is a lot nicer than Alt+130, which is what the default US-English keyboard layout requires. – supercat May 19 '14 at 19:32
  • @supercat: Oh, I see, so the apostrophe is not actually related to what can also be written with the key. True, a few language designers have unfortunately "hijacked" some accents to mean things on their own. Granted, that combination with the number is not convenient. As you were asking for the ability to *sensibly type accented characters*, I compared the Option+... combinations to the European keyboard layouts I'm used to where an acute is often on a key of its own, without any need for an additional modifier key. – O. R. Mapper May 19 '14 at 19:43
  • @O.R.Mapper: Ah. The US/International layout uses the grave key (left of '1') and the quote/apostrophe key (right of semicolon) as dead keys. – supercat May 19 '14 at 20:28
  • @supercat i love you, now I'm going to use option+shift+apostrophe instead. Thanks! – Endless Jan 31 '17 at 10:26
  • @Endless: I wonder why MS doesn't supply a layout for US keyboards which makes all ASCII codes directly available, but uses altGr with other keys to act as dead-key accents? That works out really nicely both for typing accents and when typing other things. BTW, a word processor I got in 1986, and which I often used as a text editor until Windows 7 made my give it up, used grave as an "accent" key which was typed between the letter and the desired accent. I liked that as an approach, but unlike the dead-key approach it requires application support. – supercat Jan 31 '17 at 15:14
  • "This is not bad in itself: just remember to type the backtick twice" - it also requires that you type the backticks first. Most of the time when I want to type a backtick I have already typed something and wish to wrap backticks around it. – AnnanFay May 24 '23 at 07:39
15

This is called a dead key. https://en.wikipedia.org/wiki/Dead_key

It depends on your local settings (i.e. Keyboard layout).

Echsecutor
  • 336
  • 1
  • 6
  • 1
    Concretely: "Extended" or "International" layouts may require a double-tap on the backtick key to display a single backtick symbol. Thanks to the other answers! :D – Andy May 26 '21 at 19:06
8

Other answers have mentioned that this can be a keyboard layout thing, but I felt that a concrete example might be useful, so:

On Windows I generally use the "English (UK) Extended" keyboard layout, which has better support for typing accented characters, but means I have to press backtick twice to get the ` character. If I switch to the basic "English (UK)" keyboard layout, I only have to press backtick once. So the latter keyboard is perhaps better for some uses (such as coding), even though the extended version is better for others (such as writing).

If you have more than one keyboard layout installed, on Windows you can use Ctrl + Shift to switch between them.

Nick F
  • 284
  • 3
  • 11
  • 2
    This deserves more upvotes, since (whilst the primary answer is correct) this is going to more concretely help a majority of users on here with this problem. – Brondahl Mar 23 '20 at 11:39
  • 1
    And using `CTRL` + `SHIFT` to switch between Extended and non-Extended (as mentioned by LPChip) helped me tremendously! – Shiraz Nov 10 '22 at 19:09
  • 1
    Ah, thanks, that's really useful @Shiraz! I often use `ALT` + `SHIFT` to switch between languages, but I didn't realise that `CTRL` + `SHIFT` switches keyboard layouts! I've added a note about that. – Nick F Nov 11 '22 at 23:49