Latex Title in figure

5 visualizaciones (últimos 30 días)
Patricia
Patricia el 22 de Oct. de 2012
Hi, I have a very long Latex equation where I've broken it up to 5 lines:
Tstr{1} = '$ \mathrm{a0}+\mathrm{a1}\, \left(x - \mathrm{x0}\right)+\mathrm{a2}\, \left(y - \mathrm{y0}\right)+\mathrm{a3}\, \left(z - \mathrm{z0}\right)+$';
Tstr{2}= '$\mathrm{a4}\, {\left(x - \mathrm{x0}\right)}^2+\mathrm{a5}\, \left(x - \mathrm{x0}\right)\, \left(y - \mathrm{y0}\right)+\mathrm{a6}\, {\left(y - \mathrm{y0}\right)}^2+\mathrm{a7}\, \left(x - \mathrm{x0}\right)\, \left(z - \mathrm{z0}\right)+$'
Tstr{3} = '$\mathrm{a8}\, \left(y - \mathrm{y0}\right)\, \left(z - \mathrm{z0}\right)+\mathrm{a9}\, {\left(z - \mathrm{z0}\right)}^2+\mathrm{a10}\, {\left(x - \mathrm{x0}\right)}^3+\mathrm{a11}\, {\left(x - \mathrm{x0}\right)}^2\, \left(y - \mathrm{y0}\right)+$'
Tstr{4} = '$\mathrm{a12}\, \left(x - \mathrm{x0}\right)\, {\left(y - \mathrm{y0}\right)}^2+\mathrm{a13}\, {\left(y - \mathrm{y0}\right)}^3+\mathrm{a14}\, {\left(x - \mathrm{x0}\right)}^2\, \left(z - \mathrm{z0}\right)+\mathrm{a15}\, \left(x - \mathrm{x0}\right)\, \left(y - \mathrm{y0}\right)\, \left(z - \mathrm{z0}\right)+$'
Tstr{5} = '$\mathrm{a16}\, {\left(y - \mathrm{y0}\right)}^2\, \left(z - \mathrm{z0}\right)+\mathrm{a17}\, \left(x - \mathrm{x0}\right)\, {\left(z - \mathrm{z0}\right)}^2+\mathrm{a18}\, \left(y - \mathrm{y0}\right)\, {\left(z - \mathrm{z0}\right)}^2+\mathrm{a19}\, {\left(z - \mathrm{z0}\right)}^3$'
figure
h = title(Tstr,'interpreter','latex','fontsize',10);
Setting the title to Tstr give me an error: Warning: Unable to interpret LaTeX string.
However, setting the title to each cell of Tstr doesn't give me an error, nor if I limit the title to only 4 lines : Tstr(1:4) or Tstr(2:5).
Is there another way to get around this? I've tried using a simple title to see if there was a limit on lines allowed in the title but the below worked just fine:
title({'1';'2';'3';'4';'5'},'fontsize',10);
Please help! Thanks, Patricia

Respuesta aceptada

Jonathan Epperl
Jonathan Epperl el 22 de Oct. de 2012
Editada: Jonathan Epperl el 22 de Oct. de 2012
From the Matlab help on Text Properties http://www.mathworks.com/help/matlab/ref/text_props.html
Note: The maximum size of the string that you can use with the LaTeX interpreter is 1200 characters. For multiline strings, reduce this amount by about 10 characters per line.
So the only options I see for you are
  • Don't use latex, since it doesn't seem like you use any latex-specific features, except the large braces
  • Piece it together using text
  • Shorten your string, e.g. by substituting \mathrm{a19} with a_{19}
  1 comentario
Walter Roberson
Walter Roberson el 22 de Oct. de 2012
Thanks, good summary there.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Labels and Annotations en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by