R/exams NOPS generates documents in Times New Roman, which then fail during scanning

I have been using r/exams in some of my last exams and everything has worked fine. This semester, however, r/exams seems to generate the exams in Times New Roman instead of Helvetica, which messes with the character recognition in the scanning process.

Even the minimal example, produces this behavior:

library("exams")
myexam <- list("cholesky.Rnw")
set.seed(403)
ex1 <- exams2nops(myexam, n = 1,
              dir = "nops_pdf", name = "demo", date = "2015-07-29",
              points = c(1), showpoints = TRUE)

Does anyone have any idea what could have gone wrong? How do I see the intermediate steps? I get no error messages.

Thanks!

Upvotes: 3

Views: 189

Answers (1)

Achim Zeileis
Achim Zeileis

Reputation: 17183

Starting from R/exams version 2.3-2 (the current CRAN version at the time of writing) it is enforced that the digits that need to be scanned are always in Helvetica (\fontfamily{phv}) even if the font is switched for the rest of the document.

However, in a plain TinyTeX installation, i.e., after running just tinytex::install_tinytex() the Helvetica font is not installed yet. Just setting \fontfamily{phv} is not enough for TinyTeX to realize that an additional package needs to be installed (psnfss). Therefore, I have modified the devel version of exams on R-Forge to explicitly include \usepackage{helvet}. This will trigger the automatic installation of psnfss in TinyTeX. Installing version 2.3-5 should thus resolve the problem: install.packages("exams", repos = "http://R-Forge.R-project.org"). This will also be released to CRAN in the next days.

Moreover, just for future reference, I went through the source code of exams2nops() to check what packages we use. Partly for historical reasons there are quite a few. Possibly these could also be streamlined.

  • Basic tools: graphicx, color, amsmath, amssymb, latexsym.
  • For compatibility with Sweave: verbatim, url, fancyvrb, ae.
  • Layout etc.: multicol, a4wide, pdfpages, chngpage.
  • Fonts: helvet, sfmath.
  • For compatibility with LaTeX produced by pandoc from Markdown: booktabs, longtable, eurosym, textcomp.

Upvotes: 3

Related Questions