Re: [xsl] TeX to MathML by using XSLT

Subject: Re: [xsl] TeX to MathML by using XSLT
From: "James A. Robinson" <jim.robinson@xxxxxxxxxxxx>
Date: Tue, 28 Jun 2005 15:19:03 -0700
> I require to convert TeX to MathML by using XSLT, in my source
> XML I have TeX math content in the processing instruction format
> i.e., <?TeX {a \over \b}?>, please advise me how can I convert
> these TeX equations to MathML.

If you want something which can truly handle any input of TeX and
output MathML, I think you're going to find it's a difficult task to
do in XSLT.  Having a mix of markup languages in a document is an
interesting problem, and properly handling both markups generally
means you need a processing engine which understands both markups.

If all the TeX in your document is simple, like the above, you might
be able to get away with simply doing pattern matching using XSLT 2.0.
However, I think that kind of solution is unlikely, as any of the more
complex (standard) TeX markups will be difficult to deal with.

If I had to approach this task I'd look at using the ability to create
my own functions, and I'd use this function to make a call to an
external routine to handle converting the LaTeX to MathML as the
stylesheet went through the XML source.

An alternative, and possibly easier, approach would be to make
multiple passes of your sourcee XML document: the first to generate N
output documents: the original source with the LaTeX stripped out and
replaced with id tags, and (N-1) documents holding the LaTeX, which
you then process to MathML using a completely external process.  A
final stylesheet can then run through the 'id' filled document,
pulling in MathML from the filesystem.

If those sound at all palatable to you, I'd look into seeing if
someone has already done all the hard work of building an engine to
process TeX into MathML.  My Google searches turned up several
possibilities, the best of which were listed on W3C MathML page:

  http://www.w3.org/Math/Software/mathml_software_cat_converters.html

I was most interested in their link to the ORCCA software group:

  http://www.w3.org/Math/Software/desc/desc_Itranslator_from_tex_latex_to_mathml.html

It'll be interesting to see what the folks on this list have to say
about the problem.  Hopefully someone will prove me wrong and point
out some simple translation routines already written!


Jim

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
James A. Robinson                       jim.robinson@xxxxxxxxxxxx
Stanford University HighWire Press      http://highwire.stanford.edu/
+1 650 7237294 (Work)                   +1 650 7259335 (Fax)

Current Thread