latex - use package

13 ビュー (過去 30 日間)
Viesturs Veckalns
Viesturs Veckalns 2017 年 10 月 30 日
編集済み: Walter Roberson 2017 年 10 月 31 日
I want to set label text as
c_f2_3D.Label.String = '\frac{a}{b} \text{[cm]}'
I instruct to use the Latex interpreter
c_f2_3D.Label.Interpreter = 'latex';
\text requires to use the amsmath package. How can I fix the label?
  1 件のコメント
Rik
Rik 2017 年 10 月 31 日
I believe there is a folder with LaTeX packages buried deep in the installation folder of Matlab. It might be the only way to add packages. I really hope someone know a better way, but Matlab was not really designed for LaTeX package management.

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

回答 (1 件)

Walter Roberson
Walter Roberson 2017 年 10 月 31 日
編集済み: Walter Roberson 2017 年 10 月 31 日
c_f2_3D.Label.String = h.String = '$\frac{a}{b}$ [cm]'
the \frac is not valid outside of math mode, but sometimes it is good enough to just exit math mode. Spacing and weight can be a little different outside math mode, I understand. Perhaps
'$\frac{a}{b} \mbox{[cm]}$'
though I cannot say that I see any difference between that and omitting the \mbox . The material I am finding says that \text is the same as \mbox except that \text will use a smaller font if it is within a subscript.

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by