2

This is a duplicate of this 5 year old question, because the answers there don't work (for me).

Has someone managed to get knitr for Sweave documents (not RMarkdown) running with LuaLaTex as an engine? RStudio only lets you choose between PdfLaTex und XeLaTex, which unfortunately don't work for my purposes.

I'm running Mac OS 14.0 (Sonoma). Setting the environment variable RSTUDIO_PDFLATEX = "LuaLaTeX" in ~/.Rprofile unfortunately has no effect.

I would be grateful for any suggestions.

1 Answers1

1

I just updated the answer at https://tex.stackexchange.com/a/419885/9128, which was mostly correct but just had a typo. You need to set

RSTUDIO_PDFLATEX=lualatex

in .Renviron instead of .Rprofile. The former is for setting environment variables for R, and the latter is to provide an R script to run before each R session starts up. Setting environment variables in the latter will not have any effect (it didn't throw an error just because RSTUDIO_PDFLATEX = "LuaLaTeX" happens to be valid R code, and you created a global variable RSTUDIO_PDFLATEX in your R session; I'd recommend you delete it from .Rprofile).

Also remember to restart R after you change .Renviron so RStudio can pick up the new environment variable.

Yihui Xie
  • 2,805