Is it possible to control the lengths of answer boxes in the Moodle from R-exams? The image below shows that the boxes have different lengths which probably correspond to those of the hidden answers. My answers contain a mixture of numeric and string answers. The boxes for the string answers appear to be smaller than those of numeric answers. I would like to standardise these boxes and make them all have equal lengths. Thank you!
Short answer:
Good question! Yes, it is possible. You can set an extra metainformation tag numwidth
to TRUE
. Then the width of the cells is adjusted to the same width. So in R/Markdown exercises you just add
exextra[numwidth,logical]: TRUE
And in R/LaTeX exercises:
\exextra[numwidth,logical]{TRUE}
A worked example is provided at: http://www.R-exams.org/templates/fourfold2/.
Details:
This used to be an undocumented feature for numeric sub-items in cloze exercises but has been documented in R/exams 2.4-0. The analogous stringwidth
specification was also added.
In addition to the logical specification you can also use a numeric value for the maximum width (e.g., exextra[numwidth,numeric]: 8
) or a number in a character value that has the desired width (e.g., exextra[numwidth,character]: 99999999
).
Example:
A simple demo R/Markdown exercise using a numeric width specification with a mix of numeric and string questions is:
Question
========
List the first or first six numbers and letters, respectively.
| | Numbers | Letters |
|:--------|:------------|:------------|
| First | ##ANSWER1## | ##ANSWER3## |
| First 6 | ##ANSWER2## | ##ANSWER4## |
Answerlist
----------
*
*
*
*
Meta-information
================
exname: fixedwidth
extype: cloze
exclozetype: num|num|string|string
exsolution: 1|123456|A|ABCDEF
exextra[numwidth,numeric]: 9
exextra[stringwidth,numeric]: 9
Importing the XML output from exams2moodle("fixedwidth.Rmd")
into Moodle yields blank cells with equal width:
Only when providing feedback after filling in the responses, Moodle still renders the cells somewhat differently. But I think that this cannot be controlled through modifications in the Moodle XML code.