Plotly Disables Latex Rendering in HTML output of Jupyter Notebook
See original GitHub issueIn 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:
- Created 6 years ago
- Comments:6 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@anil-ganti compiling a bunch of markdown files with inline code into a static website. Business logic here
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!