Create Moodle Quiz questions from a TeX file

Moodle quizzes can be used for different purposes. They can help to build students’ confidence by providing opportunities for them to consolidate their learning, and offering instant personalised feedback. Lecturers can also benefit from using quizzes to identify parts of the curriculum that students are struggling with, and to gather feedback about content covered in lectures.

One challenge in building quizzes that include mathematical expressions is how to input and display them in Moodle in an easy and accessible way. If you already create your exams using a LaTeX editor, you are likely to have a large bank of questions ready to be used as practice questions or formative assessment. However, using an equation editor in Moodle to input the mathematical expressions can be time-consuming. The good news is that you can create quiz questions on Moodle by entering your LaTeX code into the Moodle questions.

This post will explain how to create Moodle questions using LaTeX code.

Creating a LaTeX quiz question in Moodle

You can easily create questions by copying and pasting the LaTeX question text and answer in a Moodle question. The only thing you need to take into account is to wrap your mathematical expressions with double dollar signs ($$). For instance, if you have written the following question (1):

LaTeX question image
Question text (LaTeX)

 

 

You need to add an extra $ sign and input the question in the Question text input field and the answers in the Choice input fields:

question_text
Question text (Moodle)

 

Moodle will interpret the expressions surrounded by $$ and it will transform them to images (2). Our question will be displayed by Moodle like this:

displayed question image
Displayed question

 

 

Finally, you need to check which filters Moodle uses to convert LaTeX to an image. MathJax is the filter that best displays your TeX code. This is important not only to improve the quality of the images but also because the MathJax generated images are accessible for screen readers and zooming tools.

To use this filter in your module:

  • Go to Settings>>Filters,
  • disable TeX notation,
  • enable MathJax.

This is how your filters should look:

filters
Module filters (Settings>>Module administration>>filters)
 Notes

(1)You can find guidance about how to create Moodle quizzes and questions on the EdTech guidance site: https://sleguidance.atlassian.net/wiki/display/Moodle/Quiz

(2) All LaTeX code seems to work properly with Moodle, except for mbox. This code is blacklisted in moodle and generates an error. Since this code is used to include text, you can input it outside the $$ signs.

Print Friendly, PDF & Email

Leave a Reply

Your email address will not be published. Required fields are marked *