LaTeX公式保姆級(jí)教程 (以及其中的各種細(xì)節(jié))

課代表來力!Up講的太好了!記了一個(gè)通宵
ps:請(qǐng)使用Typora等markdown編輯器打開
四.LaTex語法
1.希臘字母
(1)小寫希臘字母表:
\alpha\beta\gamma\delta\epsilon\varepsilon\alpha\beta\gamma\delta\epsilon\varepsilon\zeta\eta\theta\vartheta\iota\kappa\zeta\eta\theta\vartheta\iota\kappa\lambda\mu\nu\xio\pi\lambda\mu\nu\xio\pi\varpi\rho\varrho\sigma\varsigma\tau\varpi\rho\varrho\sigma\varsigma\tau\upsilon\phi\varphi\chi\psi\omega\upsilon\phi\varphi\chi\psi\omega
(2)大寫希臘字母表:
\alpha\Gamma\Delta\Theta\Lambda\Xi\alpha\Gamma\Delta\Theta\Lambda\Xi\Alpha\varGamma\varDelta\varTheta\varLambda\varXi\Alpha\varGamma\varDelta\varTheta\varLambda\varXi\gamma\delta\theta\lambda\xi\gamma\delta\theta\lambda\xi\vartheta\vartheta
\Sigma\Upsilon\Phi\Psi\Omega\Pi\Sigma\Upsilon\Phi\Psi\Omega\Pi\varSigma\varUpsilon\varPhi\varPsi\varOmega\varPi\varSigma\varUpsilon\varPhi\varPsi\varOmega\varPi\sigma\upsilon\phi\psi\omega\pi\sigma\upsilon\phi\psi\omega\pi\varsigma\varphi\varpi\varsigma\varphi\varpi
(3)希臘字母表(圖片傳送門):
$$
\delta,\Delta\\ \phi,\varphi,\Phi,\varPhi
$$
2.斜體和直立體
ps:
英文字母只有在表示變量(或單一字符的函數(shù)名稱,如f(x))時(shí)才可使用斜體,其余情況都應(yīng)使用羅馬體(直立體)。
x_i:i表示 1,2,...,n 為變量
x_{\rm i}:{\rm i}表示"輸入"(input)之意,為普通文本
Eg: e:自然對(duì)數(shù)的底數(shù),為常量; i,j:虛數(shù)單位,為常量
運(yùn)算符名稱超過一個(gè)字母時(shí)應(yīng)該使用直立體(Eg:max× \max√ )
(0)斜體(默認(rèn))(不兼容空格):[符號(hào)]
$$
x_i=y_j\\ x_{i j}=y_{j i}
$$
(1)羅馬體roman(不兼容空格):[ {\rm 符號(hào)} ] [ {\rm {符號(hào)組}} ]
$$
x_{\rm i}=y_{\rm j}\\ x_{\rm {i j}}=y_{\rm {j i}}
$$
(2)文本格式text(兼容空格):[ {\text 文本} ] [ {\text {文本組}} ]
$$
x_{\text i}=y_{\text j}\\ x_{\text {i j}}=y_{\text {j i}}
$$
3.上下標(biāo)
(1)上標(biāo):[ 符號(hào)^單個(gè)上標(biāo) ] [ 符號(hào)^{多個(gè)上標(biāo)} ]
(2)下標(biāo):[ 符號(hào)_單個(gè)下標(biāo) ] [ 符號(hào)_{多個(gè)下標(biāo)} ]
$$
a^2,A_1\\ a^{114514},A_{1919810}
$$
4.分式與根式
(1)分式&分式中分式變大式:[ \frac{分子}{分母} ] [ \dfrac{分子}{分母} ]
ps:\dfrac僅在Typora中適用
$$
\frac{2}{4}=\frac{1}{2}\\ f(x)=\frac{1}{x+y}\\ \frac{x+y}{\frac{1}{x}+\dfrac{1}{y}}
$$
(2)根式:[ \sqrt{符號(hào)} ] [ \sqrt[次方數(shù)]{符號(hào)} ]
$$
\sqrt{1+3}=\sqrt 4=2\\ \sqrt[3]{8}=2\\ \sqrt[4]{\sqrt{\frac{2}{x}}+1}
$$
5.普通運(yùn)算符
(1)常用運(yùn)算符查詢表
[圖片傳送門]
+-\times\cdot(centre)\div(divide)=+-\times(叉乘)\cdot(點(diǎn)乘)\div=\pm(plus-minus)\mp(minus-plus)><\ge(greater_than_or_euqal)\le(less_than_or_equal)\pm(加減)\mp(減加)><\ge(大于等于)\le(小于等于)\gg\ll\ne(not_equal)\approx(approximate)\equiv(equivalent)\varnothing\gg(遠(yuǎn)大于)\ll(遠(yuǎn)小于)\ne(不等于)\approx(約等于)\equiv(恒等于)\varnothing(空集)\cap\cup\in\notin\subseteq\subseteqq\cap(交集)\cup(并集)\in(屬于)\notin(不屬于)\subseteq(子集)\subseteqq(真子集)\forall\exists\nexists\because\therefore\mathbb Y(bboard_bold)\forall(對(duì)任意)\exists(存在)\nexists(不存在)\because\therefore\mathbb Y(黑板粗體)\R\Q\N\Z\Z_+\Z_-\R(實(shí)數(shù)集)\Q(有理數(shù)集)\N(自然數(shù)集)\Z(整數(shù)集)\Z_+(正整數(shù)集)\Z_-(負(fù)整數(shù)集)\mathcal\mathscr\cdots\vdots\ddots\infty\mathcal F(書法體)\mathscr F(手跡體/花體)\cdots(省略號(hào))\vdots(豎直省略號(hào))\ddots(斜省略號(hào))\infty\partial\nabla/propto\degree\sin x\max\partial(偏導(dǎo))\nabla(微分算子)\propto(正比)\degree(度)\sin x\max\log_n m\ln x\to\lim_{x \to y}z\lim\limits_{x \to y}z\,\log_n m\ln x\to(趨近)\lim_{x \to y}z\lim\limits_{x \to y}z(極限)A\,B(小間隔)
6.大型運(yùn)算符
(1)求和&乘積:[\sum] & [\prod]
$$
\sum,\prod\\ \sum_i,\sum_{i=1}^nx_i\\ \frac {\sum\limits_{i=1}^n x_i}{\prod\limits_{i=1}^n x_i}
$$
(2)積分(integral):[\int]
\int\iint\iiint\iiiint\oint\oiint\oiiint\int\iint\iiint\iiiint\oint\oiint\oiiint
不定積分寫法:\int f(x)
\int f(x)
定積分寫法:\int_{A}^{B}f(x)\,{\rm d}x
\int_{A}^{B}f(x)\,{\rm d}x
$$
\int,\iint,\iiint,\iiiint,\oint,\oiint,\oiiint\\ \int_{-\infty}^{+\infty}f(x)\,{\rm d}x\\
$$
(3)*間隔距離
\,<space>\quad\qquadA\,B(小空格)A\ B(普通空格)A\quadB(中空格)A\qquadB(大空格)
$$
A\,B\\ A\ B\\ A\quad B\\ A\qquad B
$$
7.標(biāo)注符號(hào)
\hat{a}\tilde{a}\check{a}\acute{a}\grave{a}\breve{a}\hat{a}\tilde{a}\check{a}\acute{a}\grave{a}\breve{a}\widehat{ABC}\widetilde{ABC}\bar{a}/vec{a}\dot{a}\ddot{a}\widehat{ABC}\widetilde{ABC}\bar{a}\vec{a}\dot{a}\ddot{a}\mathring{a}/overline{ABC}\overrightarrow{ABC}\dddot{a}\ddddot{a}\mathring{a}\overline{ABC}\overrightarrow{ABC}\dddot{a}\ddddot{a}
8.箭頭
\leftarrow \gets\rightarrow \to\leftrightarrow\Leftrightarrow\leftarrow \gets\rightarrow \to\leftrightarrow\Leftrightarrow\longleftarrow\longrightarrow\longleftrightarrow\Longleftrightarrow \iff\longleftarrow\longrightarrow\longleftrightarrow\Longleftrightarrow \iff\Leftarrow\Rightarrow\mapsto\hookleftarrow\Leftarrow\Rightarrow\mapsto\hookleftarrow\Longleftarrow\Longrightarrow\longmapsto\hookrightarrow\Longleftarrow\Longrightarrow\longmapsto\hookrightarrow\leftharpoonup\rightharpoonup\leftharpdown\rightharpoondown\leftharpoonup\rightharpoonup\leftharpoondown\rightharpoondown\uparrow\downarrow\updownarrow\rightleftharpoons\uparrow\downarrow\updownarrow\rightleftharpoons\Uparrow\Downarrow\Updownarrow\leadsto^\mathscr l\Uparrow\Downarrow\Updownarrow\leadsto^\mathscr l\nearrow\searrow\swarrow\nwarrow\nearrow\searrow\swarrow\nwarrow
9.括號(hào)與定界符
(,)[,]\ {\ }\lceil\rceil\lfloor\rfloor|(,)[,]\{\}\lceil\rceil\lfloor\rfloor|
自適應(yīng)括號(hào):\left左括號(hào) \right右括號(hào)
虛擬自適應(yīng)括號(hào):\left. \right.
$$
(AAA)[BBB]\{CCC\}\\ \{A[B(C)B]A\}\\ (\frac{1}{x},\infty]\qquad \left(\frac{1}{x},\infty\right]\\ \frac{\partial y}{\partial x}|_{x=0}\qquad \left.\frac{\partial y}{\partial x}\right|_{x=0}
$$
10.多行公式
(1)align環(huán)境:
\begin{align}
LaTex01\\
LaTex02\\
...
LaTex n
\end{align}
(2)自定義對(duì)齊(默認(rèn)右對(duì)齊中線):&(等距離空格拉伸)
$$
\begin{align} abcabc\\ ABCABC\\ a&=b+c\\ &=e+f+g \end{align}
$$
11.大括號(hào)
(1)cases環(huán)境:
\begin{cases}
LaTex01\\
LaTex02\\
...
LaTex n
\end{cases}
(2)自定義對(duì)齊(默認(rèn)右對(duì)齊中線):&(等距離空格拉伸)
$$
f(x)= \begin{cases} \sin x &(x\ge1)\\ \cos x &(0\le x<1)\\ 0 &(x<0) \end{cases}
$$
12.矩陣
(1)矩陣環(huán)境:
matrixbmatrixpmatrixvmatrix無括號(hào)方括號(hào)圓括號(hào)豎直括號(hào)(行列式)
\begin{環(huán)境}
LaTex01\\
LaTex02\\
...
LaTex n
\end{環(huán)境}
$$
\begin{matrix} \tag{matrix:無括號(hào)} 1&0&0&\cdots&0\\ 0&1&0&\cdots&0\\ 0&0&1&\cdots&0\\ \vdots&\vdots&\vdots&\ddots&\vdots\\ 0&0&0&\cdots&1 \end{matrix}
$$
$$
\begin{bmatrix} \tag{bmatrix:方括號(hào)} 1&0&0&\cdots&0\\ 0&1&0&\cdots&0\\ 0&0&1&\cdots&0\\ \vdots&\vdots&\vdots&\ddots&\vdots\\ 0&0&0&\cdots&1 \end{bmatrix}
$$
$$
\begin{pmatrix} \tag{pmatrix:圓括號(hào)} 1&0&0&\cdots&0\\ 0&1&0&\cdots&0\\ 0&0&1&\cdots&0\\ \vdots&\vdots&\vdots&\ddots&\vdots\\ 0&0&0&\cdots&1 \end{pmatrix}
$$
$$
\begin{vmatrix} \tag{vmatrix:行列式} 1&0&0&\cdots&0\\ 0&1&0&\cdots&0\\ 0&0&1&\cdots&0\\ \vdots&\vdots&\vdots&\ddots&\vdots\\ 0&0&0&\cdots&1 \end{vmatrix}
$$
(2)矩陣名稱:[\bf 字母] (bold face黑色粗體)
$$
\bf A= \begin{pmatrix} 1&0\\ 0&1 \end{pmatrix}
$$
(3)矩陣轉(zhuǎn)置:[\bf 矩陣名^{\rm T}]
$$
\begin{align} {\bf B}= &\begin{pmatrix} 1&2\\ 3&4 \end{pmatrix}\\\\ {\bf A}={\bf B^{\rm T}}= &\begin{pmatrix} 1&3\\ 2&4 \end{pmatrix} \end{align}
$$
13.復(fù)合LaTeX實(shí)例
(1)正態(tài)分布
$$
\begin{align} &f(x)=\frac{1}{\sqrt{2\pi}\sigma}{\rm e}^{-\frac{(x-\mu)^2}{2\sigma^2}}\\ &f(x)=\frac{1}{\sqrt{2\pi}\sigma}\exp\left[{-\frac{(x-\mu)^2}{2\sigma^2}}\right] \end{align}
$$
(2)極限例式
$$
\lim\limits_{N\to\infty}P\left\{\left|\frac{I\left(\alpha_i\right)}{N}-H(s)\right|<\varepsilon\right\}=1
$$
(3)積分例式
$$
x(n)=\frac{1}{2\pi}\int_{-\pi}^\pi X\left({\rm e^{{\rm j}\omega}}\right){\rm e}^{{\rm j}\omega n}\,{\rm d}\omega
$$
(4)復(fù)合例式
$$
\begin{align} \vec{B}\left(\vec{r}\right)&=\frac{\mu_0}{4\pi}\oint_C\frac{I\,{\rm d}\vec{l}\times\vec{R}}{R^3}\\ &=\frac{\mu_0}{4\pi}\int_V\frac{\vec{J}_V\times\vec{R}}{R^3}\,{\rm d}V' \end{align}
$$