maximum number of characters of the latex interpreter?

5 次查看(过去 30 天)
Hi
I wanted to write a multiline text in a text box with the latex interpreter but found that there seems to be a limit on how many characters I can use. Is there a way around it?
For example the following code works for N<17 but crashes the latex interpreter for N>=17:
N=17;
A=reshape(1:N^2,N,N)';
Na=length(A(:,1));
ltex=cell(Na,1);
for inda=1:Na
ltex{inda}=num2str(A(inda,:));
end
figure
th=text(0.1,0.9,ltex,'interpreter','latex')
set(th,'verticalAlignment','top')
  4 个评论
Oleg Komarov
Oleg Komarov 2011-9-13
Please correct the above example (since you know):
Warning: Unable to interpret LaTeX string
I'm using R2011a Win32 Vista.

请先登录,再进行评论。

采纳的回答

the cyclist
the cyclist 2011-9-13
According to this section of the documentation:
there is a maximum of string size of 1200 characters for the LaTeX interpreter, and multiline strings reduce the limit (by about 10 characters per line).
  3 个评论
Fred
Fred 2011-9-14
thanks. That is what I was looking for. So there is a limitation. Too bad. I guess I will just have to use multiple text commands

请先登录,再进行评论。

更多回答(1 个)

Oleg Komarov
Oleg Komarov 2011-9-13
A workaround:
N = 20;
ltex = cellstr(reshape(sprintf('%3.0f\\;',1:N^2).',[],N).');
axes('Ylim',[0,18])
for n = 17:-1:1
th = text(0.02,n,['$' ltex{18-n} '$'],'interpreter','latex');
end
  2 个评论
Fred
Fred 2011-9-14
thanks. I'm aware of this workaround but I just wanted to avoid using multiple text commands since I may want to move the text boxes around dynamically and having multiple text makes it more tedious.
Walter Roberson
Walter Roberson 2011-9-14
You could put them inside a uipanel() and then they would move together.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Interactive Control and Callbacks 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by