MathJax in Jekyll
I found this to be the simplest way to integrate mathjax into Jekyll. This assumes you are using Kramdown as your markdown renderer, and your _config.yml contains the line markdown: kramdown
Here is the process:
- Create an
_includesdirectory in your root Jekyll directory - Create a file called
mathjax.htmlinside it, and put the following inside the file
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ extensions: [ "MathMenu.js", "MathZoom.js", "AssistiveMML.js", "a11y/accessibility-menu.js" ], jax: ["input/TeX", "output/CommonHTML"], TeX: { extensions: [ "AMSmath.js", "AMSsymbols.js", "noErrors.js", "noUndefined.js", ] } }); </script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js"> </script> - That’s it! When you’re creating a new page, just put this template tag at the top of your page
{% include mathjax.html %} - You can now use the kramdown $$ syntax
$$ \begin{align*} & \phi(x,y) = \phi \left(\sum_{i=1}^n x_ie_i, \sum_{j=1}^n y_je_j \right) = \sum_{i=1}^n \sum_{j=1}^n x_i y_j \phi(e_i, e_j) = \\ & (x_1, \ldots, x_n) \left( \begin{array}{ccc} \phi(e_1, e_1) & \cdots & \phi(e_1, e_n) \\ \vdots & \ddots & \vdots \\ \phi(e_n, e_1) & \cdots & \phi(e_n, e_n) \end{array} \right) \left( \begin{array}{c} y_1 \\ \vdots \\ y_n \end{array} \right) \end{align*} $$\(\begin{align*} & \phi(x,y) = \phi \left(\sum_{i=1}^n x_ie_i, \sum_{j=1}^n y_je_j \right) = \sum_{i=1}^n \sum_{j=1}^n x_i y_j \phi(e_i, e_j) = \\ & (x_1, \ldots, x_n) \left( \begin{array}{ccc} \phi(e_1, e_1) & \cdots & \phi(e_1, e_n) \\ \vdots & \ddots & \vdots \\ \phi(e_n, e_1) & \cdots & \phi(e_n, e_n) \end{array} \right) \left( \begin{array}{c} y_1 \\ \vdots \\ y_n \end{array} \right) \end{align*}\)