How do I get bold formatted subscript mathematical expressions in MATLAB using LaTeX?
56 views (last 30 days)
Show older comments
I want to format the variable
as given as an axis label for a figure using the the latex interpreter: Both, g and R, should be italic, but R should be subscript and bold additionally. In the corresponding document, that the figure is for, I formatted it as $g_{\boldsymbol{R}}$, however this does not seem to work here. So far, I found a very similar question, yet the accepted answer does not use a subscript and I do not seem to get the described math mode switching to work. Any help, getting the math mode switching to work, or a totally different approach to format the label as intended, is appreciated. Thanks in advance!

0 Comments
Answers (2)
Star Strider
on 20 Aug 2025 at 13:12
Using
g_{\it\textbf{R}}
works here using tthe LaTeX interpreter (Σ button in the top toolbar) --

The 'R' actually is subscripted. Were it not, it would appear as --

Using it as an axis label --
figure
xlabel('$g_{\it\textbf{R}}$', Interpreter='LaTeX')
.
4 Comments
Star Strider
on 20 Aug 2025 at 16:59
If the approach that you reference works for you, then go for it. It appears to work, at least in the referenced releases.
Alternatively, you can plot here and then upload the plot as an image --
figure
xlabel('$g_{\it\textbf{R}}$', Interpreter='LaTeX', FontSize=26)
savefig(gcf,'ItalicBoldSubscript.fig')
figfiles = dir('*.fig')
which('ItalicBoldSubscript.fig')
openfig('ItalicBoldSubscript');
There does not appear to be a way to save it to MATLAB Drive (at lest that I can find, if that were possible you could then export it through MATLAB Online), so the easiest way to do it would probably be to copy it by right-clicking on it and then saving it appropriately, or taking a screenshot of it.
.
See Also
Categories
Find more on Axis Labels 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!