Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit fa4ae59

Browse filesBrowse files
committed
De-duplicate fonts in LaTeX preamble.
If the same font is used in sans + serif, then the `usepackage` gets duplicated. This appears harmless, but can be de-duplicated to simplify the produced LaTeX files.
1 parent d37551a commit fa4ae59
Copy full SHA for fa4ae59

File tree

Expand file treeCollapse file tree

1 file changed

+5
-5
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-5
lines changed

‎lib/matplotlib/texmanager.py

Copy file name to clipboardExpand all lines: lib/matplotlib/texmanager.py
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,12 @@ def get_font_config(self):
110110

111111
# The following packages and commands need to be included in the latex
112112
# file's preamble:
113-
cmd = [fonts['serif'][1],
114-
fonts['sans-serif'][1],
115-
fonts['monospace'][1]]
113+
cmd = {fonts[family][1]
114+
for family in ['serif', 'sans-serif', 'monospace']}
116115
if self.font_family == 'cursive':
117-
cmd.append(fonts['cursive'][1])
118-
self._font_preamble = '\n'.join([r'\usepackage{type1cm}', *cmd])
116+
cmd.add(fonts['cursive'][1])
117+
cmd.add(r'\usepackage{type1cm}')
118+
self._font_preamble = '\n'.join(sorted(cmd))
119119

120120
return ''.join(fontconfig)
121121

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.