Closed atharva-2001 closed 3 years ago
Can you please provide a minimal reproducible example?
Sure, with nbsphinx_assume_equations = False
in conf.py
:
latex in labels and cells
latex only in labels
no latex at all
see the conf.py
file used to make these here
Without any changes in conf.py (nbsphinx_assume_equations = True
, default value)
latex in labels and cells
labels only in latex
no latex at all
see the conf.py
file used to make these here
Thanks for the examples. The aren't really minimal, though.
Any updates on this? @mgeier
Not from my side. I'm waiting for a minimal example for me to reproduce and investigate the problem.
Could you please check if this works?
html file with links to files built with nbsphinx_assume_equations = False
in conf.py
html file with links to files built with nbsphinx_assume_equations = True
in conf.py
link to the repository
I was not sure what was needed, please let me know if I can do anything more.
Thanks, this is still more complicated than necessary, but I can work with it!
IMHO, this should just work regardless of the value of nbsphinx_assume_equations
.
The problem (or rather one of the problems) seems to be that plotly inserts this code into the HTML page:
if (window.MathJax) {MathJax.Hub.Config({SVG: {font: "STIX-Web"}});}
... and Sphinx defines window.MathJax
because nbsphinx
sets some default values for mathjax3_config
.
Anyone who uses mathjax3_config
will have the same problem, even if they don't use nbsphinx
.
You should make another minimal example without nbsphinx
that uses mathjax3_config
, for example
mathjax3_config = {'tex': {'processEscapes': True}}
(EDIT: fixed dict
syntax)
If this causes the same error (which I think it does), you can create an issue at the plotly issue tracker.
Once that is fixed, you can try it with nbsphinx
again and we can continue here.
In the meantime, you can work around this problem by either downgrading Sphinx to below version 4 or by manually switching to MathJax 2 like this:
mathjax_path = 'https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js?config=TeX-AMS-MML_HTMLorMML'
mathjax2_config = {
'tex2jax': {
'inlineMath': [['$', '$'], ['\\(', '\\)']],
'processEscapes': True,
'ignoreClass': 'document',
'processClass': 'math|output_area',
}
}
Thank you very much! I will make an issue in plotly soon.
In the meantime, https://github.com/plotly/plotly.js/pull/6073 has been merged.
Maybe it works now with MathJax 3?
I am trying to plot Plotly graphs inside sphinx documentation, but it seems MathJax is causing some issues. In the documentation, MathJax v3 is being loaded, which causes errors because
MathJax.hub
doesn't exist anymore.MathJax v3 should work with plotly because
is also present in the documentation (see here as well please)
However, if I set
nbsphinx_assume_equations = False
inconf.py
and remove Latex in cells, I am able to see the figure, because MathJax is no longer loaded.Could someone please tell me how to solve this?