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