3.4 Word document
To create a Word document from R Markdown, you specify theword_document output format in the YAML metadata of your document:
---title:"Habits"author: John Doedate: March 22, 2005output: word_document---The most notable feature of Word documents is the Word template, which is also known as the “style reference document.” You can specify a document to be used as a style reference in producing a*.docx file (a Word document). This will allow you to customize things such as margins and other formatting characteristics. For best results, the reference document should be a modified version of a.docx file produced usingrmarkdown or Pandoc. The path of such a document can be passed to thereference_docx argument of theword_document format. Pass"default" to use the default styles. For example:
---title:"Habits"output:word_document:reference_docx: my-styles.docx---For more on how to create and use a reference document, you may watch this short video:https://vimeo.com/110804387, or read this detailed article:https://rmarkdown.rstudio.com/articles_docx.html.
3.4.1 Other features
Refer to Section3.1 for the documentation of most features of Word documents, including figure options (Section3.1.5), data frame printing (Section3.1.6), syntax highlighting (Section3.1.4), keeping Markdown (Section3.1.10.1), Markdown extensions (Section3.1.10.4), Pandoc arguments (Section3.1.10.5), and shared options (Section3.1.11).