This article summarizes the authoring patterns currently covered by the package and its bundled examples.
The package exports the following main question types:
clozeschoicemchoicenumstringFor cloze exercises, the gap subtypes num,
string, schoice, and mchoice are
mapped to the corresponding ILIAS gap elements.
For new cloze exercises, the recommended style is to use
exams::add_cloze() together with
format_metainfo(). This keeps the question text and the
cloze metadata synchronized.
library(exams)
n <- sample(20:30, 1)
mean_x <- sample(seq(70, 80, by = 0.5), 1)
choices <- c("t-test", "chi-squared test", "Wilcoxon signed-rank test")
# Inside the exercise body:
# How many observations are in the sample? `r add_cloze(n)`
# What is the sample mean? `r add_cloze(mean_x, tolerance = 0.1, digits = 1)`
# Which method is appropriate? `r add_cloze(choices[1], choices, type = "schoice")`
#
# Meta-information:
# exclozetype: `r format_metainfo("type")`
# exsolution: `r format_metainfo("solution")`
# extol: `r format_metainfo("tolerance")`See the bundled file stats_cloze.Rmd for a full,
self-contained example.
Single-choice and multiple-choice questions follow the standard
R/exams pattern with an answer list in the question and a
logical answer key in the solution block. For static answer lists, plain
Markdown is sufficient.
Question
========
Which statement about p-values is correct?
Answerlist
----------
* A p-value below 0.05 can justify rejection at the 5% level.
* A p-value is the probability that the null hypothesis is true.
* A p-value cannot depend on the sample size.
Solution
========
Answerlist
----------
* True
* False
* FalseIf you want imports to arrive with explicit scoring in ILIAS, include
expoints in the exercise metadata.
Meta-information
================
extype: schoice
exsolution: 100
exname: P-value interpretation
exshuffle: TRUE
expoints: 1For cloze exercises with several gaps, you can provide one point value per gap. ILIAS Identical Scoring is enabled by default, so repeated correct answers in different gaps are scored independently.
Choice-based cloze gaps are rendered as ILIAS dropdowns. ILIAS
displays these labels as plain text, so avoid HTML and math markup in
the answer options. exams2ilias removes unsupported HTML
tags from dropdown labels and emits a warning.
For visible tables in question text, prefer simple Markdown tables or
knitr::kable(df, format = "html", row.names = FALSE). The
exporter normalizes tables by default with
table_strategy = "html_basic", which keeps only a
conservative table structure for ILIAS. Avoid kableExtra,
CSS classes, inline styles, captions, rowspan,
colspan, nested tables, and layout HTML. If a table is wide
or column separation is critical, test the exercise with
table_strategy = "pre".
For static external files, register the file as a supplement before linking it:
Plots and files created while processing the exercise are handled as supplements automatically.
metasolution = TRUE adds ILIAS solution metadata for
essay/string-like questions. It is disabled by default and internally
uses the PHP-serialized solution structure expected by ILIAS.