Latex Title in figure

5 次查看(过去 30 天)
Patricia
Patricia 2012-10-22
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

采纳的回答

Jonathan Epperl
Jonathan Epperl 2012-10-22
编辑:Jonathan Epperl 2012-10-22
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}

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Printing and Saving 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by