Message Boards Message Boards

How insert LaTeX code into Mathematica

Posted 10 years ago


Can you please help with the following?

I attempt to bring some equations written in LaTeX into Mathematica by utilizing the 'ToExpression' command. Some of the problems I encounter may be illustrated by considering a simple example below.

Suppose the LaTeX code produces the following expression

 i \[HBar] \[PartialD]\[Psi]/\[PartialD]t

Copy-Paste into Mathematica results in

In[38]:= ToExpression["I \\hbar \\dfrac{d}{d t} \\psi", TeXForm]

Out[38]= Id/(d t \[Psi])

Clearly, the last line shows the following problems with 'ToExpression' command 1. It doesn't recognize the \hbar symbol from LaTeX (also it doesn't recognize the partial derivative symbol, \partial, which were replaced by ordinary derivatives). 2. Inserts \Psi under into the denominator.

The following line shows that putting brackets around \dfrac would solve 2., but not 1., as I have just replaced \hbar with 'h'.

In[39]:= ToExpression["I h (\\dfrac{d}{d t}) \\psi", TeXForm]

Out[39]= I \[Psi] h[d/dt]

We now observe that new problem have emerged 3. \psi is written in the left and not on the right side of the derivative, as intended.

Can you please suggest better methods to generate the expression I intended to create?


POSTED BY: Shimon Rubin
2 Replies
Posted 10 years ago

Thank you very much.

POSTED BY: Shimon Rubin

I sent a report to developers. I do not know when the problem will be addressed.

POSTED BY: Bruce Miller
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract