The problem isn't to convert TeX into SymPy, but just LaTeX math,
which would probably realistically not include any fancy macros or
anything that might make the grammar to complicated.

The real problems, from what I see, are:

- LaTeX does not have a well-defined grammar.
- LaTeX allows for a lot of nice shortcuts (this may be more of an
annoyance than a problem)
- The same thing might be entered in different ways by different
people.  As a simple example, someone might use \cos, \operator{cos},
or \mathrm{cos} (the second two might be produced from a LaTeX
printer).
- LaTeX lets you print things that are mathematically nonsensical
(like e.g., \frac{\lim{\sum \to \int}}{+}).

Because of these (especially the last item), I think that any function
that does this would end up being more of a heuristic than a complete
algorithm to convert LaTeX to a mathematical expression tree.  That
doesn't mean that it wouldn't be worthwhile to implement, however.

Aaron Meurer

On Fri, Nov 11, 2011 at 1:19 PM, Joachim Durchholz <[email protected]> wrote:
> Am 11.11.2011 18:52, schrieb Vincent MAILLE:
>>
>>        I found the latax command to convert a Sympy object to LaTeX
>> format,
>> but, I’m looking for convert a LaTeX expression to Sympy format, is it
>> possible?
>
> TeX is Turing-complete, so this is not possible in general.
>
> Worse, even if you try a heuristic approach (like what Roman proposed),
> you'd never be sure that the result is correct. So you'd need to to a manual
> check after conversion, nullifying most (maybe all) of the advantages of an
> automatic conversion.
>
> To judge whether these problems are showstoppers or just mild annoyances,
> you'd probably need somebody with high wizardry skills in
> mathtex/plastex/whatever.
> I guess that's why nobody has volunteered for such a project yet. (I
> wouldn't. I once did some TeX stuff and concluded that TeX's macro syntax
> and semantics are so horrid I never want to do anything with it.)
>
> Regards,
> Jo
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to