Hungry Moodle 1.5+ eating slashes in TeX formula

Hungry Moodle 1.5+ eating slashes in TeX formula

by Orestes Mas -
Number of replies: 1
Picture of Translators
We're trying to put an formula in a cloze question. The formula involves an array a bit complex, so we typeset it in TeX using Moodle embedded TeX filter.

The code is:

$$\rm\large\left(\begin{array}{ccc}\vspace{12pt}R_1+(C_1s)^{-1}\hspace{24pt}&-(C_1s)^{-1}\hspace{24pt}&0\\\vspace{12pt}-(C_1s)^{-1}\hspace{24pt}&Z_{22}\hspace{24pt}&(C_2s)^{-1}\\\vspace{12pt}\vspace{12pt}Z_{31}\hspace{26pt}&Z_{32}\hspace{24pt}&Z_{33}\end{array}\right)$$

The formula is entered, and is displayed correctly, but every time I edit the formula it removes one bacslash from "\\\vspace" command, resulting in "\\vspace". If edited once more, the "\\vspace" becomes "\vspace". With only one backslash left, no more backslashes are removed.

This happens either *with* or *without* the embedded HTML editor enabled. You can easily check this behavior because it also happens in this very message.

Great! When I re-edited this message I've found that the backslashes also disappear outside TeX expression, so it may be a more general problem, perhaps related to the PHP expression managing.

One more question: It seems that the "\color" command doesn't work in the TeX filter. Is this a bug or a feature?

Thanks a lot.
Average of ratings: -
In reply to Orestes Mas

Re: Hungry Moodle 1.5+ eating slashes in TeX formula

by John Forkosh -
I can't help you with the "hungry" part of your problem, which is an apparently well-known ... feature.

The TeX filter should indeed recognize \color{blue} or \color{red} or \color{green}(my green is actually color #00ff00 which html more accurately calls lime), but no other colors. And \color{} applies to the _entire_ expression regardless of where you put it.

You may have an old version of the TeX filter before \color{} support (such as it is) was added. If the above command doesn't work for you as advertised, try downloading http://www.forkosh.com/mimetex.zip and compiling the current version from its source (see http://www.forkosh.com/mimetex.html for instructions).

Let's see if Martin has a sufficiently current version installed:
$$$\color{blue}\frac1{\sqrt{x^2+y^2}}$$$ renders $$\color{blue}\frac1{\sqrt{x^2+y^2}}$$
From my site, the same expression renders mimetex.cgi?\Large\color{blue}\frac1{sqrt{x^2+y^2}} as intended.

Yeah, Orestes, it looks like you might want to download yourself a more recent version.