1

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.

Truong
  • 569
  • 2
  • 4
  • 13
  • Small update: I removed `tinytex` from R. When I tested creating PDF outputs, R/Exams gave an error "Failed with error: ‘there is no package called ‘tinytex’" but it still produced correct PDF outputs (I guess using my system TeXLive). I think it'd be nicer to check and use system TeX if available and not give such an error message. Or a way to configure R/Exams to use system TeX that I don't know? – Truong Jul 03 '20 at 17:43
  • Maybe the package was not removed cleanly? Or you did not re-start R? Otherwise removing `tinytex` should do the trick – Achim Zeileis Jul 04 '20 at 11:36

1 Answers1

1

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.

Achim Zeileis
  • 15,710
  • 1
  • 39
  • 49
  • Uninstalling `tinytex` (cleanly, I checked and restarted R) didn't solve the error message: R/Exams still asked for `tinytex` and showed the error message. Setting the options to "tools" did resolve the problem and made R/Exams use my system LaTeX. – Truong Jul 06 '20 at 23:04
  • Thanks for checking! I now saw the problem in the code and suppress the error message in the development version of R/exams. As you already noted above, the code behaved correctly after removing `tinytex` it just displayed the unnecessary information that `tinytex` wasn't available. Hence, please accept the answer so that the question is marked as resolved here on SO. – Achim Zeileis Jul 06 '20 at 23:49