Python 如何在sympy(jupyter笔记本)中将latex字符串显示为latex输出?
我在Jupyter的序言是:Python 如何在sympy(jupyter笔记本)中将latex字符串显示为latex输出?,python,sympy,Python,Sympy,我在Jupyter的序言是: %reset import numpy as np from sympy import * from sympy.physics.quantum import Commutator, Dagger, Operator from sympy.vector import CoordSys3D import matplotlib.pyplot as plt from sympy.interactive import printing printing.init_print
%reset
import numpy as np
from sympy import *
from sympy.physics.quantum import Commutator, Dagger, Operator
from sympy.vector import CoordSys3D
import matplotlib.pyplot as plt
from sympy.interactive import printing
printing.init_printing(use_latex = True)
如何以latex格式打印以下字符串?至关重要的是,我不希望字符串中术语的顺序发生变化
'\\mathbf{R}_B \\cdot j'
跟随
输出
所以答案是:
从IPython.display导入数学
display(Math('\\mathbf{R}_B \\cdot j'))
它保留了符号的顺序。但是,“Math”没有属性“subs”,并且无法进行同构,因此似乎不可能对该输出执行同构操作
display(Math('\\mathbf{R}_B \\cdot j'))