Skip to content

Plotly Disables Latex Rendering in HTML output of Jupyter Notebook #2300

Closed
@SafwanAhmad

Description

@SafwanAhmad

In my limited understanding of Javascript it seems like a plotly.js or an NbConvert bug.

Plotly is using the following configuration option for MathJax:
MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0

Looking at the code here and in light of the MathJax documentation here it's more of a Plotly issue IMHO than a bug in Nbconvert.

 MathJax.Hub.Queue(['Typeset', MathJax.Hub, tmpDiv.node()], function() {
        var glyphDefs = d3.select('body').select('#MathJax_SVG_glyphs');

        if(tmpDiv.select('.MathJax_SVG').empty() || !tmpDiv.select('svg').node()) {
            Lib.log('There was an error in the tex syntax.', _texString);
            _callback();
        }
        else {
            var svgBBox = tmpDiv.select('svg').node().getBoundingClientRect();
            _callback(tmpDiv.select('.MathJax_SVG'), glyphDefs, svgBBox);
        }

        tmpDiv.remove();
    });

Only Latex inside a particular DIV element is queued for Mathjax rendering by Plotly. This makes sense but combined with the configuration above, perhaps, disables automatic rendering in the rest of the page. Nbconvert's HTML seems to rely on this document-wide auto rendering.

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