gutow / Algebra_with_Sympy

Tools for doing stepwise algebra in an on paper like manner using SymPy.
https://gutow.github.io/Algebra_with_Sympy/
GNU General Public License v3.0
16 stars 3 forks source link

Fixed latex printer #16

Closed Davide-sd closed 2 years ago

Davide-sd commented 2 years ago

The _latex method was implemented in a wrong way, which didn't allowed the use of a custom printer. The capability to use custom printer is essential. Think for example to an equation containing multiple undefined applied functions, f(x, y, z), g(x, y, z), .... We quickly run out of display space on a Jupyter Notebook cell because (x, y, z) is rendered multiple times. With a custom printer we can easily hide these repetitions.

This PR implements the def _latex(self, printer) as pointed out in the documentation: https://docs.sympy.org/latest/modules/printing.html

This way allows the use of a custom printer. Tests have been added to assert this behavior.

gutow commented 2 years ago

Thanks. Looks good.