Is there maximum number of characters of the figure title latex interpreter string?

조회 수: 5 (최근 30일)
Dear all,
I would like to write a multiline title using the latex interpreter.
I understand there is a limit of 1200 characters (minus roughly 10 characters for each line breaking).
I tried the following code but the interpreter fails.
title({[sprintf('$\\psi$ = %.0f$^\\circ$, $\\theta$ = %.0f$^\\circ$', rotationAngle,rad2deg(thetaIncidence)) newline ...
sprintf('$n_{Exp}$=%.2E, $vc_{Exp}$=%.2E', beta(1), beta(2)) sprintf('$\\sigma_n$=%.2E, $\\sigma_v_c$=%.2E', errBeta(1), errBeta(2))]},'Interpreter','latex')
Any idea?
Many thanks in advance
  댓글 수: 2
dpb
dpb 2020년 7월 11일
Simplify, simplify, simplify!!!! Break you string up into smaller pieces, debug each part to make sure of syntax...the LaTeX stuff is very fragile to proper syntax and very difficult to read easily. That there's no indication of which part fails doesn't help but is why simply have to work on the pieces from left to right, getting each working before going on to the next...
FastCar
FastCar 2020년 7월 11일
I tried to break the title in 3 pieces and each one works fine. The problem is when I put together the pieces.

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

채택된 답변

madhan ravi
madhan ravi 2020년 7월 12일
Painful but manageable ;)
first = sprintf('$$\\psi = %.0f^{\\circ}$$', rotationAngle);
second = sprintf('$$\\theta = %.0f^{\\circ}$$', rad2deg(thetaIncidence));
third = sprintf('$$n_{Exp} = %.2E$$', beta(1) );
fourth = sprintf('$$vc_{Exp} = %.2E$$', beta(2));
fifth = sprintf('$$\\sigma_n = %.2E$$', errBeta(1));
sixth = sprintf('$$\\sigma_{v_{c}} = %.2E$$', errBeta(2));
title({first, second,third,fourth,fifth,sixth},'Interpreter','latex')
  댓글 수: 8
Walter Roberson
Walter Roberson 2020년 7월 13일
I have a difficult time finding documentation for TeX itself that is not LaTeX; even the documents I find that say they are talking about TeX specifically tend to be contaminated by LaTeX constructs.

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

추가 답변 (1개)

dpb
dpb 2020년 7월 11일
First, you must pass a char() string, not cellstr. You've got too many $ signs for pieces, but a start at what outlined above using
tstr=[sprintf('$\\psi = %.0f^\\circ$', rotationAngle)];
title(tstr)
does work...just keep adding pieces one at a time.
  댓글 수: 2
FastCar
FastCar 2020년 7월 12일
편집: FastCar 2020년 7월 12일
Dear dpb, I tried each one of the sprint strings (and the first two together) and they work fine alone. I tried char() and I still get the same wrong text.
Now I tried
text= [sprintf('$\\psi$ = %.0f$^\\circ$, $\\theta$ = %.0f$^\\circ$', rotationAngle,rad2deg(thetaIncidence)) newline ...
sprintf('$n_{Exp}$=%.2E, $vc_{Exp}$=%.2E', beta(1), beta(2)) sprintf('$\\sigma_n$=%.2E, $\\sigma_v_c$=%.2E', errBeta(1), errBeta(2))];
title(text,'Interpreter','latex')
and it still does not work fine, but I do not get anymore the warning on the interpreter.
dpb
dpb 2020년 7월 12일
As said, just piece together pieces one at a time. If you break somewhere along the line, that's the portion with a syntax error to fix (or you're trying to do something the MATLAB LaTeX implementation doesn't support).

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

카테고리

Help CenterFile Exchange에서 Function Creation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by