[Tex/LaTex] Relationship between MathML and TeX

mathml

What is the relationship, if any, between Tex and MathML?

I am interested in representing mathematical information generally, but is TeX going to be a legacy format going forward? Is there any attempt to automatically transform one into the other? Is MathML obviously going to replace TeX in the near future? Essentially I am in a position where I need a math markup language, I am writing a math editor, and I am free to choose either (or both, but that represents twice the work AFAIK) as suits me. Is TeX in theory any more powerful than MathML? I mean more complete in terms of underlying markup capabilities, of the class of things it can represent?

Meta this – I understand that this question might give offense only because whenever there are two different technologies that have the same aim they are sometimes thought of as "rivals" or "competitors" and have their respective "camps". Please know I am a total newbie in this area and in no way am I making a judgement about the worthiness of either technology. I am really just trying to understand how practitioners understand their own world.

Best Answer

MathML is very verbose and is a pain to write manually, which is no problem if your code is automatically generated. For programs it is easy to parse, since it is XML.

TeX math code was designed to be written by humans and results in much shorter code. I cannot answer your question if one format will replace the other. As I mentioned they serve different purposes.

Is there any attempt to automatically transform one into the other that anyone is aware of?

I cannot speak for LaTeX, but in ConTeXt you can input MathML directly. Information about MathML in ConTeXt and the Wiki - MathML. Here is an example (credits to Hans Hagen) taken from one of the ConTeXt manuals:

\usemodule[mathml]
\starttext
\xmlprocessdata{}{
<?xml version="1.0" encoding="UTF-8"?>
<math xmlns="http://www.w3c.org/mathml" version="2.0">
  <apply>
    <eq/>
    <apply>
      <diff/>
      <bvar>
        <ci> x </ci>
      </bvar>
      <apply>
        <root/>
        <ci> u </ci>
      </apply>
    </apply>
    <apply>
      <times/>
      <apply>
        <divide/>
        <cn> 1 </cn>
        <apply>
          <times/>
          <cn> 2 </cn>
          <apply>
            <root/>
            <ci> u </ci>
          </apply>
        </apply>
      </apply>
      <apply>
        <diff/>
        <bvar>
          <ci> x </ci>
        </bvar>
        <ci> u </ci>
      </apply>
    </apply>
  </apply>
</math>
}{}
\stoptext

The output: output

For a TeX to MathML conversion, you can use the XML export, see ConTeXt wiki - epub and my answer to the question Converting ConTeXt document to HTML.