advanced topics
Consecutive errors
The automatic correction of generic TeX problems can take into account consecutive errors. This feature is only
available for questions of type input.number or input.function.
Consider a problem with several questions, all of them of type input.number or type input.function.
Assume the solution of the n-th question depends on the solution of the m-th question for some question numbers $$m$$,$$n$$
with $$m < n$$. Say the student's solution of the m-th question was wrong. Then the student used a wrong input for the
n-th question. Assume that, apart from starting with a wrong input, the student solved the n-th question correctly.
This is what we call a consecutive error.
Taking into account consecutive errors means the student doesn't get the points for the m-th question, but the solution
of the n-th question is counted as correct and the points are awarded.
Taking into account consecutive errors works as follows. The questions are corrected one after the other.
For each question, the following happens:
- First, the question is corrected normally, meaning the student's solution is compared to the correct solution.
- If the student's solution coincide with the correct solution, everything is ok and the correction proceeds to the
next question.
- Otherwise, the correction of this question is repeated with certain variables bound to student answers of previous
questions. This is called conditional correction. Which variable is bound to which answer is controlled by the author
using the \earlierAnswer command described below.
- The score resulting from the conditional correction is compared to that of the normal correction. The correction
with the higher score counts.
The \earlierAnswer command has the following form:
\earlierAnswer{VARIABLE}{QUESTION_NUMBER,ANSWER_NUMBER}
where VARIABLE is the name of the variable defined on global (not question) level, QUESTION_NUMBER
the number of the question and ANSWER_NUMBER the number of the answer.
You can also use -1 for the QUESTION_NUMBER to refer to the same question (see below)
The \earlierAnswer command is only allowed in the "variables" environment of a question.
Do not use the command \earlierAnswer to refer to an earlier question in a problem that has
\randomquestionpool enabled! This can cause unwanted behaviour.
Problems with random question pools should only use \earlierAnswer
for subtasks within the same question, by using the value -1 for the question number.
\earlierAnswer doesn't work in combination with \permuteAnswers.
Below is a complete example of a problem. The problem is trivial: a random number Q is given, and the student has to
compute $$x = Q + 1$$ in the first question, $$y = x + 1$$ in the second, and $$z = y + 1$$ in the third. The second
and third question depend on the solutions of previous questions. To take this into account, we added \earlierAnswer
commands to bind variables to earlier answers. In the second question, for example, we bound x to the first answer of
question 1.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | \begin{problem}
\begin{variables}
\randint{Q}{-4}{4}
\function{x}{Q+1}
\function{y}{x+1}
\function{z}{y+1}
\end{variables}
\begin{question}
\text{\textbf{Step 1}\\ \textit{Let Q = $\var{Q}$. Compute x = Q + 1:}}
\explanation{Simply add one}
\type{input.number}
\precision{3}
\field{real}
\begin{answer}
\text{ x = }
\solution{x}
\end{answer}
\end{question}
\begin{question}
\begin{variables}
\earlierAnswer{x}{1,1}
\end{variables}
\text{\textbf{Step 2}\\ \textit{Compute y = x + 1:}}
\explanation{Simply add one}
\type{input.number}
\precision{3}
\field{real}
\begin{answer}
\text{ y = }
\solution{y}
\end{answer}
\end{question}
\begin{question}
\begin{variables}
\earlierAnswer{x}{1,1}
\earlierAnswer{y}{2,1}
\end{variables}
\text{\textbf{Step 3}\\ \textit{Compute z = y + 1:}}
\explanation{Simply add one}
\type{input.number}
\precision{3}
\field{real}
\begin{answer}
\text{ z = }
\solution{z}
\end{answer}
\end{question}
\end{problem}
|
Here you find a more advanced example in WebMiau with consecutive errors with text answers:
Example 1
Example 2
Consecutive errors within one question
You can also set the QUESTION_NUMBER to -1 to refer to a previous answer in the same question:
\earlierAnswer{VARIABLE}{-1,ANSWER_NUMBER}
When you use \randomquestionpool (see Randomquestionpool) at the begin of
a problem to make a selection, this is the only case of \earlierAnswer that you can use.
Warning:
If you use \earlierAnswer{VARIABLE}{-1,ANSWER_NUMBER}, be aware of the correction procedure described above.
Wrong use:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | \begin{problem}
\begin{variables}
\randint{Q}{-4}{4}
\function{x}{Q+1}
\function{y}{x+1}
\end{variables}
\begin{question}
\begin{variables}
\earlierAnswer{x}{-1,1}
\end{variables}
\text{Let Q = $\var{Q}$.}
\type{input.number}
\begin{answer} % this answer will always be marked as correct!!
\text{Compute x = Q + 1:}
\solution{x}
\end{answer}
\begin{answer}
\text{Compute y = x + 1:}
\solution{y}
\end{answer}
\end{question}
\end{problem}
|
In this line of code, the student will always get full score for the first answer. Indeed, if
the answer is wrong, the correction will be repeated with x being the student's first answer,
and so evaluate the first answer as conditionally correct.
The correct way is given by using a copy of the variable x:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | \begin{problem}
\begin{variables}
\randint{Q}{-4}{4}
\function{x}{Q+1}
\function{xc}{x}
\function{y}{xc+1}
\end{variables}
\begin{question}
\begin{variables}
\earlierAnswer{xc}{-1,1}
\end{variables}
\text{Let Q = $\var{Q}$.}
\type{input.number}
\begin{answer}
\text{Compute x = Q + 1:}
\solution{x}
\end{answer}
\begin{answer}
\text{Compute y = x + 1:}
\solution{y}
\end{answer}
\end{question}
\end{problem}
|
Now the solution x of the first answer is not affected by the \earlierAnswer-command,
but the solution y of the second answer will.
Weighting the score of answers
By default the user obtains the same amount of points for every correct answer within a problem.
An exception is the case where an answer is not evaluated directly (compare the example for CheckFunctionForZero ).
This default can be changed by using the \score-command.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | \usepackage{mumie.genericproblem}
\title{Different Score Weights Per Answer}
\begin{problem}
\begin{variables}
\number{a}{1}
\number{b}{2}
\end{variables}
\begin{question}
\text{1 or 2?}
\explanation{}
\type{input.number}
\field{real}
\begin{answer}
\text{$1\cdot 1=$}
\solution{a}
% by default the score is 1.
\end{answer}
\begin{answer}
\text{$1\cdot 2=$}
\solution{b}
\score{2} % default score is 1
\end{answer}
\end{question}
\end{problem}
|
In the example above, the second answer is given the score weight 2.
Hence, if the total amount of points for the problem is 6, a correct first answer gives 2 points, a correct second answer 4 points.
This also works with answers in multiple questions.
Remark: The total amount of points for a problem is set in the "Settings" of a course in which it is used, and can change from course to course.
Show score details for students
After grading, it is possible to display the score directly behind the student's answer.
Example:

