There are only two steps to add functionality of showing math formular in Jekyll. MathJax is the engine to achive it.

- open the file
`default.html`

in the folder`_layouts`

- add the following codes before `

1

2

3

4

5

<script type="text/x-mathjax-config">

MathJax.Hub.Config({tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}});

</script>

<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>

<link href="/assets/css/syntax.css" rel="stylesheet" >

## Test:

Add the following codes to your posts to test whether MathJax is working.

the

**inline**mode**Code:**1

2In physics, the mass-energy equivalence is stated

by the equation $E=mc^2$, discovered in 1905 by Albert Einstein.**Desired result:**In physics, the mass-energy equivalence is stated

by the equation $E=mc^2$, discovered in 1905 by Albert Einstein.the

**display**mode**Code:**1

2

3

4

5

6

7

8

9

10The mass-energy equivalence is described by the famous equation

$$E=mc^2$$

discovered in 1905 by Albert Einstein.

In natural units ($c$ = 1), the formula expresses the identity

\begin{equation}

E=m

\end{equation}**Desired result:**The mass-energy equivalence is described by the famous equation

$$E=mc^2$$

discovered in 1905 by Albert Einstein.

In natural units ($c$ = 1), the formula expresses the identity\begin{equation}

E=m

\end{equation}

### Related posts:

This content is supported by readers like you.