使用 matplotlib 通过 Latex 渲染文本时出现运行时错误

使用 matplotlib 通过 Latex 渲染文本时出现运行时错误

我正在尝试在 Matplotlib 上使用 Latex 进行文本渲染,代码如下:

plt.rcParams.update({
"text.usetex": True,
"font.family": "sans-serif",
"font.sans-serif": ["Helvetica"]})

但是出现了以下错误:

RuntimeError: LaTeX was not able to process the following string:
b'lp'

以下是 LaTeX 生成的完整报告:

This is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017/Debian) (preloaded 
format=latex)
restricted \write18 enabled.

kpathsea: Running mktexfmt latex.fmt
mktexfmt: mktexfmt is using the following fmtutil.cnf files (in precedence order):
mktexfmt: mktexfmt is using the following fmtutil.cnf file for writing changes:
mktexfmt:   /home/nikita/.texlive2017/texmf-config/web2c/fmtutil.cnf
mktexfmt [INFO]: writing formats under /home/nikita/.texlive2017/texmf-var/web2c
mktexfmt [INFO]: did not find entry for byfmt=latex, skipped
mktexfmt [INFO]: Total formats: 0
mktexfmt [INFO]: exiting with status 0

我找不到格式文件“latex.fmt”!请帮我解决此问题

相关内容