Skip to content

Mathjax.Hub.config used for plotly 5.7.0 #3696

Description

@AakashGfude

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?

Activity

  1. nicolaskruchten commented on Apr 28, 2022

    @nicolaskruchten
    Contributor

    @alexcjohnson @archmoj can you take a look plz?

  2. archmoj commented on Apr 28, 2022

    @archmoj
    Contributor

    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"}});}
  3. alexcjohnson commented on Apr 28, 2022

    @alexcjohnson
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions