How to change font to times new roman when using matlab latex interpreter?

104 Views Asked by At

My plot for x axis name using matlab is "normalized time t/T", where "normalized time" should be in times new roman font, the same as normal font as my paper, and t/T should be in math mood. How to do this using matlab latex interpreter?

For example, if I write

xlabel('Normalized time $t$', 'Fontsize',10,'Interpreter',"latex");

in Matlab, I get

enter image description here

in the plot, but what I really want to get is

enter image description here

1

There are 1 best solutions below

0
bla On

when mixing latex with figure labels, Matlab has limited font support. A hack you can try is use the xlabel without a latex interperter, find its position, and add a text next to it with latex. For example:

plot(rand(2))
xlabel('Normalized time', 'Fontsize',20,'FontName',"Impact"); % just text, no latex
% get the xlabel position as [left,bottom,width,height]
a=get(get(gca,'XLabel'),'Extent'); 
text(1.01*(a(1)+a(3)),a(2)+a(4)/2,'$\frac{t}{T}$','Fontsize',20,'Interpreter',"latex")

enter image description here