No, there is no parser for LaTeX yet. Reusing code from mathtex or
plastex would be a start, but I guess that the difficult part is to
rebuild a mathematical expression tree from the printing representation.
>
> Thanks.
>
> Vincent
>
> P.S : is there a French community of Sympy users ?
>
No, there isn't. ISTR the same question being asked before, maybe we
should create a sympy-fr mailing-list?
See http://code.google.com/p/sympy/issues/detail?id=2319.
Aaron Meurer
>>
>> Thanks.
>>
>> Vincent
>>
>> P.S : is there a French community of Sympy users ?
>>
> No, there isn't. ISTR the same question being asked before, maybe we
> should create a sympy-fr mailing-list?
>
>
> --
> You received this message because you are subscribed to the Google Groups "sympy" group.
> To post to this group, send email to sy...@googlegroups.com.
> To unsubscribe from this group, send email to sympy+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/sympy?hl=en.
>
>
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
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 <j...@durchholz.org> 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
I think it's definitely doable, and someone just has to do it for
simple expressions and then (if there is interest) it can be improved
for more complex ones. It will never be able to parse 100% of all
latex, but I can imagine it to work just fine for normal math that
people use.
Ondrej
Nonetheless, it would be good to have a module that starts even with
simple regular expressions, because then we will start to see what
needs to be done, and what the real limitations of it are.
Aaron Meurer
2011/11/15 Ondřej Čertík <ondrej...@gmail.com>:
Does anyone know of a good framework to implement this in, so that it
is easily extensible (something like the printer, only backwards)?
Obviously, we can implement the simple cases like \frac{}{} and ^
We can try to use first the Latex-->MathML converter (a few
third-party's examples exists I hope), to avoide parsing *.tex (which
can be used complex nested instructions) and only then translate MathML
to SymPy expressions.
>
> 2011/11/15 Ondřej Čertík <ondrej...@gmail.com>:
>> On Sun, Nov 13, 2011 at 3:25 AM, Vincent MAILLE <htcv...@gmail.com> wrote:
>>> OK, thanks for your answers. It's true that LaTeX is complexe to
>>> parse. My question was juste for very simple expressions :
>>>
>>> \frac{..}{..} => (...)/(...)
>>> 2x+x^2 => 2*x+x**2
>>
>> I think it's definitely doable, and someone just has to do it for
>> simple expressions and then (if there is interest) it can be improved
>> for more complex ones. It will never be able to parse 100% of all
>> latex, but I can imagine it to work just fine for normal math that
>> people use.
>>
>> Ondrej
>>
>> --
>> You received this message because you are subscribed to the Google Groups "sympy" group.
>> To post to this group, send email to sy...@googlegroups.com.
>> To unsubscribe from this group, send email to sympy+un...@googlegroups.com.
>> For more options, visit this group at http://groups.google.com/group/sympy?hl=en.
>>
>>
>
--
Alexey U.
A Latex -> Sympy converter: https://github.com/augustt198/latex2sympy