41

I've noticed that man pages and other documents formatted by Unix utilities often use double backticks `` followed by double single quotes '' to wrap quoted phrases instead of the double quote character ". Single quotes are similarly replaced. Why is this?

Here are a couple examples, from the man page for grep:

 To find all occurrences of the pattern `.Pp' at the beginning of a line:

       $ grep '^\.Pp' myfile

 The apostrophes ensure the entire expression is evaluated by grep instead
 of by the user's shell.  The caret `^' matches the null string at the
 beginning of a line, and the `\' escapes the `.', which would otherwise match
 any character.

 The grep utility is compliant with the IEEE Std 1003.1-2008 (``POSIX.1'')
 specification.
2
  • 2
    I don't have enough for a full answer, but Emacs (in just about all the modes I've seen) has special highlighting for `...', making it stand out (even within comments). Jul 11, 2016 at 19:50
  • Ten years later, man grep now has smart quotes: pattern ‘.Pp’ and and the ‘\’ escapes the ‘.’
    – Hugo
    Feb 13, 2023 at 9:01

2 Answers 2

43

The semantics and the usual glyphs for these characters have changed (several times) during the last 50 years.

The six-bit predecessors of ASCII contained various multi-purpose characters, including one single quote-like character, which was used for anything that had some similarity with a quote: opening quote, closing quote, apostrophe, or (by overprinting) acute or grave accent.

ASCII introduced one more quote-like character, so that now we had ', which was used as apostrophe, closing quote, and acute accent, and `, which was used as opening quote or grave accent (the concrete glyphs differed in various fonts).

For some bizarre reason, ISO-8859-1 declared ' to be an apostrophe or undirected quote, declared ` to be a grave accent, added one more accent ´ (acute accent), and abolished overprinting (so that the isolated accent marks were now completely pointless). Later extensions (MS-Windows codepages and Unicode) fixed this by introducing new directed quote characters and combining accents.

What you see here is essentially a relict from ASCII times, when most fonts had paired (slanted and/or curly) glyphs for ' and `.

3
  • 7
    Actually, ISO-8859-1 was irrelevant to overprinting and reflects an effect rather than a cause. That was lost due to (essentially) no video terminal support for the feature. Hardcopy terminals are unaffected. Mar 13, 2016 at 12:40
  • 3
    I think using `...' is a "GNU-ism". Recent gcc compilers also use this style of quoting.
    – U. Windl
    Mar 30, 2020 at 9:41
  • 1
    @U.Windl in program output, it is a GNUism, in man pages, it was/is used on UNIX as well.
    – schily
    May 4, 2020 at 21:28
11

Output like that is generated by makeinfo from Texinfo sources. Texinfo can also render to other formats like PDF, so it needs to be more expressive than ASCII. Maybe to avoid throwing away semantics, makeinfo encodes quotes like that, so you can see what is opening and closing quotes.

Example: If you couldn't see the difference, I can imagine I'd be a bit confusing if you wrote some Texinfo source and relied on the quote difference being visible, because you would have previewed it as PDF. Because you never rendered with makeinfo, you'd never discover that it isn't readable, rendered like that.

You must log in to answer this question.

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