Hexo 中显示数学公式

使用

Inline:

Simple inline $a = b + c$.

Block:

$$\frac{\partial u}{\partial t} = h^2 \left( \frac{\partial^2 u}{\partial x^2} + \frac{\partial^2 u}{\partial y^2} + \frac{\partial^2 u}{\partial z^2}\right)$$

Tag:

Single line content will be parsed as inline math (same as $...$):

This equation $\cos 2\theta = \cos^2 \theta - \sin^2 \theta = 2 \cos^2 \theta - 1$ is inline.

Multiple line content will be parsed as block math (same as $$...$$)

\begin{aligned} \dot{x} & = \sigma(y-x) \\ \dot{y} & = \rho x - y - xz \\ \dot{z} & = -\beta z + xy \end{aligned}

Deprecated since 2.0.0
Tag Block:

Migration Note

Migrating to 3.0.0

• mathjax should be moved under math section in your _config.yml

Migrating to 2.1.0

• math_block is removed

Migrating to 2.0.0

• math_block is deprecated (but still usable. This won’t break your site)

• math block is used to handle both inline and block math due to breaking changes made since Hexo 3.x. (This will break your site if you’re using math block)

Since Hexo 3.x, nunjucks is used as tag engine instead of swig. Syntax like this won’t work any more:

Instead, you should use open and close tag since this version:

Change all your math tags accordingly.