How to use Latex / MathJax in Jekyll

<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",
      ]
    }
  });
  MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
    var TEX = MathJax.InputJax.TeX;
    var COLS = function (W) {
      var WW = [];
      for (var i = 0, m = W.length; i < m; i++)
        {WW[i] = TEX.Parse.prototype.Em(W[i])}
      return WW.join(" ");
    };
    TEX.Definitions.Add({
      environment: {
        psmallmatrix: ['Array',null,'(',')','c',COLS([1/3]),".2em",'S',1],
      }
    });
  });
</script>
<script type="text/javascript" async
  src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js">
</script>

{% include mathjax.html %}

</body>

References

★ 3 min read · Rajesh Pandian M · jekyll , latex , mathjax