-
Notifications
You must be signed in to change notification settings - Fork 150
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 KaTeX instead of MathJax #97
Comments
I think that this issue is not an issue because you can switch the math equation render between KaTeX and MathJax by modifying the import script resource. Besides, there are some equations not parse in KaTeX but MathJax. |
A quick search for "mathjax" in this repo shows that MathJax is embedded in this theme's Go-HTML and SCSS template. I would like to know how you can "switch the math equation renderer between KaTeX and MathJax" without getting deep into the code.
Mind giving an example? I only know that AMScd is not (and won't be) supported, and that it lacks support for equation auto-referencing. However, MathJax's support for AMScd is so primitive that professional mathematicians would hardly use them. |
Take a look in this file: <script async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script> It include a js file to render with MathJax. If you want to render with KaTeX, we can get the code from its offical site: <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.10.0/dist/katex.css" integrity="sha384-xNwWFq3SIvM4dq/1RUyWumk8nj/0KFg4TOnNcfzUU4X2gNn3WoRML69gO7waf3xh" crossorigin="anonymous">
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.10.0/dist/katex.js" integrity="sha384-UP7zD+aGyuDvxWQEDSRYcvoTxJSD82C6VvuEBktJZGo25CVhDstY9sCDHvyceo9L" crossorigin="anonymous"></script> Well, it seems that many rendering issues are done. But can we use something below in KaTeX?
|
Thanks for your suggestion, but why don't we consider incorporating that into the project through a PR/a commit? In fact, many Hugo themes have chosen KaTeX instead of MathJax, such as BH, Finite, Minos, etc. This has been documented in Macros section of supported functions. $$\def\water{\rm H_2O} \rm 2\, H_2 + O_2 \to 2\, \water$$ |
@VincentTam @Hsins Thanks for all of your suggestions, I haven't heard KaTeX before, but I will consider supporting KaTeX after an investigation. Maybe KaTeX and MathJax can be both supported through a switcher in |
KaTeX renders math much quicker than MathJax. To get an idea of how slow the later can be, you may try Math Meta.SE's MathJax tutorial.
You may consult, for example, davidar/TeX.js#9 for more info. Despite the closing of this linked issue, KaTeX has eventually been implemented in that project.
Therefore, many Hugo themes ship with KaTeX, notably Beautiful Hugo.
The text was updated successfully, but these errors were encountered: