[Matplotlib-users] How to make \mathdefault{} the default?

Daniele Nicolodi daniele at grinta.net
Tue Oct 3 17:13:56 EDT 2017


On 10/3/17 2:59 PM, Daniele Nicolodi wrote:
> Hello,
> 
> when adding LaTeX symbols to labels on my figures, most often I use
> \mathdefault{} to make Matplotlib use the same fond for the regular text
> and for the LaTeX part.  Is there a way to configure Matplotlib to use
> the regular text by default?  Looking at the configuration file I
> haven't found anything hinting to it.

After staring a bit more at the example configuration file, I can answer
my own question.  This does the trick:

matplotlib.rcParams['mathtext.fontset'] = 'custom'

I'm a bit worried by the note next to this setting in the example
configuration file, though:

# The following settings allow you to select the fonts in math mode.
# They map from a TeX font name to a fontconfig font pattern.
# These settings are only used if mathtext.fontset is 'custom'.
# Note that this "custom" mode is unsupported and may go away in the
# future.

Why is it unsupported?  I find this functionality very neat.

Thanks. Cheers,
Daniele


More information about the Matplotlib-users mailing list