The display is controlled using the \score command, which accepts an optional parameter.
In the example shown, \score[true]{6} is used to make the score visible.
By default, this parameter is set to false, meaning the score is not displayed.
Alternatively, you can enable score display for all answers within a question using \showScore.
In this case, the optional parameter for \score is no longer needed.
If \showScore is set at the problem level, it applies to all included questions.
Partial score for an answer
If a student's answer was only partially incorrect, you may want to award partial credit for the response.
You can achieve this by using the command \partialScore{score}{condition} within an answer environment. Specify the condition that must be met to receive the points. You can use the command multiple times within an answer environment. Make sure that the sum of possible partial scores earned at the same time does not exceed the maximum score (default: 1).
An example for answer type input.number:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | \begin{variables}
\randint{a}{-5}{-2}
\randint{b}{6}{9}
\function[calculate]{sol}{a*b}
\end{variables}
\begin{answer}
\type{input.number}
% maximum score is 2 (default: 1)
\score{2}
% +0.25 partial score, if the student tried to answer at all
\partialScore{0.25}{edited(ans)}
% +1 partial score, if the absolute value of the student's answer ist at least correct
\partialScore{1}{equal(|sol|,|ans|)}
\solution{sol}
% give an explanation for the partial scores (not mandatory)
\explanation[edited(ans)]{+0.25 point, at least you tried it}
\explanation[equal(|sol|,|ans|)]{+1 point, absolute value correct}
\end{answer}
|
So far partial scores can be used for the following answer types: input.number, input.function, input.text, input.interval.
The condition syntax is similar to the one used for the optional condition in explanations.
For answer type input.matrix only the very basic equal comparison is for now implemented.
1 2 3 4 5 6 7 8 9 10 | \begin{variables}
\matrix{m}{1&0\\0&1}
\end{variables}
\begin{answer}
\type{input.matrix}
% ...
\partialScore{0.5}{equal(m,ans)}
% ...
\end{answer}
|
For partial scores for answer types mc.multiple and mc.matrix see: MC Score Types.
Lists in \text{} and \explanation{}
You can use ordered lists, unordered lists, and description lists inside \text{} and \explanation{} blocks
(and generally anywhere text is allowed), using the enumerate, itemize, and description environments and
the \item command:
1 2 3 4 5 6 7 | \text{
\begin{enumerate}
\item First step.
\item Second step.
\item[$\alpha^2$] Third item, with a custom label instead of the automatic number.
\end{enumerate}
}
|
enumerate numbers each \item automatically (1., 2., 3., ...).
itemize gives each \item a bullet.
description expects a label per \item, given as \item[Term]; use \item[$\alpha^2$] or similar for a
custom label in enumerate/itemize too, overriding the automatic number/bullet for that one item.
Numbering/bullet style
Both enumerate and itemize take an optional style class right after \begin{...}, e.g.
\begin{enumerate}[Roman]. Recognized values:
enumerate: arabic (1. 2. 3. - the default), alph (a) b) c)), Alph (A. B. C.), roman (i. ii. iii.),
Roman (I. II. III.)
itemize: bullet (• - the default), dash (-), ast (∗), dot (·), square (▪), circle (∘), arrow (▸)
1 2 3 4 | \begin{enumerate}[Roman]
\item First item
\item Second item
\end{enumerate}
|
If you don't set a style class, nesting one list of the same kind (enumerate in enumerate, itemize in
itemize) inside another automatically steps through a default sequence with nesting depth - for enumerate:
arabic → alph → roman → Alph; for itemize: bullet → dash → ast → dot. Nesting an itemize
inside an enumerate (or vice versa) resets this back to depth 1 for the inner list.
Lists are also usable in static article/example text, which has always worked. Using
them specifically inside \text{}/\explanation{} - i.e. in the actual question or
explanation text a student sees, with variables already filled in - only became reliable since mid-September
2026; on older MUMIE-course installations this could show an error, or show the list without any
numbering/bullets, when the student opened the problem, even though saving/compiling the document itself
showed no error.
In that same personalized \text{}/\explanation{} case, the style
class support is currently more limited than in static article/example text: for enumerate, all
five styles above work; for itemize, only circle currently renders distinctly - the
other style classes (bullet, dash, ast, dot, arrow)
fall back to a plain default bullet there. The automatic depth-based nesting style also doesn't apply in this
case. None of this applies to lists in static article/example text, where all styles and automatic nesting work
as described above.