Pycharm运行时无法识别latex命令

2024-10-08 19:32:20 发布

您现在位置:Python中文网/ 问答频道 /正文

如果我喜欢通过IPython控制台中的run命令在pycharm中运行我的代码,那么运行将无法识别\unitfrac{}{}}。 但是,如果我在Python控制台手动运行代码,它可以正常工作:

IPython控制台(运行):

PyDev控制台:使用ipython6.2.1

Python 3.6.4 | Anaconda,Inc.|(默认值,2018年1月16日,10:22:32)[MSC v.1900 64位(AMD64)]

  • 未知符号:\unitfrac(在字符1处)(行:1, 列:2)在

但是:

Python控制台(手动):

Python 3.6.4 | Anaconda,Inc.|(默认值,2018年1月16日,10:22:32)[MSC v.1900 64位(AMD64)] 键入“copyright”、“credits”或“license”以获取更多信息

ipython6.2.1——一个增强的交互式Python。类型“?”寻求帮助。在

PyDev控制台:使用ipython6.2.1

Python 3.6.4 | Anaconda,Inc.|(默认值,2018年1月16日,10:22:32)[MSC v.1900 64位(AMD64)]

import matplotlib
matplotlib.use('Qt5Agg')
import matplotlib.pyplot as plt
from matplotlib import rc
from matplotlib import verbose

rc('font', family='sans-serif', size=7)
rc('text', usetex=True)
rc('text.latex', preamble=r"\usepackage{units},\usepackage{cmbright}")
verbose.level = 'debug-annoying'
rc('ps', usedistiller='xpdf')
rc('pdf', fonttype=42)
rc('ps', fonttype=42)

plt.plot(range(10), label="$\\unitfrac{2}{3}$")
plt.legend()

工作正常。在


Tags: 代码fromimportverbosematplotlibipythonpltanaconda

热门问题