如何在 'cloze' 个问题中使用选项 '\exshuffle{}'

how to use the option '\exshuffle{}' in 'cloze' questions

我想使用 \exshuffle{5} 随机填空题:

<<echo=FALSE, results=hide>>=

questions <- solutions <- explanations <- list()

type <-rep("schoice", 2)

questions[[1]]<- letters[1:7]
solutions[[1]]<- c(TRUE, rep(FALSE, 6))

questions[[2]]<- LETTERS[1:7]
solutions[[2]]<- c(TRUE, rep(FALSE, 6))



explanations[type=="num"] <- solutions[type=="num"]
explanations[type=="schoice"] <- lapply(solutions[type=="schoice"], 
                                        function(x) ifelse(x, "True", "False"))

solutions[type=="schoice"] <- lapply(solutions[type=="schoice"], mchoice2string)


@

\begin{question}
What is the first letter of ``apple''? ##ANSWER1##

What is the first letter of ``Algeria''? ##ANSWER2##


<<echo=FALSE, results=tex>>=
answerlist(unlist(questions))
@ 


\end{question}


\begin{solution}

<<echo=FALSE, results=tex>>=
answerlist(unlist(explanations))
@


\end{solution}



%% META-INFORMATION
%% \extype{cloze}
%% \exsolution{\Sexpr{paste(solutions, collapse = "|")}}
%% \exclozetype{\Sexpr{paste(type, collapse = "|")}}
%% \exname{question}
%% \exshuffle{5}

但是在 Moodle 中导入问题时出现错误(我认为这是由于最后的 \exshuffle{5}):

Error importing question Invalid embedded answers (Cloze) question (One of the answers should have a score of 100% so it is possible to get full marks for this question.).

我想了解如何在完形填空题中正确使用 \exshuffle{}

如果至少使用 R/exams 的 2.4-0 版(撰写本文时的 R-Forge 开发版),完形填空练习中的 exshuffle 将按预期工作。修复了一些错误以正确支持这一点。特别是,不再需要 {solution} 环境来使其工作。 (在您的情况下,这可以简单地删除,因为除了解决方案之外,它不会增加太多价值。)

要安装开发版,请使用:

install.packages("exams", repos = "https://R-Forge.R-project.org")