question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Plotly cannot be loaded if Mathjax v3 is already loaded

See original GitHub issue

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!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:12
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
glinskyccommented, Jun 20, 2020

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

1reaction
akhmerovcommented, Jan 3, 2022

Thanks for letting me know. Setting up a dev environment is a bit too much work for me, so I’m good on testing for now. I did give feedback though 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Plotly library interferes with MathJax - Plotly Community Forum
…but if Plotly is loaded after MathJax, MathJax stops working. I have no idea why, but I'm glad I found a workaround. I...
Read more >
Using mathjax with anvil
I have placed the CDN link to MathJax in the Native Library: ... Plotly cannot be loaded if Mathjax v3 is already loaded....
Read more >
python - Unable to export plotly images to png with Kaleido
1) and an older version (4.14.3), but I've got the same problem. python -m pip install plotly. kaleido is the latest version (0.2....
Read more >
Loading and Configuring MathJax
Version 3 is now the current version of MathJax. This document is for version 2. Loading and Configuring MathJax¶. You load MathJax into...
Read more >
plotly package — 5.11.0 documentation - Plotly Help Center
If True, the trace will not be added to subplots that don't already have traces ... Specifies how the plotly.js library is included/loaded...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found