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?
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
.