## Thursday, 5 August 2010

### Moodle Chemistry

Today I've been prompted to write a short post on how to render complex (i.e. math and chemical) notation in a Moodle quiz.

@lasic retweeted a question from @betchaboy:

"Way in Moodle to use rich text in m/c [multichoice] quiz answer choice? Need to offer chem. formulas with subscript as option."

You would be forgiven for thinking it looking at the relatively small edit box you use to specify your multichoice answers but (as the developer responsible for Moodle's quiz engine @tim_hunt later confirmed) you can actually type HTML in there (the only reason why the HTML Editor isn't displayed is that a pretty long page web page would be rendered even longer - the multi-choice scroll of death becoming even more deadly). The image below demonstrates what I mean about the small edit box...

My solution, rather than using HTML, would be to use LaTeX.

Those of us of a certain age (*cough*) predate these new-fangled "what you see is what you get/WYSIWYG" text editor whatsits. We had to use a typesetting langauge. The language of choice - certainly in the science and math community - was (and in some instances, thinking of University of Birmingham here in the UK, still is) LaTeX.

LaTeX is pronounced "lah-tek" or "lay-tek", depending on who you speak to (more details here).

Speak to your server/Moodle administrator about getting LaTeX installed on the server and the Moodle TeX filter enabled (see http://docs.moodle.org/en/TeX_filter for details). Make sure you have TeX properly configured. Check that your LaTeX isn't being rendered using the Mimetex filter - for no better reason than Mimetex only recognises a subset of TeX and the output can look a little jagged. See this discussion thead on in the Mathematics Tools forum on Moodle.org for some tests you can try: http://moodle.org/mod/forum/discuss.php?d=120418. For the more technical readers, you'll also witness me having a strange configuration error on one of my servers.

Here is a multi-choice question on the Haber Process:

How did I write those equations in the answer edit box to make them look so neat?

...is actually written in the answer edit box like so:

$$\textrm{N}_{2(g)} + 3\textrm{H}_{2(g)} \leftrightharpoons 2\textrm{NH}_{3(g)}$$

That may seem horribly complicated (and I'm challenging you with a technically difficult example) but, rest assured, once you learn some of the basic typesetting commands it can become extremely powerful way of arranging/typesetting your text. Check out http://docs.moodle.org/en/Using_TeX_Notation for more details.

For more details on LaTeX, how to set it up in your Moodle, and how to typeset complex notation using LaTeX then definitely visit the Mathematics Tools forum on Moodle.org (http://moodle.org/mod/forum/view.php?id=752).

Are you a LaTeX user? Do you find it easy or difficult to typeset mathematical and/or chemical notation using LaTeX? I'm interested to hear from you.

PS I don't want to be accused of plugging one of my books but I go into detail about configuring Moodle to support complex notation in Moodle 1.9 Math - including how to integrate the excellent DragMath drag-and-drop LaTeX editor into Moodle.

1. http://moodle.org/mod/forum/discuss.php?d=111785&mode=1

http://docs.moodle.org/en/Chemistry/Biochemistry

2. Hi Marc,

Thanks for those extra links. If you're thinking of chemistry teaching then also check out the link to the Jmol filter. I'm also a big fan of this (especially the 3D view). It's here: http://docs.moodle.org/en/Jmol_filter

Thanks again,

Ian.

3. I tried entering the tex code:
$$\textrm{N}_{2(g)} + 3\textrm{H}_{2(g)} \leftrightharpoons 2\textrm{NH}_{3(g)}$$
but it did not give me a valid result. $$\sqrt{x + y}$$ works fine...
Any suggestions? I am trying to help some of our Chemistry teachers.