Skip to content

November 30, 2019

Support LaTeX in GitHub Pages for Math Equations

How to fix common LaTeX rendering issues in GitHub Pages with MathJax, including inline math escaping for pipes, braces, and underscores

By flpvvvv 2 min read Github Page Bug

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
seperation of table column
(no ”{}”)
(<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 (not \Harr)
\arg\max (not \argmax)
2 { together{ { (add a space between them)