Skip to content

Commit 3cafb00

Browse files
committed
first pass at adding mathjax
Using the workaround as suggested here: #515 (comment)
1 parent 7064d74 commit 3cafb00

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

plotly/offline/offline.py

+13
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,20 @@ def init_notebook_mode(connected=False):
140140
'</script>'
141141
'').format(script=get_plotlyjs())
142142

143+
mathjax_script = (
144+
'<script>'
145+
'var waitForPlotly = setInterval( function() {'
146+
' if( typeof(window.Plotly) !== "undefined" ){'
147+
' MathJax.Hub.Config('
148+
' { SVG: { font: "STIX-Web" }, displayAlign: "center" });'
149+
' MathJax.Hub.Queue(["setRenderer", MathJax.Hub, "SVG"]);'
150+
' clearInterval(waitForPlotly);'
151+
' }}, 250 );'
152+
'</script>'
153+
)
154+
143155
ipython_display.display(ipython_display.HTML(script_inject))
156+
ipython_display.display(ipython_display.HTML(mathjax_script))
144157
__PLOTLY_OFFLINE_INITIALIZED = True
145158

146159

0 commit comments

Comments
 (0)