0

I would like to know, if possible, how to include other "simple" (I know it is a relative concept) LaTeX packages in my Rnw exercises for R/exams. I just want to use bbfonts. I can't define any new command as well. There is one question related to it here, but for Rmd exercises.

In my Rnw file I must have \usepackage[utf8]{inputenc}, why it doesn't accept any other packages (in fact R/exams ignores it)?

Achim Zeileis
  • 15,710
  • 1
  • 39
  • 49
  • Thanks @AchimZeileis, this is not what I want to hear but is an answer. I simulated the mathbb font wih \mathrm{I\! R}. Not the same thing, but it works. – Alexandre Lymberopoulos Nov 05 '20 at 15:14
  • If you just want \mathbb{R} then you can use the version from `amsfonts` rather than `bbfonts`. In HTML all the standard `ams*` packages are supported via the MathJax plugin (which was developed by the AMS). If you can edit your question and add a minimal example exercise along the `exams2xyz()` interface you want to use, then I can edit my answer as well. – Achim Zeileis Nov 05 '20 at 17:09

1 Answers1

1

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 http://www.R-exams.org/tutorials/math/ 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. In that version the entire package was switched to UTF-8 and all standard templates have UTF-8 support enabled by default.

Achim Zeileis
  • 15,710
  • 1
  • 39
  • 49