question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MathJax does not work straight away with instant loading

See original GitHub issue

I’ve found a bug and checked that …

  • … the problem doesn’t occur with the default MkDocs template
  • … the problem is not in any of my customizations (CSS, JS, template)
  • … the documentation does not mention anything about my problem
  • … there are no open or closed issues that are related to my problem

Description

As the title suggests.

Expected behavior

When instant loading is enabled, MathJax is expected to typeset the content on page changes.

Actual behavior

Formulas won’t be rendered unless MathJax.typesetPromise() is manually called or the page is refreshed.

Steps to reproduce the bug

  1. Follow the guide on creating a new site, enabling instant loading, and enabling MathJax.
  2. Create a new page and write random formulas.
  3. Preview and click on the new page to see if formulas are rendered.

Package versions

  • Python: 3.9.2
  • MkDocs: 1.1.2
  • Material: 7.1.0

Project configuration

site_name: My Docs

theme:
  name: material
  features:
    - navigation.instant

markdown_extensions:
  - pymdownx.arithmatex:
      generic: true

extra_javascript:
  - javascripts/config.js
  - https://polyfill.io/v3/polyfill.min.js?features=es6
  - https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js

System information

  • OS: macOS 11.2.3, Ubuntu 20.04

  • Browser: Chrome 89.0.4389.114

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
squidfunkcommented, Apr 9, 2021

Thanks for reporting. We might need to adjust the configuration (after window.MathJax and add:

document$.subscribe(() => {
  MathJax.typesetPromise()
})

This should trigger after the new document content was injected.

0reactions
squidfunkcommented, Apr 10, 2021

Added in 7761cad09.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Mathjax not working - Mathematics Meta - Stack Exchange
There is a connection timeout when loading things from cdn.mathjax.org. After a long time, the page is rendered without rendering the formulas.
Read more >
Loading and Configuring MathJax
Usually, MathJax loads its components only when they are needed, but each component will require a separate file to be loaded, and that...
Read more >
MathJax sometimes fails to load math equation in Android
I have put MathJax into my project to display math equations on my app, it appears to be working, however, on some situations...
Read more >
Lazy load mathjax - Google Groups
I liked the idea of mathjax lazyload. I tried and it is fast. The only problem is the equations are rendering when in...
Read more >
Loading and Configuring MathJax
If you don't load an explicit configuration file, you will need to include an in-line configuration block in order to tell MathJax how...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found