There is no package option for this as far as I can see. However, you can prevent the Latex output part of the internal answer processing routines from being executed by redefining the relevant commands as \relax
(i.e., do nothing). There are five such commands, for short answers, numerical, multiple choice, matching, and essay questions.
For multiple choice questions it would be useful to still show the answers but don't show the tick mark for the correct answer. Therefore for this question type the answer processing should not be switched off completely by replacing the command with \relax
. Instead you can redefine the command to first locally redefine the \checkmark
command to print nothing, (\checkmark
is from the amssymb
package, this command is used to print the checkmark after the correct answer in Moodle), and then proceed with the rest of the code. In the code below this is done by copying the processing code to a second command using \let
, then redefining the original command to first change the definition of \checkmark
and then call the copy of the original command.
The definition of \checkmark
inside of multi@latexprocessing
allows you to use the checkmark symbol in the question itself or elsewhere in the document if needed, however it is no longer possible to use the symbol in one of the answers for any multiple choice question.
For matching questions the situation is a bit more complicated, because there ideally you want to show both the questions and the answers, but shuffled. During processing of a question-answer pair the other questions and answers are not easily available though, so that would require a more substantial rewrite of the code and is therefore not implemented in the code below.
MWE:
\documentclass[12pt]{article}
\usepackage{moodle}
\usepackage{amsmath}
\makeatletter
\def\moodle@shortanswer@latexprocessing{\relax}
\def\moodle@numerical@latexprocessing{\relax}
\let\origmultiprocessing\moodle@multi@latexprocessing
\def\moodle@multi@latexprocessing{\let\checkmark\relax\origmultiprocessing}
%\def\moodle@matching@latexprocessing{\relax} % it's complicated
\def\moodle@essay@latexprocessing{\relax}
\makeatother
\begin{document}
\begin{quiz}{Quizz 2}
\begin{numerical}[points=2]{Addition}
2+2=
\item 4
\end{numerical}
\begin{shortanswer}[case sensitive=false]{Hugo}
Firstname of Hugo
\item Victor
\end{shortanswer}
\begin{multi}[points=3]{A first derivative}
What is the first derivative of $x^3$?
\item $\frac{1}{4} x^4+C$
\item* $3x^2$
\item $51$
\end{multi}
\end{quiz}
\end{document}
Result:

This does not affect the XML output, there the answers are still present.
<?xml version="1.0" encoding="UTF-8"?>
<quiz>
<question type="category">
<category>
<text>$module$/Quizz 2</text>
</category>
</question>
<question type="numerical">
<name>
<text>Addition</text>
</name>
<questiontext format="html">
<text><![CDATA[<p>2+2= </p>]]></text>
</questiontext>
<defaultgrade>2</defaultgrade>
<generalfeedback format="html"><text/></generalfeedback>
<penalty>0.1000000</penalty>
<hidden>0</hidden>
<answer fraction="100" format="plain_text">
<text>4</text>
<tolerance>0</tolerance>
</answer>
</question>
<question type="shortanswer">
<name>
<text>Hugo</text>
</name>
<questiontext format="html">
<text><![CDATA[<p>Firstname of Hugo </p>]]></text>
</questiontext>
<defaultgrade>1.0</defaultgrade>
<generalfeedback format="html"><text/></generalfeedback>
<penalty>0.1000000</penalty>
<hidden>0</hidden>
<usecase>0</usecase>
<answer fraction="100" format="plain_text">
<text>Victor</text>
</answer>
</question>
<question type="multichoice">
<name>
<text>A first derivative</text>
</name>
<questiontext format="html">
<text><![CDATA[<p>What is the first derivative of \(x^3\)? </p>]]></text>
</questiontext>
<defaultgrade>3</defaultgrade>
<generalfeedback format="html"><text/></generalfeedback>
<penalty>0.1000000</penalty>
<hidden>0</hidden>
<single>true</single>
<shuffleanswers>1</shuffleanswers>
<answernumbering>abc</answernumbering>
<answer fraction="0" format="html">
<text><![CDATA[<p>\(\frac {1}{4} x^4+C\)</p>]]></text>
</answer>
<answer fraction="100" format="html">
<text><![CDATA[<p>\(3x^2\)</p>]]></text>
</answer>
<answer fraction="0" format="html">
<text><![CDATA[<p>\(51\)</p>]]></text>
</answer>
</question>
</quiz>
moodle
package. – Marijn May 14 '20 at 14:19