In the process of working on handling spaces in latex, I had two realizations. First, spaces in Latex math could mean "multiply two variables" or it could just be a way of managing layout of the expression. (I posted examples in https://github.com/sympy/sympy/issues/19075).
My second realization was that it might be easier to remove the aspects of the Latex string that are related to presentation. Specifically in this case, replace a Latex string's "\ " with " " and replace "\," with " " before passing the string to Sympy. Kindly, Ben On Sunday, May 24, 2020 at 11:30:38 PM UTC-4, Aaron Meurer wrote: > > It would be great to have improvements to the LaTeX parser. Let us > know if you have any issues opening a pull request. > > The test_latex.py file is correct. test_sympy_parser.py has tests for > the Python parser, which isn't related to the LaTeX parser as far as I > know. > > > Aaron Meurer > > On Sun, May 24, 2020 at 9:33 AM Ben <[email protected] <javascript:>> > wrote: > > > > To answer my own question, I think I found the tests: > > > https://github.com/sympy/sympy/blob/master/sympy/parsing/tests/test_latex.py > > > https://github.com/sympy/sympy/blob/master/sympy/parsing/tests/test_sympy_parser.py > > > > > > > On Sunday, May 24, 2020 at 3:01:09 AM UTC-4, Ben wrote: > >> > >> Hello, > >> > >> I'm using Sympy to parse mathematical expressions written in Latex. I > have observed that parsing Latex does not always work, so I've been > collaborating with a friend to modify the ANTLR grammar file to address > some of the issues we have encountered. The repo with the changed files (as > well as a Dockerfile to configure the environment and build Sympy with the > modified grammar) is > https://github.com/allofphysicsgraph/sympy-grammar-modifications > >> > >> I'm interested in contributing the modified grammar file to Sympy and I > have not contributed to Sympy before. I've read the Sympy workflow > documentation. > >> My background: I've been using Python for about 15 years and am > comfortable with git and branching. > >> Prior to making the pull request, I have a question. > >> > >> I don't see where the current grammar file for parsing Latex is tested. > Looking at the script https://github.com/sympy/sympy/blob/master/bin/test > doesn't lead me to insights. Also, I don't see any tests defined in the > directory https://github.com/sympy/sympy/tree/master/sympy/parsing/latex > >> > >> I want to eventually make a pull request regarding the Latex parsing > grammar, but I don't know where to create tests that would validate the > changes. I'd like to be able to demonstrate that the changes are not > breaking Sympy. > >> > >> Kindly, > >> > >> Ben > >> > >> > > -- > > You received this message because you are subscribed to the Google > Groups "sympy" group. > > To unsubscribe from this group and stop receiving emails from it, send > an email to [email protected] <javascript:>. > > To view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/70932dbc-c528-4cf3-a8a3-f9999fc74209%40googlegroups.com. > > > -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/8c719eeb-7e0d-4ce3-8a85-fe50ed49d118%40googlegroups.com.
