How to use MathJax in Jekyll generated Github pages

It’s really simple actually!
Thanks to this article:
https://haixing-hu.github.io/programming/2013/09/20/how-to-use-mathjax-in-jekyll-generated-github-pages/

And this article about changing source of MathJax: https://www.linpx.com/p/front-end-integration-mathjaxjs-configuration.html

Also the official docs:
Using MathJax from a Content Delivery Network (CDN)

TeX Input Processor Options

Automatic Equation Numbering


Latex math symbol reference

maths-symbols


Some notes about MathJax in Jekyll

  1. The inline formula is between $ ... $.
  2. The display formula is between \$\$ ... \$\$ (It should be $$ ... $$ but markdown will confuse).
  3. You can use the math envrionment directly, for example:
    \begin{equation}...\end{equation} or \begin{align}...\end{align} for numbered equation,
    \begin{equation\*}...\end{equation\*} or \begin{align\*}...\end{align\*} for not numbered equation.
  4. Whenever in the inline math or display math, the star character '*' must be escaped, use '\*' instead.
  5. In the multi-lines display math, the line break symbol double-backslash '\\' should be escaped, i.e., use four backslash '\\\\'.
  6. If you found error while typeseting math formula, try to escape some special characters.

Little test

Let’s test some inline math $x$, $y$, $x_1$, $y_1$.

Now a inline math with special character: $\psi\rangle$, $x’$, $x^*$.

1 $x+y=z$

2
$x+y=z$

3

[ x+y=z ]

4

$$ x+y=z $$

5

$$ \begin{align} x+y=z x+y=z \end{align} $$

6

$$ \begin{align*} x+y=z
x+y=z \end{align*} $$

7

$$ \begin{equation} x+y=z
x+y=z \end{equation} $$

8

$$ \begin{equation*} x+y=z \
x+y=z \end{equation*} $$