Apply the interpreter latex just to a part of the legend title

25 ビュー (過去 30 日間)
Sim
Sim 2020 年 9 月 14 日
編集済み: Sim 2020 年 9 月 14 日
Hi, I would like to apply the interpreter Latex just to a part of the legend title.
In the following attempt all the legend title is completely interpreted as Latex, but I would like that only the $\\alpha_b$ part is interpreted as Latex
lgd = legend(myplot,'interpreter','latex');
A = sprintf('My quantity $\\alpha_b$ is > %d', mynumber);
lgd.Title.String = A;
Any suggestion? (maybe still keeping both sprintf and 'interpreter','latex') ?
Thanks!

回答 (1 件)

madhan ravi
madhan ravi 2020 年 9 月 14 日
'\\textbf{My quantity $\\alpha_b$ is \\textgreater %d}' % ?
  1 件のコメント
Sim
Sim 2020 年 9 月 14 日
編集済み: Sim 2020 年 9 月 14 日
Thanks Madhan! .
..Btw, the text you kindly showed has a font style which is different from the default font style of the legend (I don't know the exact name of the legend's default font) and I would like the same default font since I used it for the rest of my plots....... Do you think it is still possible? (i.e. using the legend's default font style for all the legend title except for the $\\alpha_b$ part, where I would like to use the font from interpreter latex)
I also tried this code without interpreter latex, but the $\\alpha_b$ part is not as nice as when using interpreter latex:
lgd = legend(myplot);
A = sprintf('My quantity \\alpha_b is < %d', mynumber);
lgd.Title.String = A;
Or should I accept this answer and create another question?

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

カテゴリ

Help Center および File ExchangeLabels and Annotations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by