0

I am trying to knit a document from RStudio to pdf, but I am getting the following error (attached). I have made a MWE that replicates my problem.

Error

I have Rstudio 2022.12.0 on Windows 10 Pro with R 4.2.2, along with TexLive 2022 and Pandoc installed. The latest version of tinytex is installed, and updated.

tinytex details

A similar question is here: Error with Unicode escape character U+001B knitting .rmd to .pdf but mine problem seems to be slightly different since it involves the compile_document command from the file menu on a normal R script rather than a Rmd script.

I have reinstalled TexLive, Reinstalled R and reinstalled RStudio but with no success. I've also changed the rendering engine between pdflatex and xelatex, and changed from swerve to knitr. None of these have worked.

Code is below

require(tidyverse)

a <- mtcars

g <- a %>% 
  ggplot()+
  aes(x = mpg,
      y = wt)+
  geom_point()
print(g)
pg320
  • 1
  • 1
  • 1
    Same question as https://stackoverflow.com/q/75504968/8400969 – Michael Roswell Mar 03 '23 at 17:36
  • I think you may need to reinstall **cli**, or even the dev version of **cli** to fix. – Michael Roswell Mar 03 '23 at 17:37
  • 2
    This isn't Rmarkdown syntax nor an Rmd file. Rmarkdown is a mix of Markdown (i.e. text) and code, either in blocks or inline. Have you tried rendering just the demo template that's included when you start a new Rmarkdown document in RStudio? – Marcus Mar 03 '23 at 17:47
  • @MichaelRoswell how do I install the dev version of cli? Devtools requires cli to run, so install_github complains that cli is already in use. – pg320 Mar 03 '23 at 21:12
  • @Marcus The template in Rmarkdown compiles to PDF okay – pg320 Mar 03 '23 at 21:12
  • Good question. Maybe **remotes** or **gihtubinstall** https://cran.r-project.org/web/packages/githubinstall/vignettes/githubinstall.html will let you get around this, or you could download and build the package in two steps. – Michael Roswell Mar 03 '23 at 21:20
  • Or just force reinstall **devtools**, they might have already released the fix on **cli** – Michael Roswell Mar 03 '23 at 21:30
  • install.packages("pak", repos = sprintf( "https://r-lib.github.io/p/pak/stable/%s/%s/%s", .Platform$pkgType, R.Version()$os, R.Version()$arch )) pak::pkg_install("r-lib/cli") – pg320 Mar 06 '23 at 15:25

0 Answers0