LaTeX 功能测试

本文档用于全面测试 LaTeX 各种功能是否正常工作。

1. 行内公式

1.1 基本行内公式

  • 简单公式:E=mc2E = mc^2
  • 分数:ab\frac{a}{b}
  • 平方根:x\sqrt{x}
  • n次方根:xn\sqrt[n]{x}
  • 指数:ab+ca^{b+c}
  • 下标:ai,ja_{i,j}

1.2 行内矩阵

  • 简单矩阵:(abcd)(\begin{smallmatrix}a & b \\ c & d\end{smallmatrix})
  • 行内矩阵:(abcd)\begin{pmatrix}a & b \\ c & d\end{pmatrix}

1.3 行内符号

  • 希腊字母:α,β,γ,δ,ϵ\alpha, \beta, \gamma, \delta, \epsilon
  • 三角函数:sin(x),cos(x),tan(x)\sin(x), \cos(x), \tan(x)
  • 对数:log(x),ln(x)\log(x), \ln(x)
  • 极限:limx0sinxx=1\lim_{x \to 0} \frac{\sin x}{x} = 1

2. 块级公式

2.1 基本块级公式

E=mc2E = mc^2

2.2 求和

i=1ni=n(n+1)2\sum_{i=1}^{n} i = \frac{n(n+1)}{2}

2.3 积分

abf(x)dx\int_{a}^{b} f(x) \, dx

ex2dx=π\int_{-\infty}^{\infty} e^{-x^2} \, dx = \sqrt{\pi}

2.4 求积

i=1ni=n!\prod_{i=1}^{n} i = n!

2.5 导数

dydx\frac{dy}{dx}

d2ydx2\frac{d^2y}{dx^2}

f/x\partial f/\partial x

F=Fxx+Fyy+Fzz\nabla \cdot \vec{F} = \frac{\partial F_x}{\partial x} + \frac{\partial F_y}{\partial y} + \frac{\partial F_z}{\partial z}

3. 矩阵

3.1 基本矩阵

(abcd)\begin{pmatrix}a & b \\ c & d\end{pmatrix}

3.2 带括号的矩阵

[abcd]\begin{bmatrix}a & b \\ c & d\end{bmatrix}

3.3 大矩阵

(123456789)\begin{pmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{pmatrix}

3.4 带省略号的矩阵

(12n23n+1nn+12n1)\begin{pmatrix} 1 & 2 & \cdots & n \\ 2 & 3 & \cdots & n+1 \\ \vdots & \vdots & \ddots & \vdots \\ n & n+1 & \cdots & 2n-1 \end{pmatrix}

3.5 分块矩阵

(100100001001)\begin{pmatrix} \begin{matrix}1 & 0 \\ 0 & 1\end{matrix} & \begin{matrix}0 \\ 0\end{matrix} \\ \begin{matrix}0 & 0\end{matrix} & \begin{matrix}1 & 0 \\ 0 & 1\end{matrix} \end{pmatrix}

4. 多行方程

4.1 对齐的多行方程

(a+b)2=a2+2ab+b2(ab)2=a22ab+b2(a+b)(ab)=a2b2\begin{aligned} (a + b)^2 &= a^2 + 2ab + b^2 \\ (a - b)^2 &= a^2 - 2ab + b^2 \\ (a + b)(a - b) &= a^2 - b^2 \end{aligned}

4.2 带编号的多行方程

cos2θ=cos2θsin2θ=2cos2θ1=12sin2θ\begin{aligned} \cos 2\theta &= \cos^2 \theta - \sin^2 \theta \\ &= 2\cos^2 \theta - 1 \\ &= 1 - 2\sin^2 \theta \end{aligned}

4.3 方程组

{2x+y=5xy=1\begin{cases} 2x + y = 5 \\ x - y = 1 \end{cases}

5. 分段函数

5.1 基本分段函数

f(x)={0,x<01,x0f(x) = \begin{cases} 0, & x < 0 \\ 1, & x \geq 0 \end{cases}

5.2 复杂分段函数

f(x)={sinxx,x01,x=0f(x) = \begin{cases} \frac{\sin x}{x}, & x \neq 0 \\ 1, & x = 0 \end{cases}

5.3 多段分段函数

f(x)={1,x<1x,1x11,x>1f(x) = \begin{cases} -1, & x < -1 \\ x, & -1 \leq x \leq 1 \\ 1, & x > 1 \end{cases}

6. 特殊符号

6.1 关系符号

  • 等于:==
  • 不等于:\neq
  • 约等于:\approx
  • 小于等于:\leq
  • 大于等于:\geq
  • 恒等于:\equiv
  • 成正比:\propto

6.2 逻辑符号

  • 且:\land
  • 或:\lor
  • 非:¬\neg
  • 蕴含:\Rightarrow
  • 等价:\Leftrightarrow
  • 对于所有:\forall
  • 存在:\exists

6.3 箭头符号

  • 右箭头:\rightarrow
  • 左箭头:\leftarrow
  • 双向箭头:\leftrightarrow
  • 长箭头:\longrightarrow
  • 上箭头:\uparrow
  • 下箭头:\downarrow

6.4 特殊符号

  • 无穷大:\infty
  • 空集:\emptyset
  • 属于:\in
  • 不属于:\notin
  • 子集:\subset
  • 并集:\cup
  • 交集:\cap
  • 求和:\sum
  • 积分:\int
  • 求积:\prod
  • 极限:lim\lim

7. 复杂公式示例

7.1 泰勒展开

f(x)=n=0f(n)(a)n!(xa)nf(x) = \sum_{n=0}^{\infty} \frac{f^{(n)}(a)}{n!} (x - a)^n

7.2 欧拉公式

eiθ=cosθ+isinθe^{i\theta} = \cos\theta + i\sin\theta

7.3 傅里叶变换

F{f(t)}=F(ω)=f(t)eiωtdt\mathcal{F}\{f(t)\} = F(\omega) = \int_{-\infty}^{\infty} f(t) e^{-i\omega t} \, dt

7.4 薛定谔方程

itΨ(r,t)=H^Ψ(r,t)i\hbar \frac{\partial}{\partial t} \Psi(\mathbf{r}, t) = \hat{H} \Psi(\mathbf{r}, t)

7.5 勾股定理

a2+b2=c2a^2 + b^2 = c^2

8. 其他功能测试

8.1 带上下标的符号

  • x^,xˉ,x~\hat{x}, \bar{x}, \tilde{x}
  • v,AB\vec{v}, \overrightarrow{AB}
  • AB,AB\overline{AB}, \underline{AB}

8.2 文本和公式混合

if x>0 then f(x)=x, else f(x)=x\text{if } x > 0 \text{ then } f(x) = x, \text{ else } f(x) = -x

8.3 颜色

E=mc2\color{red} E = mc^2

8.4 大小

E=mc2,E=mc2,E=mc2,E=mc2\tiny E = mc^2, \small E = mc^2, \large E = mc^2, \huge E = mc^2


测试完成!如果您能看到以上所有公式正确渲染,说明 LaTeX 功能正常工作。