What functions can Mathematica convert from LaTeX?

When I write:

ToExpression["\\sqrt{2}", TeXForm]


I get, as expected: "$\sqrt{2}$".

But, when I write:

ToExpression["\\ln{2}", TeXForm]


I get: "2 ln". Similarly, Mathematica seems to not recognize "\exp" and "\log".

What functions from LaTeX can Mathematica recognize? Is there a way to make it recognize more functions?

• I think that asking for a full list of supported functions is not a very constructive question. Asking to extend it is, but I do not think that there is a good way to do this currently. Someone might dig into the internal implementation and find something. – Szabolcs Jan 29 '18 at 12:05
• I thought such list should be in the documentation somewhere. But I looked here: reference.wolfram.com/language/tutorial/… and did not find. – Erel Segal-Halevi Jan 29 '18 at 12:07
• Also, there's a fundamental difference between \sqrt and \log, \sin, etc. in TeX. The former takes an argument. The latter does not. There is no difference between \sin{x} and \sin x. Even when typeset, it takes a human to understand how much of the following things belong to the argument of the sine. Is \sin x \sin y $\sin(x) \sin(y)$ or $\sin( x \sin(y))$? That's not clear. TeX is for producing formulas to be read by humans, but it is completely inadequate for representing precise mathematical meaning. – Szabolcs Jan 29 '18 at 12:09
• The easiest solution may be if you can find an external program that will convert to MathML, then read MathML with Mathematica. Ideally that would be Content MathML (not Presentation MathML). – Szabolcs Jan 29 '18 at 13:13
• I don't know any documentation on Mathematica's $\TeX$ parser. You could try to reverse the conversion, i.e. see what $\TeX$ commands will Mathematica produce, for example: Log[a] // TeXForm (*\log (a)*). This will give you some idea of $\TeX$ format that is likely, but not guaranteed, to be recognized by Mathematica. For simple functions from from question you just need to add round brackets around their arguments: ToExpression[{"\\ln(a)", "\\log(a)", "\\log_b(a)", "\\exp(a)"}, TeXForm, HoldForm] (* {Log[a], Log[a], Log[b,a], E^a} *). – jkuczm Jan 29 '18 at 14:39