Skip to content

Plotly cannot be loaded if Mathjax v3 is already loaded #4563

Closed
@Bertbk

Description

@Bertbk

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsomething broken

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions