TeX notation filter

From Carleton Moodle Docs

The TeX Filter is a core Moodle filter intended to allow one to convert tex expressions into GIF, PNG or SVG images. The filter relies on some additional binaries to accomplish this for expressions contained between appropriate tokens. Where these binaries are not available, Moodle provides for a fallback through the use of Mimetex. Versions of MimeTex for Linux (glib2.3 32bit), Windows, Mac OS X and FreeBSD are included in the Moodle distribution. There are other technologies available for displaying Tex (see the section on Mathematics tools for a discussion.)

Note: being based on binaries it requires the availability of three PHP program execution functions: exec, shell_exec and system.

Methods and Usage

To avoid confusion you should note that the TeX filter has two separate methods for converting the TeX notation to images. The preferred method is a collection of three binaries that you are responsible for installing (if they are not already present, though many webhosts make these available) and configuring on your server. The filter settings page relates entirely to this method. If this fails for any reason the filter will fall back to a single binary - MimeTeX. A number of different builds are included in the Moodle distribution for popular operating systems, though Mimetex and its bigger brother, MathTex are easy enough to compile and install if you have systems administration experience.

Once the filter is turned on and properly configured you can make use of it by including a TeX expression delimited by double-dollar signs. Example:

   $$ \sqrt{x + y} $$

See Using TeX Notation for more details on using TeX in Moodle.


Moodle may use a pre-built MimeTeX binary (located in the filters/tex directory) as a fallback if it can't properly access dvips, convert and latex binaries. There are a number of different versions for different operating systems. The TeX filter picks the appropriate binary for the detected host operating system (you will need to hack the script if your operating system is not included). Note that your web server needs to be set up with appropriate permissions for running binaries in that location.

The MimeTeX manual is available but is arguably intended for persons with systems administration experience and does not specifically address the Moodle environment.

You should only use MimeTeX if installing the full LaTeX system fails or the binaries are not available on your system. The results are not nearly as good.

Compatability with MathJax

In Moodle 2.8 onwards, the TeX Notation and MathJaxloader filter may be used in combination. If both filters are enabled on the page, images will be displayed first by the TeX notation filter, and the MathJax version of the TeX expression will replace a little while later when MathJax has finished loading and processing. If both filters are available, a teacher may decide which to use in an activity by enabling one and disabling the other.

See also