Use MathJax to write Equations in Jekyll blogs
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">
MathJax.Hub.Config({
tex2jax: {
inlineMath: [['$','$'], ['\\(','\\)']],
processEscapes: true
}
});
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" 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
Use k_{n+1} = n^2 + k_n^2 - k_{n-1}
to write