【笔记】LaTeX数学公式

LaTeX数学公式 笔记



1.简介

LATEX是一种基于TeX的排版系统,由计算机学家莱斯利·兰伯特(Leslie Lamport)在20世纪80年代初期开发,利用这种格式,即使使用者没有排版和程序设计的知识也可以充分发挥由TeX所提供的强大功能,能在几天、甚至几小时内生成很多具有书籍质量的印刷品。对于生成复杂表格和数学公式,这一点表现得尤为突出。因此它非常适用于生成高印刷质量的科技和数学类文档。

利用LaTeX可以高效统一地排版数学公式,笔记中涵盖了LaTeX数学公式的一些基本语法。

当然,你需要编译LaTeX代码的工具并且能够支持数学公式。

在LaTeX代码中,所有LaTeX表达式都包含在两个$之间。行内公式用$ 公式内容 $表示,可以将公式嵌入文本;行外公式用$$ 公式内容 $$表示,可实现公式单独成行。

1.1行内公式

质能方程 E = m c 2 E=mc^{2} E=mc2

$E=mc^{2}$

1.2行外公式

在latex中,行外公式推荐使用\[ ...\]或者是\begin{equation} ... \end{equation}

本文中出现的$$...$$markdown中的写法,不推荐在latex中使用
F = G m 1 m 2 R 2 F=G \frac {m_{1}m_{2}}{R^{2}} F=GR2m1m2

$$
F=G \frac {m_{1}m_{2}}{R^{2}}
$$

1.3编号

