3

When trying to knit my rmd file, I'm getting this error -

! LaTeX Error: Unicode character ^^[ (U+001B)
           not set up for use with LaTeX.

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

Any ideas?

Michael Roswell
  • 1,300
  • 12
  • 31
  • Look for `warnings`, especially from **tidyverse**, that might have special characters like `ℹ`. This had me struggling for a long time. Changing from `pdf_output: default` to `pdf_output: pdf_engine: xelatex` gave me a helpful message in the "render" console, then setting the chunk options to `warning = FALSE` seems to enable render to pdf (html rendering had worked all along). – Michael Roswell Feb 23 '23 at 19:07
  • @yihuixie Not exactly sure what the framing of the issue would be here, but this is hard to troubleshoot. – Michael Roswell Feb 24 '23 at 14:16
  • related: https://stackoverflow.com/q/58907202/8400969 – Michael Roswell Feb 24 '23 at 14:41

1 Answers1

2

I seem to be able to reproduce this error with dplyr-generated warnings. Here's an Rmarkdown document that will create this:

---
title: "special_i"
author: "Michael Roswell"
date: "2023-02-24"
output: 
  pdf_document: 
    latex_engine: pdflatex
---
seems like the dplyr warning message creates problems with 

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(dplyr)
```
```{r create a warning}


mtcars[1,"carb"] <- NA
mtcars %>% summarize_all(sqrt)

```

I troubleshot by silencing warnings when knitting to .pdf (html rendered fine).

Michael Roswell
  • 1,300
  • 12
  • 31
  • 1
    Issue filed for **knitr** https://github.com/yihui/knitr/issues/2234#issue-1601490153. That team localized problem in **cli**, and they're already working to address https://github.com/r-lib/cli/issues/581#issue-1576635242 – Michael Roswell Feb 27 '23 at 17:24
  • Im still having issues rendering to PDF after following those github threads... not sure what else to try, most of this is way over my head – FishyFishies Mar 19 '23 at 04:35
  • @FishyFishies, maybe you can try to isolate the issue by making some very simple .rmd documents and adding pieces to them until they break; might be worth writing your own question especially if you can identify a problem but not the solution. – Michael Roswell Mar 20 '23 at 12:53
  • 1
    Thank you! @Michael , I did try making some simple pdfs from markdown and they worked fine, once I start adding packages and other things it gives me errors. I think I will post a question about it. – FishyFishies Mar 21 '23 at 19:56