我尝试了pprint
和print
,前者只打印Unicode版本,而后者不会进行美观的打印。
from sympy import symbols, Function
import sympy.functions as sym
from sympy import init_printing
init_printing(use_latex=True)
from sympy import pprint
from sympy import Symbol
x = Symbol('x')
# If a cell contains only the following, it will render perfectly.
(pi + x)**2
# However I would like to control what to print in a function,
# so that multiple expressions can be printed from a single notebook cell.
pprint((pi + x)**2)
init_printing
函数进行初始化。 - asmeurerdisplay(expr, width=1000)
,但没有成功。 - mmj