yihui / knitr

A general-purpose tool for dynamic report generation in R
https://yihui.org/knitr/
2.36k stars 873 forks source link

knitr or tinytex error #2299

Closed lfmcmillan closed 9 months ago

lfmcmillan commented 9 months ago

Hi,

I am suddenly getting an unexplained error whenever I try to knit an Rmd file to PDF. One example file I've tried to knit is shown below: it's just the RStudio Rmd file example but changed to output to pdf.

I have also attached the log, and the .tex file relabelled as a .txt file to allow Github to accept it.

The error I am getting is:

output file: temp_rmarkdown_doc.knit.md

! Undefined control sequence. l.128 \cs_new:Npe __color_backend_devicen_colorants:n #1

Error: LaTeX failed to compile temp_rmarkdown_doc.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See temp_rmarkdown_doc.log for more info. Execution halted

and I'm submitting this as an issue because I can't find any reference to this particular control sequence anywhere on the web, nor can I find it in the .knit.md file or in the .tex file.

I have tried updating to the latest version of tinytex, so I'm now on version 4.7, and updating to the latest version of knitr, so I'm now on 1.44, and I'm on R 4.3.1 and I've restarted RStudio and R.

The example below was saved as an .Rmd file named temp_rmarkdown_doc.Rmd.

---
title: "Untitled"
output: pdf_document
date: "2023-10-11"
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)

R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

summary(cars)

Including Plots

You can also embed plots, for example:

plot(pressure)

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.



[temp_rmarkdown_doc.log](https://github.com/yihui/knitr/files/12874845/temp_rmarkdown_doc.log)
[temp_rmarkdown_doc.tex.txt](https://github.com/yihui/knitr/files/12874855/temp_rmarkdown_doc.tex.txt)

<!--
Please keep the below portion in your issue. Your issue will be closed if any of the boxes is not checked (i.e., replace `[ ]` by `[x]`). In certain (rare) cases, you may be exempted if you give a brief explanation (e.g., you are only making a suggestion for improvement). Thanks!
-->

---

By filing an issue to this repo, I promise that

- [X] I have fully read the issue guide at https://yihui.org/issue/.
- [ ] I have provided the necessary information about my issue.
    - If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
    - If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included `xfun::session_info('knitr')`. 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('yihui/knitr')`.
    - If I have posted the same issue elsewhere, I have also mentioned it in this issue.
- [X] I have learned the Github Markdown syntax, and formatted my issue correctly.

I understand that my issue may be closed if I don't fulfill my promises.
github-actions[bot] commented 2 months ago

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.