executablebooks / sphinx-exercise

A Sphinx extension for producing exercise and solution directives.
https://ebp-sphinx-exercise.readthedocs.io
MIT License
18 stars 6 forks source link

mathjax loading on per page basis causes issue for nodes containing math in reference only #40

Open mmcky opened 2 years ago

mmcky commented 2 years ago

Describe the problem

It looks like mathjax doesn't get loaded by sphinx on page that contains nodes that reference math but don't explicitly include math on that page

For example:

.. solution:: exercise-1
    :label: solution-1

    This is a solution to exercise 1

references

.. exercise:: :math:`n!` factorial
    :label: exercise-1

    Exercise 1 about :math:`n!` factorial

But will result in:

Screen Shot 2021-11-29 at 12 23 25 pm

but if you add a math role anywhere on that page it will be correctly rendered.

Link to your repository or website

No response

Steps to reproduce

  1. Have a page with solution nodes only with references to exercise nodes that contain math in the titles

The version of Python you're using

No response

Your operating system

No response

Versions of your packages

No response

Additional context

I suspect this relates to loading mathjax on a per page basis

https://github.com/sphinx-doc/sphinx/issues/9686