### MathML + HTML in Moodle

Number of replies: 20While I have not tried yet to incorporate this in Moodle, I can demonstrate MathML rendering from within the WeBWorK electronic homework system for which I provide an interface in Moodle. To see this go to the following url:

https://webwork2.math.ohio-state.edu/moodle1_2/mod/webwork/view.php?id=2866&username=guest

and check the MathML radio button. Try it with Mozilla or with IE+MathPlayer, and look at the HTML source.

### Re: MathML + HTML in Moodle

Hi Zig,

looks great. I think that MathML will finally be the best solution (for the presentation in the browser), since this is the way of the W3C. Concerning the authoring part it's good to see that Peter Jipsen's javascripts optionally support TeX commands.

The question arises now if you plan to replace soon the mimeTeX filter by these scripts?

Andreas

### Re: MathML + HTML in Moodle

I wish all maths could be implemented in standard browsers using standard MathML, but unfortunately even this nifty javascript solution will only work for the original web page in a Mozilla browser (and not in email etc). Pity.

Still, we have the MathML and TeX plugins for now.

### Re: MathML + HTML in Moodle

I think it would not be hard to integrate Peter Jipsen's javascripts into Moodle in such a way that it would work for browsers with or without MathML capability, replacing the current algebra and TeX filters.

Here's a sketch of how it would work. The javascripts would detect if the browser is MathML capable. If it is MathML capable, then some other javascripts of Peter's would convert the imbedded TeX/algebra into MathML. If not, then the javascript would generate an IMG tag calling a Moodle server script, which would generate a gif using mimeTeX, similar to the current filter. Briefly the current filter.php scripts would be replaced by client-side javascripts, calling a server-side pix.php script for non-MathML capable browsers.

### Re: MathML + HTML in Moodle

### Re: MathML + HTML in Moodle

And is there in fact a javascript test for MathML capability? For some reason I think we previously found there wasn't (could easily be wrong on this one).

### Re: MathML + HTML in Moodle

The main advantage of MathML would in fact be superior, resizable display of math expressions in MathML capable browsers. While I am hardly knowledgable about Javascript, I think it ought to be possible to copy/paste MathML display, using something like overlib.js.

Also there is the public relations advantage of being able to brag that Moodle supports MathML.

As for MathML detection, Peter has a javascript which he thinks is pretty reliable. An alternative would be some kind of user preference based on which Moodle would decide whether or not to include the TeX-->MathML javascripts in the header.

### Re: MathML + HTML in Moodle

With that scheme as I understood it, you couldn't copy MathML from anywhere, then paste it into a Moodle forum post, because the source code would actually need to be TeX. This means students would still have to learn TeX.

I'm not dissing the scripts, I'm just trying to point out small problems to help us think about solutions for this tricky client/server situation ... they are most likely surmountable. User preferences are a good idea that will help.

The nice thing about the scheme we hammered out for the TeX filter is that it "just works" in all browsers and HTML-email programs. I'm of course as keen as you to see MathML support in Moodle but it has to have the same sort of solidity for all sorts of viewer situations. I'd love to see a MathML->gif filter written 100% in PHP, for example.

### Re: MathML + HTML in Moodle

It does not preclude later developing some other method of inputting MathML directly using, e.g. some equation editor addon to HTML Editor.

### Re: MathML + HTML in Moodle

As far as I can tell there are at least three areas for formulas on webpages that can benefit from development.

1. Output:

Converting formulas to gifs is certainly the most portable, and has been used on the web for many years. The correct baseline positioning and sizing of the formulas is often difficult, and the printed output is less than perfect, but it ensures that the largest number of users can see the formulas. So it is desirable to keep such a solution as a default, and perhaps allow the user to switch to several other formats that her/his browser might support. MathML would be the recommended format, and the more it is used, the more likely it will be included in future releases of browsers or provided by plugins.

2. Input:

Wysiwyg seems to be what most beginning users prefer (i.e. formulas are constructed by clickinig on templates and symbols). But there are several drawbacks.

There are not many good freely available editors that work uniformly on different operating systems, and the resulting files are often nonportable. Many users prefer the editor they learn to use first, making it difficult to communicate with users of a different editor. It is unlikely that there will be a standard solution anytime soon.

If copied and pasted into email the formulas are seldom readable or familar to the user.

Text with many (small) formulas (e.g. most mathematical text where each variable is a formula) is cumbersome to type since it requires frequent switching between keyboard and pointer device.

So, ascii based formula languages are often a convenient alternative. Variants are part of most computer algebra systems and advanced calculators, but certainly (La)TeX is the most widely used.

Any such ascii language has to translate the 2D formula notation into a one-dimensional character stream, and come up with ways to code many different symbols. Currently Moodle provides an algebra and TeX filter, and there is discussion here to include another recent variant (ASCIIMathML) that partially overlaps both these languages. It would be a good idea to compare and contrast all three and see if there is some concensus that could result in a combined "standard". This would lead to less confusion on the users' side, but perhaps also to less flexibility.

3. Translating from input to output:

3a. Server-side.

Advantages: complete control over server setup.

The user is sent a webpage that (hopefully) works correctly on the client.

3b. Client-side.

Advantages: Less overhead for server.

Can also work offline.

Allows instant dynamic preview (possibly even as the formula is being typed).

I'm currently a complete novice to Moodle, but it looks like a fantastic system. The hard work that has been done to integrate formulas nicely in Moodle is very impressive. If ASCIIMathML (the language) or ASCIIMathML.js (the javascript) can contribute in some small way to this effort, that is great, and I'll be glad to make some required modifications to help in this way. The current version (1.3) has been moved to http://asciimathml.sourceforge.net, and it can be used quite easily on standalone webpages, as well as within wikiservers (there is also a PHP version, see the link on the homepage).

I'm looking forward to reading about other users views on these issues.

-- Peter

### Re: MathML + HTML in Moodle

I like ASCIIMathML a lot and I think it would be very nice to have

it included in Moodle - and it seems as if I am not alone :

http://moodle.org/mod/forum/discuss.php?d=7384

(in case you havent already read this thread)

nadja

### Re: MathML + HTML in Moodle

Hi Martin,

*...if TeX is still required at the source level then what's the advantage converting into MathML?*

I believe that many would still prefer entring math. expressions in TeX because (1) they know this syntax (2) it's imo a more comfortable syntax for authoring larger texts than MathML

Maybe a good alternative would be a php wysiwyg math editor (like mathtype) as I mentioned earlier today (see below).

And MathML as the way to deliver math expressions to the browser could have the advantage that it's the preferred standard by W3C. I think that regarding the bandwidth there's only a slight advantage, but the formulas seem to be a bit nicer with MathML (heavily subjective for sure). Also, if the approach is to transfer a javascript along with TeX in ASCII and convert it in the browser it will probably even turn into a disadvantage concerning the bandwidth aspect.

For the php wysiwyg math editor I could maybe help although I am just starting with php (but I have some knowledge in other programming languages like Java, LabView/G, Pascal, js and (rudimentary) in C). But I like constructionism... Depends on your plans with this issue.

Andreas

### Re: MathML + HTML in Moodle

Also, if the approach is to transfer a javascript along with TeX in ASCII and convert it in the browser it will probably even turn into a disadvantage concerning the bandwidth aspect.

The javascript would be cached by the client browser.

### Re: MathML + HTML in Moodle

In my ideal world the raw, base format (to be actually stored in the database) would be normal MathML format. There could be various input methods (including TeX) that would convert to MathML, and various filters to transform the MathML into images or whatever is required to get them to work for each user.

There are already plenty of WYSIWYG MathML editors around (and they don't need to be built-in to the editor) that will produce MathML which can be pasted into Moodle, so this is not that urgent.

Now with all that said, I just took a look at Peter's AsciiMath page and I must say the shorthand format there looks pretty impressive as an input method, especially since the scripts also support TeX. However, the TeX support seems rather rudimentary.

It's difficult to see the best way forward - I've confused myself again. I'll go work on something else for a while.

### Re: MathML + HTML in Moodle

It looks to me like this could be a good candidate the replace the algebra filter (especially if the database format became MathML). The algebra filter is very neat and I have students who use it a lot, but it does have limitations that come from its history as a Perl function evaluation translator, not an input layer filter. Did you notice AsciiMath has now been ported to PHP? http://www.jcphysics.com/ASCIIMath/index.php

Also, I think it could be a mistake to underestimate the value of better equation rendering that might come through MathML--especially as a PR tool.

--Rudy

### Re: MathML + HTML in Moodle

Is there a way to create a pop-up screen like the "Use emoticons", that can be filled with teacher/admin selected material? My thought was that the screen could serve as kind of a palette/quickeys tool, where the graphic parts of maths could be listed and selected into non-html windows.

If this were possible, I would be interested in creating other kinds of palettes for the screens my teachers see (items that teachers might frequently use to respond to a student's assignment)...

-Tom

### Re: MathML + HTML in Moodle

WP1

### Re: MathML + HTML in Moodle

### Re: MathML + HTML in Moodle

Hi Martin,

Porting WebCT UQAM site to Moodle, I am asking:

"What happen to MathML since your 2004 comment?

Tex is always in Moodle but MathMl seems to have disappeared."

There is nothing in Moodle docs on MathML and nothing easy to find in forums.

Thanks

Pierre