# LaTeX support

## How to edit using LaTeX

- If you type LaTeX equations between double dollar signs – $$ – in your HTML editor and you save the page, you will get a page with the math rendered as a readable equation. This behavior means the MathType integration is installed and works behind the scenes to manage the LaTeX.
- When you re-edit the page, you will see the $${LaTeX}$$ again. Thus, during editing you see LaTeX, and when displaying the rendered page, you see the image of the formula.

### Example

Imagine in your course there is a line like this:

Since $$\psi=-\frac{1}{\varphi}$$, this formula can also be written as

After installing the MathType plugin, students will see:

Teachers who edit the page in the regular text editor, will once again see this:

If the teacher clicks inside the $$…$$ marks, then clicks on the MathType icon to edit the expression, he or she will see:

After saving the edited equation from MathType, this is the teacher view:

After publishing the page, this is what the student will see:

So *users* see formulas and *editors* see LaTeX most of the time. Editors can edit visually a formula if they want.

This is a great feature, but please be aware that:

- You must disable any other plugins that render LaTeX. For example, Moodle comes with another TeX filter by default. You must choose which one you want; you cannot use both.
- You cannot copy LaTeX documents directly to the application's editor. As a minimum, you must convert all single $ to double $$, and previously all double $$ to a centered paragraph. This is the standard format for embedded LaTeX, and most plugins expect this.
- Not all LaTeX is supported. There dozens of LaTeX commands, many of them dealing text formatting and unrelated to math. Therefore, MathType doesn't support these. Technically, we support the LaTeX instructions which have a MathML equivalent.

## LaTeX is manipulated as MathML

Above, we describe the user experience, but what is important to note is that formulas are stored and displayed using MathML.

When the author or editor submits the content in the HTML editor (generally when previewing or publishing the page or module), MathType Integrations will search all `$$`

and convert the LaTeX into MathML. During this process, the plugin stores the MathML and the original LaTeX text written by the author. Thus, when displaying formulas the MathML conversion takes place.

`<semantics>`

and `<annotation>`

elements. Using a simple example, the fraction $\frac{1}{2}$, we have this MathML code block:
<math xmlns="http://www.w3.org/1998/Math/MathML"> <semantics> <mfrac><mn>1</mn><mn>2</mn></mfrac> <annotation encoding="LaTeX">\frac12</annotation> </semantics> </math>

When the HTML editor has been opened again, the stored LaTeX is recovered from the `<semantics>`

tag and is displayed in the HTML editor area for further editing. What it is important to note is that this works even when the LaTeX cannot be converted into MathML. In that case, it is possible to edit the erroneous LaTeX to fix any potential error.

## Supported LaTeX

The supported LaTeX is dependent on how well it can be translated from/to MathML. The limits are due to the following facts:

- Some formulas have no MathML equivalent.
- LaTeX is an extensible language with many non-official packages. To add to the difficulty, consider that it is possible in LaTeX to define custom characters and other adjustments.
- On our website, you can see some examples of the current LaTeX supported.

## Disable this feature

You might want to disable the interpretation of LaTeX, while continuing to use MathType. In this case, you will need to edit the JavaScript configuration file and change the line

var _wrs_conf_parseModes = ['latex'];

to

var _wrs_conf_parseModes = [];