简体   繁体   English

如何在MATLAB中创建该图形标题?

[英]How can I create this figure title in MATLAB?

I want to combine Latex, numbers, and Tex into the title of a figure using the following ( beta_b and lambda are defined variables): 我想使用以下内容将Latex,数字和Tex组合为图形标题( beta_blambda是已定义的变量):

title(['$\overline{\beta}=$' num2str(beta_b) 'TE0 , \lambda=' num2str(lambda*1e6) ' \mum'], 'interpreter','latex');

But it doesn't display properly. 但它没有正确显示。 What's the problem? 有什么问题?

You can't combine Latex and Tex in a title . 您不能在标题中合并Latex Tex。 You have to use one or the other (ie whichever one you set for the 'Interpreter' property ). 您必须使用另一个(即您为'Interpreter'属性设置的任何一个)。 The following will work: 以下将起作用:

title(['$\overline{\beta}=$' num2str(beta_b) ...
       ' TEO , $\lambda=$' num2str(lambda*1e6) ' $\mu$m'],...
      'Interpreter','latex');

Note that you have to include $ on either side of \\lambda and \\mu so they can be interpreted properly. 请注意,您必须在\\lambda\\mu任一侧都包含$ ,以便可以正确解释它们。 The $ also has to go between the \\mu and m , otherwise it gets tripped up on the \\mum . $还必须介于\\mum ,否则它将被\\mum绊倒。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM