latex - use package

8 次查看(过去 30 天)
Viesturs Veckalns
Viesturs Veckalns 2017-10-30
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 CenterFile Exchange 中查找有关 Characters and Strings 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by