MathQuiz is a LATEX based system to create interactive web quizzes. The idea is that you write the quiz using LATEX and that MathQuiz creates the web page from this file. Anything which you can write using LATEX will be converted to HTML by MathQuiz. This includes, for example, mathematics and graphics written using PSTricks. MathQuiz supports three different types of quiz questions:
- Multiple choice questions with a unique correct answer. (See Question 1 )
- Multiple choice questions with several (or no) correct answers. (See Question 2 )
- Questions which require a numerical answer. (See Question 3 )
The use of MathQuiz is described in the next section. Later sections describe how each of the MathQuiz environments are used.
The discussion environment in MathQuiz can also be used to write Web Pages like this one (The pages you are reading here were written using MathQuiz.)
Once you have a MathQuiz file, you can run it through LATEX, in the usual way, to produce a readable version of your quiz. When you are happy with the quiz, use mathquiz to create the HTML version. Note that the printable version of the quiz does not look like the web page; rather, it contains all of the information in an easily readable layout.
If, for example, your quiz file is called quiz1.tex then you can use the following
commands:
> latex quiz1 % latex a quiz file
> xdvi quiz1 % view the quiz using xdvi
> dvips quiz1 % print the quiz
> mathquiz quiz1 % converts the quiz to html
Converting the quiz to html can take quite a long time, particularly if a large number of images need to be created.
The basic structure of a MathQuiz file is as follows:
\documentclass{mathquiz}
\title{Quiz 1: Complex numbers}
\UnitCode{MATH1001}
\UnitName{Differential Calculus}
\UnitURL{/u/UG/JM/MATH1001/}
\QuizzesURL{/u/UG/JM/MATH1001/Quizzes/}
\begin{document}
\begin{discussion}[optional title] % optional "discussion"
. . .
\end{discussion}
\begin{question} % question 1
. . .
\end{question}
\begin{question} % question 2
. . .
\end{question}
.
.
\end{document}
The preamble of the LATEX file specifies the course code, the name of the unit of study, the location of the homepage for the unit and the index file for the quizzes for this unit; this is done using the commands \UnitCode, \UnitName, \UnitURL and \QuizzesURL respectively. If the command \QuizzesURL is omitted then the URL for the quiz index file is set to \UnitURL/Quizzes. (Within the the School of Mathematics and Statistics, there is also a package smsquiz.sty which sets the default parameters from the course code.)
The title of the quiz should also be set in the preamble using the \title command. Note that the \title command must appear before the \begin{document} command. In the preamble you can also define macros and load any packages that you want in the usual way .
The discussion environment can be used to add comments or remarks to a quiz. For
example, it can be used to summarize the material being tested in the quiz or to give
references to the course notes. The syntax for the discussion environment is as
follows:
\begin{discussion}[optional title]
. . .
\end{discussion}
Anything you like (text, mathematics, …) can go inside discussion environments. The optional title is used both as the section heading on the web page and as the heading in the navigation bar which runs down the left hand side of the page. The headings should not be too long as they have to fit in the left hand margin. By default, the title is discussion. There can be several discussion environment, but they go all in front of the questions.
Questions are set inside a question environment. The text is followed by the answers.
MathQuiz supports three types of questions:
- Multiple choice questions with precisely one correct answer;
- Multiple choice questions with several or no correct answers;
- Questions taking a numerical answer.
With each of these types of questions you can (and should) provide feedback to the students depending on whether their answer is correct or incorrect. Below we describe how to produce these different types of questions.
The syntax for a multiple choice question having precisely one correct answer is as follows:
The multiple choice responses for each question go inside a choice environment. The correct answer goes after \correct, incorrect answers after \incorrect. Either can be followed by a \response, providing comments on the students choice when checking their answers. The \reponse commands are optional; however, it is recommended that you use them as good feedback is very useful for the students.
\begin{question}
. . .question text
\begin{choice}
\(in)correct . . . text for (in)correct option
\response . . . feedback on response
\(in)correct . . . text for (in)correct option
\response . . . feedback on response
.
.
.
\end{choice}
\end{question}
For example, Question 1 below was typed into MathQuiz using the following
commands:
\begin{question}
The shaded region in the graph
\begin{center}
\begin{pspicture}(-3,-1.5)(3,4)
\pscircle[linewidth=1pt,linestyle=dashed,%
fillcolor=SkyBlue,fillstyle=solid](1,1){2}
\psaxes[linecolor=red,linewidth=1pt,labels=none]%
{->}(0,0)(-1.5,-1.5)(3.5,3.5)
\rput(3.75,0){$x$}
\rput(0,3.85){$iy$}
\rput(3,-0.4){3}
\rput(-0.4,3){3$i$}
\psdots(1,1)
\end{pspicture}
\end{center}
is equal to which of the following sets of complex numbers?
\begin{choice}
\incorrect $\{z \in \C : (z-1)^{2}+(z-(i+1))^{2}<2\}$
\response The equation of a circle in the complex plane with
centre $a+ib$ and radius $r$ is
\begin{displaymath}
\{z\in\C : |z-(a+ib)|<r \}.
\end{displaymath}
\incorrect $\{z \in \C : z+(i+1)<2\}$
\response You want the set of points whose \textit{distance}
from $1+i$ is less than $2$.
\correct $\{z \in \C : |z-(i+1)|<2\}$
\response The graph shows the set of complex numbers whose
distance from $1+i$ is less than $2$.
\incorrect $\{z \in \C : |z-2|<|i+1-2|\}$
\response As $|i+1-2|=\sqrt 2$, this is the set of complex
numbers whose distance from $2$ is less than
$\sqrt 2$.
\incorrect None of the above.
\response The graph shows the set of complex numbers whose
distance from the centre of the circle is less than $2$.
\end{choice}
\end{question}
To allow multiple (or no) correct answer we add multiple as an optional argument to the choice environment:
\begin{question}
. . .question text. . .
\begin{choice}[multiple]
\(in)correct . . . text for (in)correct option
\response . . . feedback on response
\(in)correct . . . text for (in)correct option
\response . . . feedback on response
.
.
.
\end{choice}
\end{question}
The only difference to the previous case is that multiple (or no) \correct commands may be used.
For example, Question 2 below was typed into MathQuiz using the following commands:
\begin{question}
Which of the following numbers are prime?
\begin{choice}[multiple]
\incorrect 1
\response By definition, a prime is a number greater than 1
whose only factors are 1 and itself.
\correct 19
\response The only factors of 19 are 1 and itself.
\incorrect 6
\response 2 is a factor of 6
\correct 23
\response The only factors of 23 are 1 and itself.
\correct 191
\response The only factors of 191 are 1 and itself.
\end{choice}
\end{question}
By default, the choice environments puts the multiple choice options into two column format. Sometimes, however, the options look better when listed in a single column and, sometimes, three or more columns are better. The choice environment lets you specify the number of columns in the HTML version of the quiz.
\begin{question}
. . .question text. . .
\begin{choice}[multiple, n] . . . n columns
\(in)correct . . . text for (in)correct option
\response . . . feedback on response
\(in)correct . . . text for (in)correct option
\response . . . feedback on response
.
.
.
\end{choice}
\end{question}
If the optional argument [multiple] is not present, then the question admits precisely one correct answer.
For example, Question 3 below was typed into MathQuiz using the following
commands:
\begin{question}
What are suitable parametric equations for this plane curve?
\begin{center}
\psset{unit=.6cm}
\begin{pspicture}(-2.5,-0.5)(5,5.5)
\psaxes[linecolor=red,linewidth=1pt,labels=none]%
{->}(0,0)(-2.5,-1.5)(5,5)
\psellipse[linecolor=blue,linewidth=2pt](1,2)(3,2)
\end{pspicture}
\end{center}
\begin{choice}{1}
\incorrect $x=2\cos t + 1$, $y=3\sin t + 2$
\response This is an ellipse with centre $(1,2)$ and with axes of
length $4$ in the $x$-direction and $6$ in the $y$-direction.
\begin{center}
\psset{unit=.6cm}
\begin{pspicture}(-2.5,-0.5)(5,5.5)
\psaxes[linecolor=red,linewidth=1pt,labels=none]%
{->}(0,0)(-2.5,-1.5)(5,5)
\parametricplot[linecolor=blue,linewidth=2pt]{0}{360}%
{t cos 2 mul 1 add t sin 3 mul 2 add}
\end{pspicture}
\end{center}
\correct $x=3\cos t + 1$, $y=2\sin t + 2$
\response The curve is an ellipse centre (1,2) with axes length 6
in the $x$ direction and 4 in the $y$ direction.
\incorrect $x=3\cos t - 1$, $y=2\sin t - 2$
\response This is an ellipse with centre $(-1,-2)$ and with axes
of length $6$ in the $x$-direction and $4$ in the $y$-direction.
\begin{center}
\psset{unit=.6cm}
\begin{pspicture}(-5,-4)(1,2)
\psaxes[linecolor=red,linewidth=1pt,labels=none]%
{<-}(0,0)(-4.5,-5.5)(1,2)
\parametricplot[linecolor=blue,linewidth=2pt]{0}{360}%
{t cos 3 mul 1 sub t sin 2 mul 2 sub}
\end{pspicture}
\end{center}
\incorrect $x=2\cos t - 1$, $y=3\sin t - 2$
\response This is an ellipse with centre $(-1,-2)$ and with axes
of length $4$ in the $x$-direction and $6$ in the $y$-direction.
\begin{center}
\psset{unit=.6cm}
\begin{pspicture}(-4,-5)(1,2)
\psaxes[linecolor=red,linewidth=1pt,labels=none]%
{<-}(0,0)(-4.5,-5.5)(1,2)
\parametricplot[linecolor=blue,linewidth=2pt]{0}{360}%
{ t cos 2 mul 1 sub t sin 3 mul 2 sub}
\end{pspicture}
\end{center}
\end{choice}
\end{question}
The final type of question that MathQuiz supports is a question which requires a numerical as an answer. The numerical answer must be given in decimal form. The answer is typeset using the \answer macro. That macro takes two arguments, some text appearing in an answer box after the question and the actual numerical answer. The text is optional. The syntax is \answer[text after answer box]{numerical answer}. Then there is a mechanism for providing feedback for correct and incorrect answers. This is done using \whenRight and \whenWrong. Unlike the \response commands, the two reponses \whenRight and \whenWrong are both mandatory for questions of this type. The syntax is for such questions is as follows:
\begin{question}
. . .question text. . .
\answer[text after the answer box]{actual answer}
\whenRight . . . feedback when right
\whenWrong . . . feedback when wrong
\end{question}
For example, Question 4 below was typed into MathQuiz using the following
commands:
\begin{question}
If the vectors $\vect{a}$ (of magnitude 8 units) and $\vect{b}$
(of magnitude 3 units) are perpendicular, what is the value
of
\begin{displaymath}
|\vect{a} -2\vect{b}|~?
\end{displaymath}
(Hint: Draw a diagram!)
\answer[units]{10}
\whenRight The vectors $\vect{a}$, \(-2\vect{b}\), and
$\vect{a} - 2\vect{b}$ form the sides of a right-angled
triangle, with sides of length $8$ and $6$ and
hypotenuse of length $|\vect{a} -2\vect{b}|$. Therefore
by Pythagoras’ Theorem,
\(|\vect{a} -2\vect{b}|=\sqrt{8^2+6^2}=10\).
\whenWrong Draw a diagram and then use Pythagoras’ theorem.
\end{question}
MathQuiz also provides a mechanism for creating a web page containing an index of all quizzes for a given Unit of Study. This is done with a MathQuiz file which contains a |quizlist| environment. The syntax for this environment is as follows:
If no url is given as an optional argument to |
\begin{quizlist}
\quiz[url1]{title for quiz 1}
\quiz[url2]{title for quiz 2}
. . .
\end{quizlist}
MathQuiz was written and developed in the School of Mathematics and Statistics at the University of Sydney. The system is built on LATEX with the conversion from LATEX to HTML being done by Eitan Gurari’s TeX4ht, and Michal Hoftich’s make4ht.
To write quizzes using MathQuiz it is only necessary to know LATEX, however, the MathQuiz system has three components:
- A LATEX document class file, mathquiz.cls, and a TEX4ht configuration file, mathquiz.cfg, that enable the quiz files to be processed by LATEX and TEX4ht, respectively.
- A python program, mathquiz, that translates the xml file that is produced by TEX4ht into HTML.
- Some javascript and css that controls the quiz web page.
The LATEX component of MathQuiz was written by Andrew Mathas and the python, css and javascript code was written by Andrew Mathas (and Don Taylor), based on an initial protype of Don Taylor’s from 2001. Since 2004 the program has been maintained and developed by Andrew Mathas. Although the program has changed substantially since 2004 some of Don’s code and his idea of using TEX4ht are still very much in use.
Thanks are due to Bob Howlett for general help with CSS and, for Version 5, to Michal Hoftich for technical advice.
For example, choice (a) should be False.
For example, choice (b) should be True.
For example, choice (c) should be False.
For example, choice (d) should be True.
For example, choice (e) should be True.
- False By definition, a prime is a number greater than 1 whose only factors are 1 and itself.
- True The only factors of 19 are 1 and itself.
- False 2 is a factor of 6
- True The only factors of 23 are 1 and itself.
- True The only factors of 191 are 1 and itself.