在表达式后添加\tag{序号}
{ ▽ × H = J + ∂ D ∂ t ▽ × E = − d B d t ▽ ⋅ B = 0 ▽ ⋅ D = ρ (1.2) \left \{\begin{matrix} \begin{align} &\bigtriangledown \times H =J+\frac {\partial D} {\partial t}\tag1 \\ &\bigtriangledown \times E =-\frac {dB}{dt} \tag2 \\ &\bigtriangledown \cdot B=0 \tag3 \\ &\bigtriangledown \cdot D=\rho \tag4 \end{align} \end{matrix} \right. \tag{1.2} ×H=J+tD×E=dtdBB=0D=ρ(1)(2)(3)(4)(1.2)

$$
\left
\{\begin{matrix}
\begin{align}
&\bigtriangledown \times H =J+\frac {\partial D} {\partial t}\tag1 \\
&\bigtriangledown \times E =-\frac {dB}{dt} \tag2 \\
&\bigtriangledown \cdot B=0 \tag3 \\
&\bigtriangledown \cdot D=\rho \tag4
\end{align}
\end{matrix}
\right.
\tag{1.2}
$$

2.在线编辑

除了敲代码,你也可以利用在线工具编辑公式,套用公式模板。

推荐:@妈咪说 简洁免费的在线LaTeX公式编辑器 https://www.latexlive.com/

3.单字符


+ - = () / [] abc 123等字符可直接写进公式,而大多数字符由于LaTeX语法保留或无法直接键入需要进行字符转义。
例如: α \alpha α​需由\alpha转义。

3.1字母

3.1.1希腊字母
希腊字母LaTeX表达式希腊字母LaTeX表达式
α \alpha α\alpha A \Alpha A\Alpha
β \beta β\beta B \Beta B\Beta
γ \gamma γ\gamma Γ \Gamma Γ\Gamma
δ \delta δ\delta Δ \Delta Δ\Delta
ϵ \epsilon ϵ\epsilon E \Epsilon E\Epsilon
ζ \zeta ζ\zeta Z \Zeta Z\Zeta
η \eta η\eta H \Eta H\Eta
θ \theta θ\theta Θ \Theta Θ\Theta
ι \iota ι\iota I \Iota I\Iota
κ \kappa κ\kappa K \Kappa K\Kappa
λ \lambda λ\lambda Λ \Lambda Λ\Lambda
μ \mu μ\mu M \Mu M\Mu
ν \nu ν\nu N \Nu N\Nu
ξ \xi ξ\xi Ξ \Xi Ξ\Xi
ο \omicron ο\omicron O \Omicron O\Omicron
π \pi π\pi Π \Pi Π\Pi
ρ \rho ρ\rho P \Rho P\Rho
σ \sigma σ\sigma Σ \Sigma Σ\Sigma
τ \tau τ\tau T \Tau T\Tau
υ \upsilon υ\upsilon Υ \Upsilon Υ\Upsilon
φ \varphi φ\varphi Φ \Phi Φ\Phi
χ \chi χ\chi X \Chi X\Chi
ψ \psi ψ\psi Ψ \Psi Ψ\Psi
ω \omega ω\omega Ω \Omega Ω\Omega
3.1.2补充
字符LateX表达式字符LaTeX表达式
ℓ \ell \ell ℜ \Re \Re
ı \imath \imath ℵ \aleph \aleph
ȷ \jmath \jmath ℘ \wp \wp
ℏ \hbar \hbar ℧ \mho \mho
∂ \partial \partial ℶ \beth \beth
ϝ \digamma ϝ\digamma ϰ \varkappa ϰ\varkappa
ℸ \daleth \daleth

3.2特殊

字符LaTeX表达式字符LaTeX表达式
单空格\quad横省略: ⋯ \cdots \cdots
双空格\qquad竖省略: ⋮ \vdots \vdots
下划线: _ \_ _\ _斜省略: ⋱ \ddots \ddots
换行\\无穷: ∞ \infty \infty

3.3运算

字符LaTeX表达式字符LaTeX表达式
× \times ×\times ± \pm ±\pm
÷ \div ÷\div ∓ \mp \mp
⋅ \cdot \cdot − - -
∙ \bullet \bullet ∘ \circ \circ
⊕ \oplus \oplus ⊙ \odot \odot
⊗ \otimes \otimes ⊖ \ominus \ominus
⊘ \oslash \oslash ⋄ \diamond \diamond

3.4注释

字符LaTeX表达式
⋆ \star \star
∗ \ast \ast

3.5比较

字符LaTeX表达式字符LaTeX表达式
< \lt <\lt > \gt >\gt
≤ \leq \le ≥ \geq \geq
⩽ \leqslant \leqslant ⩾ \geqslant \geqslant
≦ \leqq \leqq ≧ \geqq \geqq
≠ \neq =\neq ≮ \not\lt <\not\lt
≪ \ll \ll ≫ \gg \gg
≐ \doteq \doteq ≈ \approx \approx
≍ \asymp \asymp ∝ \propto \propto
⌢ \frown \frown ⌣ \smile \smile
⋘ \lll \lll ⋙ \ggg \ggg

\not写在表达式前,能在该表达式对应的符号上画出斜线。

3.6集合

字符LaTeX表达式字符LaTeX表达式
∪ \cup \cup ∩ \cap \cap
∖ \setminus \setminus ⊂ \subset \subset
⊆ \subseteq \subseteq ⊊ \subsetneq \subsetneq
⊃ \supset \supset ⊇ \supseteq \supseteq
⊋ \supsetneq \supsetneq ∈ \in \in
∉ \notin /\notin ∅ \emptyset \emptyset
∅ \varnothing \varnothing

3.7组合

字符LaTeX表达式
( n + 1 2 k ) {n+1 \choose 2k} (2kn+1){n+1 \choose 2k}
( n + 1 2 k ) \binom{n+1}{2k} (2kn+1)\binom{n+1}{2k}

3.8逻辑

3.8.1箭头
3.8.1.1逻辑箭头
字符LaTeX表达式字符LaTeX表达式
→ \to \to → \rightarrow \rightarrow
← \leftarrow \leftarrow ⇒ \Rightarrow \Rightarrow
⇐ \Leftarrow \Leftarrow ⟶ \longrightarrow \longrightarrow
⟵ \longleftarrow \longleftarrow ↔ \leftrightarrow \leftrightarrow
   ⟺    \iff \iff ⟹ \Longrightarrow \Longrightarrow
⟸ \Longleftarrow \Longleftarrow ⇔ \Leftrightarrow \Leftrightarrow

首字母大写会变成双线,即推出或等价符号

箭头中还有上下箭头,例如\Uparrow对应 ⇑ \Uparrow ​,\Updownarrow对应 ⇕ \Updownarrow ​​​

not适用于箭头,例如\not \Rightarrow表示 ⇏ \not \Rightarrow ​​​​

3.8.1.2浮标箭头
字符LaTeX表达式字符LaTeX表达式
x y z → \overrightarrow{xyz} xyz \overrightarrow{xyz} x ⃗ \vec x x \vec x
x y z ↔ \overleftrightarrow{xyz} xyz \overleftrightarrow{xyz} ⟶ F \stackrel{F}{\longrightarrow} F\stackrel{F}{\longrightarrow}
3.8.2量词
字符LaTaX表达式
∀ \forall \forall
∃ \exists \exists
3.8.3与或非
字符LaTaX表达式
∧ \land \land
∨ \lor \lor
¬ \lnot ¬\lnot
3.8.4因果
字符LaTaX表达式
∵ \because \because
∴ \therefore \therefore

3.9几何

字符LateX表达式字符LaTeX表达式
∼ \sim \sim △ \triangle \triangle
≃ \simeq \simeq □ \Box \Box
≅ \cong \cong ▽ \triangledown \triangledown
∥ \parallel \parallel ◯ \bigcirc \bigcirc
⊥ \bot \bot ◊ \Diamond \Diamond
⊤ \top \top □ \square \square
⊢ \vdash \vdash ∠ \angle \angle
△ \bigtriangleup \bigtriangleup ∡ \measuredangle \measuredangle

角度上标 ∘ ^\circ 可用$^/circ$实现

3.10非数学符号

字符LaTeX表达式字符LaTeX表达式
♢ \diamondsuit \diamondsuit ♯ \sharp \sharp
♡ \heartsuit \heartsuit ♭ \flat \flat
♠ \spadesuit \spadesuit ♮ \natural \natural
♣ \clubsuit \clubsuit

4.上下标


4.1字母右侧

下标使用下划线_ ,上标使用 ^。例如 x i 2 x_i^2 xi2​​​​​​​ 的LaTeX代码为 $x_i^2$​​

LaTeX表达式中的上下标可以叠加。例如 x y z {x^y}^z xyz​​的LaTeX代码为 $x^{y^z}$​或者${x^y}^z$​

值得注意的是,LaTeX表达式默认 _ ^ 之后一位才是上下标的内容,对于超过一个字母的上下标需要使用{}

例如 x 2 i 2 + b x_{2i}^{2+b} x2i2+b​​的Latex代码为$x_{2i}^{2+b}$

4.2字母上方

字符LaTeX表达式字符LaTeX表达式
a ^ \hat{a} a^\hat{a} a ˊ \acute{a} aˊ\acute{a}
a ˋ \grave{a} aˋ\grave{a} a ˘ \breve{a} a˘\breve{a}
a ˉ \bar{a} aˉ\bar{a} a ~ \widetilde{a} a \widetilde{a}
a ˇ \check{a} aˇ\check{a} a ~ \tilde{a} a~\tilde{a}
a ˙ \dot{a} a˙\dot{a} a ¨ \ddot{a} a¨\ddot{a}
a ⃗ \vec{a} a \vec{a} a ^ \widehat{a} a \widehat{a}
x y z ‾ \overline{xyz} xyz\overline{xyz} x y z → \overrightarrow{xyz} xyz \overrightarrow{xyz}
x y z ↔ \overleftrightarrow{xyz} xyz \overleftrightarrow{xyz}

4.3通用

\sideset{_1^2}{_3^4}X_a^b 

5.括号


LaTeX表达式中的 ( ) [ ]均可以正常使用,但是对于{ }需要转义字符,即使用\{\}分别表示 { }

字符LaTeX表达式
( … ) \left(…\right) ()\left(…\right)
∣ \vert \vert
∥ \Vert \Vert
⟨ \langle \langle
⟩ \rangle \rangle
⌈ \lceil \lceil
⌉ \rceil \rceil
⌊ \lfloor \lfloor
⌋ \rfloor \rfloor
( ( ( ( ( x ) ) ) ) ) \Biggl(\biggl(\Bigl(\bigl((x)\bigr)\Bigr)\biggr)\Biggr) (((((x)))))\Biggl(\biggl(\Bigl(\bigl((x)\bigr)\Bigr)\biggr)\Biggr)
∣ x ∣ \vert x \vert x\vert x \vert
{ a b c \begin{cases} a \\ b \\ c \end{cases} abc​​​\begin{cases} a \\ b \\ c \end{cases}

6.分数


字符LaTeX表达式
a b \frac ab ba\frac a b
a b \cfrac{a}{b} ba\cfrac{a}{b}
a + 1 b + 1 \frac{a+1}{b+1} b+1a+1\frac{a+1}{b+1}
a + 1 b + 1 {a+1\over b+1} b+1a+1{a+1\over b+1}

7.开方


字符LaTeX表达式
x 3 \sqrt{x^3} x3 \sqrt{x^3}
x y 3 \sqrt[3]{\frac xy} 3yx \sqrt[3]{\frac xy}

8.矩阵


常用的矩阵环境有matrix、bmatrix、vmatrix、pmatrix,其区别为在于外面的括号不同。

字符LaTeX表达式
0 1 1 0 \begin{matrix} 0 & 1 \\ 1 & 0 \end{matrix} 0110\begin{matrix} 0 & 1 \\ 1 & 0 \end{matrix}
( 0 − i i 0 ) \begin{pmatrix} 0 & -i \\ i & 0 \end{pmatrix} (0ii0)\begin{pmatrix} 0 & -i \\ i & 0 \end{pmatrix}
[ 0 − 1 1 0 ] \begin{bmatrix} 0 & -1 \\ 1 & 0 \end{bmatrix} [0110]\begin{bmatrix} 0 & -1\\ 1 & 0 \end{bmatrix}
{ 1 0 0 − 1 } \begin{Bmatrix} 1 & 0 \\ 0 & -1 \end{Bmatrix} {1001}\begin{Bmatrix} 1 & 0 \\ 0 & -1 \end{Bmatrix}
∣ a b c d ∣ \begin{vmatrix} a & b \\ c & d \end{vmatrix} acbd \begin{vmatrix} a & b \\ c & d \end{vmatrix}
∥ i 0 0 − i ∥ \begin{Vmatrix} i & 0 \\ 0 & -i \end{Vmatrix} i00i \begin{Vmatrix} i & 0 \\ 0 & -i \end{Vmatrix}

以下代码中,&用于分隔列,\\用于分隔行

$$
\begin{bmatrix}
1 & 1 & 1 & \cdots \\ 
1 & 2 & 3 & \cdots \\  
1 & 3 & 6 & \cdots \\ 
\vdots & \vdots & \vdots & \ddots \\ 
\end{bmatrix}
效果
[ 1 1 1 ⋯ 1 2 3 ⋯ 1 3 6 ⋯ ⋮ ⋮ ⋮ ⋱ ] \begin{bmatrix} 1 & 1 & 1 &\cdots \\ 1 & 2 & 3& \cdots \\ 1& 3& 6 & \cdots\\ \vdots & \vdots &\vdots& \ddots \\ \end{bmatrix} 111123136 ​​​​​

9.函数


9.1三角

符号LaTeX表达式
sin ⁡ \sin sin\sin
cos ⁡ \cos cos\cos
sin ⁡ − 1 \sin^{-1} sin1\sin^{-1}
arcsin ⁡ \arcsin arcsin\arcsin
⋯ \cdots ⋯ \cdots

9.2对数

符号LaTeX表达式
log ⁡ a b \log_{a}{b} logab\log_{a}{b}
ln ⁡ a b \ln_ab lnab\ln_{a}{b}
lg ⁡ a b \lg_ab lgab\lg_{a}{b}

10.导数与极限


符号LaTeX表达式
$\lim_{x \to \infty} $\lim_{x \to \infty}
$\textstyle \lim_{x \to 0} $\textstyle \lim_{x \to 0}
a ′ {a}' a{a}’
a ′ ′ a'' a′′{a}‘’

10.1导数

f ′ ( x ) = x 2 + x {f}'(x) = x^2 + x f(x)=x2+x

$$
{f}'(x) = x^2 + x
$$

10.2极限

lim ⁡ x → 0 3 x 2 + 7 x 3 x 2 + 5 x 4 = 3 \lim_{x \to 0} \frac {3x ^2 +7x^3} {x^2 +5x^4} = 3 x0limx2+5x43x2+7x3=3

$$
\lim_{x \to 0} \frac {3x ^2 +7x^3} {x^2 +5x^4} = 3
$$

11.积分


符号LaTeX表达式符号LaTeX表达式
$ \int $\int ∮ \oint \oint
$ \int_{a}^{b} $\int_{a}^{b}$\oint_{a}^{b} $\oint_{a}^{b}
$\int\limits_{a}^{b} $\int\limits_{a}^{b} ∬ a b \iint_{a}^{b} ab\iint_{a}^{b}
∬ \iint \iint$\iint\limits_{a}^{b} $\iint\limits_{a}^{b}
∭ \iiint \iiint

∫ a b f ( x ) d x \int_a^b f(x) dx abf(x)dx

$$
\int_a^b f(x) dx 
$$

∫ x 2 + y 2 ≤ R 2 f ( x , y ) d x d y = ∫ θ = 0 2 π ∫ r = 0 R f ( r cos ⁡ θ , r sin ⁡ θ ) r d r d θ \int_{x^2 + y^2 \leq R^2} f(x,y) dx dy = \int_{\theta=0}^{2\pi} \int_{r=0}^R f(r\cos\theta,r\sin\theta) r dr d\theta x2+y2R2f(x,y)dxdy=θ=02πr=0Rf(rcosθ,rsinθ)rdrdθ

$$
\int_{x^2 + y^2 \leq R^2}   
f(x,y) dx dy = 
\int_{\theta=0}^{2\pi}    \int_{r=0}^R    f(r\cos\theta,r\sin\theta) r dr d\theta
$$

12.大型运算


12.1求和

符号LaTeX表达式
∑ \sum \sum
$\sum_{a}^{b} $\sum_{a}^{b}

12.2乘积余积

符号LaTeX表达式
∏ \prod \prod
∏ a b \prod_{a}^{b} ab\prod_{a}^{b}
$\coprod $\coprod
$\coprod_{a}^{b} $\coprod_{a}^{b}

12.3交集并集

符号LaTeX表达式
⋃ \bigcup \bigcup
⋃ a b \bigcup_{a}^{b} ab\bigcup_{a}^{b}
⋂ \bigcap \bigcap
⋂ a b \bigcap_{a}^{b} ab\bigcap_{a}^{b}

12.4析取合取

符号LaTeX表达式
⋁ \bigvee \bigvee
⋁ a b \bigvee_{a}^{b} ab\bigvee_{a}^{b}
⋀ \bigwedge \bigwedge
⋀ a b \bigwedge_{a}^{b} ab\bigwedge_{a}^{b}

13.LaTeX数学字体


13.1字体简介

名称含义用途示例
mathbbBlackboard Bold,黑板粗体期望 H e l l o W o r l d \mathbb{HelloWorld} HelloWorld
mathbfBoldface,粗体矩阵 向量 H e l l o W o r l d \mathbf{HelloWorld} HelloWorld
mathcalCalligraphy,书法字体集合 分布 H e l l o W o r l d \mathcal{HelloWorld} HelloWorld
mathrmRoman,罗马字体正文 H e l l o W o r l d \mathrm{HelloWorld} HelloWorld
mathnormalNormal,默认公式 H e l l o W o r l d \mathnormal{HelloWorld} HelloWorld​​​
mathitItalic,斜体(适用数字和字符)注释 H e l l o W o r l d \mathit{HelloWorld} HelloWorld​​
mathsfSans-serif,无衬线正文 H e l l o W o r l d \mathsf{HelloWorld} HelloWorld
mathttTypewriter Typestyle,打字机复古 H e l l o W o r l d \mathtt{HelloWorld} HelloWorld
mathfrakFraktur,德文尖角体未知 H e l l o W o r l d \mathfrak{HelloWorld} HelloWorld​​

13.2代码示例

$\mathnormal{HelloWorld}$

关于


参考资料

  1. B站UP主「妈咪说MommyTalk」的原创视频,视频链接:
    妈咪说

  2. CSDN博主「ViatorSun」的原创文章,原文链接:
    ViatorSun的原创文章

  3. LaTeX Documentation 链接:文档

  4. 百度百科:LaTeX(排版系统) 链接:百度百科

推荐工具(在线)

  1. 在线LaTeX公式编辑器,链接:在线latex公式

  2. 在线生成latex表格,链接:表格

  • 5
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值