Vinicius Brasil

June 8, 2021

The weird backtick-apostrophe `notation'

There is an old and weird convention to represent inline code that is still being used today. Instead of the regular surrounding grave accents `like this`, the weird notation is `like this'.

This is an excerpt from the bash man page:

For example, a{d,c,b}e expands into `ade ace abe'.

Another example from the same man page, with a similar pattern doubling the quotes:

-k file: True if file exists and its ``sticky'' bit is set.

And if you're thinking that this is exclusive to man pages, take this example from a Ruby stacktrace:

5: from /usr/bin/irb:23:in `<main>'

For the sake of curiosity, I could find where this convention comes from, why, and where this is still being used. The GNU documentation refers to this `pattern' as an older single-quoting convention. Even though referring as an old convention, we can still see it being used in various contexts, from Unix to Ruby.

The EmacsWiki recommends this notation and calls it the `backtick-apostrophe notation' and notes that the origins are uncertain. Looking up the GNU mailing list archive, Barry Margolin suggests that the original authors of the documentation were using a font that had a slanted apostrophe. If that is true, the original idea was to have something that looked `balanced´, but in the end, the actual representation ended up `unbalanced'.

Even though the origins are uncertain, we could say that using this `notation' today is a GNUism.

Another explanation for the convention is the visual and semantic confusion that can happen with the following glyphs:

  • ` ASCII code 96 representing a grave accent, or backtick
  • ´ ASCII code 239 representing an acute accent
  • " ASCII code 34 representing double quotes
  • ' ASCII code 39 representing an apostrophe

All these four glyphs exist independently in ASCII. Before this, some 6-bit encodings had the same character for multiple semantic purposes. The GNU convention could have come from the ASCII times and the styled fonts that printed these glyphs in a curved or over-stylized way.

About Vinicius Brasil

Building cool stuff with Elixir, OTP and Ruby. Musician and majoring in Theology. I'm based in beautiful Curitiba, and yes, that is my real last name.