我希望在图表中显示图片1中的文本内容(摘自Daniel A. Steck的Rubidium 87 D Line Data第23页)。这是一个简单的等式,包含一个大写字母,在粗体和斜体下,使用Computer Modern字体。到目前为止,我已经尝试过:
import matplotlib.pyplot as plt
plt.rcParams["text.usetex"] = True
plt.rcParams["text.latex.preamble"].join([
r"\usepackage{bm}",
r"\usepackage{amsmath}"])
fig, ax = plt.subplots()
# Not bold
ax.text(0, 0.5, r"$F=0$", fontsize=18)
# Not italic
ax.text(0.2, 0.5, r"$\mathbf{F=0}$", fontsize=18)
# Not italic, not the correct font
ax.text(0.4, 0.5, r"\textit{\textbf{F}}=0", fontsize=18)
# Returns an error from LaTeX
ax.text(0.6, 0.5, r"$\bm{F}=0$", fontsize=18)
# Returns an error from LaTeX
ax.text(0.8, 0.5, r"$\boldsymbol{F}=0$", fontsize=18)
我正在使用pdfTeX,版本为3.141592653-2.6-1.40.23(TeX Live 2021/W32TeX)来显示方程式。
bm
。 - Quang Hoang