How to implement new Latex Font in matlab?

51 views (last 30 days)
Dear all,
although this question has been asked in previous forum posts, I have to ask again because I still have problems in implementing a new Latex Font in matlab. I would like to use the font "Gyre Pagella" (font package name: tgpagella; font code: qpl) for the labels of my figures. After I downloaded the font and adjusted folders, matlab still doesn't report Gyre Pagella with the command listfonts.
Does anyone has an idea what I have to do to be able to use this font ?
Many thanks for your help !

Accepted Answer

Angelo Yeo
Angelo Yeo on 20 Mar 2024
I don't think MATLAB checks text object's FontName properties. I can only find that MATLAB supports Sans Serif and Roman fonts though.
text(0.5, 0.8, '\textsf{sans serif}','interpreter','latex');
text(0.5, 0.7, '\textrm{roman}','interpreter','latex');
text(0.5, 0.6, '$$\mathsf{math\,\,mode\,\,sans\,\,serif}$$','interpreter','latex');
text(0.5, 0.5, '$$\mathrm{math\,\,mode\,\,roman}$$','interpreter','latex');
You can reach out to Technical Support to request an enhancement on FontName check for LaTeX.

More Answers (1)

Walter Roberson
Walter Roberson on 20 Mar 2024
There is no way (documented) to add latex fonts to most of MATLAB. There used to be an obscure way it could be done, but that way disappeared a number of years ago.
If I understand correctly, it is possible to add latex fonts for Report Generator use.

Categories

Find more on MATLAB Report Generator 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!