2

Please help me with the following problem:

TeXForm[2/3]

The Answer is correct:

"\frac{2}{3}"

I don't understand why Mathematica gives me a wrong inverse:

ToExpression["\frac{2}{3}", TeXForm]

The Answer is:

23 a c r
Darek
  • 119
  • 2

1 Answers1

1

You should escape "\" by second "\"

ToExpression["\\frac{2}{3}", TeXForm]

To avoid this problem, produce strings explicitly. Copy-pasted text from the TeXForm is designed for an external TeX editor

ToString[2/3, TeXForm]
(* "\\frac{2}{3}" *)
ybeltukov
  • 43,673
  • 5
  • 108
  • 212