Open
Description
Issue Summary
I need to reset MathJax instance in order to re-render the page with same instance, however I tried lot ways, it always ends up some issues.
For version 2, I use this workaround to do the reset job:
<script src="//cdn.jsdelivr.net/npm/mathjax@2/MathJax.js?config=TeX-AMS_CHTML"></script>
MathJax.Hub.Queue(
['PreProcess', MathJax.Hub],
['resetEquationNumbers', MathJax.InputJax.TeX],
['PreProcess', MathJax.Hub],
['Reprocess', MathJax.Hub]
);
It works fine for re-rendering page, but sometimes I will get:
Uncaught Error: Can't make callback from given data
USING http://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js?config=TeX-AMS_CHTML:19
Push http://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js?config=TeX-AMS_CHTML:19
Queue http://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js?config=TeX-AMS_CHTML:19
Related to issue#2935
For version 3, already tried following reset functions:
MathJax.startup.document.state();
MathJax.texReset();
MathJax.typesetClear()
But it will end up to:
Label 'eq:m1' multiply defined
For the temporary workaround, I can re-render labels without getting any error by:
<script src="//cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
MathJax.startup.output.clearCache();
MathJax.startup.getComponents();
If this will be ok?
But if I change to use svg on Chrome 105(without change anything else):
<script src="//cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-svg.js"></script>
Will always get:
tex-mml-svg.js:formatted:39500 Error: MathJax retry
at e.retryAfter (tex-mml-svg.js:formatted:41256:25)
at L (tex-mml-svg.js:formatted:20310:110)
at c (tex-mml-svg.js:formatted:16727:31)
at e.parse (tex-mml-svg.js:formatted:14673:31)
at t.parse (tex-mml-svg.js:formatted:12635:50)
at t.parse (tex-mml-svg.js:formatted:15329:63)
at t.controlSequence (tex-mml-svg.js:formatted:13186:23)
at t.parse (tex-mml-svg.js:formatted:14507:39)
at t.parse (tex-mml-svg.js:formatted:12635:50)
at t.parse (tex-mml-svg.js:formatted:15329:63)
Steps to Reproduce:
- Clone docsify-latex, enter into repo folder
- Modify
docs/index.md
with following text:
When $a \ne 0$, there are two solutions to $ax^2 + bx + c = 0$ and they are $\ref{eq:m1}$
$$
x = {-b \pm \sqrt{b^2-4ac} \over 2a}.\tag{M1}\label{eq:m1}
$$
This equation $\eqref{eq:m1}$ is very important.
- Click to switch to
/#/example
page, then switch back to/#/
- Start the server to review via:
cd docs && python -m SimpleHTTPServer 3000
or
npm i docsify-cli -g
docsify serve docs
- You can see the result
For version 2:
- Replace MathJax v3 script to v2, do same steps as v3.
Technical details:
- MathJax Version: 2,7.9, 3.2.2
- Client OS: Windows 10
- Browser: Firefox
Supporting information:
Check this commit:
scruel/docsify-latex@136fe8c#diff-ee52eacc98a34424ac3b8149882469d47619cc1e6c05e00d86bbba97c11d714d