I have found that the smart-quotes option of org-mode does not export properly the quotes when they are nested (single quotes inside double quotes), but only when they coincide at the start or the end of the quote.

Maybe the problem will be clearer with an example:

#+TITLE: Smart quotes example
#+OPTIONS: toc:nil ':t
#+LANGUAGE: en
#+LATEX_CLASS: book
She said to me: "Rick screamed, 'let's go together'" 

This gets exported to TeX as:

She said to me: ``Rick screamed, `let's go together'''

Which gets rendered as PDF as:

The order of the closing quotes is wrong

The order of the closing quotes gets reversed, it first closes the outside double quotes and then the nested single quote.

I have tried leaving a space between them, but that is arguably worse

Org:

She said to me: "Rick screamed, 'let's go together' " 

TeX:

She said to me: ``Rick screamed, `let's go together' "

PDF:

Internal quotes are ok, closing double quote is wrong

In this case, the internal single quotes are rendered correctly, but the closing quote is not converted into its "smart" version.

If the nested quotes are in such a way that there are other characters between the quotes, that is they are not together at the start or the end of the quote, they get rendered correctly.

  • 2
    This probably qualifies as a bug. Please report it on the org-mode mailing list. – NickD Oct 5 '17 at 14:08
  • It would seem to me as well. I have reported it to the mailing list. Thanks for your comment! – Martín Oct 5 '17 at 16:38

I am answering my own question, after posting it in the org-mode mailing list and getting help from the wonderful people there.

Regarding the first example, the problem was not with org-mode, but with LaTeX not being able to correctly interpret the three consecutive single quotes at the end (... together''').

Regarding the second example, when adding a separating space between the single and the double quotes, apparently there was a bug in the org-mode I was using (8.2.10), which got fixed in a later version.

I updated org-mode from the Org ELPA sources to the last version (9.1.2) and the problem went away.

In summary, you should separate the nested quotes with a space for them to get correctly exported.

  • If Org Mode really wanted to it could generate the ugly but correct LaTeX '{}'' to correct the problem of the three consecutive single quotes. I don't think it would be worth complicating the exporter to account for this edge case. – Omar Oct 7 '17 at 1:42
  • There were also some other edge cases that the update fixed for me. For instance, in org-mode 8.2.10, when the double quotes or the slash character were right next to an em-dash, it did not interpret neither the smart quotes or the italized text. Ex: when I wrote Yesterday he said something---"this is my house"---that shocked me, the quotes inside the em-dashes would not get "smarter". – Martín Oct 8 '17 at 17:18

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.