如何在Latex的Matlab标题中设置TImes New Roman

时间:2018-10-16 12:07:53

标签: fonts latex matlab-figure title

我想将此字体更改为Times New Roman,但不起作用。

即使set(gca, 'fontname','times new roman')也不起作用。

title(' $ \sqrt{\textit{\textbf{b}}^2+\textit{\textbf{c}}^2}$','interpreter','latex','fontsize',10,'fontname','Times New Roman')

figure1

我尝试的另一种方法是

title('\surd{\itb}^{2}+{\itc}^{2}','fontsize',10,'fontname','Times New Roman')

figure2

尽管它可能是Times New Roman字体,但我想要的是\sqrt符号。 (如果仅输入\sqrt而没有LaTeX,则无法使用。)

1 个答案:

答案 0 :(得分:0)

有一个原因导致您找不到解决方案。简单地为此提供一个好的解决方案是不存在的,除非您编写有关matlab如何应用和解释字体的复杂脚本。

现在您可以做什么。 您可以使您的字母以新罗马字母出现,但是如果您希望它们为罗马字母,则不能将其用斜体显示。

运行这段代码,以简要了解可能发生的情况:

figure 
text(0.5, 0.6, '\textsf{sans serif}','interpreter','latex','fontsize',14) %set text to sans-serif
text(0.5, 0.5, '\textrm{roman}','interpreter','latex','fontsize',14) %set text to roman
text(0.5, 0.4, '$$math\,\,mode\,\,roman$$','interpreter','latex','fontsize',14) % Latex roman for mathematical equations
text(0.5, 0.3, '$$\textrm{roman}, math$$','interpreter','latex','fontsize',14) % A combination of roman and math roman

text(0.1, 0.5, '$$\sqrt{\textbf{\textit{\textrm{b}}}^2}$$','interpreter','latex','fontsize',16) %letter b in italic and bold, the italic part "undoes" the roman font
text(0.25, 0.5, '$$\sqrt{\textbf{\textrm{b}}^2}$$','interpreter','latex','fontsize',16) %Letter b bold in roman
text(0.17, 0.35, '$$\sqrt{\textbf{\textrm{b}}^\textbf{2}}$$','interpreter','latex','fontsize',16) %letter b and superscript 2 in bold, b is in roman