【发布时间】:2017-04-08 06:45:06
【问题描述】:
我使用其中一个reveal.js 模板(使用revealjs R 包)在R 中做了一个演示。
默认情况下,它会生成一个 html 文件,当打开以进行演示时,它会显示浏览器的顶部,包括书签、文件路径等...我可以关闭书签栏但不能关闭文件路径部分,我需要在一个正式设置,因此将演示文稿导出为 pdf 似乎是一个更好的选择。
有谁知道如何将其导出为pdf?我可以在 YAML 标头中添加任何内容,以便输出为 pdf 而不是 html?
下面是示例代码,它生成“test.html”文件。我想生成“test.pdf”,同时保留演示文稿的所有其他属性,例如转换、交互式绘图等......
---
title: "test"
output: revealjs::revealjs_presentation
---
## R Markdown
This is an R Markdown presentation. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.
When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document.
## Slide with Bullets
- Bullet 1
- Bullet 2
- Bullet 3
## Slide with R Code and Output
```{r}
summary(cars)
```
## Slide with Plot
```{r, echo=FALSE}
plot(cars)
```
【问题讨论】:
-
如果您在可以测试的示例代码中包含某种reproducible example,会更容易提供帮助。
-
使用 Chrome,选择打印并另存为 PDF ....
-
@MartinSchmelzer 保存为 pdf 只会生成静态 pdf 文件,会丢失演示文稿的属性,包括交互式绘图、转换标题等。
-
@MrFlick 添加了带有示例代码的可重现示例
-
我不知道在 pdf 文件中进行交互式绘图的任何可能性。
标签: r pdf rstudio r-markdown reveal.js