6
$\begingroup$

First I tried the following:

ToExpression["$\\delta\\alpha$", TeXForm, HoldForm]

and then as expected, I got

\[Delta]\[Alpha]

Then I tried

ToExpression["$\\delta a$", TeXForm, HoldForm]

and I got

\[Delta] a

with an unexpected space between a $\delta$ and $a$. A standard LaTeX interpreter will not add a space between $\delta$ and $a$.

My question is: how can I get rid of the space between the greek letter delta and the latin letter a?

I'm using Mathematica 11.0.1.0 on Mac.

$\endgroup$
5
$\begingroup$

A standard LaTeX interpreter will not add a space between $\delta$ and $a$.

This is not a "space". It is multiplication.

LaTeX does not understand the meaning of formulae and has no concept of multiplication. LaTeX only does typesetting. LaTeX code is not appropriate for representing precise mathematical meaning.

ToExpression needs to convert it to a meaningful mathematical expression. It has to decide whether you meant one symbol named $\delta\alpha$ or the multiplication of two distinct symbols, $\delta\times\alpha$. ToExpression does not preserve typesetting. It makes a guess about the mathematical meaning and gives you the corresponding expression, which can be typeset in multiple different ways.

The guesses is makes are not always good. I believe the idea is that you will correct them manually. So I suggest just fixing the output by hand.


If you really need to get this output automatically, a possible solution is to convert the LaTeX to MathML using some other, more configurable tool. Then import the MathML to Mathematica. I would try this if I had to process hundreds of such inputs.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.