You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I have some Rmd documents (weekly assignments) I want to render both as PDF (for turning them in) and HTML (for sharing them with classmates), and to make it easier, I use a simple build script that calls rmarkdown:render() for both formats:
However, when used in a script, the commands yield an error when building the PDF:
Error: Functions that produce HTML output found in document targeting latex output.
Please change the output type of this document to HTML. Alternatively, you can allow
HTML output in non-HTML formats by adding this option to the YAML front-matter of
your rmarkdown file:
always_allow_html: yes
Note however that the HTML output will not be visible in non-HTML formats.
Since it is possible to render both PDF and HTML interactively in RStudio through the "knit" button, I am confused as to what exactly I'm doing wrong. Also, your previous comments on Stackoverflow I found through googling suggest that kabelExtra functions are "smart" enough to decide for themselves which output format is required.
To Reproduce
I have prepared a demo project here: https://github.com/jemus42/Rmd-pdf-html-debug
You can clone the project, interactively render the testing.Rmd to PDF and HTML, and then execute the lines in the build.R script which should yield the described error.
I would like to know if this is some bug somewhere or if my understanding of the knitr/RMarkdown/kableExtra internals is merely insufficient.
Edit:
Tested this on macOS Mojave and Ubuntu 16.04, each with current R 3.5.1 and up to date packages (CRAN)
The text was updated successfully, but these errors were encountered:
Hi, @jemus42 this question is kind of related with this SO question. The trick this time is to add envir = new.env(). I put the detailed explanation in my updated answer there.
Describe the bug
I have some Rmd documents (weekly assignments) I want to render both as PDF (for turning them in) and HTML (for sharing them with classmates), and to make it easier, I use a simple build script that calls
rmarkdown:render()
for both formats:However, when used in a script, the commands yield an error when building the PDF:
Since it is possible to render both PDF and HTML interactively in RStudio through the "knit" button, I am confused as to what exactly I'm doing wrong. Also, your previous comments on Stackoverflow I found through googling suggest that
kabelExtra
functions are "smart" enough to decide for themselves which output format is required.To Reproduce
I have prepared a demo project here: https://github.com/jemus42/Rmd-pdf-html-debug
You can clone the project, interactively render the
testing.Rmd
to PDF and HTML, and then execute the lines in thebuild.R
script which should yield the described error.I would like to know if this is some bug somewhere or if my understanding of the knitr/RMarkdown/kableExtra internals is merely insufficient.
Edit:
Tested this on macOS Mojave and Ubuntu 16.04, each with current R 3.5.1 and up to date packages (CRAN)
The text was updated successfully, but these errors were encountered: