Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 36c6632

Browse files
authored
Merge pull request #20272 from QuLogic/dedupe-tex-fonts
De-duplicate fonts in LaTeX preamble.
2 parents d37551a + fa4ae59 commit 36c6632

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/matplotlib/texmanager.py

Lines 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)