Plotly.js: Plotly cannot be loaded if Mathjax v3 is already loaded

Created on 9 Feb 2020  路  2Comments  路  Source: plotly/plotly.js

Since MathJax v3, Mathjax.Hub does not exist anymore. This makes impossible to load PlotlyJS if Mathjax v3 has already been loaded. I get the following error:

TypeError: MathJax.Hub is undefined

I believe the error comes from these lines plotly.js:

module.exports = function() {
    if(typeof MathJax !== 'undefined') {
        var globalConfig = (window.PlotlyConfig || {}).MathJaxConfig !== 'local';

        if(globalConfig) {
            MathJax.Hub.Config({
                messageStyle: 'none',
                skipStartupTypeset: true,
                displayAlign: 'left',
                tex2jax: {
                    inlineMath: [['$', '$'], ['\\(', '\\)']]
                }
            });
            MathJax.Hub.Configured();
        }
    }
};

A check on MathJax version should probably be made here to use MathJax.Hub or not?

Here is a short example where plotly failed to be loaded: https://codepen.io/bthierry/pen/PoqwXzm

Many thanks!

bug

Most helpful comment

MathJax v3 and plotly.js can be loaded together as long as the following is set before loading Plotly:

window.PlotlyConfig = {MathJaxConfig: 'local'}

For reference:
https://github.com/plotly/plotly.js/blob/master/dist/README.md#to-support-mathjax

All 2 comments

MathJax v3 and plotly.js can be loaded together as long as the following is set before loading Plotly:

window.PlotlyConfig = {MathJaxConfig: 'local'}

For reference:
https://github.com/plotly/plotly.js/blob/master/dist/README.md#to-support-mathjax

Is there any advance on this bug? I would like to load Mathjax v3 in my project, but unfortunately it does work with plotly at the moment. Plotly is using the old Mathjax.Hub object.

Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

etpinard picture etpinard  路  3Comments

WG- picture WG-  路  3Comments

emanuelsetitinger picture emanuelsetitinger  路  3Comments

chriddyp picture chriddyp  路  3Comments

jonmmease picture jonmmease  路  3Comments