Unable to produce landscape orientation microsoft word document from R markdown when using classoption: landscape

谁说胖子不能爱 提交于 2020-01-03 18:06:05

问题


I am unable to produce a landscape orientation document when using RStudio and Rmarkdown.

R is version 3.4.2 RStudio is version 0.98.1103

I cannot change these as they are the latest versions on the cluster which I run my programs on.

After knitting the document, I do get a document out (in portrait form), however get the following error message:

Output created: test_landscape.docx
Warning message:
In (function (toc = FALSE, toc_depth = 3, fig_width = 5, fig_height = 4,  :
  table of contents for word_document requires pandoc >= 1.14

Reproducible code is here:

---
title: "test_landscape"
author: "Name"
date: "09/10/2018"
output: word_document
classoption: landscape
---

Test for landscape orientation

```{r}
summary(cars)
```

You can also embed plots, for example:

```{r, echo=FALSE}
plot(cars)
```

Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.

Unsure if this is more suited to cross validated, as R is a statistical programming language, but the question is not a statistical one.

Thank you.

EDIT: Have edited title to better represent my problem after the below comment.


回答1:


Thanks to Ralf Stubner.

There is a good explanation for the process of how to do this specifically for word here: https://rmarkdown.rstudio.com/articles_docx.html

You must create a word document that has the setting (e.g. landscape orientation) that you want, save it in the same location as your .Rmd file and then refer to it as the reference document, e.g.:

---
title: "test_landscape"
author: "Name"
date: "09/10/2018"
output: 
  word_document:
    reference_docx: word_styles.docx
---


来源:https://stackoverflow.com/questions/52719576/unable-to-produce-landscape-orientation-microsoft-word-document-from-r-markdown

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!