Happy Tuesday! Today in the MathML Meetup, we devoted the session to MathML → SVG conversion. We discovered that our chosen tool, SVGMath, has been upgraded to work with OpenType fonts, most notably the STIX Font Project we are using in our SVG Track.
Professor Jacques Distler modded a working version of SVG Math for his own project, and we used it as an illustration on how to work with diffs. Jasper and I both agree with Distler’s sentiment that it would be really useful to have the new version be a proper Python package, or have this code readily accessible in github, and we may fold this into our own release cycle at the end of the program.
Once we successfully patched SVG Math to the working version, we found the documentation of the original program to be concise and useful. It did not take long for us to successfully convert our first equation into an SVG format. Below are the results showing the original equation on the left and the generated SVG on the right:
MathML:
SVG:
Using a simple python command …
python math2svg.py new.jasper/Page_240_02.html
… our equations are converted from MathML to SVG markup code. Below is the SVG markup for the equations displayed above:
Debugging
We are experiencing encoding errors with certain entities that we need to track down when attempting to run in batch-file mode. We think this is most likely related to an unsupported element in the MathML namespace, although most elements are supported as shown in this snippet from mathml-coverage.txt from SVGMath:
Token elements:
<mi>, <mn>, <mo>, <mtext>, <ms>, <mspace>
General layout schemata:
<math>, <mrow>, <mstyle>, <mfrac>, <msqrt>, <mroot>,
<mfenced>, <mphantom>, <mpadded>, <merror>, <menclose>
Scripts and limits schemata:
<msub>, <msup>, <msubsup>,
<munder>, <mover>, <munderover>, <mmultiscripts>
Tables and matrices:
<mtable>, <mtr>, <mtd>
Unfortunately, the debugging interface is not particularly verbose (as with other command line conversion programs, such as PrinceXML). Ideally, we want this script to be designed to become part of a workflow scenario, so it will be easy to batch generate new equations as they are added to the repository.
In other debugging news, we are working to reconcile some presentation issues between WordPress and MathJax. We are hopeful to have them resolved to support code contributions from other cool folks interested in our project.
More news next Meetup!