Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Latex fonts in matlab

Tags:

Is it possible to convert the font of a matlab plot to be the same of latex fonts. For example I can modify the font of a plot by:

x = -pi:.1:pi; y = sin(x); plot(x,y) set(gca,'FontName','Helvetica'); 

Is it possible to do the same but for latex fonts (I say latex fonts as I am not sure of the actual name of the font latex uses as its basic font).

like image 378
KatyB Avatar asked Jun 26 '12 16:06

KatyB


People also ask

What is the LaTeX font in MATLAB?

However, linux's command fc-list lists all fonts on your system, I think they are all supported by Matlab. In ubuntu (and possibly other distro's) the latex font is called Latin Modern, or lm for short. You can find them all via: # fc-list | grep lmroman /usr/share/texmf/fonts/opentype/public/lm/lmroman10-bold.

Can you write LaTeX in MATLAB?

MATLAB supports most standard LaTeX math mode commands. These tables show a list of supported LaTeX commands.

How do I enable fonts in MATLAB?

On the Home tab, in the Environment section, click Preferences. Select MATLAB > Fonts and, in the Desktop code font section, select a font name and style.


1 Answers

For any text object you just need to set the 'Interpreter' property to 'latex'. So, for example you could do

xlabel('$$\int_0^x\!\int_y dF(u,v)$$','Interpreter','latex'); 

For tick labels it is more difficult, though there may be files available to make it easier (example).

like image 118
ioums Avatar answered Oct 29 '22 17:10

ioums