12
$\begingroup$

How to convert the Latex format to Mathematica input?

For example, if I have a formula:

$$ \sum_{m_{i}=0}^M\sum_{n_{j}=0}^N \frac{(z_{i}/2)^{m_{i}}(z_{j}/2)^{n_{j}}}{m!n!} $$

in terms of Latex format:

  \sum_{m_{i}=0}^M\sum_{n_{j}=0}^N \frac{(z_{i}/2)^{m_{i}}(z_{j}/2)^{n_{j}}}{m!n!}

How would we convert it to Mathematica input?

$\endgroup$
18
$\begingroup$

You can use ToExpression.

Paste your content inside quotes and select "yes", in order to escape backslashes and use them verbatim:

ToExpression["string", TeXForm, HoldForm]

$\endgroup$
  • $\begingroup$ It works, but strangely \sum becomes \\sum when I past into the "string"...? $\endgroup$ – wonderich Dec 6 '16 at 2:44
  • $\begingroup$ That's because the backslah of the TeX expression is not intended to be interpreted as Mathematica code, so it must be "escaped". The way to do this is to precede it by another backslash. Mathematica is aware of this and offers this transformation when you paste the string. $\endgroup$ – Fred Dec 6 '16 at 2:49

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.