Normally when you want left quotation marks in LaTeX, you type the following:


However, in RMarkdown, you will trigger a block of R code to run when you type two pairs of backticks on the same line, causing the LaTeX to render incorrectly.

For example,

``Sticks and stones may break my bones,'' he said. ``But words will never hurt me.''

Will be rendered incorrectly in the output document; specifically, the stuff enclosed by the backticks will be printed out by R, and everything after will be rendered properly by LaTeX. Here is a picture:

bad rendering

I then attempted to use backslashes in order to escape the R code, and this got me closer, but now the right quotation marks are now recognized as a pair of single quotes right next to each other:

\`\`Sticks and stones may break my bones,'' he said. \`\`But words will never hurt me.''

closer, but no cigar

How can I properly obtain two left quotation marks on the same line using RMarkdown, without having these render issues?

2 Answers 2


First of all, you need to be aware of this fact:

Markdown is not LaTeX.

So in general you should not expect LaTeX syntax to work in Markdown documents. The correct way to write quotes in Markdown is to just write quotes literally, i.e., use " ". They will be converted to the correct LaTeX code (i.e., `` '') when Markdown is converted to LaTeX (via Pandoc). The same thing applies to single quotes.

Backticks have a special meaning in Markdown: they are used to write text verbatim. You can use any number of backticks (one, two, three, ...), as long as the backticks come in pairs. In your case, you have a pair of double backticks, which mark the text Sticks and stones may break my bones,'' he said. as verbatim.

I strongly recommend you to read the Pandoc's Markdown syntax at least once before using R Markdown. It will save you a lot of time in the future, and you probably won't have questions about the Markdown basics.

  • @CoreyLevinson If you want it to be LaTeX in stead of Markdown, you could use the R-and-Weave (.Rnw)-format. I wrote a package includeRnw to make it even more LaTeX-convenient. Commented May 15, 2018 at 17:34

The R-side fix:

It's a bit hairy, because you could do escaped regex in R to redefine what is interpreted as R-code. However, there is an "easy" way out:

Redefining how knitr parses you file:

A little depending on how the file is knited. The idea here is to define the pattern right before it's knited.

If you're in RStudio then you can redefine what is the current -code chunk to, say, the default Rnw syntax. From the knitr docs. So in R:

old_patterns = knit_patterns$get() # old pattern list (to restore later)
all_patterns = all_patterns # a list of all built-in patterns
str(all_oatterns) # See all the patterns
knit_patterns$set(all_patterns[["rnw"]]) # set pattern list from 

However, there are some TeX alternatives:

The quickTeX-fix

Make a new character, e.g. ", to represent a backtick, and use it like this:

        % Define " to be an active character
        % Define " to be the backtick ` like so
        % Now use " as if it was a back
        ""Sticks and stones may break my bones,'' he said. ""But words will never hurt me.''

Another (possibly) quick (possibly) fix:

use the package dirtytalk:

    \say{Sticks and stones may break my bones,} he said. \say{But words will never hurt me.}

Yet another (possibly) fix:

You can make your own external tex file that is not parsed by knitr:

%% quoteCommands.tex

and then

        \startQuote Sticks and stones may break my bones,\endQuote he said. \startQuote But words will never hurt me.\endQuote
  • This is a great writeup of a number of ways to get the correct result, but I have marked the other answer correct because it is simpler (just use the quotation marks.) It was not obvious to me that I have been writing in Markdown instead of LaTeX, but now that I realize that I am writing in Markdown, I will begin to use Markdown notation. (Example: I was curious why \textbf{hey} wouldn't always work. Now I know just to use hey). Commented May 17, 2018 at 3:16
  • @CoreyLevinson Also, the other post is written by the creator of Knitr. I would have done the same as you :) Commented May 17, 2018 at 6:56

You must log in to answer this question.

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