latex in text doesn't work

조회 수: 20 (최근 30일)
DAVIDE MODESTO
DAVIDE MODESTO 2023년 1월 22일
답변: Matt J 2023년 1월 22일
Hi,
I've tried the following:
text(1, 1.5,sprintf('$\tilde{y_x}$= %.3f',5), ...
'Interpreter', 'LaTeX','fontsize', 30);
and the result is:
If I remove the tilde:
text(1, 1.5,sprintf('$y_x$= %.3f',5), ...
'Interpreter', 'LaTeX','fontsize', 30);
the result is:
I really appreciate any kind of help.

채택된 답변

Star Strider
Star Strider 2023년 1월 22일
Use two backslants (\\) in any sprintf call to ‘escape’ it —
text(1, 1.5,sprintf('$\\tilde{y_x}$= %.3f',5), ...
'Interpreter', 'LaTeX','fontsize', 30);
axis([0 2 0 2])
.

추가 답변 (1개)

Matt J
Matt J 2023년 1월 22일
gca;
s=sprintf('$\\tilde{y}_x$ = %.3f',5)
s = '$\tilde{y}_x$ = 5.000'
text(0.5, 0.5,s, ...
'Interpreter', 'LaTeX','fontsize', 30);

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by