Search code examples
r-exams

R-exams: How to change labels for multiple choice alternatives to distinguish from cloze items (a, b, ...)


I am trying to create pdf exam sets using exams2pdf(...) using templates "exam.tex", "solution.tex". I want to have some questions of type "cloze", with e.g. both single choice questions and numeric questions. The problem is that the cloze question is itemized with (a), (b), ... The same labels (a), (b), ... are also used for the different possible answers to single choice questions. So, using the template questions "lm.Rmd" and "switzerland.Rmd" I get this in the question sheet:

From question sheet

While the front page answer sheet looks like this.

Front page answer sheet

This obviously doesn't look great. I have tried to modify the "exam.tex" template by changing the "answerlist" environment definition, specifically changing

 ...\renewcommand{\labelenumi}{(\alph{enumi})}...

to e.g.

...\renewcommand{\labelenumi}{(\roman{enumi})}...

However, this appeared to have no effect on the output. I moreover tried to modify the \exmchoice definition, changing "(a)" to e.g. "(A)". This only affected the labels on the front page, not in the question sheet. The exams2pdf call in R looks as

exams2pdf(c("lm.Rmd", "switzerland.Rmd"), n = 1, name = c("MAT210-exam", "MAT210-solution"),
      encoding = "UTF-8", dir = "output", edir = "../MAT210exercises",
      template = c("../templates/exam.tex", "../templates/solution.tex"))

So, I hope someone can guide a solution route to enable different labels for cloze items and choice alternatives in this setting. I am running R version 3.6.1 (2019-07-05). Windows 7, MikTex 2.9.


Solution

  • The behavior of the cloze formatting can be controlled "a little bit" by the cloze.collapse control argument. And I think you are looking for the "enumerate" option:

    exams2pdf(c("lm.Rmd", "switzerland.Rmd"), template = "exam.tex",
      control = list(cloze.collapse = "enumerate"))
    

    This yields the following format in the questionnaire on the title page:

    cloze questionnaire

    And the following format in the exercise itself:

    cloze exercise

    Note that if the only target is PDF output, it might be easier to split up the combined cloze question into separate exercises. You can still share parameters/data across the exercises if you specify a dedicated environment envir= in which the exercises are processed (rather than using a fresh environment for every question). The drawback is that such sequencing of exercises is only available when producing standalone PDF files but cannot be used in learning management systems like Moodle because these all exercises separately. For further discussion of these issues, see the R/exams forum on R-Forge:

    https://R-Forge.R-project.org/forum/forum.php?thread_id=33878&forum_id=4377&group_id=1337
    https://R-Forge.R-project.org/forum/forum.php?thread_id=33912&forum_id=4377&group_id=1337