alshedivat / al-folio

A beautiful, simple, clean, and responsive Jekyll theme for academics
https://alshedivat.github.io/al-folio/
MIT License
11.13k stars 11.2k forks source link

KaTeX Equations not rendering #115

Closed ajrheng closed 4 years ago

ajrheng commented 4 years ago

Acknowledge the following

Describe the bug Math is not rendering properly with KaTeX. All I did was fork al-folio's master and deploy it locally with bundle exec jekyll serve, and on localhost equations do not render even for the example math blog post. I've took the liberty to inspect the actual HTML files generated and found that the surrounding tags like

<script type="math/tex; mode=display"> ... </script>

which should be auto generated around math text delineated by $$ .. $$ was not generated. For eg, on my blog post's HTML file the summation equation in the example math post is just

\[\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)\]

while in the original repo's it correctly has the tags

<script type="math/tex; mode=display">\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)</script>

Is there any reason why jekyll/katex for me is not doing the auto generation? enable_katex in _config.yml is set to true. Thanks so much!

Edit: Issue looks like katex.js script in assets/js is not being called at compile time. I don't know why though.

alshedivat commented 4 years ago

Thanks for pointing out this bug. I've just switched al-folio from KaTeX to MathJax 3 which has a significantly improved loading and rendering speed compared to its previous version. In addition, MathJax is less painful to integrate and maintain.

After switching to MathJax 3, the bug should be fixed. If it persists on your end, please feel free to reopen the issue.

christineymshen commented 3 years ago

I have a similar issue. I have done some customization with my set up, so I haven't incorporated the latest version yet. And today I found that KaTeX doensn't render just as described above. I wonder whether there's any way to make it work if I'm reluctant to git rebase to the latest version ... Thanks!