If you need your multiplication to be noncommutative you'll be better off defining A and B to be commutative=False.
Aaron Meurer On Tue, Nov 18, 2014 at 5:00 PM, Duane Nykamp <dqnyk...@comcast.net> wrote: > I just posted this bug on github: > > https://github.com/sympy/sympy/issues/8470 > > Here's a horrible example that shows what can happen > > In [9]: latex(parse_expr("-B*A",evaluate=False)) > Out[9]: 'A - B' > > Fixing this problem is urgent for me. I have students entering answers > like this, and my website gives the unevaluated version of it as a > response. Clearly, telling them they enter A-B is a problem. > > I'm not at all familiar with the latex printer. I thought the problem > might be with the _needs_brackets function from latex.py, but that does > return True for -B. > > Any suggestions for a workaround or a way to fix this? > > Thanks, > Duane > > > > > > -- > 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+unsubscr...@googlegroups.com. > To post to this group, send email to sympy@googlegroups.com. > Visit this group at http://groups.google.com/group/sympy. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/b3ddff99-6940-486b-b0aa-6e5d101529ea%40googlegroups.com > <https://groups.google.com/d/msgid/sympy/b3ddff99-6940-486b-b0aa-6e5d101529ea%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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+unsubscr...@googlegroups.com. To post to this group, send email to sympy@googlegroups.com. Visit this group at http://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAKgW%3D6Ke%2BzrxRFbxdUwPQdCH3ER7Fo3yiJWUJmjJLt0qAAuSjA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.