Math notation in Moodle
Moodle Math Symbols – the background
Back in the days before what-you-see-is-what-you-get (a.k.a. wysiwyg) text editors, like LibreOffice Writer or Microsoft Word, documents needed to be typeset. Once upon a time printers required movable type, where each character (letters, numbers and symbols) are cast in relief on a separate, tiny blocks. These little blocks where gathered together to make sentences, inked and then had paper pressed against them to print a page.
When printing began to go digital, letters, numbers and punctuation characters were allocated dedicated codes (ASCII codes) but, sadly, not most mathematical symbols. Our special math symbols needed to be represented by some kind of text markup and so TeX (pronounced ‘tek’) was invented. For example, the ‘divide’ symbol would be represented by \div. LaTeX (pronounced ‘lar-tek’) is used to convert this TeX notation to the equivalent symbols (drawn to an image file), which can then be printed.
By default, Moodle uses a special filter called ‘MathJax’ to turn TeX into the correct symbol. MathJax looks out for TeX notation included in any text added to courses and performs the necessary conversion to make it look like the corresponding mathematical symbols. However, this filter works stopgap (there can be problems with screen readers and browser compatibility to name two issues) so a better option is to ask your admin to install the industry standard suite of digital typesetting tools called MiKTeX and ImageMagick and the ‘TeX’ filter instead. In the rest of this post we show you how.
Configuring the TeX filter
To produce math notation four separate tools will be needed. They are:
- latex – the document preparation system. This converts TeX markup to DVI (a device independant file format, DVI).
- dvips – takes the output from latex (DVI) and converts it to PostScript format (PS).
- convert – part of the ImageMagick suite of tools, this tool can convert files between image formats.
- dvisvgm – converts from DVI to SVG format.
Regardless of which operating system your server is running, these tools are contained in two separate suites of applications:
Full installation instructions for both application suites can be found from the links provided.
Once installed, in Moodle navigate to Site administration -> Plugins -> Filters -> Manage filters. Enable the TeX notation filter and disable the MathJax filter. Click on the TeX filter Settings link and specify the location of each TeX tool. If it can access it, Moodle will display a green check mark next to each application or a red cross if it can’t.
You can test math symbol rendering wherever you see the text editor (for example when configuring a topic summary). You will now be able to click on the Show/hide advanced buttons link then press the Equation editor button. If the filter is working as it should then you’ll be able to see mathematical symbols in the Equation editor itself.
If you have all the right TeX-rendering tools installed on your server and they are configured correctly in Moodle but math notation is still not being rendered correctly then check the tool’s permissions.
- Moodle Competency Frameworks – 28th September 2017
- Math notation in Moodle – 28th July 2017