Skip to content

Instantly share code, notes, and snippets.

@matrix-morpheus
Last active November 17, 2022 22:44
Show Gist options
  • Save matrix-morpheus/9080d5bad2386b13ff61ead0e5ada093 to your computer and use it in GitHub Desktop.
Save matrix-morpheus/9080d5bad2386b13ff61ead0e5ada093 to your computer and use it in GitHub Desktop.
adding latex support in jekyll - chirpy

how to enable mathjax in jekyll

https://rscircus.github.io/2020/02/21/latex-and-jekyll.html

https://chrisjhart.com/Creating-a-Simple-Free-Blog/

https://chirpy.cotes.page/posts/getting-started/

https://tranglc.github.io/posts/getting-started/

https://github.com/cotes2020/jekyll-theme-chirpy

https://github.com/QijingZheng/QijingZheng.github.io

http://staff.ustc.edu.cn/~zqj/posts/Numerical_TDSE/

http://staff.ustc.edu.cn/~zqj/posts/Numerical_TDSE/

https://jekyllrb.com/docs/installation/ubuntu/

https://jekyllrb.com/docs/step-by-step/01-setup/

https://igor-brishkoski.com/posts/start-your-own-blog/

https://stackoverflow.com/questions/10987992/using-mathjax-with-jekyll

https://stackoverflow.com/questions/26275645/how-to-support-latex-in-github-pages/57370526#57370526

cotes2020/jekyll-theme-chirpy#641

https://haixing-hu.github.io/programming/2013/09/20/how-to-use-mathjax-in-jekyll-generated-github-pages/

https://jekyllrb.com/docs/deployment/automated/

https://www.codecogs.com/eqnedit.php

https://stackoverflow.com/questions/35672330/how-to-use-numbered-latex-equations-using-kramdown-in-jekyll

https://candid.technology/enable-disable-javascript-microsoft-edge/

https://stackoverflow.com/questions/59141529/mathjax-equation-numbers-do-not-show-using-jekyll-on-github-pages

https://www.martinklein.co/2022/02/18/latex-in-jekyll.html

https://stackoverflow.com/questions/59141529/mathjax-equation-numbers-do-not-show-using-jekyll-on-github-pages

https://www.earthdatascience.org/workshops/intro-version-control-git/basic-git-commands/

https://www.smashingmagazine.com/2014/08/build-blog-jekyll-github-pages/

Howto setup correctly

if we follow the standard recommended way of changing the _config.yml to enable maths as below,

math: true

it does not work.!! So, dont enable it. Dont know why by enabling this, although equation work but equation numbering does not work.

instead go to the _includes/head.html and add the following line:

---
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
  <script>
  MathJax = {
    tex: {
      tags: 'ams'  // should be 'ams', 'none', or 'all'
    }
  };
  </script>

---

test with a post

add the following lines in a .md post and check if it works

---

$$
  \begin {equation} \label{diffint}
    \frac{\mathrm{d}}{\mathrm{d} x} \int e^{x}\,dx = e^{x}
  \end{equation}
$$

 $$ \begin{equation*}
   E = mc^2
  \end{equation*} $$


$$
\begin{align} 
i\hbar \frac{\partial}{\partial t} \psi(\mathbf{r}, t) &= {\cal H}(\mathbf{r};t)\psi(\mathbf{r}, t) = [\hat{T} + \hat{V}]\,\psi(\mathbf{r}, t) \label{classicalmotion1}\\
&=\left[ -\frac{\hbar^2}{2m}\nabla^2 + \hat{V}(\mathbf{r}) \right]\psi(\mathbf{r}, t) \label{classicalmotion2}\\
\end{align}
$$

---
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment