latex interpreter - different fonts

6 vues (au cours des 30 derniers jours)
Waldemar Gerok
Waldemar Gerok le 26 Juin 2011
Hello,
I plot a figure, where the xlabel uses latex interpreter.
e. g.: xlabel('$\frac{1}{pi}dy$','Interpreter','latex','FontName','Times')
Unfortunately the font is not Times in the figure, however, when I do not use latex-interpreter, the FontName option works fine.
Does anybody know how to solve the problem: use the latex interprete and get the Time font in the figure?
Best Regards and thanks in advance for the help
Waldemar
  3 commentaires
Andrew Newell
Andrew Newell le 26 Juin 2011
My question too - I can't reproduce this.
Daniel Shub
Daniel Shub le 27 Juin 2011
Interesting, I can reproduce it on both 32-bit Windows (r2010a) and 64-bit Linux (r2010b). When the `interpreter` is `tex` or `none` changing the `fontname` has an effect. When the interpreter is `latex`, changing the `fontname` has no effect. I tried it with both an equation and plain text.

Connectez-vous pour commenter.

Réponses (1)

Patrick Kalita
Patrick Kalita le 27 Juin 2011
What you're describing is basically the expected behavior. When you set the Interpreter property to 'latex', MATLAB will hand off the string (e.g. '$\frac{1}{pi}dy$') directly to the LaTeX system, and LaTeX decides what fonts get used. The FontName property gets ignored.
It may be possible to install some kind of custom font alongside the regular LaTeX fonts (they're in %MATLABROOT/sys/fonts/ttf/cm), and then use some kind of LaTeX markup in your string that tells it to switch fonts. I've never done it, and I don't guarantee that would work, but if you're really desperate to make it work you might give it a try.

Community Treasure Hunt

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

Start Hunting!

Translated by