0

How can I install the font used by matplotlib when TeX is enabled?

import matplotlib

matplotlib.rcParams['text.usetex'] = True

The context is that some editor, on the same system, does not find the font, and consequently produces gibberish. The same problem appeared without LaTeX. In that case manually installing (system-wide) all ttf fonts shipped with matplotlib solved the problem. I would like to employ the same solution for the case with LaTeX.

(In my case I use MacTeX.)

Tom de Geus
  • 5,625
  • 2
  • 33
  • 77
  • In many cases, tex does not use ttf fonts at all. In that sense it's not too clear what this is asking for. – ImportanceOfBeingErnest Jun 19 '18 at 15:34
  • @ImportanceOfBeingErnest Thanks. In that case indeed my question was too narrow. I've edited, I hope it is more clear now? – Tom de Geus Jun 19 '18 at 15:40
  • When `usetex=True`, the text is produced by the tex system in use. You could use the MacTeX to make sure you get the same output in both cases. – ImportanceOfBeingErnest Jun 19 '18 at 15:54
  • @ImportanceOfBeingErnest That's what I also assumed. But then my editor cannot interpret everything, apparently because MacTeX uses the fonts but does not install them (because, as you point out, the fonts are integrated in TeX). What improved the situation was to manually install also the TeX fonts (see [this answer](https://apple.stackexchange.com/questions/117946/computer-modern-font-for-osx#117951)). But still special characters like `.` and `/` are not interpreted correctly. A workaround is to convert all fonts to outlines (see [this answer](https://stackoverflow.com/a/28798374/2646505)). – Tom de Geus Jun 20 '18 at 13:18

0 Answers0