[Python] Quarto: Math figure labels disappear when embed-resources: true

Discussão em 'Python' iniciado por Stack, Janeiro 30, 2025.

  1. Stack

    Stack Membro Participativo

    I've been struggling to create a "correct" standalone html file using quarto! Below a minimal reproducible example.

    Here is what I have observed:


    • When embed-resources: true, I get the standalone html file BUT I lose the axes' labels written with math symbols.


    • When embed-resources: false, I lose the standalone html file (I get an html file + a files folder) BUT I get the axes' labels written with math symbols.

      ---
      embed-resources: true
      ---

      ```{python}

      import plotly.express as px

      from IPython.display import display, HTML
      display(HTML(
      '<script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_SVG"></script>'
      ))

      fig = px.line(x=[0, 1, 2, 3, 4],
      y=[1, 2, 4, 8, 16],
      )
      fig.update_layout(yaxis_title = r'$2^x$',
      xaxis_title = r'$x$')
      fig.show()

    I'm really confused and do not know how to solve this issue. I've tried many things like

    • Using self-contained-math: true
    • Using html-math-method: mathjax (with a specific url or with multiple methods)

    But nothing seems to work. Any help is welcome. Thank you.

    Continue reading...

Compartilhe esta Página