Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change math renderer to Common HTML #1174

Closed
dennissxz opened this issue Jan 12, 2021 · 3 comments
Closed

Change math renderer to Common HTML #1174

dennissxz opened this issue Jan 12, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@dennissxz
Copy link

By default the math renderer is HTML-CSS.

Can I set it to Common HTML?

@dennissxz dennissxz added the enhancement New feature or request label Jan 12, 2021
@dennissxz
Copy link
Author

dennissxz commented Jan 14, 2021

Solved!

Short answer:
add the following to _config.yml

sphinx:
  config:
    mathjax_path: https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js

Long answer:

There are many MathJax configurations, and in my case Jupyter Book uses TeX-AMS-MML_HTMLorMML by default. I found this from the HTML source code in _build/html:

<script async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>

And the MathJax documentation says TeX-AMS-MML_HTMLorMML will output HTML-CSS.

So just pick a configuration from the list that outputs CommonHTML, such as Tex-MML-CHTML, and add it to the _config.yml file.

sphinx:
  config:
    mathjax_path: https://cdn.jsdelivr.net/npm/mathjax@3/es5/[configuration-name].js

@choldgraf
Copy link
Member

Nice solve! Any interest in adding a short section on "manual mathjax configuration" to the docs here: https://jupyterbook.org/advanced/sphinx.html#manual-sphinx-configuration ? :-)

@chrisjsewell
Copy link
Member

Yeh interesting about the CommonHTML. When considering customisation, I would also note a related issue #963

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants