[texhax] (La)TeX with Flash

James Quirk jjq at galcit.caltech.edu
Tue Sep 29 22:26:25 CEST 2009


On Tue, 29 Sep 2009, Ivan Ramos Pagnossin wrote:

> James, thank you very much for the answer. I'll check your suggestions.
> My intention is to produce interactive Flash/ActionScript applications for
> teaching mathematics and physics. Sometimes I need to write some equations.
> When the symbols are static I usually use LaTeX and convert them to curves,
> but when I need to write "dynamic" expressions... that is quite a problem!
Not at all. All you need do is to make a request to a TeX server
such a Mathran. For example, try compiling the following flex3
using mxmlc from Adobe's SDK.

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" backgroundColor="#ffe0e0" >
           private var example:String = "\\displaystyle e^{i\\pi}+1=0";

           private function tex():String {
              var server:String = "http://www.mathtran.org/cgi-bin/mathtran?D=3;"
              return server+";tex="+escape(texinput.text);
    <mx:VBox width="100%" height="100%" verticalGap="0" >
       <mx:Image source="{tex()}" width="100%" height="50%" />
       <mx:TextArea id="texinput" width="100%" height="50%"
           fontSize="20" fontFamily="Courier"
       <mx:Button label="Call TeX Server" click="dispatchEvent(new Event('TeX'));" />

The only weakness is that the current crop of servers are delivering
PNG's which are non scalable. But with a minor tweak they
could deliver SWF's, at not extra cost, then you would
have scalable equations in your FLASH documents to match
the fidelity you see in a PDF.


p.s. If the above gets mangled in transit, let me know
and I'll send it to you offline as an attachment.

> So I think of using the TeX font metrics files to draw each symbol. Yeah, I
> know... too much work, but this was my first thought. Alternatively, I think
> of using XeTeX fonts, whose format (OpenType, TrueType ...?) may be easily
> accessed.

More information about the texhax mailing list