Dean Attali’s template is an excellent tutorial for building GitHub pages. However, it did not provide solution to show LaTex symbols, which is crusial for math and statistics teachers or math-related users. Here’s an easy way to solve this problem.

Basically, you only need add following script in your markdown file which contains LaTex inputs:

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

Note that this script should appear before any LaTex inputs in your file.

It is tedious to add this script for every md file, so we can build a _html file in the _includes fold, named mathjax.html, which includes the very script mentioned above. Then we only need add one short sentence in the md file to get everything set: {% include mathjax.html %}. No configuration in _config.yml is needed!

Yet it is still time-consuming to write the include things in every post. Here comes the final solution: change your base.html file in the _layouts folder in the template. Include the   {% include mathjax.html %} sentence into the base.html file, then everything is set and there is no need write the script again in every md file.

You can check my GitHub repo to see how this works.

See how beautiful these LaTex formulas are:

Try it out!

Xiaokang Lu

Associate Professor

Department of Social Psychology, Nankai University

Tianjin, China

xkdog@126.com