16

In many word processors, when you type " twice, it will give you a left and right double quotation marks in sequence, they are smartly matched. Why does latex end up with using,

``Blahblahblah...''

to do double quotings?

Question: Any philosophy behind this design?

A side complaint: This is very annoying when you try to copy a text file with a lot of " double quote marks. And you cannot just simply replace them all, you have to do it manually!!!

13
  • 14
    \documentclass{article}\usepackage{csquotes}\MakeOuterQuote{"}\begin{document}"Hello"\end{document} (this will probably not work with babel and a language that uses " as shorthand...)
    – cgnieder
    Jul 31, 2013 at 15:23
  • 1
    My editor TeXnicCenter does this trick for me. you can configure what you want.
    – Mensch
    Jul 31, 2013 at 15:48
  • 8
    Related: Replace “quotes” with „quotes“?
    – cgnieder
    Jul 31, 2013 at 16:14
  • 6
    Realy, use the csquotes package as suggested by @cgnieder. It does exactly this and has the additional advantage that you could easily change the actual quote style (single, double, french quotes...) in a central position.
    – Daniel
    Aug 1, 2013 at 6:01
  • 1
    Related tex.stackexchange.com/q/531/15925 Aug 1, 2013 at 7:04

4 Answers 4

6

The standard logic for inserting smart quotes in place of dumb quotes is as follows:

  1. If there is a space character before the quote, it is an opening quote;
  2. Otherwise, it is a closing quote.

However, this is problematic in the case of the apostrophe. Consider the (English) transcription of the dropped 'h' in 'hello', which is stereotypically attributed to the Cockney accent:

’ello

According to the rules above, this would be typeset as an opening single quote, rather than as an apostrophe (which is equivalent to the closing single quote).

Although I am not familiar with the language, I gather that there are many examples of this in French as well.

There is no algorithm for determining when such an apostrophe is intended, rather than an opening quote, and so incorporating this feature would require an exception list, as in hyphenation. However, since the use of apostrophes for indicating elisions (as in the example above) is significantly increased in dialectal speech (at least in English), an exception list is not an appropriate solution to this problem.

So it is not appropriate for the compiler to attempt to convert dumb single quotes into smart single quotes. Although your question refers to double quotes, single quotes and double quotes really ought to work the same way, since they are so closely related.

3
  • 1
    While this is would certainly be an issue for the “take dumb quotes as input, compile as smart quotes” approach, it’s hardly a deal-breaker: an extremely similar problem occurs with LaTeX’s approach to spacing after periods (i.e. assume by default that periods are sentence-final, unless explicitly escaped by the user). Indeed, I’d guess that non-sentence-final periods are considerably more frequent than word-initial apostrophes. Aug 14, 2013 at 23:23
  • @PeterLeFanuLumsdaine The crucial difference between sentence spacing and smart quotes is that sentence spacing is cosmetic--it only improves the document's appearance--whereas smart quotes can alter the meaning of words. If you don't know about TeX's automatic sentence spacing, it doesn't really matter, but it can be quite a world of difference if you don't know about the conversion of quote marks.
    – ChrisS
    Aug 15, 2013 at 7:56
  • While I agree the difference is slightly more than just cosmetic, I don’t think it’s that crucial — I can’t think of any case, even contrived, where actual misunderstanding or ambiguity could be cause by a mis-punctuation of ’ello, ’cello, or ’tis. (I say this despite it having been a pet peeve of mine for years, in documents written in Microsoft Word and the like.) Aug 16, 2013 at 14:07
6

Short answer: You said it: "while typing". LaTeX code can be typed with any text editor and even any word processors, so this is a problem of the editor, not the LaTeX code, that it must be unambiguous. Use a editor with this feature, as TeXWorks.

Long answer: Since pdflatex, xetex, etc work with an already typed code, a LaTeX solution would require a posteriori the interpretation of your thoughts in that you have typed, a needless complication in IMHO. For instance, what to do with this simple code?:

\documentclass{article}
\begin{document}
2", 5" and 7"
\end{document}

May be you want here 2``, 5'' and 7", or may be 2", 5`` and 7'' or simply 2", 5" and 7" exactly as you typed? What to do if this interpretation is wrong? It will be a pain if you need to re-edit to be more specific about what you want really.

Instead, if the interpretation of your thoughts is done by the editor, misinterpretation is less painfull. Following the example, if you typed in TeXWorks 2", 5" and 7" and "more" will be typed 2'' and 5'' and 7'' and ``more'' (note that each " are now two characters) that probably is what you want, but in other case you can change easily in a second.

Anyway, this feature is not painless, since this force that " (single character) must be obtained with Ctrl+Shift+2 instead of the usual Shift+2.

2
  • Didn't know this about TeXWorks—really cool! But I have to ask… Ctrl+May+2? What is May? Aug 15, 2013 at 2:32
  • 1
    @SeanAllred, Sorry, I was not aware that in an English keyboard this is the Shift key. May is the usual abbreviation of "mayúsculas" (upper case).
    – Fran
    Aug 15, 2013 at 2:47
3

I have difficulties understanding what you want to ask. I recognize 3 distinct points here:

(1) Why doesn't Latex automatically change " + " to smart quotes + ?

(2) Why does LaTeX use `` + '' for quoting?

(3) It's annoying that you can't automatically replace dumb quotes " + " with smart quotes + in LaTeX when you copy and paste a text with dumb quotes into a text editor.

The answer to (1) is that LaTeX uses (2). I can't see how that's any better or worse than using " + ". Nevertheless, at least some text editors (e.g. Texworks) will automatically replace " + " with the conventional LaTeX sequences `` + ''.

For (3), I guess that's annoying, but I don't know of any other word processor that automatically replaces " + " with smart quotes + when you copy a text with dumb quotes either. MS Word certainly does not.

3
  • Concerning you last paragraph, I'd rather prefer no replacement at all than giving me two s by latex's "auto-replacement".
    – Daniel
    Jul 31, 2013 at 20:09
  • 1
    Concerning (3) it is easy to do with WinEdt with RegEx: search for "\(**\)", replace with ``\0'' (I don't know how to to get rid of bactick in comments...) Jul 31, 2013 at 20:11
  • @Daniel: In that case you can replace all dumb quotes with something like \textquotedbl, which the fontenc package will output as dumb quotes.
    – Sverre
    Jul 31, 2013 at 20:21
1

In an editor, you can always undo the change. When LaTeX processes it, you do not have such an option, as the processing is usually not interactive (apart from some errors). So, if the autoreplace was there, we'd also need a "don't replace" version, which would be a needless complication.

Add to that that software systems that try to outsmart the user, usually end up being to stubborn for normal use, with the results often less than satisfactory.

Similarly, if you use \begin{equation}...\end{equation}, LaTeX will add a tag, even if you didn't use \label{...} and, hence, will not be referencing the equation. You made a choice to use a tagged equation, and LaTeX is not trying to outsmart you. Same with the quotation marks: you take your pick, and LaTeX respects it, thus reducing the number of undesirable results.

You must log in to answer this question.

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