8

Let's assume an OP wishes to juxtapose the validity of, or difference between two commands in the question title. Both commands do quote a string, like puts "foo" and p "foo". To improve legibility, it seems reasonable to separate the actual commands from the question with extra quotation marks.

SE sites convert quotes in titles to typographer's (a.k.a. double) quotes.

Obviously, this title is not a good idea:

Fastest way to print: Should I use "puts "foo"" or "put "foo""? becomes
Fastest way to print: Should I use “puts “foo”” or “put “foo””? after conversion.

Typographic convention for quoting strings containing double quotes is to use single quotes, which then again are converted to typographically correct equivalents by SE.

More readable:

Fastest way to print: Should I use 'puts "foo"' or '"put "foo"'? becomes
Fastest way to print: Should I use ‘puts “foo”’ or ‘“put "foo”’? after conversion.

I have also seen people using the grave accent ("backtick") for the outer quotation mark:

enter image description here

A typographic abomination, it may be defendable from a computer science-only standpoint.

For Stack Exchange, is there one correct way to "double quote" mentioned above, or is there one or more incorrect way/s?

1 Answer 1

2

Firstly, kudos for the phrase "typographical abomination"; it's also an ocular abomination, so let's put the backtick option to one side.

There is no "Stack Exchange" method of quoting a double quoted string in a title. So, use either of your methods; if you have to do such a thing. I would argue that you don't have to.

A title should be your way of describing the question and interesting your potential readership. You don't want to make your title difficult to parse. By adding nested double quotes, whether the typographer's version or not, you're doing exactly that.

To use your example, I would title the question:

Is puts or put the fastest way to print?

You can double quote if you want, for further clarity:

Is “puts” or “put” the fastest way to print?

I think this is a significant improvement; any problems with nested quotes are gone. It's also more human readable because it's a single, full-sentence question, rather than an implicit question fragment and a separate explicit question, which is seemingly unrelated to the first, implied, question.

You must log in to answer this question.

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