@@ -207,10 +207,9 @@ def render_math(
207
207
"""Render the LaTeX math expression *math* using latex and dvipng or
208
208
dvisvgm.
209
209
210
- Return the filename relative to the built document and the "depth",
210
+ Return the image absolute filename and the "depth",
211
211
that is, the distance of image bottom and baseline in pixels, if the
212
212
option to use preview_latex is switched on.
213
- Also return the temporary and destination files.
214
213
215
214
Error handling may seem strange, but follows a pattern: if LaTeX or dvipng
216
215
(dvisvgm) aren't available, only a warning is generated (since that enables
@@ -317,7 +316,8 @@ def html_visit_math(self: HTMLTranslator, node: nodes.math) -> None:
317
316
image_format = self .builder .config .imgmath_image_format .lower ()
318
317
img_src = render_maths_to_base64 (image_format , rendered_path )
319
318
else :
320
- relative_path = path .relpath (rendered_path , self .builder .outdir )
319
+ bname = path .basename (rendered_path )
320
+ relative_path = path .join (self .builder .imgpath , 'math' , bname )
321
321
img_src = relative_path .replace (path .sep , '/' )
322
322
c = f'<img class="math" src="{ img_src } "' + get_tooltip (self , node )
323
323
if depth is not None :
@@ -357,7 +357,8 @@ def html_visit_displaymath(self: HTMLTranslator, node: nodes.math_block) -> None
357
357
image_format = self .builder .config .imgmath_image_format .lower ()
358
358
img_src = render_maths_to_base64 (image_format , rendered_path )
359
359
else :
360
- relative_path = path .relpath (rendered_path , self .builder .outdir )
360
+ bname = path .basename (rendered_path )
361
+ relative_path = path .join (self .builder .imgpath , 'math' , bname )
361
362
img_src = relative_path .replace (path .sep , '/' )
362
363
self .body .append (f'<img src="{ img_src } "' + get_tooltip (self , node ) +
363
364
'/></p>\n </div>' )
0 commit comments