MathJax configuration should appear before loading MathJax itself #9878
Labels
extensions:mathematics
The `sphinx.ext.imgmath`, `sphinx.ext.jsmath`, or `sphinx.ext.mathjax` extensions
type:bug
Milestone
Describe the bug
According to the MathJax docs (see v2.7: http://docs.mathjax.org/en/v2.7-latest/configuration.html#using-in-line-configuration-options and v3.2: http://docs.mathjax.org/en/v3.2-latest/web/configuration.html#configuration-using-an-in-line-script), it is necessary to run the configuration before loading MathJax itself. In
sphinx/sphinx/ext/mathjax.py
Lines 82 to 98 in 6473141
app.add_js_file()
method for the main MathJax.js script is called before the config scripts are added; the solution to this would be to move the first part of the code here, dealing with the MathJax.js script, after the twoif
blocks which handle themathjax2_config
andmathjax3_config
.How to Reproduce
(Note that there may be a lot of "undefined label" warnings, but I do not yet understand the source of these; this is an unrelated issue.)
Expected behavior
The MathJax lines in the above html file appear as:
but should appear in the opposite order as:
Your project
https://github.com/juliangilbey/abydos.git
Screenshots
No response
OS
Linux
Python version
3.9
Sphinx version
4.2.0 (same issue occurs with 4.3.0)
Sphinx extensions
sphinx.ext.mathjax
Extra tools
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: