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

Use SVG math instead of png or mathjax #90

Open
certik opened this issue Aug 13, 2018 · 7 comments
Open

Use SVG math instead of png or mathjax #90

certik opened this issue Aug 13, 2018 · 7 comments

Comments

@certik
Copy link
Owner

certik commented Aug 13, 2018

I switched to SVG for math in #76. All math is vectorized and looks good in all resolutions.

@asmeurer, would you mind checking some math heavy page, say this one: https://www.theoretical-physics.net/dev/elmag/elmag.html on your retina and tell me if the equations looks good now?

Also does it load relatively quickly?

@asmeurer
Copy link

The math looks fine on a retina display. I think MathJax would still be more accessible, so maybe it would be worth having a separate build with it.

@certik
Copy link
Owner Author

certik commented Aug 14, 2018

@asmeurer thanks for checking it. The MathJax is still available, e.g., the above link becomes:

https://www.theoretical-physics.net/dev/html_mathjax/elmag/elmag.html

There are some math errors which I didn't have time to fix yet, but most equations show fine. The MathJax equations look a bit bigger (about 140% larger it seems) and also they seem to be a bit nicer: the font seems "fuller" and so it looks better.

I would prefer to have just one version, so that I can ensure that one looks good and be done with it. In terms of robustness, I really like the SVG approach. I'll see if I can make the equations look a bit better, in principle I can't see why the svg version couldn't look pretty much identical to MathJax.

@asmeurer
Copy link

That page renders instantly on my iPhone. I think Mathjax has gotten a lot faster.

@asmeurer
Copy link

I'm guessing the errors are from a preamble (like \L). Supposedly preambles are supported at least in Sphinx master now. sphinx-doc/sphinx#5230

@certik
Copy link
Owner Author

certik commented Aug 14, 2018

I tested on two different computers and an Android device and the MathJax version doesn't load immediately at all, it takes about 30s to fully load.

I think the SVG is the way to go, but I still need to improve the way it looks. I reported the problem upstream:

sphinx-doc/sphinx#5301

@asmeurer
Copy link

Well Android is known to have poor Javascript performance, but I would expect your desktop to be comparable to mine. For me in Chrome desktop it loads in a couple of seconds. In Firefox it is a little slower but still a few seconds. Maybe the difference is my internet speed (MathJax does have to download some fonts, though I imagine they are cached).

Anyway, as I said, the main advantage of MathJax is accessibility. Try loading the pages in a text based browser and you can see the difference. You can also select the math with MathJax, right click it to make it larger or show the TeX source, and so on.

@certik
Copy link
Owner Author

certik commented Aug 14, 2018

Yes, I think MathJax shows latex if you use some text based browser.

I use Firefox on a pretty fast machine desktop machine. Ok, I'll leave both SVG and mathjax in there as an option.

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

No branches or pull requests

2 participants