【发布时间】:2017-11-24 21:53:01
【问题描述】:
我可以编写一个 YAML 标头来使用 knitr 为 R Markdown 文件生成多种输出格式吗?我无法重现the original question with this title 的答案中描述的功能。
这个降价文件:
---
title: "Multiple output formats"
output:
pdf_document: default
html_document:
keep_md: yes
---
# This document should be rendered as an html file and as a pdf file
生成一个 pdf 文件,但不生成 HTML 文件。
还有这个文件:
---
title: "Multiple output formats"
output:
html_document:
keep_md: yes
pdf_document: default
---
# This document should be rendered as an html file and as a pdf file
生成一个 HTML 文件(和一个 md 文件),但不生成 pdf 文件。
后一个例子是original question 的解决方案。我曾尝试使用 Shift-Ctrl-K 和 RStudio 中的 Knit 按钮进行编织,以及调用 rmarkdown::render,但无论我使用哪种方法生成输出文件,都只创建了一种输出格式。
可能相关,但我无法确定解决方案:
- How do I produce R package vignettes in multiple formats?
- Render all vignette formats #1051
- knitr::pandoc can't create pdf and tex files with a single config #769
- Multiple formats for pandoc #547
- three year old RStudio blog post 中提到了多种输出格式支持
使用 R 版本 3.3.1 (2016-06-21)、knitr 1.14、Rmarkdown 1.3
【问题讨论】:
-
标题中的
(new)指的是哪里?这是knitr的特殊版本吗,例如Windows NT中的NT -
@Anthon 括号中的“新”指的是这个问题与之前提出(并回答)的问题具有相同的标题。
标签: r yaml knitr r-markdown