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 Disables Latex Rendering in HTML output of Jupyter Notebook

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
akhmerovcommented, Aug 21, 2018

@anil-ganti compiling a bunch of markdown files with inline code into a static website. Business logic here

0reactions
jonmmeasecommented, Nov 3, 2018

This has been addressed in plotly.js 1.42 by #2994. You’ll need to set window.PlotlyConfig = {MathJaxConfig: 'local'} before loading plotly.js. See https://github.com/plotly/plotly.js/blob/master/dist/README.md#to-support-mathjax for more information. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

LaTeX-text does not work at all in plotly.offline?
I tried the following code from the plotly homepage and only changed one word … import plotly.plotly as py - > new-> import...
Read more >
In plotly (python API): How to enable latex rendering in offline ...
I have both LaTex installation and a local installation of MathJax. ipython-notebook · jupyter · plotly · Share.
Read more >
Plots + PlotlyJS + LaTeX - General Usage - Julia Discourse
Plotly needs to load mathjax to render LaTeX strings, therefore passing extra keywords with extra_kwargs = :plot is implemented. With that it is ......
Read more >
1581899 – Math/Latex fails to render properly in Jupyter
Bug 1581899 - Math/Latex fails to render properly in Jupyter ... NotebookApp] 404 GET /static/components/MathJax/fonts/HTML-CSS/STIX-Web/ ...
Read more >
Jupyter - Visual Studio Marketplace
Extension for Visual Studio Code - Jupyter notebook support, ... to provide renderers for MIME types such as latex, plotly, vega, etc.
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