Matplotlib-Latex Premable 包未加载

Matplotlib-Latex Premable 包未加载

我想在绘图的 x 标签中使用 LaTeX。我需要标签带有\varepsilon一个下标,该下标是符号的较小版本\parallel。这是我尝试过的,但它不起作用,我得到ParseSyntaxException: Unknown symbol: \scalebox, found '\'

import matplotlib.pyplot as plt
from matplotlib import rc

rc('font',**{'family':'STIXGeneral'})
rc('text.latex', preamble=r'\usepackage{graphicx}')
fig, ax = plt.subplots()
ax.set_xlabel(r"$\mathregular{\varepsilon_{\scalebox{0.8}{\parallel}}}$")
plt.show()

相关内容