parsing of latex with lark, implicit multiplication and exponentiation

17 views
Skip to first unread message

Jim Martin

unread,
Nov 3, 2025, 11:47:17 AM (4 days ago) Nov 3
to sympy
Hi Everyone:

I'm having trouble converting a latex expression to sympy using the lark based parsing:

import sympy.parsing.latex as spl
ex = r"a^2 b"
print(spl.parse_latex_lark(ex))

throws an exception:
lark.exceptions.UnexpectedCharacters: No terminal matches 'b' in the current parser context, at line 1 col 5

Python version 3.10.18
sympy version 1.14.0

Any suggestions?  Should I expect this to work?

Thanks! --- Jim.



Oscar Benjamin

unread,
Nov 4, 2025, 3:41:44 PM (3 days ago) Nov 4
to sy...@googlegroups.com
Hi Jim,

It looks like a bug to me. Best to open a GitHub issue.

Oscar
> --
> 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 sympy+un...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/sympy/a9d328eb-3c76-4541-b384-d0610180b454n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages