convert MathML to LaTeX

7,401 views
Skip to first unread message

UnsungHero97

unread,
Jul 5, 2011, 2:38:05 AM7/5/11
to MathJax Users
Using MathJax, is it possible to convert MathML to LaTeX? What I mean
by that is, when there is math on the page that is created using
MathML, can MathJax output the LaTeX equivalent when you do the right-
click->Show Source?

If not, are there any tools out there (web based) that can handle this
or should I start building my own?

Thanks,
Hristo

Sidharth Kshatriya

unread,
Jul 5, 2011, 3:06:29 AM7/5/11
to mathja...@googlegroups.com
I don't think this should be possible. As MathML is presentation markup, it does not understand the meaning of the Equation.

It should be possible to go from LaTeX to MathML but I wonder if the reverse is possible.
--
Sidharth Kshatriya
www.sidk.info

UnsungHero97

unread,
Jul 5, 2011, 3:11:42 AM7/5/11
to MathJax Users
Let me rephrase... if I were dynamically building a math equation
using MathML, would it be possible to dynamically build the LaTeX
representation of that equation? For example... if I first create a
fraction, then I know that I want my LaTeX to have "\frac" somewhere
in there.

On Jul 5, 12:06 am, Sidharth Kshatriya <sid.kshatr...@gmail.com>
wrote:
> I don't think this should be possible. As MathML is presentation markup, it
> does not understand the meaning of the Equation.
>
> It should be possible to go from LaTeX to MathML but I wonder if the reverse
> is possible.
>

Davide P. Cervone

unread,
Jul 5, 2011, 7:43:42 PM7/5/11
to mathja...@googlegroups.com
Since MathJax's internal format is MathML, its TeX input jax already
does the LaTeX to MathML conversion, so showing the MathML source is
easy. But MathJax doesn't include a MathML to LaTeX translator. Such
a feature is possible, but would take some work. One thing that would
be difficult would be to convert MathML tables to appropriate math
environments in LaTeX. I don't know a good way to do that well for
arbitrary MathML tables. If you would be willing to require an extra
package in your LaTeX that could define some special purpose macros,
it would be easier to produce reasonable LaTeX, but I still think the
tables would be a challenge.

Someone else asked about this not too long ago, but I can't seem to
locate the reference. In any case, I have no immediate plans to
produce such a translator.

Davide

UnsungHero97

unread,
Jul 5, 2011, 9:21:12 PM7/5/11
to MathJax Users
Hi Davide,

Thanks for your reply. I now understand the difficulty involved in
implementing this. However, I'm not giving up :)

I found a Java library that can get me started...
http://www.tilman.de/programme/mathparser/index_en.html

I'll take a look at this and try to make it work with test strings I
create and then try to implement it in JavaScript. Maybe with this
source, MathJax could dedicate some time to investigate the
possibility of implementing a MathML to LaTeX translator.

Thanks,
Hristo

Robert Miner

unread,
Jul 6, 2011, 11:25:20 AM7/6/11
to mathja...@googlegroups.com
The "standard" way of going from MathJax to LaTeX is XSL stylesheets. Just google for it, and you will find a number of existing stylesheets (as you probably already have...) David Carlisle also wrote a TeX package that directly parses the MathML syntax, which is kind of a knovel approach. It used to be in CTAN (see http://lists.w3.org/Archives/Public/www-math/2000Apr/0060.html)= MathType can do it too. And I see you mention MathParser.

So there are a number of possibilities which makes be curious about you are interested in having the functionality in MathJax. I gather you are publishing in MathML and want your users to be able to copy and paste as LaTeX? That is a little unusual, in my experience, so anything you can share about the context of your project would be interesting.

--Robert

UnsungHero97

unread,
Jul 13, 2011, 10:33:32 PM7/13/11
to MathJax Users
Hey Robert,

Sorry for the late reply. So you can view my project here...

http://hristo.oskov.com/projects/Kamma

So MathJax can go from MathML to LaTeX but it can't go from LaTeX to
MathML. My project aims to be able to seamlessly go between the two so
that if a user knows LaTeX, they can just type in LaTeX and get the
corresponding MathML or if they know MathML, they can type it in and
get the corresponding LaTeX. Or if they don't know either, they can
build instead of type and generate either or.

So that is the reason I'm trying to build a MathML to LaTeX converter.

Let me know if you don't understand how to interact with my project.

Thanks,
Hristo

On Jul 6, 8:25 am, "Robert Miner" <robe...@dessci.com> wrote:
> The "standard" way of going from MathJax to LaTeX is XSL stylesheets.  Just google for it, and you will find a number of existing stylesheets (as you probably already have...)  David Carlisle also wrote a TeX package that directly parses the MathML syntax, which is kind of a knovel approach.  It used to be in CTAN (seehttp://lists.w3.org/Archives/Public/www-math/2000Apr/0060.html)= MathType can do it too. And I see you mention MathParser.  

Asit Panda

unread,
Mar 12, 2013, 4:35:36 AM3/12/13
to mathja...@googlegroups.com
Hi UnsungHero97

sorry i am not able to use your project?

Basically after insert some template from toolbar into type area then how to edit those in type area ?
Message has been deleted

Yasantha Niroshan

unread,
May 25, 2021, 12:40:59 PM5/25/21
to MathJax Users
Reply all
Reply to author
Forward
0 new messages