Including LaTeX packages in R/exams Rnw exercises

The answer regarding the support of LaTeX packages depends on the type of output you want to generate with R/exams.

If you produce PDF output:
Then internally pdfLaTeX is used and it is possible to load additional packages. However, this is not done in the individual exercises but in the master LaTeX template that ties the exercises together into a document. When you use exams2pdf() you can provide your own template to fully customize the appearance of your PDF exams, see Section 3 of vignette("exams", package = "exams"). When you use exams2nops() then you can still adapt the fixed template that this uses, either simply by usepackage = "bbfonts" or by including a suitable header = specification.

If you produce HTML-based output:
Then the LaTeX code is actually not processed by some LaTeX distribution but converted to HTML, either via pandoc or via ttm (TeX-to-MathML). This applies to all exams2xyz() interfaces for learning management systems like Moodle, Canvas, OpenOLAT, Ilias, Blackboard, etc. In this case the commands you can use are limited to what the converters support. See for an overview and How to use a LaTeX package with R/exams? for some more practical comments.

UTF-8 encoding:
The encoding issue is best resolved by installing at least version 2.4-0 of the exams package (the current devel version of the package from R-Forge, at the time of writing). In that version the entire package was switched to UTF-8 and all standard templates have UTF-8 support enabled by default. To install the devel version use: install.packages("exams", repos="")

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top