我可以编写一个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中的“编织”按钮进行编织,以及调用
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
最佳答案
我实际上在Render all vignette formats #1051中简要提到过,而您却错过了它:
rmarkdown::render('your.Rmd', output_format = 'all')
它记录在帮助页面
?rmarkdown::render
上。
关于r - 在knitr中指定多种同时输出格式(新),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44685485/