Closed
Description
First of all, thanks for the great set of Plotly libraries!
I would like to embed plots into a Sphinx documentation which makes use of LaTeX via its sphinx.ext.mathjax extension. I do not want to embed the plots as images like jpg in order to keep them interactive.
My strategy to achieve that is to
- put plotly-latest.min.js into Sphinx'
_static
folder, - embed "ready to use" HTML div elements created in Python via
plotly.offline.plot
with theinclude_plotlyjs
flag set to False using the.. raw:: html
directive, - Add a
script
reference to Plotly.js into each HTML file's head element using the following code snipped in Sphinx'_templates
folder:
{% extends "!layout.html" %}
{%- block extrahead %}
<script type="text/javascript" src="_static/plotly-latest.min.js"></script>
{% endblock %}
With that strategy the generated html file include the following script
tags:
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7./MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
,<script type="text/javascript" src="_static/plotly-latest.min.js"></script>
.
While Plotly's plots are shown as expected, LaTeX embeddings using the :math:
directive do not render anymore.
- The reason seems to be Sphinx' usage of MathJax
TeX-AMS-MML_HTMLorMML
profile. - The problem also seems to be related to an issue with Jupyter notebooks Plotly Disables Latex Rendering in HTML output of Jupyter Notebook #2300.
Is there any way to use the same MathJax profile in Plotly.js as in Sphinx?
Metadata
Metadata
Assignees
Labels
No labels