This blog has moved.

The content here has been left available for historical purposes, and should be considered out of date. For the most part, comments have been closed. If you have questions, feel free to contact me at justin.henry(at)uvm.edu. Any new material can be found at http://greengaloshes.cc. Thanks for visiting!

Notes on Displaying Math Equations in Macromedia Flash

Last week, Rob brought to my attention a post asking about displaying math equations in flash on the ever-so-chatty Chattyfig Flashcoders list.

Since I had just been doing some research on the subject, it seemed like a good opportunity to pull together my notes. Here goes.

Originally, I was just looking around to see what was out there, in terms of displaying math on the web. I found a number of interesting posts[1] and projects[2] at Galaxy Goo, however many of them seemed rather outdated and incomplete, as well as being a little more complex than I was looking for.

I came across a number of tools which dealt with the display and editing of math on the web. ASCIIMathML[3], which uses javascript to convert acsii math representations into MathML, is one example. Another tool, Simple Equation[4] uses PHP to generate images from ascii math. Both of these require special fonts, however, either on the server or on the local browser, along with other drawbacks.

My ideal application would be reusable and as portable as possible, so I’ve ended up focusing on various methods of implementing existing standards into the process - specifically, MathML [5], the Math Markup Language reccommended by the W3C. The MathML site has a list of software[6] for creating and handling MathML.

One of the more promising applications I considered was Wolfram’s webMathematica [7]. It appears to be able to allow one to send MathML as HTTP data (POST/GET) and generate an image of the equation.

This is a pretty impressive application (and very near what I was looking for), but it is expensive and not everyone has access to this service, nor the adminstrative or technical infrastructure to support it. I still want something simpler.

I looked at various xsl/xslt possibilities, hoping to find a way to process the MathML similar to what’s demonstrated at the W3C testsuite [8]. Since the xsl method is generally client side, and still requires special fonts, I looked for server side tools that would pre process the xsl. The xsltproc tool [9] and PHP’s xslt functions [10] were a few I considered.

The most promising tool I think I’ve seen so far is SVGMath [11] - which claims to convert MathML 2.0 expressions to SVG images. If this works as advertised (I’ve given it a brief spin, but so far without luck - I think I’ve got it miosconfigured), then I can theoretically use the mx.controls.Image tag [12] in flash to display the equation.

Unfortunately, implementing any of the above would require run-time processing/retrieval of the images/equations. That leaves the alternative of somehow pre-processing the equations, but you’re still importing the images into the movie at runtime, which, if I understand correctly, can slow down the application.

That’s about as far as I’ve come so far. I’ll update this post as I come across new information, or if/when I make any progress.

[1] www.galaxygoo.org/blogs/archives/cat_06_mathml.html
[2] www.galaxygoo.org/MediaLab/MathML.html
[3] www1.chapman.edu/~jipsen/mathml/asciimath.html
[4] www.eder.us/projects/simple_equation/
[5] www.w3.org/Math/
[6] www.w3.org/Math/Software/mathml_software_cat_composition_engines.html#Imathml_renderer
[7] www.wolfram.com/products/webmathematica/index.html
[8] www.w3.org/Math/testsuite/
[9] xmlsoft.org/XSLT/xsltproc2.html
[10] us3.php.net/manual/en/ref.xslt.php
[11] www.grigoriev.ru/svgmath/
[12] livedocs.macromedia.com/flex/15/asdocs_en/mx/controls/ImageTag.html

Comments are closed.