ukylin

Mathjax 是一款运行在浏览器中的开源的数学符号渲染引擎,使用MathJax可以方便的在浏览器中显示数学公式,不需要使用图片 。然而,加载 Mathjax 的数学公式时是相当消耗资源和时间的。即使在网页中并没有生成公式时,也会加载最基本的Mathjax.js。因此应该考虑在使用公式的页面才加载 Mathjax ,这样就需要一个控制。在此主题的根目录_config.yml里面加入mathjax: true,接下来在after_footer.ejs里修改

解决办法

1
<% if (theme.mathjax){ %>
<%- partial('mathjax') %>
<% } %>

1
<% if (page.mathjax & theme.mathjax){ %>
<%- partial('mathjax') %>
<% } %>

现在就可以在 Markdown 中随意调用 Mathjax 了。

1
2
3
4
5
6
7
8
9
10
11
12
13
title: 制作 ubuntu 启动盘
date: 2015-10-24 23:11:40
tags:
- install
- iso
- 技术
categories:
- ubuntu
- linux
mathjax: true
---


>在 ubuntu 下制作启动盘 $|a|<1 $

LaTeX 公式使用示例

表格

$$\begin{array}{c|lcr} n & \text{Left} & \text{Center} & \text{Right} \\ \hline 1 & 0.24 & 1 & 125 \\ 2 & -1 & 189 & -8 \\ 3 & -20 & 2000 & 1+10i \\ \end{array}$$

矩阵

$$\begin{pmatrix} 1 & a_1 & a_1^2 & \cdots & a_1^n \\ 1 & a_2 & a_2^2 & \cdots & a_2^n \\ \vdots & \vdots& \vdots & \ddots & \vdots \\ 1 & a_m & a_m^2 & \cdots & a_m^n \end{pmatrix}$$

增广矩阵

$$\left[ \begin{array}{cc|c} 1&2&3\\\\ 4&5&6 \end{array} \right]$$

公式对齐

$$\begin{align} \sqrt{37} & = \sqrt{\frac{73^2-1}{12^2}} \\ & = \sqrt{\frac{73^2}{12^2}\cdot\frac{73^2-1}{73^2}} \\ & = \sqrt{\frac{73^2}{12^2}}\sqrt{\frac{73^2-1}{73^2}} \\ & = \frac{73}{12}\sqrt{1 - \frac{1}{73^2}} \\ & \approx \frac{73}{12}\left(1 - \frac{1}{2\cdot73^2}\right) \end{align}$$

参考文章

http://mlworks.cn/posts/introduction-to-mathjax-and-latex-expression/
(此篇文章有对 LaTeX 数学公式有较全面的总结)