原文在http://kqueue.org/blog/2012/01/05/hello-world/。通过MathJax, 把latex打在网页上。
首先是在source/_includes/custom/head.html添加以下代码:
<script type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
在_config.yml 把markdown的引擎从rdiscount换成kramdown, 当然如果没有装的话装一下gem install kramdown。从现在开始就能通过 $$.. $$($$在单独的一行中,代码上下各留一空行)写latex啦
原文作者说好像会出现一些杂乱字符,你可以在source/_includes/custom/head.html添加以下代码来解决:
<script type="text/x-mathjax-config">
MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
MathJax.InputJax.TeX.prefilterHooks.Add(function (data) {
data.math = data.math.replace(/^\s*<!\[CDATA\[\s*((?:\n|.)*)\s*\]\]>\s*$/m,"$1");
});
});
</script>
这里是一个例子Multivariate normal distribution:
$$
f_x(x_1,...,x_k)=\frac{1}{(2\pi)^{k\/2}|\Sigma|^{1\/2}}exp(-\frac{1}{2}(x-\mu)^T\Sigma^{-1}(x-\mu))
$$