From 20e705ba17e565862ef0ae573105ca1bf5f9d433 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Tue, 7 May 2019 14:24:20 +0200 Subject: [PATCH] Clarify error with usetex when cm-super is not installed. This PR makes the error when cm-super is not installed (and rcParams["text.latex.unicode"] = True, which is now the default) be ``` ! LaTeX Error: File `type1ec.sty' not found. Type X to quit or to proceed, or enter new name. (Default extension: sty) Enter file name: ! Emergency stop. l.5 \usepackage {type1ec}^^M No pages of output. ``` (or, if using miktex, miktex will prompt for installing cm-super). --- lib/matplotlib/texmanager.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/matplotlib/texmanager.py b/lib/matplotlib/texmanager.py index c970526976bc..39ab7383483a 100644 --- a/lib/matplotlib/texmanager.py +++ b/lib/matplotlib/texmanager.py @@ -86,10 +86,13 @@ class TexManager(object): 'helvetica': ('phv', r'\usepackage{helvet}'), 'avant garde': ('pag', r'\usepackage{avant}'), 'courier': ('pcr', r'\usepackage{courier}'), - 'monospace': ('cmtt', ''), - 'computer modern roman': ('cmr', ''), - 'computer modern sans serif': ('cmss', ''), - 'computer modern typewriter': ('cmtt', '')} + # Loading the type1ec package ensures that cm-super is installed, which + # is necessary for unicode computer modern. (It also allows the use of + # computer modern at arbitrary sizes, but that's just a side effect.) + 'monospace': ('cmtt', r'\usepackage{type1ec}'), + 'computer modern roman': ('cmr', r'\usepackage{type1ec}'), + 'computer modern sans serif': ('cmss', r'\usepackage{type1ec}'), + 'computer modern typewriter': ('cmtt', r'\usepackage{type1ec}')} _rc_cache = None _rc_cache_keys = (