如何通过乳胶在matlab标题中设置TImes New Roman

How to set TImes New Roman in matlab title by latex

我想将此字体更改为 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')

我试过的另一种方法是

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

虽然可以是Times New Roman字体,但我要的是\sqrt符号。 (如果不使用 LaTeX 只输入 \sqrt 是行不通的。)

找不到解决办法是有原因的。简而言之,除非您编写自己的关于 matlab 如何应用和解释字体的复杂脚本,否则实际上并不存在一个好的解决方案。

现在谈谈您可以做什么。 您可以让您的字母以 New Roman 显示,但如果您希望它们是罗马字母,则它们不能是斜体。

运行 这段代码对可能的情况有一点概述:

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