latex interpreter sprintf issue

56 ビュー (過去 30 日間)
Turbulence Analysis
Turbulence Analysis 2022 年 2 月 15 日
Hi,
I would like insert text in my figure y = 10mm_x=1, I tried as follows, but it throws below error
Suggestions please !!
String scalar or character vector must have valid interpreter syntax: $Y= 10mm
text(0.7,1.05,(sprintf('$Y= 10mm\_{x} = %dmm$', i)),'FontSize',16,'Color','black','Interpreter','latex');

採用された回答

Voss
Voss 2022 年 2 月 15 日
編集済み: Voss 2022 年 2 月 15 日
Since there is a backslash (for the latex format) inside the sprintf format string, you must escape it (i.e., put another backslash before it) so that sprintf() doesn't interpret it as a format specifier:
i = 1;
text(0.7,1.05,(sprintf('$Y= 10mm\\_{x} = %dmm$', i)),'FontSize',16,'Color','black','Interpreter','latex');
  1 件のコメント
Turbulence Analysis
Turbulence Analysis 2022 年 2 月 15 日
Thanks a lot..

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLaTeX についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by