@@ -184,31 +184,34 @@ def _get_tex_source(self, tex, fontsize):
184184 r'\rmfamily' )
185185 return "\n " .join ([
186186 r"\documentclass{article}" ,
187- # Pass-through \mathdefault, which is used in non-usetex mode to
188- # use the default text font but was historically suppressed in
189- # usetex mode.
187+ r"% Pass-through \mathdefault, which is used in non-usetex mode" ,
188+ r"% to use the default text font but was historically suppressed" ,
189+ r"% in usetex mode." ,
190190 r"\newcommand{\mathdefault}[1]{#1}" ,
191191 self ._font_preamble ,
192192 r"\usepackage[utf8]{inputenc}" ,
193193 r"\DeclareUnicodeCharacter{2212}{\ensuremath{-}}" ,
194- # geometry is loaded before the custom preamble as convert_psfrags
195- # relies on a custom preamble to change the geometry.
194+ r"% geometry is loaded before the custom preamble as " ,
195+ r"% convert_psfrags relies on a custom preamble to change the " ,
196+ r"% geometry." ,
196197 r"\usepackage[papersize=72in, margin=1in]{geometry}" ,
197198 self .get_custom_preamble (),
198- # Use `underscore` package to take care of underscores in text
199- # The [strings] option allows to use underscores in file names
199+ r"% Use `underscore` package to take care of underscores in text." ,
200+ r"% The [strings] option allows to use underscores in file names." ,
200201 _usepackage_if_not_loaded ("underscore" , option = "strings" ),
201- # Custom packages (e.g. newtxtext) may already have loaded textcomp
202- # with different options.
202+ r"% Custom packages (e.g. newtxtext) may already have loaded " ,
203+ r"% textcomp with different options." ,
203204 _usepackage_if_not_loaded ("textcomp" ),
204205 r"\pagestyle{empty}" ,
205206 r"\begin{document}" ,
206- r"% The empty hbox ensures that a page is printed even for empty " ,
207+ r"% The empty hbox ensures that a page is printed even for empty" ,
207208 r"% inputs, except when using psfrag which gets confused by it." ,
208- r"\fontsize{%f}{%f}%%" % (fontsize , baselineskip ),
209+ r"% matplotlibbaselinemarker is used by dviread to detect the" ,
210+ r"% last line's baseline." ,
211+ rf"\fontsize{{{ fontsize } }}{{{ baselineskip } }}%" ,
209212 r"\ifdefined\psfrag\else\hbox{}\fi%" ,
210- r"{ \obeylines%s %s}\special{matplotlibbaselinemarker}"
211- % ( fontcmd , tex ) ,
213+ rf"{{ \obeylines{ fontcmd } { tex } }}%" ,
214+ r"\special{matplotlibbaselinemarker}%" ,
212215 r"\end{document}" ,
213216 ])
214217
0 commit comments