Sunday 4 October 2020

Matplotlib generated pdf cannot be opened by Acrobat Reader

I am trying to use serif fonts with latex with matplotlib, unfortunately it does not display in Acrobat Reader, but it is OK on Internet Explorer or Chrome. My minimal code produces an error StandardSymL_Slant_167 not found and varepsilon is not visible, what is missing?

import matplotlib as mpl
import matplotlib.pyplot as plt

mpl.rcParams.update(mpl.rcParamsDefault)
mpl.rcParams['text.usetex'] = True
mpl.rcParams['font.family'] = ['serif']
mpl.rcParams['font.serif'] = ['times']

fig, ax = plt.subplots()
ax.set_xlabel(r'$x$ $\alpha \varepsilon$')
fig.savefig('test.pdf')

error on acrobat pdf

The output of my enviroment is:

import matplotlib
print(matplotlib.__version__)
3.2.0

edit Found this as well strange:

pdffonts test.pdf
name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
NimbusRomNo9L-Regu                   Type 1            Custom           yes no  no      21  0
CMMI10                               Type 1            Builtin          yes no  no      13  0
NimbusRomNo9L-ReguItal               Type 1            Custom           yes no  no      25  0
StandardSymL_Slant_167               Type 1            Builtin          yes no  no      17  0


from Matplotlib generated pdf cannot be opened by Acrobat Reader

No comments:

Post a Comment