Search code examples
r-exams

How to configure R/Exams to use system LaTeX?


I'm completely new to R and R/Exams. I have installed R and R/Exams, and tested the dist example to generate HTML outputs. When I tried to generate PDF outputs, R/Exams always used tinytex and failed because Sweave.sty was not found. I already have TeXLive installed on my system and use LaTeX regularly in my work. I have resolved the problem with Sweave.sty being not found by adding the R's texmf to my TeXLive. However, I still want to use my TeXLive installation instead of tinytex. Is there a way to configure R/Exams to use the system TeXLive instead of tinytex? I'm on MacOS.


Solution

  • The default in exams2pdf() and exams2nops() is to use tinytex when requireNamespace("tinytex") is TRUE, i.e., when tinytex is installed. If you generally don't want to use tinytex, simply uninstall it.

    If tinytex is installed but you still want to use pdflatex() from the tools package instead, please set options(exams_tex = "tools"). You can also put it into your .Rprofile if you generally want to set it.

    Finally, you can also set up your own LaTeX template for exams2pdf(..., template = ...) and omit the packages you don't need - or replace Sweave.sty

    See also http://www.R-exams.org/tutorials/latex/ for more details.