My PhD field involves a lot of statistic, so I usually need to write math equations both by hands and, more convenient, on the internet. This is my solution.

Use MathJax for Jekyll

  • insert the code in the _layouts/default.html
<script type="text/x-mathjax-config">
  tex2jax: {
    inlineMath: [['$','$'], ['\\(','\\)']],
    processEscapes: true
<script src="" type="text/javascript"></script>

The first part is used to enable inline equation.

Use LaTex to write equations

I found LaTex/Mathematics is wildly used to write equations on the website, such as rmarkdown.

For example, use $$mean = \frac{\displaystyle\sum_{i=1}^{n} x_{i}}{n}$$ to write

\[mean = \frac{\displaystyle\sum_{i=1}^{n} x_{i}}{n}\]

Use k_{n+1} = n^2 + k_n^2 - k_{n-1} to write

\[k_{n+1} = n^2 + k_n^2 - k_{n-1}\]