如何使用 LaTeX 替代 {} 以便使用 LaTeX 代码将 R/exams 完形填空题导入 Moodle?

How to use a LaTeX alternative to {} in order to import R/exams cloze questions to Moodle with LaTeX code?

我们正在使用出色的 exams 包来生成要导入到 Moodle 的项目。尽管我们注意到在导入问题时使用 LaTeX 代码(即 {})会与 Moodle 代码产生冲突。因此,我们想知道在 Moodle 中使用所有 LaTeX 功能的替代方案。例如。

$H_0: \mu_{males}=\mu_{females}$ 不会被导入,因为“{}”

我无法复制这个问题。我刚刚在我的 Moodle 系统中测试了导入,这看起来没问题:

我的import.Rmd练习内容如下。

可能您启用了一些额外的过滤器来阻止将此类内容导入您的 Moodle 系统?

[我们之前已经看到在激活 tidy XHTML 过滤器时在 Moodle 中呈现某些 R/exams 练习的问题。然而,这些问题发生在渲染阶段而不是导入阶段(然后也只是在非常具体的设置中)。所以我怀疑你的问题不是这个过滤器造成的。]

Question
========
Is it possible to import questions with LaTeX code like
`$H_0: \mu_{males}=\mu_{females}$`
that should be rendered like
$H_0: \mu_{males}=\mu_{females}$?

Answerlist
----------
* Yes
* No

Meta-information
================
exname: LaTeX import
extype: schoice
exsolution: 10

更新

在 Beatriz 的回答的提示下,我能够重现错误。只有在完形填空题的单项选择或多项选择元素的答案选项中使用花括号时才会出现这种情况。原因是 Moodle 的嵌入式答案语法依赖于大括号 ({1:MULTICHOICE:...}),因此必须转义右大括号。这已在 R-Forge R/exams 的开发版本 2.4-0 中实现。

hypothesis.Rmd对应的内容为:

Question
========
Consider a numeric response `outcome` and is a binary factor `gender`
with levels `male` and `female`. What is the alternative hypothesis
used in `t.test(outcome ~ gender)`?

Answerlist
----------
* $\mu_{male} \neq \mu_{female}$
* $\mu_{male} \leq \mu_{female}$
* $\mu_{male} \geq \mu_{female}$

Meta-information
================
exname: Alternative hypothesis
extype: cloze
exclozetype: schoice
exsolution: 100

我有同样的问题,但是当我只在答案列表选项中包含长度大于 1 的 {} 时,例如 \sqrt{25} o t_{25}。 \sqrt 2 和 t_2,工作正常。如果它包含在问题文本中,它就会起作用。