mathjax / MathJax-src

MathJax source code for version 3 and beyond
https://www.mathjax.org/
Apache License 2.0
2.07k stars 207 forks source link

How MathJax works ? #709

Open Lagrida opened 3 years ago

Lagrida commented 3 years ago

Hi, I have a question and suggestion.

First i thank all the work team for that great job.

My question : How MathJax work ? if for example i have $\sum_{k=1}^{n} k$ in my page how mathJax render it to a mathematic formula. (I see the dev of 2. versions and the use of images, but i can't figure it out how versions 3. work)

My Suggestion : MathJax version 3 transform all Latex codes to mathematic formulas in the same time, then if we have a heavy page with a lot of LaTeX codes, then the page take lot of time to display mathematic formulas, i suggest to start rendring formulas from the top to bottom.

applecuckoo commented 2 years ago

Hi there @Lagrida! MathJax v3 uses fonts to pop math onto your screen. If you need something faster then I suggest using KaTeX. It's much faster and great if you want to focus on efficientcy.

dpvc commented 1 year ago

My Suggestion : MathJax version 3 transform all Latex codes to mathematic formulas in the same time, then if we have a heavy page with a lot of LaTeX codes, then the page take lot of time to display mathematic formulas, i suggest to start rendring formulas from the top to bottom.

MathJax v3 has a lazy-typesetting extension that typesets only the math that is currently showing, and typesets additional math when it comes into the viewport. That should make pages with lots of mathematics render more quickly. See

https://github.com/mathjax/MathJax-src/releases/tag/3.2.0#lazy

for more information. Version 2 did use the approach you suggest, but it has some drawbacks as well. The lazy typesetting feature seems to be the best solution at this point.

Davide