Switching between different font settings

Hi all,
I use Matplotlib and LaTeX to produce essentially two types of documents; technical reports for a large corporation and scientific papers.
Thus, I use several LaTeX cls-files which uses different fonts.

What is the most convenient way to get Matplotlib to use the same fonts as my main document and also to quickly switch between the
different document types?

So far I’ve tried reading a file with settings specific to the current document and using “rcParams.update(params)” to dynamically change
the settings. This way I can get the right font for legends and labels, but I have not figured out how to get correct fonts for the numbers
on the x- and y-axes. Matplotlib uses whatever is default in my LaTeX installation (Computer Modern?). I use “text.usetex: True”.

This must be a problem that I share with others. Does anyone have a good solution?

Best regards,
Johan

Hi all,

Johan Ekh-2 wrote:

What is the most convenient way to get Matplotlib to use the same fonts as
my main document and also to quickly switch between the
different document types?

Take a look at: LaTeX sans serif math fonts with sfmath.sty

Best regards,
Tobias

···

--
View this message in context: http://www.nabble.com/Switching-between-different-font-settings-tp21279388p22245251.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

Hi all,

Johan Ekh-2 wrote:

What is the most convenient way to get Matplotlib to use the same fonts as
my main document and also to quickly switch between the
different document types?

Take a look at: LaTeX sans serif math fonts with sfmath.sty
You have to load the package in the preambel of LaTeX.
For matplotlib this can be done by adding "text.latex.preamble :
\usepackage{sfmath}" to your matplotlibrc.

Best regards,
Tobias

···

--
View this message in context: http://www.nabble.com/Switching-between-different-font-settings-tp21279388p22245329.html
Sent from the matplotlib - users mailing list archive at Nabble.com.