Adding MathJax to a GitHub Pages Jekyll Blog
This post covers adding MathJax support to a GitHub Pages Jekyll blog.
Software Versions
$ date -u "+%Y-%m-%d %H:%M:%S +0000"
2016-08-21 23:41:54 +0000
$ uname -vm
FreeBSD 11.0-ALPHA6 #0 r302384: Thu Jul 7 22:40:47 JST 2016 root@mirage.sennue.com:/usr/obj/usr/src/sys/MIRAGE_KERNEL amd64
$ ruby --version
ruby 2.2.5p319 (2016-04-26 revision 54774) [amd64-freebsd11]
$ jekyll --version
jekyll 3.0.1Instructions
Add the following code to _includes/mathjax.html.
_includes/mathjax.html.
{% if page.mathjax %}
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
processEscapes: true
}
});
</script>
<script
type="text/javascript"
charset="utf-8"
src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"
>
</script>
<script
type="text/javascript"
charset="utf-8"
src="https://vincenttam.github.io/javascripts/MathJaxLocal.js"
>
</script>
{% endif %}Add the following line to the header in _layouts/post.html or anywhere else you want to use MathJax.
_layouts/post.html partial listing
{% include mathjax.html %}Add the following line to the YAML front matter of a post to enable MathJax on a post by post basis.
mathjax: trueFor example, the front matter of this post looks like this. Note that Disqus comments have been added with the same strategy.
---
layout: post
mathjax: true
comments: true
title: "Adding MathJax to a GitHub Pages Jekyll Blog"
date: 2016-08-21 23:41:54 +0000
categories: github jekyll
---If all goes well, you should be able to use MathJax inline and display modes. Note that the MathJax dynamic preview can be useful when formatting complex equations.
In N-dimensional simplex noise, the squared kernel summation radius $r^2$ is $\frac 1 2$
for all values of N. This is because the edge length of the N-simplex $s = \sqrt {\frac {N} {N + 1}}$
divides out of the N-simplex height $h = s \sqrt {\frac {N + 1} {2N}}$.
The kernel summation radius $r$ is equal to the N-simplex height $h$.
$$ r = h = \sqrt{\frac {1} {2}} = \sqrt{\frac {N} {N+1}} \sqrt{\frac {N+1} {2N}} $$In N-dimensional simplex noise, the squared kernel summation radius $r^2$ is $\frac 1 2$ for all values of N. This is because the edge length of the N-simplex $s = \sqrt {\frac {N} {N + 1}}$ divides out of the N-simplex height $h = s \sqrt {\frac {N + 1} {2N}}$. The kernel summation radius $r$ is equal to the N-simplex height $h$.
\[r = h = \sqrt{\frac {1} {2}} = \sqrt{\frac {N} {N+1}} \sqrt{\frac {N+1} {2N}} \tag{1}\]Equations
This section collects the 1 display equations of the article in the order they appear, each under its number and reproduced exactly as it stands in the text. A title in bold names an established result, and a title in italics beginning with the word Bespoke names a construction made for this analysis. Of the 1, 1 are established and 0 are bespoke. All lengths are dimensionless and measured in the unit grid of N-dimensional simplex noise, in which the simplex edge length depends on the dimension N.
Equation 1, Kernel Summation Radius of Simplex Noise. The height of a regular N-simplex is its edge length multiplied by $\sqrt{(N+1)/2N}$, so with the simplex noise edge length $\sqrt{N/(N+1)}$ the dimension cancels and the kernel radius is $\sqrt{1/2}$ for every $N$.
\[r = h = \sqrt{\frac {1} {2}} = \sqrt{\frac {N} {N+1}} \sqrt{\frac {N+1} {2N}} \tag{1}\]Notation
- $r$, the kernel summation radius of simplex noise
- $h$, the height of the N-simplex
- $N$, the number of dimensions
References
Primary Sources, Non-Peer-Reviewed
- “Front Matter.” 2016. Jekyll • Simple, blog-aware, static sites. Accessed October 25, 2026. http://jekyllrb.com/docs/frontmatter/
- “GitHub Pages.” n.d. pages.github.com. Accessed October 25, 2026. https://pages.github.com
- “Jekyll.” n.d. jekyllrb.com. Accessed October 25, 2026. https://jekyllrb.com
Commercial Sources
- “Disqus.” n.d. Accessed October 25, 2026. https://disqus.com
General Sources
- “Dynamic Preview of Textarea with MathJax Content.” n.d. Accessed October 25, 2026. https://cdn.mathjax.org/mathjax/latest/test/sample-dynamic-2.html
- “Loading and Configuring MathJax.” n.d. Accessed October 25, 2026. http://docs.mathjax.org/en/latest/configuration.html
- “MathJax.” n.d. Accessed October 25, 2026. https://www.mathjax.org
- “Mathjax Inline Mode Not Rendering: TeX.” n.d. Accessed October 25, 2026. http://tex.stackexchange.com/questions/27633/mathjax-inline-mode-not-rendering
- “MathJax, Local Configuration File (Blog Post).” n.d. Accessed October 25, 2026. https://vincenttam.github.io/blog/2014/11/09/mathjax-local-configuration-file/
- “Using MathJax on a Github Page?” n.d. Stack Overflow. Accessed October 25, 2026. http://stackoverflow.com/questions/34347818/using-mathjax-on-a-github-page
Related Posts
- Sechter, Brendan. 2016. “Adding Disqus to a Jekyll Blog.” Brendan A R Sechter’s Development Blog, February 14. https://sgeos.github.io/jekyll/disqus/2016/02/14/adding-disqus-to-a-jekyll-blog.html