Skip to content Skip to sidebar Skip to footer

Any Reason To Favor Mathml Syntax Over Tex In Mathjax?

MathJax, opensource javascript library to render maths, support multiple syntaxes, including MathML and LaTeX. Are there any reason to favor the use of the MathML syntax for in-pag

Solution 1:

Well, if you actually look closely at the coding, you will find that MathJax, as well as jsMath, and other similar javascript programs, all do pretty much the same thing. They convert what is LaTeX in the source code of the webpage, as it is served by the server, into MathML on the client side. Feel free to highlight your "LaTeX" and see what the selected source code actually looks like to the browser. You will find that it is MathML (in most cases).

Unless you use a script or a hosting site that rasterizes LaTeX into a GIF or PNG image (which is another viable option), then your LaTeX is rendered as MathML-Presentation.

In the case of MathJax, however, it also gives you the option of SVG and HTML-CSS rendering. Both of which require massive amounts of client-side source code. SVG is not really practical (unfortunately it isnt even universally recognized), but it certainly is cool. HTML-CSS, though perhaps looks better, is not readable by a math parser or XML parser... it is also the MathJax default and it puts a heavier load on the client-side. So defaulting to their MathML rendering is better, in my opinion.

Thus, if I understand your question correctly, your question is actually moot. You are already dealing with MathML in both cases. The difference is, which do you find easier to write and embed into the page? Personally, I prefer writing in LaTeX, not MathML.

I have used jsMath and most recently MathJax. But I also currently do still use Codecogs.com to convert latex into GIF on the fly. (They have both a <script> and you can use direct linking <img src=> )

The fact of the matter is, you only have two options (well, four technically). You have MathML or GIF images as the primary two. What all these scripts and hosting sites do is they facilitate a conversion from LaTeX to either GIF or MathML (or the less desirable SVG or HTML-CSS). Straight LaTeX text is as difficult to read as MathML source code - you have to have some sort of rendering process.

One enormous advantage to coding your own MathML is that you have total control over the grammar and structure of the XML-based language (in case you make it available to other math programs and sites). But the other advantages are: you do not require javascript, and therefore your visitors dont have to enable javascript.

Coincidentally, ASCIIMath is a good example of a simple javascript converting LaTeX to Unicode and HTML-CSS in a very beautiful and streamlined way.

Solution 2:

If you do not need a human to write the equations, MathML is more robust. There's a clear interpretation to the mark-up, (which display mode will be used by default in all MathJax implementations?), there's a better chance for text-to-speech support for MathML. It is easy to search by XPath where your mathematical elements are, etc.

Other disadvantages of the MathJax approach are, start-up time tax, the fact it forces your browser to use Javascript.

Solution 3:

MathML provides accessibility to the visually impaired, but you can display your equations as MathML even if you author them with LaTeX.

As to Elazar's question about "which display mode will be used by default in all MathJax implementations", it's strictly up to you when you set up the page. It's done with the <script> tag, as described in the MathJax documentation.

Post a Comment for "Any Reason To Favor Mathml Syntax Over Tex In Mathjax?"