Add MathJax into GitHub Pages

Add MathJax into GitHub Pages · Brianne's Farm

在GitHub Pages中添加数学公式

\(E = m c^2\)

markdown: kramdow
<head>
    <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>
</head>
{\% include head.html %\}

上面故意加了两个\。添加的时候去掉即可。


下面来看一下效果。 行间公式换行后无空行: \(\min_{x} f(x)\). 如果公式(包括双$)前后各有一个空行,则产生行间的公式。测试如下:

\(\min_{x} f(x)\).

可另参考Jekyll中使用MathJax