New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
render() fails without R session restart #1851
Comments
I think this is indeed related to KableExtra and Rmarkdown. From what I know, here is what I think is happening: To work with Latex, kable extra requires some Tex packages to be loaded. In order to simplify, these packages are trying to be automatically "provided" by kableExtra as information for rmarkdown to be found. This happens at load time : https://github.com/haozhu233/kableExtra/blob/master/R/zzz.R It works by passing the information to knitr and rmarkdown that these latex dependencies are required. When rendering, the What happens in your case is that at first call to In your case, you need ---
title: "toy_example"
output: pdf_document
header-includes:
- \usepackage{booktabs}
---
```{r cars}
library(kableExtra)
kable(head(mtcars), format = "latex", booktabs = T)
```It is possible that the packages are added as latex dependencies in I don't know if it is a bug, or a limitation in usage to render a Rmd file to PDF with kableExtra in a clean session each time. @haozhu233, if I may, what do you think ? Hope it helps. |
|
Thank you for this. Unfortunately, the addition of to the YAML header doesn't actually change the behavior/ solve the problem on my end, either for the toy example or my larger use case. |
|
Thanks for the feedback. For the toy example, it should work if you copy paste the code above For your larger use case, with this workaround, you may need to include more that the booktabs packages. See the full list in the vignette: https://cran.r-project.org/web/packages/kableExtra/vignettes/awesome_table_in_pdf.pdf |
|
Thank you for this. I should've read the linked vignette to see the recommended req headers, which are: |
|
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary. |
Hello- I first investigated this issue on this RStudio Community post. But here's the problem:
The following toy example .Rmd knits just fine from the RStudio IDE knit button:
toy_ex.Rmd
It fails, however, using
rmarkdown::render("toy_ex.Rmd")from the console, producing this error at the end of attempted compilation:BUT if I restart R...it will successfully render via
rmarkdown::render("toy_ex.Rmd"), BUT ONLY ONCE; ie a subsequent identical call will again produce the error.Now, I realize that the use of
{kableExtra}is possibly contributing to the error here, but the idiosyncratic behavior ofrenderseems like more of an rmarkdown issue.Thank you for your time and many contributions to this fine community.
By filing an issue to this repo, I promise that
xfun::session_info('rmarkdown'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version:remotes::install_github('rstudio/rmarkdown').I understand that my issue may be closed if I don't fulfill my promises.
The text was updated successfully, but these errors were encountered: