exit \fontname in label

13 views (last 30 days)
franco otaola
franco otaola on 13 Oct 2021
I wanted to use a custom font only for a part of a label inside an axis label. for this I followed the following workflow https://fr.mathworks.com/matlabcentral/answers/95987-how-can-i-use-different-fonts-within-one-axis-label-in-matlab-7-13-r2011b
using something like this:
xlabel('part 1 \fontname{Cambria Math} part2\rm part3')
to get the part 2 with cambira math font and the rest in the default font (lets say arial), this works fine. the issue i am getting is that when I change the label to for example to Calibri (from the gui or by using set(findall(gcf,'-property','FontName'),'FontName','Calibri') ) I will get a half result.
what I mean, I will get the part1 in calibri, the part2 in cambira math and part 3 will stay in cambira math eventhought that I add the '\rm' part. the behavior I am looking for would be that part1 and 3 will the two of them change to the one used in the set function (or in the GUI). is this possible?

Answers (0)




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by