How do I get rmarkdown and knitr to use em-dash with .docx files?

I am new to using rmarkdown and knitr to create .docx text documents. The rmarkdown reference manual states that using - gives en-dash and --- gives an em-dash.

If I embed my .Rmd file in HTML, the hyphen and em dash work correctly, but when pasted into a text document they remain as - and ---.

I am using Microsoft Word 2013 and I checked the auto formatting options to replace the hyphens with dashes.

Any help would be much appreciated, thanks!

+3


source to share


1 answer


You need to add pandoc_args: ["--smart"]

in the title: Then these are the words for the DocX format



---
output: 
    word_document:
        pandoc_args: ["--smart"]
---

      

+5


source







All Articles