如何使用Python渲染Latex标记? [英] How to render Latex markup using Python?

查看:343
本文介绍了如何使用Python渲染Latex标记?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在python中显示简单的乳胶配方? 也许numpy是正确的选择?

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

我有类似python的代码:

I have python code like:

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

,并希望将其打印在图形输出中(例如matplotlib).

and want to print this in a graphical output (like matplotlib).

推荐答案

如安德鲁(Andrew)所建议,使用matplotlib的工作很少.

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()

这篇关于如何使用Python渲染Latex标记?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