@@ -167,6 +167,21 @@ def _check_dependencies():
167
167
168
168
# Sphinx gallery configuration
169
169
170
+ def matplotlib_reduced_latex_scraper (block , block_vars , gallery_conf ,
171
+ ** kwargs ):
172
+ """
173
+ Reduce srcset when creating a PDF.
174
+
175
+ Because sphinx-gallery runs *very* early, we cannot modify this even in the
176
+ earliest builder-inited signal. Thus we do it at scraping time.
177
+ """
178
+ from sphinx_gallery .scrapers import matplotlib_scraper
179
+
180
+ if gallery_conf ['builder_name' ] == 'latex' :
181
+ gallery_conf ['image_srcset' ] = []
182
+ return matplotlib_scraper (block , block_vars , gallery_conf , ** kwargs )
183
+
184
+
170
185
sphinx_gallery_conf = {
171
186
'examples_dirs' : ['../examples' , '../tutorials' , '../plot_types' ],
172
187
'filename_pattern' : '^((?!sgskip).)*$' ,
@@ -183,6 +198,7 @@ def _check_dependencies():
183
198
'remove_config_comments' : True ,
184
199
'min_reported_time' : 1 ,
185
200
'thumbnail_size' : (320 , 224 ),
201
+ 'image_scrapers' : (matplotlib_reduced_latex_scraper , ),
186
202
# Compression is a significant effort that we skip for local and CI builds.
187
203
'compress_images' : ('thumbnails' , 'images' ) if is_release_build else (),
188
204
'matplotlib_animations' : True ,
0 commit comments