views:

68

answers:

1

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?

+2  A: 

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.

gnovice
@gnovie: On an unrelated note, do you think MATLAB has a shot of winning this code golf tournie?http://stackoverflow.com/questions/3365487/code-golf-build-me-an-arc/3369332#3369332
Jacob
@Jacob: It's possible. I've done well in a couple of them using MATLAB. I'll try to take a look and see if it can be trimmed down more. ;)
gnovice
@gnovice: Thanks! The Perl code's been massively trimmed so it's quite hard now!
Jacob

related questions