diff --git a/packages/javascript/jupyterlab-plotly/src/Figure.ts b/packages/javascript/jupyterlab-plotly/src/Figure.ts index 0540354697..6b0b4a6334 100644 --- a/packages/javascript/jupyterlab-plotly/src/Figure.ts +++ b/packages/javascript/jupyterlab-plotly/src/Figure.ts @@ -826,11 +826,9 @@ export class FigureView extends DOMWidgetView { this.model.on("change:_py2js_update", this.do_update, this); this.model.on("change:_py2js_animate", this.do_animate, this); - // MathJax configuration + // MathJax v2 configuration // --------------------- - if ((window as any).MathJax) { - (window as any).MathJax.Hub.Config({ SVG: { font: "STIX-Web" } }); - } + (window as any)?.MathJax?.Hub?.Config?.({ SVG: { font: "STIX-Web" } }); // Get message ids // --------------------- diff --git a/packages/python/plotly/plotly/io/_base_renderers.py b/packages/python/plotly/plotly/io/_base_renderers.py index 2142d1a756..f4ccd0c0f8 100644 --- a/packages/python/plotly/plotly/io/_base_renderers.py +++ b/packages/python/plotly/plotly/io/_base_renderers.py @@ -236,7 +236,7 @@ def __init__(self, width=None, height=None, scale=None, engine="auto"): window.PlotlyConfig = {MathJaxConfig: 'local'};""" _mathjax_config = """\ -if (window.MathJax) {MathJax.Hub.Config({SVG: {font: "STIX-Web"}});}""" +if (window.MathJax && window.MathJax.Hub && window.MathJax.Hub.Config) {window.MathJax.Hub.Config({SVG: {font: "STIX-Web"}});}""" class HtmlRenderer(MimetypeRenderer): diff --git a/packages/python/plotly/plotly/io/_html.py b/packages/python/plotly/plotly/io/_html.py index d4f5d09406..b6f61facc5 100644 --- a/packages/python/plotly/plotly/io/_html.py +++ b/packages/python/plotly/plotly/io/_html.py @@ -20,7 +20,7 @@ _mathjax_config = """\ """ diff --git a/packages/python/plotly/plotly/offline/offline.py b/packages/python/plotly/plotly/offline/offline.py index 7afc79d85f..3060b67d12 100644 --- a/packages/python/plotly/plotly/offline/offline.py +++ b/packages/python/plotly/plotly/offline/offline.py @@ -190,7 +190,7 @@ def _get_jconfig(config=None): _mathjax_config = """\ """