--
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 post to this group, send email to sy...@googlegroups.com.
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/a4d0ec78-c065-4894-9582-a5c42d8dff37%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Isn't just a question of picking a nonnegative term to go first?
--
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 post to this group, send email to sy...@googlegroups.com.
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/abf6ec60-332e-48bf-90c4-4aa48c015f5f%40googlegroups.com.
I don't think the printing order and the args order are the same in general. You should create a custom latex printer subclass with a custom _print_Add.
>>> print(latex(f(x) - 1, order='old'))
-1 + f{\left (x \right )}
>>> from sympy.core.function import _coeff_isneg
>>> from sympy.printing.latex import LatexPrinter
>>> class MyLatexPrinter(LatexPrinter):
... def _as_ordered_terms(self, expr, order=None):
... return sorted(Add.make_args(expr), key=lambda arg: (_coeff_isneg(arg),) + arg.sort_key())
...
>>> print(MyLatexPrinter().doprint(f(x) - 1))
f{\left (x \right )} - 1
--
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 post to this group, send email to sy...@googlegroups.com.
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/a1a9f471-b4a9-47ba-ba71-32f6fdc63ce4%40googlegroups.com.