How to render Latex markup using Python?

前端 未结 6 2259
离开以前
离开以前 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:26

    Creating mathematical formulas in Pandas.

    a = r'\frac{a}{b}'
    ax = plt.axes([0,0,0.3,0.3]) #left,bottom,width,height
    ax.set_xticks([])
    ax.set_yticks([])
    ax.axis('off')
    plt.text(0.4,0.4,'$%s$' %a,size=50,color="green")
    

    a = r'f(x) = \frac{\exp(-x^2/2)}{\sqrt{2*\pi}}'
    ax = plt.axes([0,0,0.3,0.3]) #left,bottom,width,height
    ax.set_xticks([])
    ax.set_yticks([])
    ax.axis('off')
    plt.text(0.4,0.4,'$%s$' %a,size=50,color="green")
    

提交回复
热议问题