I'm currently starting to write up my PhD thesis and am now in the middle of setting up everything. One of the objectives is to use the same font in schemes and figures as in the text. However, when selecting bold text in matplotlib the fonts are not matching the latex font.
At the moment I am using these rc_params:
new_rc_params = {'text.usetex': True,
'svg.fonttype': 'none',
'text.latex.preamble': r'\usepackage{libertine}',
'font.size': 10,
'font.family': 'Linux Libertine',
'mathtext.fontset': 'custom',
'mathtext.rm': 'libertine',
'mathtext.it': 'libertine:italic',
'mathtext.bf': 'libertine:bold'
}
mpl.rcParams.update(new_rc_params)
This will lead to the right font in normal text as far as I can tell.
Matplotlib:
LaTeX comparison:
If I now, however, select bold text in matplotlib via:
$\mathbf{TS_{I,II}}$
I get the following output:
For comparison the bold and normal pure LaTeX output:
Now, I have read that for better math support in LaTeX I should add \usepackage[libertine]{nextxmath}
to text.latex.preamble
in rc_params
. If I do this, matplotlib generates the following output:
Which still is not the same font as I get from my LaTeX document. Does anyone have any ideas what I could additionally change to make the fonts identical?
(Can't post inline images...)