Re: ToExpression[..,TexForm] does not seem to work on
- To: mathgroup at smc.vnet.net
- Subject: [mg104386] Re: [mg104351] ToExpression[..,TexForm] does not seem to work on
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Fri, 30 Oct 2009 02:17:06 -0500 (EST)
- Reply-to: hanlonr at cox.net
Put a space after sum in the TeX
s = TeXForm[Sum[f[n], {n, 1, m}]]
\sum _{n=1}^m f(n)
Note the space after sum in the above output
ToExpression["\\sum _{n=1}^m f(n)", TeXForm]
Sum[f[n], {n, 1, m}]
ToExpression["\\sum _ {n=1}^m f(n)", TeXForm]
Sum[f[n], {n, 1, m}]
Bob Hanlon
---- "Nasser M. Abbasi" <nma at 12000.org> wrote:
=============
Version 7.
Some Latex commands are converted ok to Mathematica expressions, such as:
ToExpression["\\sqrt{3}", TeXForm]
ToExpression["\\frac{a}{b}", TeXForm]
But the next Latex "sum" command does not seem to work. Is this a known
"issue" or is there a trick for one command?
I take the output of the TexForm command, and then try to convert it back to
Mathematica expression, but the conversion back fails:
s = TeXForm[Sum[f[n], {n, 1, m}]]
ToExpression[ToString[s], TeXForm]
Even when I type the Latex output by hand, it does not work:
ToExpression["\\sum_{n=1}^m f(n)", TeXForm]
the error is :
Syntax::sntxi:Incomplete expression; more input is needed.
ToExpression::esntx:Could not parse \sum_{n=1}^m f(n) as Mathematica input.
--Nasser