Skip to content

No italics with latex typesetting and pdf backend #3906

Closed
@breedlun

Description

@breedlun

This issue only shows up under rather specific circumstances, but I am hopeful it can be solved because I have pin pointed when the problem was introduced. With matplotlib v1.3.1-9, the following code:

import matplotlib as mpl
import matplotlib.pyplot as plt
mpl.rcParams['text.usetex'] = True
mpl.rcParams['text.latex.preamble'] = [r'\usepackage{newtxtext}',\
    r'\renewcommand*\familydefault{\sfdefault}', \
    r'\usepackage[italic]{mathastext}']
fig = plt.figure()
fig.text(0.4,0.5,'$ABC$',fontsize=64)
fig.savefig('Italics_Issue.png')
fig.savefig('Italics_Issue.pdf')

produces the following figure for both the png and the pdf
italics_issue-mpl_1 3 1-9

With matplotlib 1.4.0-1, the same code produces the following png
italics_issue-mpl_1 4 0-1
and the following pdf
italics_issue-mpl_1 4 0-1 pdf
The png looks the same in v1.3.1-9 and v1.4.0-1, but the pdf is different in v1.4.0-1. The italics (or oblique) letters have been converted to upright letters.

I tried to look in the history of the pdf backend to see if I could find the commit that caused the problem, but I don't have the github know-how to find just the commits between v1.3.1-9 and v1.4.0-1 that affected the pdf backend.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions