在matplotlib中更改LaTeX数学字体风格

3

当使用latex时,我该如何更改matplotlib中的数学字体样式。例如,我有以下代码:

matplotlib_font$_{latex_font}$

这里,matplotlib_font 显示为在我的 rc 文件中设置的字体,而 Latex_font 是计算机现代的。我不希望所有的字体都使用 Latex,也就是说,我想保留 rc 文件。

text.usetex         : False 

但是我需要我的LaTeX字体与我的Matplotlib字体匹配。
1个回答

7
在rc(matplotlibrc)文件中设置,找到了解决方法。
mathtext.fontset : custom

然后使用在数学模式中需要的字体更新数学文本。
mathtext.rm  : Times New Roman
mathtext.it  : Times New Roman:italic
mathtext.bf  : Times New Roman:bold

我删除了 mathtext.tt : Times New Roman,因为我认为这不是LaTex所使用的必需品。 - Austin Downey

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接