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}
  댓글 수: 1
Walter Roberson
Walter Roberson 2012년 10월 22일
Thanks, good summary there.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Labels and Annotations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by