I would like to understand how to set up correctly tolerance bounds in cloze questions containing numeric and schoice questions.
Here is an example, where I have a schoice question followed by two numeric questions and I would like the tolerance bounds for the two numeric questions to be 0 and 0.01, respectively.
<<echo=FALSE, results=hide>>=
type <- c("schoice", "num", "num")
solutions <- explanations <- rep(list(""), 3)
solutions[[1]] <- c(1, 0, 0)
solutions[[2]]<- 0
solutions[[3]] <- 1/8
solutions[type=="num"] explanations[type=="schoice"] <-
lapply(solutions[type=="schoice"], function(x) ifelse(x, "True", "False"))
solutions[type=="schoice"] <- lapply(solutions[type=="schoice"], mchoice2string)
tol <- 0
tol[2]<- 0.01
@
\begin{question}
What is the capital of Italy?
\begin{answerlist}
\item Rome \item Madrid \item Berlin
\item How many people live in a empty house?
\item Compute 1/8. (tolerance: \Sexpr{tol[2]}).
\end{answerlist}
\end{question}
%% META-INFORMATION
%% \extype{cloze}
%% \exclozetype{\Sexpr{paste(type, collapse = "|")}}
%% \exsolution{\Sexpr{paste(solutions, collapse = "|")}}
%% \exname{prova_tol}
%% \extol{\Sexpr{paste(tol, collapse = "|")}}
As a result, I obtain instead a tolerance of 0.01 for the first numeric question and of zero for the second one. Indeed, this is the "question text" that I get in Moodle:
What is the capital of Italy?
a. {1:MULTICHOICE_V:%100%Rome~%0%Madrid~%0%Berlin}
b. How many people live in a empty house? {1:NUMERICAL:=0:0.01}
c. Compute 1/8. (tolerance: 0.01). {1:NUMERICAL:=0.125:0}
Currently, you need to specify one extol
element for every cloze element, even if the cloze elements are not numeric. So with
\exclozetype{schoice|num|num}
you would need
\extol{0|0|0.1}
to get the tolerances 0 and 0.1 for the two num elements.
But I agree that your approach would also make sense. I'll have a look at whether it is possible to support both - and issue a warning if the number of tolerances is not one of the number of all elements or of all num elements, respectively.