Mathjax & LaTeX in dash

Thanks @jessexknight!

This works for me, including inside a dcc.Markdown (if escaping delimiters appropriately, using backticks for in-line equations seems easiest). It looks like there may be some changes required for MathJax 3+ however.

Hello everyone,
Iā€™ve noticed that graph labels seem to render almost seamlessly meanwhile when a div text is changed you can see for a split second the original text before it gets rendered to latex and it takes about the same time you set on setInterval but no matter how small you set it thereā€™s always that twitching from text to latex. Is there a way to render it as fast as plotly label titles or at least hide the text until latex is rendered? Or maybe Iā€™m doing something wrong. I can manage an example if needed.

Mathjax 3 rocks with Dash v2.3.0 which includes Plotly.js v2.10.0. Thanks Plotly and Equinor.

3 Likes

For everyone: Please note the release notes, which states that you need to add mathjax=True to dcc.Markdown and dcc.Graph. However, now I didnā€™t need any external_scripts in my Dash app.

Hi Christian @wc4
I am working on a new Dash v2.3.0 release post that explains all the updates, which I hope we can get out on Friday or early next week.

But thank you for sharing this with everyone and giving them a heads up :slight_smile:

Ah, cool, @adamschroeder! I was just annoyed about why my code suddenly didnā€™t work :stuck_out_tongue:

Hey @adamschroeder ,
i just came along this after debugging for quite some time.

The new version works really well!

Maybe this should be updated in the docs aswell? (Adding CSS & JS and Overriding the Page-Load Template | Dash for Python Documentation | Plotly still lists adding it as a script)

hi @venividicode
:wave: welcome to the community and thanks for making me aware of this. I just let our technical writers know about this.

1 Like