How does one change the font of a plot label that was created with the latex interpreter?
48 次查看(过去 30 天)
显示 更早的评论
Hello. I need help with plotting a figure with the following y-axis label in Arial font.
ylabel('$\it\dot{K}\rm$ / units','Interpreter','latex','Fontname','Arial','FontSize', 18);
Unfortunately, the resulting figure retains the standard latex font for this y-axis, not the sans-serif font that I require. Furthermore, since I need the overhead dot in the label, I cannot use the default tex interpreter. Therefore, I've performed a bit of preliminary research into this topic and have attempted to include "\textsf{" within the aforementioned y-axis description only to receive the following warning.
"Warning: Error updating Text. Font cmss10 is not supported."
As a result, I downloaded the cmss10.ttf files from the following website and installed them into the appropriate cm folder within the C:\Program Files\MATLAB path location.
Once again, this did not solve the issue. In other forums (https://stackoverflow.com/questions/11212172/latex-fonts-in-matlab/11212673), it has been suggested that I could export my figure as a .eps file, open in a text editor, manually exchange the fonts there, and then reopen the figure as a PDF. However, I wasn't able to find detailed instructions on what text should be changed and thus I ran into another dead end.
If anyone has any insight on this issue, I would really appreciate the help. Thank you in advance.
0 个评论
采纳的回答
Subhadeep Koley
2020-1-8
Hi, Kent you can use below workaround to get sans-serif font in ylabel. This code generates an warning but gives the desired output.
plot(rand(3,10));
ylabel('$\mathsf{\stackrel {.}{K} / units}$', 'Interpreter', 'latex', 'fontweight','bold','fontsize',20);
Hope this helps!
0 个评论
更多回答(1 个)
NIDHI TIWARI
2022-3-30
In order to control the fonts it would be better to use tex interpreter. Copy the symbol directly from somewhere else instead of writing the latex code, e.g ylabel('Mean d_{f} (Å)','FontName', 'Arial', 'FontWeight', 'bold', 'Interpreter', 'tex') successfully updates to Arial font while ylabel('\textbf{Mean d$_{f}$ ($\AA$)}','FontName', 'Arial', 'Interpreter', 'latex') does not.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Interactive Control and Callbacks 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!