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 the include_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.
Is there any way to use the same MathJax profile in Plotly.js as in Sphinx?
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
_staticfolder,plotly.offline.plotwith theinclude_plotlyjsflag set to False using the.. raw:: htmldirective,scriptreference to Plotly.js into each HTML file's head element using the following code snipped in Sphinx'_templatesfolder:With that strategy the generated html file include the following
scripttags:<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.TeX-AMS-MML_HTMLorMMLprofile.Is there any way to use the same MathJax profile in Plotly.js as in Sphinx?