Latex () in sympy. How to get \ frac, not \\ Frac

from sympy import *

x, alpha = symbols('x alpha')

latex(alpha/x)

Out[1]: '\\frac{\\alpha}{x}'

This does not work in latex. What am I doing to get the correct conclusion, i.e.: '\ frac {\ alpha} {x}'?

+4
source share
2 answers

This is the correct conclusion ( reprin this case, print some characters, \). Try to print it.

>>> x = '\\frac{\\alpha}{x}'
>>> x
'\\frac{\\alpha}{x}'
>>> print(x)
\frac{\alpha}{x}
+3
source

Got it!

Record:

print latex(alpha/x)
\frac{\alpha}{x}

Sorry to bother you guys!

0
source

Source: https://habr.com/ru/post/1527526/


All Articles