latex - use package
13 views (last 30 days)
Show older comments
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 Comment
Rik
on 31 Oct 2017
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.
Answers (1)
Walter Roberson
on 31 Oct 2017
Edited: Walter Roberson
on 31 Oct 2017
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.
0 Comments
See Also
Categories
Find more on Characters and Strings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!