Support Latex in Github Page to show math equations

2 min read

Recently, I started to use Github Page to write a summary on a course that I followed on Edx about Statistics. I am using Jekyll to create static websites. In order to insert lots of math equations, I am using Mathjax.

You can add these scripts in the head to import Mathjax:

<script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script>
<script type="text/x-mathjax-config">
	MathJax.Hub.Config({
		tex2jax: {
			skipTags: ['script', 'noscript', 'style', 'textarea', 'pre'],
			inlineMath: [['$','$']]
		}
	});
</script>

By doing so, you can show most of the math functions correctly, except for some inlineMath: math between two $ signs.

what you want to showwhat web shows
x\vert x \vertseperation of table column
{1}\{1\}{1}\{1\} (no ”{}”)
(X)_0+X1(X)\_{0}+X_{1}(X)0+X1(X)_{0}+X_{1} (<em> tags)

Solutions:

what you want to showWhat you should enter
``
{\\{
}\\}
)_ (underscore))\_ or add a space between ) and _
_( (underscore)\_\( or add a space between _ and (
}_ (underscore)}\_ or add a space between } and _
_{ (underscore)\_{ or add a space between _ and {
more than 1 * in the paragraphe\*
\Leftrightarrow\Leftrightarrow (not \Harr)
argmax\arg\max\arg\max (not \argmax)
2 { together{ { (add a space between them)