How can I create this figure title in MATLAB?

£可爱£侵袭症+ 提交于 2020-01-21 16:13:10

问题


I want to combine Latex, numbers, and Tex into the title of a figure using the following (beta_b and lambda are defined variables):

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

But it doesn't display properly. What's the problem?


回答1:


You can't combine Latex and Tex in a title. You have to use one or the other (i.e. whichever one you set for the 'Interpreter' property). 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. The $ also has to go between the \mu and m, otherwise it gets tripped up on the \mum.



来源:https://stackoverflow.com/questions/3371039/how-can-i-create-this-figure-title-in-matlab

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!