56
56
def get_texcommand ():
57
57
"""Get chosen TeX system from rc."""
58
58
texsystem_options = ["xelatex" , "lualatex" , "pdflatex" ]
59
- texsystem = rcParams . get ( "pgf.texsystem" , "xelatex" )
59
+ texsystem = rcParams [ "pgf.texsystem" ]
60
60
return texsystem if texsystem in texsystem_options else "xelatex"
61
61
62
62
@@ -68,7 +68,7 @@ def get_fontspec():
68
68
if texcommand != "pdflatex" :
69
69
latex_fontspec .append ("\\ usepackage{fontspec}" )
70
70
71
- if texcommand != "pdflatex" and rcParams . get ( "pgf.rcfonts" , True ) :
71
+ if texcommand != "pdflatex" and rcParams [ "pgf.rcfonts" ] :
72
72
# try to find fonts from rc parameters
73
73
families = ["serif" , "sans-serif" , "monospace" ]
74
74
fontspecs = [r"\setmainfont{%s}" , r"\setsansfont{%s}" ,
@@ -86,10 +86,7 @@ def get_fontspec():
86
86
87
87
def get_preamble ():
88
88
"""Get LaTeX preamble from rc."""
89
- latex_preamble = rcParams .get ("pgf.preamble" , "" )
90
- if type (latex_preamble ) == list :
91
- latex_preamble = "\n " .join (latex_preamble )
92
- return latex_preamble
89
+ return "\n " .join (rcParams ["pgf.preamble" ])
93
90
94
91
###############################################################################
95
92
@@ -223,13 +220,14 @@ def get_latex_manager():
223
220
latex_header = LatexManager ._build_latex_header ()
224
221
prev = LatexManagerFactory .previous_instance
225
222
226
- # check if the previous instance of LatexManager can be reused
227
- if prev and prev .latex_header == latex_header and prev .texcommand == texcommand :
228
- if rcParams .get ("pgf.debug" , False ):
223
+ # Check if the previous instance of LatexManager can be reused.
224
+ if (prev and prev .latex_header == latex_header
225
+ and prev .texcommand == texcommand ):
226
+ if rcParams ["pgf.debug" ]:
229
227
print ("reusing LatexManager" )
230
228
return prev
231
229
else :
232
- if rcParams . get ( "pgf.debug" , False ) :
230
+ if rcParams [ "pgf.debug" ] :
233
231
print ("creating LatexManager" )
234
232
new_inst = LatexManager ()
235
233
LatexManagerFactory .previous_instance = new_inst
@@ -289,7 +287,7 @@ def __init__(self):
289
287
# store references for __del__
290
288
self ._os_path = os .path
291
289
self ._shutil = shutil
292
- self ._debug = rcParams . get ( "pgf.debug" , False )
290
+ self ._debug = rcParams [ "pgf.debug" ]
293
291
294
292
# create a tmp directory for running latex, remember to cleanup
295
293
self .tmpdir = tempfile .mkdtemp (prefix = "mpl_pgf_lm_" )
0 commit comments