Fonts with latex interpreter and no interpreter look different

428 views (last 30 days)

When I use the latex interpreter to make a title with, for example $\frac{1}{2}$, the font for the title looks different to the font for the axes tick labels. How can I make the axis tick labels and title have the same looking font? For example:

title('Title with latex character $\frac{1}{2}$',...
'interpreter','latex','FontName','Times New Roman')
set(gca,'FontName','Times New Roman')

This is a problem because now the title (that must be latex interpreted to get the $\frac{1}{2}$) looks different to the axes. As far as I'm aware, one cannot set the interpreter for the axes to be 'latex'.

Thanks, Mark

Answers (2)

Matt Tearle
Matt Tearle on 23 Mar 2011
You can use the 'latex' interpreter option on the axis labels:
xlabel('hello world','interpreter','latex')
Do you mean the actual tick labels?
EDIT to add:
OK, try this:
This uses the LaTeX font. It should exist on your system, if LaTeX typesetting is working. I don't know if there's a high-level version of the name. ("Computer Modern Roman" doesn't work for me.)
If you go to C:\Program Files\MATLAB\R2011a\sys\fonts\ttf\cm (or wherever your MATLAB install lives) you can see the available TeX fonts.
Gustavo Pires
Gustavo Pires on 4 Oct 2020
Thanks Matt!
You saved me a lot of time searching it on the web in other related posts.
Best regards!

Sign in to comment.

Oleg Komarov
Oleg Komarov on 23 Mar 2011
Des using Tex (default) help?
title('2 1.8 1.6 Title with latex character \pi')
  1 Comment
Mark on 23 Mar 2011
Thanks for your answer Oleg.
I should clarify that when I initially wrote \pi I chose a bad example, as I often require real latex commands like $\frac{1}{2}$. The Tex interpreter, while it works well for Greek letters, cannot interpret more complicated markups.
I have edited my question so that this is more clear.

Sign in to comment.


Find more on Labels and Annotations 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!