6

1

I tried to convert a Latex expression to *Mathematica* in this way:

```
ToExpression["\\int_{a}^{b}{x dx}", TeXForm]
```

*Mathematica* gives me an error. How can I get the correct expression in *Mathematica*?

Thank very much for your time.

6

1

I tried to convert a Latex expression to *Mathematica* in this way:

```
ToExpression["\\int_{a}^{b}{x dx}", TeXForm]
```

*Mathematica* gives me an error. How can I get the correct expression in *Mathematica*?

Thank very much for your time.

9

Mathematica is expecting a space between the integrand and the $dx$. So, the following works:

```
ToExpression["\\int_{a}^{b} x \\, dx", TeXForm]
```

-(a^2/2) + b^2/2

You could see what kind of `TeXForm`

should work by doing the reverse:

```
ToString[ Unevaluated[Integrate[x, {x, a, b}]], TeXForm ]
```

"\int_a^b x \, dx"

Hello @CarlWoll. Is it also possible to get the unevaluated expression? I tried with ToExpression[Unevaluated["\int_{a}^{b} x \, dx"], TeXForm], but my statement is blatantly wrong. – Gennaro Arguzzi – 2017-10-27T15:03:15.907

3Use 3-arg form of ToExpression, e.g.,

`ToExpression[texString, TeXForm, Hold]`

– Carl Woll – 2017-10-27T15:12:26.907