使用classoption时,无法从R markdown生成横向Microsoft Word文档 [英] Unable to produce landscape orientation microsoft word document from R markdown when using classoption: landscape

查看:153
本文介绍了使用classoption时,无法从R markdown生成横向Microsoft Word文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用RStudio和Rmarkdown时,我无法生成横向文档.

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

R是版本3.4.2 RStudio版本为0.98.1103

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

可复制的代码在这里:

---
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.

由于R是一种统计编程语言,所以不确定这是否更适合交叉验证.

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

谢谢.

在下面的评论之后,已编辑标题以更好地表示我的问题.

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

推荐答案

感谢Ralf Stubner.

Thanks to Ralf Stubner.

这里有一个专门针对单词的流程的很好解释: https://rmarkdown.rstudio.com/articles_docx.html

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

您必须创建一个具有所需设置(例如横向)的Word文档,将其保存在.Rmd文件所在的位置,然后将其称为参考文档,例如:

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
---

这篇关于使用classoption时,无法从R markdown生成横向Microsoft Word文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