前言
前段时间想开始学习latex,但发现Typecho没有内置渲染latex,因此尝试在网上寻找渲染latex的插件,尝试过MarkdownKatex、MarkdownParse等插件,但因为未知原因没有办法使用。经过搜索,找到MathJax,它不需要安装插件的同时完美符合我的需求。
github仓库
安装过程
部署十分简单,只要在/usr/theme下进入主题文件夹,将以下内容添加到header.php的<head>标签中添加以下内容即可
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | <script type="text/x-mathjax-config"> MathJax.Hub.Config({ extensions: ["tex2jax.js"], jax: ["input/TeX", "output/HTML-CSS"], tex2jax: { inlineMath: [ ['$','$'], ["\\(","\\)"] ], displayMath: [ ['$$','$$'], ["\\[","\\]"] ], processEscapes: true }, "HTML-CSS": { availableFonts: ["TeX"] } }); </script> <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js? config=TeX-AMS-MML_HTMLorMML"> </script> <script type="text/javascript" src="https://d3eoax9i5htok0.cloudfront.net/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> </script> |
以上,就完成MathJax的部署
效果展示
1 | $$ \lim_{x \to \infty} x^2_{22} - \int_{1}^{5}x\mathrm{d}x + \sum_{n=1}^{20} n^{2} = \prod_{j=1}^{3} y_{j} + \lim_{x \to -2} \frac{x-2}{x} $$ |
$$ \lim_{x \to \infty} x^2_{22} - \int_{1}^{5}x\mathrm{d}x + \sum_{n=1}^{20} n^{2} = \prod_{j=1}^{3} y_{j} + \lim_{x \to -2} \frac{x-2}{x} $$
参考资料
【博客优化】Typecho博客使用MathJax显示数学公式
LaTeX 公式篇
MathJax中文文档