Specifying multiple concurrent output formats in knitr (new)
Is it possible to write a YAML header to generate multiple output formats for an R Markdown file using knitr? I have not been able to reproduce the functionality described in the answer to the original question with this title .
This markdown file:
---
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
creates a PDF file, but not an HTML file.
And this file:
---
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
creates HTML file (and md file) but not pdf file.
This last example was the solution asked by the original question. I tried knitting with Shift-Ctrl-K and Knit button in RStudio as well as calling rmarkdown::render
, but only one output format is generated regardless of the method I use to create the output file.
It might be related, but I couldn't figure out solutions:
- How do I create R vignettes in multiple formats?
- Check all vignette formats # 1051
- knitr :: pandoc cannot create pdf and tex files with one config # 769
- Several formats for pando # 547
- Multiple Output Formats Allusion in RStudio's 3-Year Blog
Using version R 3.3.1 (2016-06-21), knitr 1.14, Rmarkdown 1.3
source to share
I briefly mentioned in Mark all vignette formats # 1051 and you missed it:
rmarkdown::render('your.Rmd', output_format = 'all')
It is documented on the help page ?rmarkdown::render
.
source to share