SourceForge.net Logo

SVGMath - MathML to SVG Converter in Python

Overview

SVGMath formats MathML 2.0 expressions as SVG 1.1 images.

Platform

SVGMath is written in pure Python, with neither extension modules nor external dependencies. It runs on any platform where a modern Python environment (version 2.4 or higher) is available. It can be used either as a command-line script for batch-mode file conversion, or as a component to process MathML data in other Python applications.

License

SVGMath is an open-source project, released under MIT license.

Download

The latest version of SVGMath is available from the SourceForge project page.

Examples

Here is a couple of complexity tests from W3C MathML Test Suite, rendered by SVGMath. Please note that SVG image may not display correctly on all systems: it relies on availability of the same fonts that were used to create it. As a reference, I include the PDF rendering of the SVG with all fonts embedded, generated by RenderX XEP.
Test MathML Source SVG by SVGMath PDF
complex1 complex1.mml complex1.svg complex1.pdf
complex2 complex2.mml complex2.svg complex2.pdf

Contacts

Please send your comments, bug reports, and enhancement requests to the author, Nikolai Grigoriev <svgmath AT grigoriev.ru>.

MathML Coverage

As of version 0.3, SVGMath covers most of the Presentation MathML. The following constructions are supported:

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

The following elements and features are not supported: