KaTeX 渲染测试文档
基础公式测试
行内公式:$1+1=2$,$x^2 + y^2 = z^2$
行间公式:
$$E = mc^2$$
html 转义测试
对于 $100\%$ 的数据,$a_i<b_i$。
$$<a_i>b_i$$
分数与函数测试
简单分数:$\frac{1}{2}$
复杂分数:
$$\frac{\partial f}{\partial x} = \lim_{h \to 0} \frac{f(x+h)-f(x)}{h}$$
三角函数:$\sin(\theta) + \cos(\phi) = \sqrt{1 - \sin^2(\theta)} + \sqrt{1 - \cos^2(\phi)}$
含 \ 的公式
$1\texttt{2}$
$$1\\2$$
$1\\2$
$$1\\\\2$$
矩阵环境测试 - 重点检查换行符 \\
基础矩阵
$$ \begin{matrix} a & b \\ c & d \end{matrix} $$
重复换行符
$$ \begin{matrix} a & b \\\\ c & d \end{matrix} $$
带括号矩阵
$$ \begin{pmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{pmatrix} $$
行列式
$$ \begin{vmatrix} x_{11} & x_{12} \\ x_{21} & x_{22} \end{vmatrix} = x_{11}x_{22} - x_{12}x_{21} $$
复杂矩阵(多行多列)
$$ \begin{bmatrix} a_{11} & a_{12} & \cdots & a_{1n} \\ a_{21} & a_{22} & \cdots & a_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{m1} & a_{m2} & \cdots & a_{mn} \end{bmatrix} \begin{bmatrix} x_1 \\ x_2 \\ \vdots \\ x_n \end{bmatrix} = \begin{bmatrix} b_1 \\ b_2 \\ \vdots \\ b_m \end{bmatrix} $$
对齐环境测试
多行公式对齐
$$ \begin{aligned} f(x) &= (x+1)^2 \\ &= x^2 + 2x + 1 \\ &= (x+1)(x+1) \end{aligned} $$
多行带编号
$$ \begin{align} \nabla \cdot \mathbf{E} &= \frac{\rho}{\epsilon_0} \\ \nabla \cdot \mathbf{B} &= 0 \\ \nabla \times \mathbf{E} &= -\frac{\partial \mathbf{B}}{\partial t} \\ \nabla \times \mathbf{B} &= \mu_0\mathbf{J} + \mu_0\epsilon_0\frac{\partial \mathbf{E}}{\partial t} \end{align} $$
极度复杂的行内公式测试
这是一个极度复杂的行内公式:$\Gamma(z) = \int_0^\infty t^{z-1}e^{-t}dt = \lim_{n\to\infty}\frac{n!n^z}{z(z+1)\cdots(z+n)} = \frac{e^{-\gamma z}}{z}\prod_{n=1}^\infty\left(1+\frac{z}{n}\right)^{-1}e^{z/n}$ 看看是否能正确渲染。
分段函数测试
$$ f(x) = \begin{cases} x^2 & \text{if } x \geq 0 \\ -x^2 & \text{if } x < 0 \end{cases} $$
$$ \operatorname{sgn}(x) = \begin{cases} 1 & \text{if } x > 0 \\ 0 & \text{if } x = 0 \\ -1 & \text{if } x < 0 \end{cases} $$
积分与求和测试
多重积分:
$$\iiint_V \left(\frac{\partial P}{\partial x} + \frac{\partial Q}{\partial y} + \frac{\partial R}{\partial z}\right)dV = \oiint_S (Pdy dz + Qdz dx + Rdx dy)$$
级数求和:
$$\sum_{n=1}^\infty \frac{1}{n^2} = \frac{\pi^2}{6}$$
极限与导数测试
$$ \lim_{x \to 0} \frac{\sin x}{x} = 1 $$
$$ \frac{d}{dx}\left( \int_{a}^{x} f(t)dt \right) = f(x) $$
最后的大型矩阵测试
$$ \begin{pmatrix} \frac{\partial u}{\partial x} & \frac{\partial u}{\partial y} & \frac{\partial u}{\partial z} \\ \frac{\partial v}{\partial x} & \frac{\partial v}{\partial y} & \frac{\partial v}{\partial z} \\ \frac{\partial w}{\partial x} & \frac{\partial w}{\partial y} & \frac{\partial w}{\partial z} \end{pmatrix} \begin{pmatrix} dx \\ dy \\ dz \end{pmatrix} = \begin{pmatrix} du \\ dv \\ dw \end{pmatrix} $$
$$ \det \begin{bmatrix} 1 & \omega & \omega^2 \\ \omega & \omega^2 & 1 \\ \omega^2 & 1 & \omega \end{bmatrix} = 0 \quad \text{其中 } \omega^3 = 1 $$
测试结束。源码:
# KaTeX 渲染测试文档
## 基础公式测试
行内公式:$1+1=2$,$x^2 + y^2 = z^2$
行间公式:
$$E = mc^2$$
## 分数与函数测试
简单分数:$\frac{1}{2}$
复杂分数:
$$\frac{\partial f}{\partial x} = \lim_{h \to 0} \frac{f(x+h)-f(x)}{h}$$
三角函数:$\sin(\theta) + \cos(\phi) = \sqrt{1 - \sin^2(\theta)} + \sqrt{1 - \cos^2(\phi)}$
## 含 \\ 的公式
$1\texttt{2}$
$$1\\2$$
$1\\2$
$$1\\\\2$$
## 矩阵环境测试 - 重点检查换行符 \\\\
### 基础矩阵
$$
\begin{matrix}
a & b \\
c & d
\end{matrix}
$$
重复换行符
$$
\begin{matrix}
a & b \\\\
c & d
\end{matrix}
$$
### 带括号矩阵
$$
\begin{pmatrix}
1 & 2 & 3 \\
4 & 5 & 6 \\
7 & 8 & 9
\end{pmatrix}
$$
### 行列式
$$
\begin{vmatrix}
x_{11} & x_{12} \\
x_{21} & x_{22}
\end{vmatrix} = x_{11}x_{22} - x_{12}x_{21}
$$
### 复杂矩阵(多行多列)
$$
\begin{bmatrix}
a_{11} & a_{12} & \cdots & a_{1n} \\
a_{21} & a_{22} & \cdots & a_{2n} \\
\vdots & \vdots & \ddots & \vdots \\
a_{m1} & a_{m2} & \cdots & a_{mn}
\end{bmatrix}
\begin{bmatrix}
x_1 \\
x_2 \\
\vdots \\
x_n
\end{bmatrix}
=
\begin{bmatrix}
b_1 \\
b_2 \\
\vdots \\
b_m
\end{bmatrix}
$$
## 对齐环境测试
### 多行公式对齐
$$
\begin{aligned}
f(x) &= (x+1)^2 \\
&= x^2 + 2x + 1 \\
&= (x+1)(x+1)
\end{aligned}
$$
### 多行带编号
$$
\begin{align}
\nabla \cdot \mathbf{E} &= \frac{\rho}{\epsilon_0} \\
\nabla \cdot \mathbf{B} &= 0 \\
\nabla \times \mathbf{E} &= -\frac{\partial \mathbf{B}}{\partial t} \\
\nabla \times \mathbf{B} &= \mu_0\mathbf{J} + \mu_0\epsilon_0\frac{\partial \mathbf{E}}{\partial t}
\end{align}
$$
## 极度复杂的行内公式测试
这是一个极度复杂的行内公式:$\Gamma(z) = \int_0^\infty t^{z-1}e^{-t}dt = \lim_{n\to\infty}\frac{n!n^z}{z(z+1)\cdots(z+n)} = \frac{e^{-\gamma z}}{z}\prod_{n=1}^\infty\left(1+\frac{z}{n}\right)^{-1}e^{z/n}$ 看看是否能正确渲染。
## 分段函数测试
$$
f(x) =
\begin{cases}
x^2 & \text{if } x \geq 0 \\
-x^2 & \text{if } x < 0
\end{cases}
$$
$$
\operatorname{sgn}(x) =
\begin{cases}
1 & \text{if } x > 0 \\
0 & \text{if } x = 0 \\
-1 & \text{if } x < 0
\end{cases}
$$
## 积分与求和测试
多重积分:
$$\iiint_V \left(\frac{\partial P}{\partial x} + \frac{\partial Q}{\partial y} + \frac{\partial R}{\partial z}\right)dV = \oiint_S (Pdy dz + Qdz dx + Rdx dy)$$
级数求和:
$$\sum_{n=1}^\infty \frac{1}{n^2} = \frac{\pi^2}{6}$$
## 极限与导数测试
$$
\lim_{x \to 0} \frac{\sin x}{x} = 1
$$
$$
\frac{d}{dx}\left( \int_{a}^{x} f(t)dt \right) = f(x)
$$
## 最后的大型矩阵测试
$$
\begin{pmatrix}
\frac{\partial u}{\partial x} & \frac{\partial u}{\partial y} & \frac{\partial u}{\partial z} \\
\frac{\partial v}{\partial x} & \frac{\partial v}{\partial y} & \frac{\partial v}{\partial z} \\
\frac{\partial w}{\partial x} & \frac{\partial w}{\partial y} & \frac{\partial w}{\partial z}
\end{pmatrix}
\begin{pmatrix}
dx \\
dy \\
dz
\end{pmatrix}
=
\begin{pmatrix}
du \\
dv \\
dw
\end{pmatrix}
$$
$$
\det
\begin{bmatrix}
1 & \omega & \omega^2 \\
\omega & \omega^2 & 1 \\
\omega^2 & 1 & \omega
\end{bmatrix}
= 0 \quad \text{其中 } \omega^3 = 1
$$
测试结束。