Bring Drag & Drop to Dash with Dashboard Engine. 💫 Learn how at our next webinar!

Dash Latex with Download HTML -- is not formatted

I’ve taken the “HTML export in Dash” example program from Interactive Html Export and added a few lines for here: Latex

    yaxis_title=r'$d, r \text{ (solar radius)}$'

Now when I use the ‘Download HTML’ button and display the exported/downloaded HTML file the Latex strings are no longer formatted. I could add more code and images if needed to demonstrate this.

More details … this is the complete program – the titles added are just for demonstration:

#  11/23/21
#  plus

import io
from base64 import b64encode

import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import as px

buffer = io.StringIO()

df =
fig = px.scatter(
    df, x="sepal_width", y="sepal_length",

# lines added from ttps://  :
    yaxis_title=r'$d, r \text{ (solar radius)}$'


html_bytes = buffer.getvalue().encode()
encoded = b64encode(html_bytes).decode()

# app = dash.Dash(__name__)
app = dash.Dash(__name__, external_scripts=["" ])

app.layout = html.Div([
    dcc.Graph(id="graph", figure=fig),
        html.Button("Download HTML"),
        href="data:text/html;base64," + encoded,



The web server output is:

Note the displayed Latex.

When I use the Download HTML button I get this file:

Note the raw Latex directives for x and y titles. Obviously I’d like to see the formatted Latex here also. How can I do this?