latex 语法 & mathjax 工具 - cheat sheet

在线测试地址

https://www.mathjax.org/#demo

声明格式

For inline formulas, enclose the formula in $...$.
For displayed formulas, use $$...$$.

{% math %}...{% endmath %}
{% math %}
...
{% endmath %}

符号

分子分母($\frac{a}{b}$)
上标下标($x^2$, $x_2$, $x^2_2$)
希腊字母($\alpha$ $\beta$)
百分比($\%$)
$\sum_{i=0}^n i^2 = \frac{(n^2+n)(2n+1)}{6}$ 对应: $\sum_{i=0}^n i^2 = \frac{(n^2+n)(2n+1)}{6}$

矩阵 {matrix}

\begin{matrix}
1 & x & x^2 \\
1 & y & y^2 \\
1 & z & z^2 \\
\end{matrix}
$$\begin{matrix} 1 & x & x^2 \\ 1 & y & y^2 \\ 1 & z & z^2 \\ \end{matrix}$$

矩阵括号

{bmatrix} : $
\begin{bmatrix}
1 & x \\
1 & y \\
\end{bmatrix}
$

{Bmatrix}: $
\begin{Bmatrix}
1 & x \\
1 & y \\
\end{Bmatrix}
$

{vmatrix}: $
\begin{vmatrix}
1 & x \\
1 & y \\
\end{vmatrix}
$

{Vmatrix}: $
\begin{Vmatrix}
1 & x \\
1 & y \\
\end{Vmatrix}
$

矩阵省略号

{pmatrix} \cdots \vdots \ddots

$$\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}$$

增广矩阵 augmented matrix

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

行内小矩阵

比如 $\bigl( \begin{smallmatrix} a & b \\ c & d \end{smallmatrix} \bigr)$ 显示为 $\bigl( \begin {smallmatrix} a & b \\ c & d \end {smallmatrix} \bigr)$

在hexo 中, \\ 则要多加一个反斜杠: \\\

TODO 持续更新

$$

常用公式

Classical ML Equations in LaTeX

参考


List of LaTeX mathematical symbols - OeisWiki
LaTeX mathematics cheat sheet - David Hamann
MathJax basic tutorial and quick reference - Mathematics Meta Stack Exchange