How can I specify the font for a LaTeX mathematical expression in MATLAB?
19 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
MathWorks Support Team
am 8 Apr. 2020
Kommentiert: Walter Roberson
am 11 Okt. 2022
I am using LaTeX to create an "xlabel" in my figure. How do I select Helvetica as the font for the label?
Akzeptierte Antwort
MathWorks Support Team
am 8 Dez. 2020
Bearbeitet: MathWorks Support Team
am 8 Dez. 2020
The LaTeX processor included in MATLAB is primarily designed for creating mathematical expressions, meaning that some functionality related to fonts or document processing is not supported.
As of R2020b you cannot specify a font when using LaTeX in MATLAB. However, some commands provide a similar degree of customization. In this case, a font similar to Helvetica is achieved by using '\textsf{}', which makes the font sans-serif. An example of '\textsf{}' being implemented is shown below:
str = ['$\frac{\Delta\textsf{var1}}{\Delta\textsf{var2}}$'];
xlabel(str,'Interpreter','latex','fontsize',12);
Note that '\textsf{}' needs to be applied separately to 'var1' and 'var2' as the '\Delta' character is not compatible. This implementation may also generate the following warning when executed:
Warning: Error updating Text.
Font cmss10 is not supported.
This occurs when using the LaTeX interpreter for sans-serif fonts but should not be of any concern.
1 Kommentar
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Holidays / Seasons finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!