2

Is there a way of specifying an answerlist with two columns directly in the .rmd question?

I am preparing a single choice pdf exam using R exams exams2pdf(myexam, n=1) with answer lists containing either only texts or only images, and I would like to make some questions with the answerlist in a two-column layout (e.g. only questions that contain images). I've seen the possibility of changing the template, but that would change the layout for all questions.

  ```{r, echo = FALSE, results = "hide"}
     exams::include_supplement("a.jpg")
     exams::include_supplement("b.jpg")
     exams::include_supplement("c.jpg")
     exams::include_supplement("d.jpg")
  ```
Question
========
What is the seat of the federal authorities in Switzerland (i.e., the de facto capital)

Answerlist
----------
* ![](a.jpg){width=10%}
* ![](b.jpg){width=10%}
* ![](c.jpg){width=10%}
* ![](d.jpg){width=10%}

Meta-information
================
exname: Swiss Capital
extype: schoice
exsolution: 0100
exshuffle: 4

pdf outcome using exams2pdf(myexam, n=1)

1 Answer 1

0

It is not impossible to do this but the system is not designed to switch the layout back and forth between the exercises.

If you want to do this you would need to set up a LaTeX template that manually includes all the individual exercises and re-defines the {answerlist} environment between those exercises where you switch. The downside is that if you change the order and/or number of the exercises you always have to modify the LaTeX template. Hence I would not recommend to use this approach. For an example how a multi-column {answerlist} can be set up, see the plain-horiz.tex template from the R-Forge forum.

A simpler option is to generate a table of figures in the main question text and then to include only the numbers/labels of those figures in the answerlist. A worked example for this is available in the logic exercise.

(One caveat, though: It depends on the pandoc version how the table is rendered exactly. The most recent versions of pandoc are not compatible with the default LaTeX template from R/exams.)

Sign up to request clarification or add additional context in comments.

2 Comments

Many thanks Achim! I was hoping I was missing something obvious here and it would be a bit easier to change the layout back and forth. I will do as you suggest and include the figures in the main question text and only the labels in the answerlist. My main concern was just saving paper. Thanks again!
Yes, I see. My consolation in these cases is that our students use the white space next to the answer options for their own notes which saves paper again. // Finally: Could you please accept the answer by clicking the check mark on the left? Then the question is flagged correspondingly here on SO. I understand it's not the answer you hoped for - but IMO the correct answer given the software.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.