How to render Latex markup using Python?

前端 未结 6 2238
离开以前
离开以前 2020-12-15 07:02

How to show an easy latex-formula in python? Maybe numpy is the right choice?

EDIT:

I have python code like:

a = \'\\frac{a}{b}\'
         


        
6条回答
  •  庸人自扰
    2020-12-15 07:31

    As suggested by Andrew little work around using matplotlib.

    import matplotlib.pyplot as plt
    a = '\\frac{a}{b}'  #notice escaped slash
    plt.plot()
    plt.text(0.5, 0.5,'$%s$'%a)
    plt.show()
    

提交回复
热议问题