Removing latex font in a label/title

4 views (last 30 days)
Alex ETS
Alex ETS on 7 Mar 2013
Hi all, I have a this code :
xlabel(ha{ii},'Vitesse adimensionnelle $$\left(^{u}/_{U_{B}}\right)$$','FontSize',12,'interpreter','latex');
This gives me the "latex" font for my label. The thing is that all my other figurer have the standard Helvetica font. Is there a way to keep the latex interpreter, but having the text font set to Helvetica?

Answers (1)

Daniel Shub
Daniel Shub on 8 Mar 2013
The standard LaTeX font is computer modern. Using helvetica for text in LaTeX is relatively straight forward:\usepackage{helvet}, changing the math font is a little harder. I think the consensus is to use the sansmath LaTeX package which uses a sans serif version of computer modern. It is not a perfect match, but it is at least a little closer.
Getting MATLAB to use additional LaTeX packages is possible, but non-trivial. If you want your fonts to match, I would suggest you do everything in computer modern. If you really want to make MATLAB use additional LaTeX packages there are three solutions.
The first solution is to overload tex.m to add additional search paths so the LaTeX compiler can find your packages and modify the LaTeX wrapper code to use the packages. This is non-trivial.
The second solution is to copy the package files into the default location where MATLAB looks for LaTeX packages. On my system it is $MATLABROOT/sys/tex/latex/base.. This requires root/admin privledges. You then need to modify $MATLABROOT/sys/tex/mwarticle.cls to include the packages. This will globally affect all users and calls to the MATLAB LaTeX interpreter. This is easier, but is not as robust.
The third solution is to use something like LaPrint. or to export your figures as an eps and post process with a program like illustrator or inkscape. This is the easiest to implement but the least automated.

Community Treasure Hunt

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

Start Hunting!