Unicode error in Rmd but not Quarto when compiling to pdf

I am trying to compile a pdf file that loads the set of tidyverse packages. When the tidyverse package loads, it displays the message, "Use the conflicted package to force all conflicts to become errors". The "conflicted" part of the message embeds a url, which is causing an issue when I try to compile the pdf. It is not desirable to remove these messages.

The error I'm getting is

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

A reproducible error can be obtained by compiling the following in an Rmd file:

---
title: "Untitled"
output: pdf_document
---

```{r}
library(tidyverse)
```

A similar repex in Quarto works fine:

---
title: "Untitled"
format: pdf
---

```{r}
library(tidyverse)
```

How can I correct this error in R Markdown?

Session Information:

> sessionInfo()
R version 4.2.3 (2023-03-15 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.utf8 
[2] LC_CTYPE=English_United States.utf8   
[3] LC_MONETARY=English_United States.utf8
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.utf8    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] lubridate_1.9.2    forcats_1.0.0      stringr_1.5.0     
 [4] dplyr_1.1.0        purrr_1.0.1        readr_2.1.4       
 [7] tidyr_1.3.0        tibble_3.2.0       ggplot2_3.4.1     
[10] tidyverse_2.0.0    neastbenchmark_0.2

loaded via a namespace (and not attached):
 [1] pillar_1.8.1     compiler_4.2.3   tools_4.2.3      digest_0.6.30   
 [5] timechange_0.2.0 evaluate_0.20    lifecycle_1.0.3  gtable_0.3.1    
 [9] pkgconfig_2.0.3  rlang_1.0.6      cli_3.4.1        rstudioapi_0.14 
[13] yaml_2.3.6       xfun_0.37        fastmap_1.1.0    withr_2.5.0     
[17] knitr_1.42       generics_0.1.3   vctrs_0.5.2      hms_1.1.2       
[21] grid_4.2.3       tidyselect_1.2.0 glue_1.6.2       R6_2.5.1        
[25] fansi_1.0.4      rmarkdown_2.20   tzdb_0.3.0       magrittr_2.0.3  
[29] scales_1.2.1     htmltools_0.5.4  ellipsis_0.3.2   colorspace_2.1-0
[33] utf8_1.2.3       stringi_1.7.12   munsell_0.5.0  

Does it help to use xelatex ?
https://stackoverflow.com/questions/15796519/what-are-the-differences-between-xelatex-and-pdflatex#15797864

output:
  pdf_document:
    latex_engine: xelatex

Thank you for your response. Unfortunately, it does not. That was my first idea too, because xelatex addresses many of the weaknesses of pdflatex, but it doesn't help in this case.

Can you try updating packages ? Especially rlang or cli ? But also maybe rmarkdown and knitr

I think this has been fixed in the tidyverse ecosystem now.

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.