Q:

Use LaTeX symbols in sympy expressions

I would like to do some calculations and then have those plotted using sympy. I want to use consistent notation, so I need to define a symbol which will be printed as $\Delta_l^y$.
What I have tried so far:
delta__i_0 = sympy.symbols('Delta__i_0')
sympy.pprint(delta__i_0)

which works fine.
Unfortunately
delta__y_l = sympy.symbols('Delta__y_l')
sympy.pprint(delta__y_l)

does not really look nice. Any ideas?

A:

From the command line Python interpreter, you could use sympy.printing.latex. For example,
import sympy as sym
import sympy.printing as printing
delta__y_l = sym.symbols('Delta__y_l')
print(printing.latex(delta__y_l))

prints
\Delta^{y}_{l}

Or, using IPython notebook, call sym.init_printing() to enable pretty-printing:

