Skip to content

Mathjax.Hub.config used for plotly 5.7.0 #3696

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
AakashGfude opened this issue Apr 28, 2022 · 3 comments
Closed

Mathjax.Hub.config used for plotly 5.7.0 #3696

AakashGfude opened this issue Apr 28, 2022 · 3 comments

Comments

@AakashGfude
Copy link

Could not find a duplicate of this issue anywhere so, not sure if anyone else had an issue like this, but when using plotly in a sphinx project and creating HTML pages, I get the following js code included in my HTML page:

<div class="output text_html">        <script type="text/javascript">
        window.PlotlyConfig = {MathJaxConfig: 'local'};
        if (window.MathJax) {MathJax.Hub.Config({SVG: {font: "STIX-Web"}});}
        if (typeof require !== 'undefined') {
        require.undef("plotly");
        define('plotly', function(require, exports, module) {
            /**
* plotly.js v2.11.1
.....

When I have a math block in the same page as a plotly graph, then window.MathJax is defined and MathJax.Hub.Config gets called. Which throws an error as I am using mathjax v3, which is supported by v5.7.0.

The line MathJax.Hub.Config({SVG: {font: "STIX-Web"}}) I see written in a bunch of files like:
https://github.com/plotly/plotly.py/blob/master/packages/python/plotly/plotly/io/_base_renderers.py#L240

Is it a legit issue?

@nicolaskruchten
Copy link
Contributor

@alexcjohnson @archmoj can you take a look plz?

@archmoj
Copy link
Contributor

archmoj commented Apr 28, 2022

You must check the version of MathJax to be v2 e.g. here

if (window.MathJax && (window.MathJax.version || '').split('.')[0] === '2') {MathJax.Hub.Config({SVG: {font: "STIX-Web"}});}

@alexcjohnson
Copy link
Collaborator

@archmoj let's add this to the queue for after the coming plotly.js release, see if you can figure out the equivalent command to switch to when we detect v3.

@AakashGfude thanks for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants