any way can convert MathML or ascmath to LaTeX ?

638 views
Skip to first unread message

redsto...@163.com

unread,
Dec 19, 2014, 9:48:22 AM12/19/14
to mathja...@googlegroups.com
any way can convert MathML or asciimath to LaTeX ?

redsto...@163.com

unread,
Dec 19, 2014, 10:03:19 AM12/19/14
to mathja...@googlegroups.com, redsto...@163.com
I am following Calculus One on Coursera, it seems I have to write LaTeX expression to submit the answer ,but I found LaTeX is hard to write and learn ,while ASCIIMath allow us to use a simple calculator-style syntax to write math formulas on webpages, so any way can convert asciimath (or MathML) to LaTeX ?


在 2014年12月19日星期五UTC+8下午10时48分22秒,redsto...@163.com写道:

William F Hammond

unread,
Dec 19, 2014, 11:32:15 AM12/19/14
to mathja...@googlegroups.com

On Fri, Dec 19, 2014 at 7:03 AM, <redsto...@163.com> wrote:
so any way can convert asciimath (or MathML) to LaTeX

There probably is, but I don't know what to recommend.  The LaTeX will likely not be the LaTeX that you would want to write yourself, and because of symbols will probably require xelatex.  But these days, though not always in the past, browsers like Firefox and Chrome can print to PDF a rather good rendition of what they display -- at least when the content is html with mathjax (once the mathjax is fully loaded).  If you use Latin Modern fonts, that PDF will resemble rather well, though not perfectly, what would be produced from classically written LaTeX source using the lmodern package with pdflatex.

Peter Krautzberger

unread,
Dec 20, 2014, 9:18:00 AM12/20/14
to mathja...@googlegroups.com, Lee Philip
Hi,

While converting MathML into real LaTeX is possible via David Carlisle's pmml2tex this wouldn't help you since MathJax does not understand the TeX macros that are generated by this (yet -- we should probably add TeX macros compatible to David's work for MathML constructs and enable some conversion from MathML to that).

Converting asciimath to LaTeX is possible using David Lippman's php converter. I'd love to see a JS version one day, especially as part of a MathJax extension so that MathJax can produce TeX output when asciimath input is used. Oh well...

I suspect it might be easier to invest a little bit of time in learning Mathjax-style TeX -- it's easier than learning full LaTeX since you only need to learn a limited amount of math macros.

Two great resources are


Regards,
Peter.



--
You received this message because you are subscribed to the Google Groups "MathJax Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mathjax-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Murray

unread,
Dec 21, 2014, 3:50:27 AM12/21/14
to mathja...@googlegroups.com, redsto...@163.com
Hi

I wrote a page here that does what you need:


You input your ASCIIMathML expression into the (yellow) input field, and you get LaTeX output (as well as MathJax output so you can see if your expression works as desired).

It tends to add a lot of { } braces, but too many is better than not enough.

Hope it helps.

BTW - I looked at the Coursera math input requirements, and it appeared to be quite simple and ASCIIMathML-like. I'm surprised your calculus course **requires** you to input in LaTeX.

Regards
Murray

redsto...@163.com

unread,
Dec 26, 2014, 8:07:21 AM12/26/14
to mathja...@googlegroups.com, redsto...@163.com

Oh ,that’s my fault !

The Coursera accepted math expression seems nor pure ASCIIMath or LaTeX, only  ASCIIMathML-like.

 

Thanks for your great tool !!!


在 2014年12月21日星期日UTC+8下午4时50分27秒,Murray写道:

redsto...@163.com

unread,
Dec 26, 2014, 8:08:01 AM12/26/14
to mathja...@googlegroups.com, redsto...@163.com

Thans very much, but ASCIIMath seems much easier than Mathjax-style TeX or LaTeX .


在 2014年12月20日星期六UTC+8下午10时18分00秒,Peter Krautzberger写道:

Christian Perfect

unread,
Jan 5, 2015, 4:39:18 AM1/5/15
to mathja...@googlegroups.com
Doing presentation MathML -> TeX should be even easier than the CtoP work I did, shouldn't it? What are the macros that MathJax doesn't support?

Peter Krautzberger

unread,
Jan 5, 2015, 8:22:07 AM1/5/15
to mathja...@googlegroups.com
Doing presentation MathML -> TeX should be even easier than the CtoP work I did, shouldn't it? 

Well, I don't actually know David C's xslt / sty file that well but yes, I think so. Maybe something for a Google Summer of Code student or some such thing.

What are the macros that MathJax doesn't support?

I was not actually thinking of MathML to TeX conversion here. Rather about things that are easy in MathML and hard in TeX. 

E.g., equalrows / equalcolumns require something like tabularx in LaTeX but are built into MathML (so to speak).  So while it makes a lot of sense to convert <mtable> to \begin{matrix} ... \end{matrix} (as David C's xslt does, I think), it would also be nice to have a TeX macro that offers the full power of mtable. We have \mmltoken which is somewhat generic and a few undocumented constructs. Again, it's not hard in terms of implementation (obviously); just sitting down and thinking about the scope I guess. (Of course, current limitations of our MathML implementation also enter the picture somewhere...)

Peter.

Davide P. Cervone

unread,
Jan 5, 2015, 8:31:46 AM1/5/15
to mathja...@googlegroups.com
One could also offer an extension that defines the macros used by David's transformation. I haven't looked at the output myself, but from the examples, it looks like they are macros that correspond to the underlying MathML tags. That would be pretty straight-forward to implement.

Davide

Peter Krautzberger

unread,
Jan 5, 2015, 8:35:33 AM1/5/15
to mathja...@googlegroups.com
One could also offer an extension that defines the macros used by David's transformation.
> [...]
That would be pretty straight-forward to implement.

Right. That's what I meant with "Google Summer of Code project" :-) 

The sty file seems to mostly have macros for msubsup, mmultiscripts, etc, translations from Unicode to TeX (bigcap etc); mscarry looked like the most complex one to me.


On Mon, Jan 5, 2015 at 2:31 PM, Davide P. Cervone <dp...@union.edu> wrote:
One could also offer an extension that defines the macros used by David's transformation.  I haven't looked at the output myself, but from the examples, it looks like they are macros that correspond to the underlying MathML tags.  That would be pretty straight-forward to implement.

Davide
Reply all
Reply to author
Forward
0 new messages