我使用Moodle
和latex
来编写所有测验。但是,我使用latex
来生成公式丰富的问题moodle
。乳胶包Moodle
可以做到这一点。然后我将其作为 XML 文件导入到moodle
。这很完美。在导入测验之前,乳胶会编译代码并生成 PDF,以确保一切正常。它也适用于封闭式测验问题。但是,当我在封闭式测验中拥有所有问题“多项选择”时,当我将其作为 xml 导入时,我会收到错误消息,尽管乳胶可以编译它而没有任何错误。感谢任何帮助
乳胶代码:
\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{moodle}
\begin{document}
\begin{quiz}{MRTS}
\begin{cloze}{MRTS Q1}\\
A production function is given as $ Q=15\sqrt{KL}$. Q=quantity of output, L = the units of labour, K = the units of capital. The marginal product of labour, $MP_L$ of this function is:
\begin{multi}[horizontal]
\item*$7.5K^{0.5}L^{-0.5}$
\item $7.5K^{-0.5}L^{0.5}$
\item $K^{0.5}L^{-0.5}$
\item $K^{-0.5}L^{0.5}$
\item $15K^{0.5}L^{-0.5}$
\item $15K^{-0.5}L^{0.5}$
\end{multi}
A production function is given as $ Q=15\sqrt{KL}$. Q=quantity of output, L = the units of labour, K = the units of capital. The marginal product of labour, $MP_K$ of this function is:?
\begin{multi}[horizontal]
\item $7.5K^{0.5}L^{-0.5}$
\item *$7.5K^{-0.5}L^{0.5}$
\item $K^{0.5}L^{-0.5}$
\item $K^{-0.5}L^{0.5}$
\item $15K^{0.5}L^{-0.5}$
\item $15K^{-0.5}L^{0.5}$
\end{multi}
A production function is given as $ Q=15\sqrt{KL}$. Q=quantity of output, L = the units of labour, K = the units of capital.The marginal rate of technical substitution associated with this production function is?\\ Note: $MRTS=\displaystyle -\frac{\frac{\partial Q}{\partial L}}{\frac{\partial Q}{\partial K}}$
\begin{multi}[horizontal]
\item $\frac{K}{L}$
\item*$-\frac{K}{L}$
\item $\sqrt{\frac{K}{L}}$
\item $\sqrt{\frac{L}{K}}$
\item $-\sqrt{\frac{K}{L}}$
\item $-\sqrt{\frac{L}{K}}$
\end{multi}
\end{cloze}
\end{quiz}
\end{document}
答案1
不幸的是,我怀疑这是 Cloze 类型问题的一个错误/限制。这个 MWE
%
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{moodle}
\begin{document}
\begin{quiz}{Test cloze}
\begin{cloze}{Multiple questions}
A $x$ is
\begin{multi}[vertical]
One two three
\item* one $u^1$
\item two
\item three
\end{multi}
\end{cloze}
\end{quiz}
\end{document}
运行正常,并在 Moodle 中给出预期结果:
但如果在指数周围添加括号:
\begin{document}
\begin{quiz}{Test cloze}
\begin{cloze}{Multiple questions}
A $x$ is
\begin{multi}[vertical]
One two three
\item* one $u^{1}$
\item two
\item three
\end{multi}
\end{cloze}
\end{quiz}
\end{document}
Moodle 导入失败:
现在,生成的两个 XML 文件之间的唯一区别是:
[romano:~/tmp] % diff quiz-hr-moodle\ \(copy\).xml quiz-hr-moodle.xml
15c15
< <text><![CDATA[<p></P><P>A \(x\) is </P><P>One two three {1:MULTICHOICE_V:=one \(u^{1}\)~two~three}</p>]]></text>
---
> <text><![CDATA[<p></P><P>A \(x\) is </P><P>One two three {1:MULTICHOICE_V:=one \(u^1\)~two~three}</p>]]></text>
因此,Moodle 的解析器似乎对公式中的右括号感到困惑。我真的不知道如何避免它,即使 Moodle 文档中承认了这个问题,似乎它根本不起作用:
所以基本上我的结论是你不能在完形填空题的答案中使用公式。手册上说你可以:
...但我没能成功。请注意,如果您进入 XML 文件并转义{
}
with \{
,\}
则 XML 文件会被接受,但公式会被破坏。
cloze
幸运的是,在正常(无)multi
问题中不会发生这种情况。
所以我的权宜之计是使用直接在那里输入的 Unicode 公式,然后切换到lualatex
进行编译。
另一个权宜之计是使用图像作为公式:
%
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{moodle}
\begin{document}
\begin{quiz}{Test cloze}
\begin{cloze}{one cloze}
A $x$ is
\begin{multi}[vertical]
One two three
\item* one \includegraphics[height=4ex]{formula1.png}
\item two
\item three
\end{multi}
\end{cloze}
\end{quiz}
\end{document}
将呈现为:
并不理想(可能通过一点透明度或其他什么会更好)但如果你需要它......
答案2
我修改了 moodle 包来修复这个错误。LaTeX 方程式可用于完形填空子问题字段。请参阅此已修复问题。
以下是 MWE:
% !TEX TS-program = lualatex
\documentclass[10pt,a4paper]{article}
\usepackage{moodle} % development version 0.8
\begin{document}
\begin{quiz}{Category}
\begin{cloze}{Question name}
Question text
\begin{multi}[vertical]
\item[feedback={$7.5K^{0.5}L^{-0.5}$ is correct}]*$7.5K^{0.5}L^{-0.5}$
\item[feedback={$7.5K^{-0.5}L^{0.5}$ is incorrect}] $7.5K^{-0.5}L^{0.5}$
\end{multi}
\end{cloze}
\end{quiz}
\end{document}
生成的 XML 文件是
<?xml version="1.0" encoding="UTF-8"?>
<!-- This file was generated on 2020-11-10 by LuaLaTeX -->
<!-- running on Linux with the package moodle v0.8 -->
<quiz>
<question type="category">
<category>
<text>$course$/top/Category</text>
</category>
</question>
<question type="cloze">
<name format="html">
<text><![CDATA[Question name]]></text>
</name>
<questiontext format="html">
<text><![CDATA[<p>Question text {1:MULTICHOICE_VS:=\(7.5K^{0.5\}L^{-0.5\}\)#\(7.5K^{0.5\}L^{-0.5\}\) is correct~\(7.5K^{-0.5\}L^{0.5\}\)#\(7.5K^{-0.5\}L^{0.5\}\) is incorrect}</p>]]></text>
</questiontext>
<defaultgrade>1</defaultgrade>
<generalfeedback format="html"><text/></generalfeedback>
<penalty>0.10</penalty>
<hidden>0</hidden>
</question>
</quiz>