L A T E X L^AT_EX LATEX中的数学公式
行内公式
- 前后两边使用
$
包裹,例如:
f ( x ) = x 3 + 2 x 2 + 4 f_{(x)}=x^3+2x^2+4 f(x)=x3+2x2+4 - 源码为
$f_{(x)}=x^3+2x^2+4$
多行公式
- 代码块上下使用
$$
包裹,例如:
[ 1 2 3 4 5 6 7 8 9 ] \left[ \begin{array}{c|cc} 1 & 2 & 3 \\ \hline 4 & 5 & 6 \\ 7 & 8 & 9 \end{array} \right] ⎣⎡147258369⎦⎤
- 源代码为:
$$
\left[
\begin{array}{c|cc}
1 & 2 & 3 \\ \hline
4 & 5 & 6 \\
7 & 8 & 9
\end{array}
\right]
$$
角标
下角标
表达式 | 源码 |
---|---|
a 1 a_1 a1 | a_1 |
a 1 , a 2 a_1,a_2 a1,a2 | a_1,a_2 |
上角标
表达式 | 源码 |
---|---|
x 3 x^3 x3 | x^3 |
x n x^n xn | x^n |
括号
基础括号
表达式 | 源码 |
---|---|
( x ) (x) (x) | (x) |
[ x ] [x] [x] | [x] |
{x} | \{x\} |
⟨ x ⟩ \lang x \rang ⟨x⟩ | \lang x \rang |
⟨ x ⟩ \langle x \rangle ⟨x⟩ | \langle x \rangle |
∣ x ∣ \lvert x \rvert ∣x∣ | \lvert x \rvert |
∥ x ∥ \lVert x \rVert ∥x∥ | \lVert x \rVert |
放大的圆括号
表达式 | 源码 |
---|---|
( x ) (x) (x) | (x) |
( x ) \big( x \big) (x) | \big( x \big) |
( x ) \Big( x \Big) (x) | \Big( x \Big) |
( x ) \bigg( x \bigg) (x) | \bigg( x \bigg) |
( x ) \Bigg( x \Bigg) (x) | \Bigg( x \Bigg) |
分数
\frac{a}{b}
a
b
\frac{a}{b}
ba
\frac{a+2x}{b(n-1)}
a
+
2
x
b
(
n
−
1
)
\frac{a+2x}{b(n-1)}
b(n−1)a+2x
开方
\sqrt{a + b}
a
+
b
\sqrt{a + b}
a+b
\sqrt[n]{a + b}
a
+
b
n
\sqrt[n]{a + b}
na+b
累加/累乘
\sum_{i = 0}^{n}\frac{1}{i^2}
∑
i
=
0
n
1
i
2
\sum_{i = 0}^{n}\frac{1}{i^2}
i=0∑ni21
\prod_{i = 0}^{n}\frac{1}{x^2}
∏
i
=
0
n
1
x
2
\prod_{i = 0}^{n}\frac{1}{x^2}
i=0∏nx21
三角函数
表达式 | 源码 |
---|---|
sin \sin sin | \sin |
cos \cos cos | \cos |
tan \tan tan | \tan |
cot \cot cot | \cot |
sec \sec sec | \sec |
csc \csc csc | \csc |
⊥ \bot ⊥ | \bot |
∠ \angle ∠ | \angle |
6 0 ∘ 60^\circ 60∘ | 60^\circ |
对数函数
\ln{a + b}
ln
a
+
b
\ln{a + b}
lna+b
\log_{a}^{b}
log
a
b
\log_{a}^{b}
logab
\lg{a + b}
lg
a
+
b
\lg{a + b}
lga+b
极限
表达式 | 源码 |
---|---|
lim \lim lim | \lim |
→ \rightarrow → | \rightarrow |
∞ \infty ∞ | \infty |
\lim_{n\rightarrow+\infty}n
lim
n
→
+
∞
n
\lim_{n\rightarrow+\infty}n
n→+∞limn
向量
\vec{a}
a
⃗
\vec{a}
a
微积分
表达式 | 源码 | 说明 |
---|---|---|
′ \prime ′ | \prime | |
∫ \int ∫ | \int | 积分 |
∬ \iint ∬ | \iint | 双重积分 |
∭ \iiint ∭ | \iiint | 三重积分 |
∮ \oint ∮ | \oint | 曲线积分 |
∇ \nabla ∇ | \nabla | 梯度 |
\int_0^2 x^2 dx
∫
0
2
x
2
d
x
\int_0^2 x^2 dx
∫02x2dx
分支公式
$$
y=
\begin{cases}
-x,\quad x\leq 0\\
x, \quad x>0
\end{cases}
$$
$$
y=
\begin{cases}
-x,\quad x\leq 0\
x, \quad x>0
\end{cases}
$$
矩阵
不带括号
$$
\begin{matrix}
1 & 2 & 3\\
4 & 5 & 6 \\
7 & 8 & 9
\end{matrix}
$$
1 2 3 4 5 6 7 8 9 \begin{matrix} 1 & 2 & 3\\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{matrix} 147258369
括号
$$
\left(
\begin{matrix}
1 & 2 & 3\\
4 & 5 & 6 \\
7 & 8 & 9
\end{matrix}
\right)
$$
( 1 2 3 4 5 6 7 8 9 ) \left( \begin{matrix} 1 & 2 & 3\\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{matrix} \right) ⎝⎛147258369⎠⎞
中括号
$$
\left[
\begin{matrix}
1 & 2 & 3\\
4 & 5 & 6 \\
7 & 8 & 9
\end{matrix}
\right]
$$
[ 1 2 3 4 5 6 7 8 9 ] \left[ \begin{matrix} 1 & 2 & 3\\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{matrix} \right] ⎣⎡147258369⎦⎤
大括号
$$
\left\{
\begin{matrix}
1 & 2 & 3\\
4 & 5 & 6 \\
7 & 8 & 9
\end{matrix}
\right\}
$$
{ 1 2 3 4 5 6 7 8 9 } \left\{ \begin{matrix} 1 & 2 & 3\\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{matrix} \right\} ⎩⎨⎧147258369⎭⎬⎫
带省略号
$$
\left[
\begin{matrix}
a & b & \cdots & a\\
b & b & \cdots & b\\
\vdots & \vdots & \ddots & \vdots\\
c & c & \cdots & c
\end{matrix}
\right]
$$
[ a b ⋯ a b b ⋯ b ⋮ ⋮ ⋱ ⋮ c c ⋯ c ] \left[ \begin{matrix} a & b & \cdots & a\\ b & b & \cdots & b\\ \vdots & \vdots & \ddots & \vdots\\ c & c & \cdots & c \end{matrix} \right] ⎣⎢⎢⎢⎡ab⋮cbb⋮c⋯⋯⋱⋯ab⋮c⎦⎥⎥⎥⎤
带横线/竖线分割的矩阵
$$
\left[
\begin{array}{c|cc}
1 & 2 & 3 \\
4 & 5 & 6 \\
7 & 8 & 9
\end{array}
\right]
$$
[ 1 2 3 4 5 6 7 8 9 ] \left[ \begin{array}{c|cc} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{array} \right] ⎣⎡147258369⎦⎤
$$
\left[
\begin{array}{c|cc}
1 & 2 & 3 \\ \hline
4 & 5 & 6 \\
7 & 8 & 9
\end{array}
\right]
$$
[ 1 2 3 4 5 6 7 8 9 ] \left[ \begin{array}{c|cc} 1 & 2 & 3 \\ \hline 4 & 5 & 6 \\ 7 & 8 & 9 \end{array} \right] ⎣⎡147258369⎦⎤
字符的大小、位置和颜色
调整大小
表达式 | 源码 |
---|---|
a m o s c l o u d \Huge amoscloud amoscloud | \Huge amoscloud |
a m o s c l o u d \huge amoscloud amoscloud | \huge amoscloud |
a m o s c l o u d \LARGE amoscloud amoscloud | \LARGE amoscloud |
a m o s c l o u d \Large amoscloud amoscloud | \Large amoscloud |
a m o s c l o u d \large amoscloud amoscloud | \large amoscloud |
a m o s c l o u d \normalsize amoscloud amoscloud | \normalsize amoscloud |
a m o s c l o u d \small amoscloud amoscloud | \small amoscloud |
a m o s c l o u d \footnotesize amoscloud amoscloud | \footnotesize amoscloud |
a m o s c l o u d \scriptsize amoscloud amoscloud | \scriptsize amoscloud |
a m o s c l o u d \tiny amoscloud amoscloud | \tiny amoscloud |
修改颜色
$$
P\left(x_{l} \mid y_{l}\right) = \frac{P(x_l,y_l)}{P(y_l)}=\frac{\textcolor{#FF0000}{P(y_l\mid x_l)}P(x_l)}{P(y_l)}
$$
P ( x l ∣ y l ) = P ( x l , y l ) P ( y l ) = P ( y l ∣ x l ) P ( x l ) P ( y l ) P\left(x_{l} \mid y_{l}\right) = \frac{P(x_l,y_l)}{P(y_l)}=\frac{\textcolor{#FF0000}{P(y_l\mid x_l)}P(x_l)}{P(y_l)} P(xl∣yl)=P(yl)P(xl,yl)=P(yl)P(yl∣xl)P(xl)