One of the features which HTML5 has, and which many Web-browsers support, is the ability to typeset Mathematical formulae, which is known as ‘MathML’. Actually, MathML is an extension of XML, which also happens to be supported when inserted into HTML.
The “WiKiPedia” uses some such solution, partially because they need their formulae to look as sharp as possible at any resolution, but also, because they’d only have so much capacity, to store many, many image-files. In fact, the WiKiPedia uses a number of lossless techniques, to store sharp images as well as formulae. ( :1 )
But from a personal perspective, I’d appreciate a GUI, which allows me to export MathML. It’s fine to learn the syntax and code the HTML by hand, but in my life, the number of syntax-variations I’d need to invest to learn, would be almost as great, as the total number of software-packages I have installed, since each software-package, potentially uses yet-another syntax.
What I find however, is that if our software is open-source, very little of it will actually export to MathML. It would be very nice if we could get our Linux-based LaTeX engines, to export to this format, in a way that specifically preserves Math well. But what I find is, even though I posses a powerful GUI to help me manage various LaTeX renderings, that GUI being named “Kile”, that GUI relies back on a simple command-line tool named ‘latex2html’. Whatever that command-line outputs, that’s what all of Kile will output, if we tell it to render LaTeX specifically to HTML. ‘latex2html’ in turn, depends on ‘netpbm’, which counts as very old, legacy software.
One reason ‘latex2html’ will fail us, is the fact that in general, its intent is to render LaTeX, but not Math in any specific way. And so, just to posses the .TEX Files, will not guarantee a Linux user, that his resulting HTML will be stellar. ‘latex2html’ will generally output PNG Images, and will embed those images in the HTML File, on the premise that aside from the rasterization, PNG Format is lossless. Further, if the LaTeX code was generated by “wxMaxima”, using its ‘pdfLaTeX’ export format, we end up with incorrectly-aligned syntax, just because that dialect of LaTeX has been optimized by wxMaxima, for use in generating .PDF Files next.
(Updated 05/27/2018 : )
(As of 05/26/2018 : )
Now, even under Linux, we have options.
Firstly, it’s not a given, that we always want Computer-Algebra to be typeset. We might just as well want formulae typeset, which we just chose to display, and that were not generated by a Computer-Algebra System. But in case we do want the output of a CAS typeset, two viable options are:
- Use ‘wxMaxima’, and use its ‘Export to HTML’ feature.
- Use an expensive, commercial CAS, which has the feature to output to XML / MathML, and then, borrow the MathML from the resulting .XML File, into our carefully-crafted HTML File.
If such a CDN was to be shut down someplace on the WWW, the result would also be, that a wide variety of Web-sites would next lose their ability to display the Math correctly, even though those Web-sites were never specifically affiliated with the CDN in question.
Finally, if the Math we want to typeset comes from the top of our heads, and not from an actual CAS, then our options start to improve:
- The “LibreOffice” application-suite includes a Formula Editor, which stores its formulae in .ODF Files. But it has a feature, to Export to .MML . The big caveat with this is, that it never used LaTeX in any way.
- I hear that “LyX,” a WYSIWYG LaTeX Editor, offers to export as MathML.
My main problem with LyX would be, that although I have it installed, I have never put it to extensive use, and have therefore also not tested its capabilities vis-à-vis MathML.
(Edit : )
I have just performed a simple test, to see whether LyX can in fact be used, to export humanly-typeset Math as MathML.
If we simply use its ‘Export as HTML’ feature, then LyX will generate those PNG Image Files again, which in the pure sense are not MathML, but which are at least aligned correctly, unlike what I found from ‘latex2html’. But, because we want true MathML, I dug further. And what I found was that the ‘Export as LyXHTML’ option does what it’s supposed to do, which is to output an .XHTML-File, that uses true MathML. We could then do as I suggested, and pick out the Tags which define our formulae, to convert this XML, basically, into HTML. Or, we could do something simpler, which would be, to embed the XHTML File as an <iframe>… If the browser supports MathML in the first place, then it will also be able to display the XHTML File. The example below is the definition of the Golden Ratio:
(Update 05/27/2018 : )
Some people might respond with the idea, ‘Doing this may conserve the storage space on the server, but might congest the bandwidth between the server and the browser.’ But my own conclusion about that would be, ‘Because PNG Images can be both compressed and lossless, the actual bandwidth that is consumed to download those to the browser, can be minimized well.’