MathQuiz: Web Quizzes using LaTeX

Last unanswered question  Question  Next unanswered question

Introduction

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:

  1. Multiple choice questions with a unique correct answer. (See Question 1)
  2. Multiple choice questions with several (or no) correct answers. (See Question 2)
  3. 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.)

Basic Usage

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.

MathQuiz files

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}  
 
      % optional "discussion"  
      \begin{dicussion}[optional title]  
          . . .  
      \end{discussion}  
 
      % question 1  
      \begin{question}  
          . . .  
      \end{question}  
 
      % question 2  
      \begin{question}  
          . . .  
      \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 \tile 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.

Question 1

The syntax for a multiple choice question having precisely one correct answer is as follows:

    \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}

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.

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=2pt,linestyle=dashed,%  
         fillcolor=blue,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}

Question 2

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}

Question 3

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. There is a more general Choice environment which lets you specify the number of columns in the HTML version of the quiz. Its syntax is similar to that of the choice environment.

    \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}

Question 4

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}

Index Files

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:

    \begin{quizlist}  
      \quiz[url1]{title for quiz 1}  
      \quiz[url2]{title for quiz 2}  
      . . .  
    \end{quizlist}

If no url is given as an optional argument to — then MathQuiz sets the url(s) to quiz1.html, quiz2.html and so on.

Credits

MathQuiz is a HTML quiz preparation system which 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 some python programs.
The LATEX component of MathQuiz was written by Andrew Mathas and the python and javascript code were written by Andrew Mathas and Don Taylor, based on an initial protype by Daniel Daners and Don Taylor. A related system which produces quizzes for self assessment tests was written by a team supervised by Daniel Daners (see example test).


The MathQuiz system is also being used by the Faculty of Economics and Business. Although we do not have the time and resources necessary to fully support the system we have now made a portable version of MathQuiz which is available under the terms of the GNU General Public License (GPL). It has been tested only on Unix systems and it requires that python, LATEXand tex4ht be installed. Please contact Andrew Mathas if you are interested in using the system.


Authors
Daniel Daners, Andrew Mathas and Don Taylor.

Question 1

The shaded region in the graph
PIC
is equal to which of the following sets of complex numbers?
a)
{z : (z - 1)2 + (z - (i + 1))2 < 2}
  b)
{z : z + (i + 1) < 2}
c)
{z : |z - (i + 1)| < 2}
  d)
{z : |z - 2| < |i + 1 - 2|}
e)
None of the above.

 

Not correct. Choice (a) is false.
The equation of a circle in the complex plane with centre a + ib and radius r is
{z : |z - (a + ib)| < r}.
Not correct. Choice (b) is false.
You want the set of points whose distance from 1 + i is less than 2.
Your answer is correct.
The graph shows the set of complex numbers whose distance from 1 + i is less than 2.
Not correct. Choice (d) is false.
As |i + 1 - 2| = 2, this is the set of complex numbers whose distance from 2 is less than 2.
Not correct. Choice (e) is false.
The graph shows the set of complex numbers whose distance from the centre of the circle is less than 2.

Question 2

Which of the following numbers are prime?
a)
1
  b)
19
c)
6
  d)
23
e)
191

 

There is at least one mistake.
For example, choice (a) should be false.
By definition, a prime is a number greater than 1 whose only factors are 1 and itself.
There is at least one mistake.
For example, choice (b) should be true.
The only factors of 19 are 1 and itself.
There is at least one mistake.
For example, choice (c) should be false.
2 is a factor of 6
There is at least one mistake.
For example, choice (d) should be true.
The only factors of 23 are 1 and itself.
There is at least one mistake.
For example, choice (e) should be true.
The only factors of 191 are 1 and itself.
Your answers are correct
  1. False. By definition, a prime is a number greater than 1 whose only factors are 1 and itself.
  2. True. The only factors of 19 are 1 and itself.
  3. False. 2 is a factor of 6
  4. True. The only factors of 23 are 1 and itself.
  5. True. The only factors of 191 are 1 and itself.

Question 3

What are suitable parametric equations for this plane curve?
PIC
a)
x = 2cost + 1, y = 3sint + 2
b)
x = 3cost + 1, y = 2sint + 2
c)
x = 3cost - 1, y = 2sint - 2
d)
x = 2cost - 1, y = 3sint - 2

 

Not correct. Choice (a) is false.
This is an ellipse with centre (1,2) and with axes of length 4 in the x-direction and 6 in the y-direction.
PIC
Your answer is correct.
The curve is an ellipse centre (1,2) with axes length 6 in the x direction and 4 in the y direction.
Not correct. Choice (c) is false.
This is an ellipse with centre (-1,-2) and with axes of length 6 in the x-direction and 4 in the y-direction.
PIC
Not correct. Choice (d) is false.
This is an ellipse with centre (-1,-2) and with axes of length 4 in the x-direction and 6 in the y-direction.
PIC

Question 4

If the vectors a (of magnitude 8 units) and b (of magnitude 3 units) are perpendicular, what is the value of
|a - 2b|?
(Hint: Draw a diagram!)

units

 

Your answer is correct
The vectors a, -2b, and a - 2b form the sides of a right-angled triangle, with sides of length 8 and 6 and hypotenuse of length |a - 2b|. Therefore by Pythagoras’ Theorem, |a - 2b| = 82 + 62 = 10.
Not correct. You may try again.
Draw a diagram and then use Pythagoras’ theorem.
For questions or comments please contact webmaster@maths.usyd.edu.au