TeX(/tɛx/,常被读作/tɛk/,音译“泰赫”,“泰克”,风格化后写作“TeX”),是一个由美国计算机科学教授高德纳(Donald Ervin Knuth)编写的排版软件。TeX的MIME类型为application/x-tex
,是一款自由软件。它在学术界特别是数学、物理学和计算机科学界十分流行。TEX被普遍认为是一个优秀的排版工具,尤其是对于复杂数学符号的处理。利用LaTeX等终端软件,TeX就能够排版出精美的文本以帮助人们辨认和查找。
TEX公式过于繁多,为方便使用我把一些可能用到的列举到下面,不同的TEX解释器的支持可能不同,有些可能在特定的解释器无法解析。这里以我笔记Trilium内嵌的CKEditor5编辑器支持的为主。
测试工具:wiris.net
示例※
| \(\overset{{}_\iota^\kappa F_\mu^\lambda}{\underset{{}_\phi^\chi E_\omega^\psi}{{}_{{}_\alpha^\beta C_\delta^\gamma}^{{}_\varepsilon^\zeta D_\theta^\eta}\prod\nolimits_{{}_\rho^\sigma A_\upsilon^\tau}^{{}_\nu^\xi B_\pi^o}}}\) |
\mathop{正文}\limits_{下文} | \(\mathop{正文}\limits_{下文}\) |
\frac{a}{b} | \(\frac{a}{b}\) |
| \(\begin{array}{ccc}0&\leftarrow&3\\\downarrow&\begin{array}{cc}&\\&\end{array}\;&\uparrow\\1&\rightarrow&2\end{array}\\\) |
\sqrt[3]8+\sqrt[n]2+\sqrt[2p]x | \(\sqrt[3]8+\sqrt[n]2+\sqrt[2p]x\) |
| \(\frac{f\circ g}{f\circ h}\;\frac1{\sqrt2}\;\frac{x_j}{x^t}\;\frac{\underline x}{\overrightarrow x}\;\frac1{\overrightarrow k}\;\frac1{2.\overset\frown3}\) |
| \(\underbrace{f(x)}_{y=x^2}\circ\overbrace{g(x)}^{y=a_j}\;\;\) |
| \(\boxed{{\xcancel2}^{\boxed{\bcancel{5}}}_{\boxed{\cancel4}}}\) |
各种括号※
大括号显示※
左对齐 |
| \(\left\{ \begin{array}{lr} x-a,& \\ y=s,& \\ z=e \end{array} \right.\) |
居中 |
| \(\left\{ \begin{array}{rcl} a & \\a \\A \\as \end{array} \right.\) |
右对齐 |
| \(\left\{ \begin{array}{r} aaa&\\ B \\ sssssss\end{array} \right.\) |
大括号三种写法※
| \(\left\{ \begin{aligned} a &=cc \\ abcd &=aaa \\ B &= \frac xy \end{aligned} \right.\) |
| \(\left\{ \begin{array}{lcr} &x &-&a \\ &y&=&sss \\&z&=&e \end{array} \right.\) |
| \(\begin{cases} &a& =&a \\&bb&=&aa \\&cc&=&ccc \end{cases}\) |
函数、符号及特殊字符※
对错号※
\chackmark | \(\checkmark\) |
\Times | \(\times\) |
声调 / 变音符号※
\dot{a} | \(\dot{a}\) |
\ddot{a} | \(\ddot{a}\) |
\acute{a} | \(\acute{a}\) |
\grave{a} | \(\grave{a}\) |
\check{a} | \(\check{a}\) |
\breve{a} | \(\breve{a}\) |
\tilde{a} | \(\tilde{a}\) |
\bar{a} | \(\bar{a}\) |
\hat{a} | \(\hat{a}\) |
\widehat{a} | \(\widehat{a}\) |
\vec{a} | \(\vec{a}\) |
标准函数※
指数 | \exp_ab=a^b | \(\exp_ab=a^b\) |
对数 | \ln c,\lg d = \log e,\log_{10} f | \(\ln c,\lg d = \log e,\log_{10} f\) |
三角函数 | \sin a,\cos b,\tan c,\cot d,\sec e,\csc f | \(\sin a,\cos b,\tan c,\cot d,\sec e,\csc f\) |
反三角函数 | \arcsin a,\arccos b\,arctan c | \(\arcsin a,\arccos b\,arctan c\) |
双曲函数 | \sinh a,\cosh b,\coth c | \(\sinh a,\cosh b,\coth c\) |
\operatorname{sh}k, \operatorname{ch}l, \operatorname{th}m, \operatorname{coth}n | \(\operatorname{sh}k, \operatorname{ch}l, \operatorname{th}m, \operatorname{coth}n\) | |
反双曲函数 | \operatorname{argsh}o, \operatorname{argch}p, \operatorname{argth}q | \(\operatorname{argsh}o, \operatorname{argch}p, \operatorname{argth}q\) |
绝对值 | \left\vert \ S \right\vert | \(\left\vert \ S \right\vert\) |
最大/小值 | \min(x,y), \max(x,y) | \(\min(x,y), \max(x,y)\) |
界限,极限※
| \(\min x, \max y, \inf s, \sup t\) |
| \(\lim u, \liminf v, \limsup w\) |
| \(\lim_{x \to \infty} \frac{1}{n(n+1)}\) |
| \(\dim p, \deg q, \det m, \ker\phi\) |
投射※
| \(\Pr j, \hom l, \lVert z \rVert, \arg z\) |
微分及导数※
| \(dt, \mathrm{d}t, \partial t, \nabla\psi\) |
| \(dy/dx, \mathrm{d}y/\mathrm{d}x, \frac{dy}{dx}, \frac{\mathrm{d}y}{\mathrm{d}x}, \frac{\partial^2}{\partial x_1\partial x_2}y\) |
| \(\prime, \backprime, f^\prime, f', f'', f^{(3)}, \dot y, \ddot y\) |
类字母符号及常数※
| \(\infty, \aleph, \complement, \backepsilon, \eth, \Finv, \hbar\) |
| \(\Im, \imath, \jmath, \Bbbk, \ell, \mho, \wp, \Re, \circledS, \circledR\) |
模运算※
s_k \equiv 0 \pmod{m} | sk≡0(modm) |
a \bmod b | amodb |
\gcd(m, n), \operatorname{lcm}(m, n) | gcd(m,n),lcm(m,n) |
\mid, \nmid, \shortmid, \nshortmid | ∣,∤,∣,∤ |
根号※
\surd, \sqrt{2}, \sqrt[n]{}, \sqrt[3]{\frac{x^3+y^3}{2}} | √,2,n,x3+y323 |
运算符※
+, -, \pm, \mp, \dotplus | +,−,±,∓,∔ |
\times, \div, \divideontimes, /, \backslash | ×,÷,⋇,/,∖ |
\cdot, * \ast, \star, \circ, \bullet | ⋅,∗∗,⋆,∘,∙ |
\boxplus, \boxminus, \boxtimes, \boxdot | ⊞,⊟,⊠,⊡ |
\oplus, \ominus, \otimes, \oslash, \odot | ⊕,⊖,⊗,⊘,⊙ |
\circleddash, \circledcirc, \circledast | ⊝,⊚,⊛ |
\bigoplus, \bigotimes, \bigodot | ⨁,⨂,⨀ |
集合※
\{ \}, \O \empty \emptyset, \varnothing | {},∅∅∅,∅ |
\in, \notin \not\in, \ni, \not\ni | ∈,∉∉,∋,∌ |
\cap, \Cap, \sqcap, \bigcap | ∩,⋒,⊓,⋂ |
\cup, \Cup, \sqcup, \bigcup, \bigsqcup, \uplus, \biguplus | ∪,⋓,⊔,⋃,⨆,⊎,⨄ |
\setminus, \smallsetminus, \times | ∖,∖,× |
\subset, \Subset, \sqsubset | ⊂,⋐,⊏ |
\supset, \Supset, \sqsupset | ⊃,⋑,⊐ |
\subseteq, \nsubseteq, \subsetneq, \varsubsetneq, \sqsubseteq | ⊆,⊈,⊊,⊊,⊑ |
\supseteq, \nsupseteq, \supsetneq, \varsupsetneq, \sqsupseteq | ⊇,⊉,⊋,⊋,⊒ |
\subseteqq, \nsubseteqq, \subsetneqq, \varsubsetneqq | ⫅,⊈,⫋,⫋ |
\supseteqq, \nsupseteqq, \supsetneqq, \varsupsetneqq | ⫆,⊉,⫌,⫌ |
关系符号※
=, \ne, \neq, \equiv, \not\equiv | =,≠,≠,≡,≢ |
\doteq, \doteqdot, \overset{\underset{\mathrm{def}}{}}{=}, := | ≐,≑,=def,:= |
\sim, \nsim, \backsim, \thicksim, \simeq, \backsimeq, \eqsim, \cong, \ncong | ∼,≁,∽,∼,≃,⋍,≂,≅,≆ |
\approx, \thickapprox, \approxeq, \asymp, \propto, \varpropto | ≈,≈,≊,≍,∝,∝ |
<, \nless, \ll, \not\ll, \lll, \not\lll, \lessdot | <,≮,≪,≪̸,⋘,⋘̸,⋖ |
>, \ngtr, \gg, \not\gg, \ggg, \not\ggg, \gtrdot | >,≯,≫,≫̸,⋙,⋙̸,⋗ |
\le, \leq, \lneq, \leqq, \nleq, \nleqq, \lneqq, \lvertneqq | ≤,≤,⪇,≦,≰,≰,≨,≨ |
\ge, \geq, \gneq, \geqq, \ngeq, \ngeqq, \gneqq, \gvertneqq | ≥,≥,⪈,≧,≱,≱,≩,≩ |
\lessgtr, \lesseqgtr, \lesseqqgtr, \gtrless, \gtreqless, \gtreqqless | ≶,⋚,⪋,≷,⋛,⪌ |
\leqslant, \nleqslant, \eqslantless | ⩽,⪇,⪕ |
\geqslant, \ngeqslant, \eqslantgtr | ⩾,⪈,⪖ |
\lesssim, \lnsim, \lessapprox, \lnapprox | ≲,⋦,⪅,⪉ |
\gtrsim, \gnsim, \gtrapprox, \gnapprox | ≳,⋧,⪆,⪊ |
\prec, \nprec, \preceq, \npreceq, \precneqq | ≺,⊀,⪯,⋠,⪵ |
\succ, \nsucc, \succeq, \nsucceq, \succneqq | ≻,⊁,⪰,⋡,⪶ |
\preccurlyeq, \curlyeqprec | ≼,⋞ |
\succcurlyeq, \curlyeqsucc | ≽,⋟ |
\precsim, \precnsim, \precapprox, \precnapprox | ≾,⋨,⪷,⪹ |
\succsim, \succnsim, \succapprox, \succnapprox | ≿,⋩,⪸,⪺ |
≿,⋩,⪸,⪺≿,⋩,⪸,⪺
几何符号※
\parallel, \nparallel, \shortparallel, \nshortparallel | ∥,∦,∥,∦ |
\perp, \angle, \sphericalangle, \measuredangle, 45^\circ | ⊥,∠,∢,∡,45∘ |
\Box, \blacksquare, \diamond, \Diamond \lozenge, \blacklozenge, \bigstar | ◻,◼,⋄,◊◊,⧫,★ |
\bigcirc, \triangle, \bigtriangleup, \bigtriangledown | ◯,△,△,▽ |
\vartriangle, \triangledown | △,▽ |
\blacktriangle, \blacktriangledown, \blacktriangleleft, \blacktriangleright | ▴,▾,◂,▸ |
逻辑符号※
全称量词 | \forall x | \(\forall x\) |
存在量词 | \exists x | \(\exists x\) |
不存在 | \nexists x | \(\nexists x\) |
因此 | \therefore | \(\therefore\) |
因为 | \because | \(\because\) |
和且 | \And | \(\And\) |
逻辑或 | \lor \vee, \curlyvee, \bigvee | \(\lor \vee, \curlyvee, \bigvee\) |
逻辑与 |
| \(\land \wedge, \curlywedge, \bigwedge\) |
逻辑非 | \bar{q}, \bar{abc}, \overline{q}, \overline{abc}, \lnot \neg | \(\bar{q}, \bar{abc}, \overline{q}, \overline{abc}, \lnot \neg\) |
非R | \not\operatorname{R} | \(\not\operatorname{R}\) |
逻辑底/假 | \bot | \(\bot\) |
逻辑顶/真 | \top | \(\top\) |
推导关系 | \vdash | \(\vdash\) |
左垂直双关系 | \dashv | \(\dashv\) |
模型关系 | \vDash | \(\vDash\) |
强模型关系的反向 | \Vdash | \(\Vdash\) |
模型关系 | \models | \(\models\) |
双垂直双关系 | \Vvdash | \(\Vvdash\) |
推导关系的否定形式 | \nvdash | \(\nvdash\) |
强模型关系 的否定形式 | \nVdash | \(\nVdash\) |
模型关系的否定形式 | \nvDash | \(\nvDash\) |
强模型关系的否定形式 | \nVDash | \(\nVDash\) |
四个角 | \ulcorner \urcorner \\ \llcorner \lrcorner | \(\ulcorner \urcorner\\ \llcorner \lrcorner\) |
箭头※
\Rrightarrow, \Lleftarrow | \(\Rrightarrow, \Lleftarrow\) |
\Rightarrow, \nRightarrow, \Longrightarrow \implies | \(\Rightarrow, \nRightarrow, \Longrightarrow \implies\) |
\Leftarrow, \nLeftarrow, \Longleftarrow | \(\Leftarrow, \nLeftarrow, \Longleftarrow\) |
\Leftrightarrow, \nLeftrightarrow, \Longleftrightarrow \iff | \(\Leftrightarrow, \nLeftrightarrow, \Longleftrightarrow \iff\) |
\Uparrow, \Downarrow, \Updownarrow | \(\Uparrow, \Downarrow, \Updownarrow\) |
\rightarrow \to, \nrightarrow, \longrightarrow | \(\rightarrow \to, \nrightarrow, \longrightarrow\) |
\leftarrow \gets, \nleftarrow, \longleftarrow | \(\leftarrow \gets, \nleftarrow, \longleftarrow\) |
\leftrightarrow, \nleftrightarrow, \longleftrightarrow | \(\leftrightarrow, \nleftrightarrow, \longleftrightarrow\) |
\uparrow, \downarrow, \updownarrow | \(\uparrow, \downarrow, \updownarrow\) |
\nearrow, \swarrow, \nwarrow, \searrow | \(\nearrow, \swarrow, \nwarrow, \searrow\) |
\mapsto, \longmapsto | \(\mapsto, \longmapsto\) |
\rightharpoonup \rightharpoondown \leftharpoonup \leftharpoondown \upharpoonleft \upharpoonright \downharpoonleft \downharpoonright \rightleftharpoons \leftrightharpoons | \(\rightharpoonup \rightharpoondown \leftharpoonup \leftharpoondown \upharpoonleft \upharpoonright \downharpoonleft \downharpoonright \rightleftharpoons \leftrightharpoons\) |
\curvearrowleft \circlearrowleft \Lsh \upuparrows \rightrightarrows \rightleftarrows \rightarrowtail \looparrowright | \(\curvearrowleft \circlearrowleft \Lsh \upuparrows \rightrightarrows \rightleftarrows \rightarrowtail \looparrowright\) |
\curvearrowright \circlearrowright \Rsh \downdownarrows \leftleftarrows \leftrightarrows \leftarrowtail \looparrowleft | \(\curvearrowright \circlearrowright \Rsh \downdownarrows \leftleftarrows \leftrightarrows \leftarrowtail \looparrowleft\) |
\hookrightarrow \hookleftarrow \multimap \leftrightsquigarrow \rightsquigarrow \twoheadrightarrow \twoheadleftarrow | \(\hookrightarrow \hookleftarrow \multimap \leftrightsquigarrow \rightsquigarrow \twoheadrightarrow \twoheadleftarrow\) |
特殊符号※
省略号:数学公式中常见的省略号有两种,\ldots
表示与文本底线对齐的省略号,\cdots
表示与文本中线对齐的省略号。
\amalg \P \S \% \dagger \ddagger \ldots \cdots | \(\amalg \P \S \% \dagger \ddagger \ldots \cdots\) |
\smile \frown \wr \triangleleft \triangleright | \(\smile \frown \wr \triangleleft \triangleright\) |
\diamondsuit, \heartsuit, \clubsuit, \spadesuit, \Game, \flat, \natural, \sharp | \(\diamondsuit, \heartsuit, \clubsuit, \spadesuit, \Game, \flat, \natural, \sharp\) |
未分类※
\diagup \diagdown \centerdot \ltimes \rtimes \leftthreetimes \rightthreetimes | \(\diagup \diagdown \centerdot \ltimes \rtimes \leftthreetimes \rightthreetimes\) |
\eqcirc \circeq \triangleq \bumpeq \Bumpeq \doteqdot \risingdotseq \fallingdotseq | \(\eqcirc \circeq \triangleq \bumpeq \Bumpeq \doteqdot \risingdotseq \fallingdotseq\) |
\intercal \barwedge \veebar \doublebarwedge \between \pitchfork | \(\intercal \barwedge \veebar \doublebarwedge \between \pitchfork\) |
\vartriangleleft \ntriangleleft \vartriangleright \ntriangleright | \(\vartriangleleft \ntriangleleft \vartriangleright \ntriangleright\) |
\trianglelefteq \ntrianglelefteq \trianglerighteq \ntrianglerighteq | \(\trianglelefteq \ntrianglelefteq \trianglerighteq \ntrianglerighteq\) |
\not6, \frac{1\not6}{\not64}=\frac{1}{4} | \(\not6, \frac{1\not6}{\not64}=\frac{1}{4}\) |
上标、下标及积分等※
^
表示上标, _
表示下标。如果上下标的内容多于一个字符,需要用 {}
将这些内容括成一个整体。上下标可以嵌套,也可以同时使用。
上标 | a^2 | a2 |
下标 | a_2 | a2 |
组合 | a^{2+2} | a2+2 |
a_{i,j} | ai,j | |
结合上下标 | x_2^3 | x23 |
前置上下标 | {}_1^2\!X_3^4 | 12X34 |
上下标错开 | {x_1}^2=x_1 \times x_1 | x12=x1×x1 |
导数 (HTML) | x' | x′ |
导数 (PNG) | x^\prime | x′ |
导数 (错误) | x\prime | x′ |
导数点 | \dot{x} | x˙ |
\ddot{y} | y¨ | |
向量 | \vec{c} | c→ |
\overleftarrow{a b} | ab← | |
\overrightarrow{c d} | cd→ | |
\overleftrightarrow{a b} | ab↔ | |
\widehat{e f g} | efg^ | |
上弧 (注: 正确应该用 \overarc,但在这里行不通。要用建议的语法作为解决办法。)(使用\overarc时需要引入{arcs}包。) | \overset{\frown} {AB} | AB⌢ |
上划线 | \overline{h i j} | hij¯ |
下划线 | \underline{k l m} | klm_ |
上括号 | \overbrace{1+2+\cdots+100} | 1+2+⋯+100⏞ |
\overbrace{ 1+2+\cdots+100 }^{5050} | 1+2+⋯+100⏞5050 | |
下括号 | \underbrace{a+b+\cdots+z} | a+b+⋯+z⏟ |
\underbrace{ a+b+\cdots+z }_{26} | a+b+⋯+z⏟26 | |
求和 | \sum_{k=1}^N k^2 | ∑k=1Nk2 |
\begin{matrix} \sum_{k=1}^N k^2 \end{matrix} | ∑k=1Nk2 | |
求积 | \prod_{i=1}^N x_i | ∏i=1Nxi |
\begin{matrix} \prod_{i=1}^N x_i \end{matrix} | ∏i=1Nxi | |
上积 | \coprod_{i=1}^N x_i | ∐i=1Nxi |
\begin{matrix} \coprod_{i=1}^N x_i \end{matrix} | ∐i=1Nxi | |
极限 | \lim_{n \to \infty}x_n | limn→∞xn |
\begin{matrix} \lim_{n \to \infty}x_n \end{matrix} | limn→∞xn | |
积分 | \int_{-N}^{N} e^x\, \mathrm{d}x | ∫−NNexdx |
\begin{matrix} \int_{-N}^{N} e^x\, \mathrm{d}x \end{matrix} | ∫−NNexdx | |
双重积分 | \iint_{D}^{W} \, \mathrm{d}x\,\mathrm{d}y | ∬DWdxdy |
三重积分 | \iiint_{E}^{V} \, \mathrm{d}x\,\mathrm{d}y\,\mathrm{d}z | ∭EVdxdydz |
四重积分 | \iiiint_{F}^{U} \, \mathrm{d}x\,\mathrm{d}y\,\mathrm{d}z\,\mathrm{d}t | ⨌FUdxdydzdt |
闭合的曲线积分、曲面积分 | \oint_{C} x^3\, \mathrm{d}x + 4y^2\, \mathrm{d}y | ∮Cx3dx+4y2dy |
顺时针的闭合曲线积分、曲面积分 | \varointclockwise_{C} 7^x\, \mathrm{d}x + e^y\, \mathrm{d}y | ∲C7xdx+eydy |
逆时针的闭合曲线积分、曲面积分 | \ointctrclockwise_{C} 7^x\, \mathrm{d}x + e^y\, \mathrm{d}y | ∳C7xdx+eydy |
闭合面积分 | \oiint_{S} \,f\mathrm{d}A | ∯S7xfdA |
闭合体积分 | \oiiint_{E}\,f\mathrm{d}V | ∰E7xfdV |
交集 | \bigcap_1^{n} p | ⋂1np |
并集 | \bigcup_1^{k} p | ⋃1kp |
分数※
通常使用 \frac {分子} {分母}
命令产生一个分数,分数可嵌套。
便捷情况可直接输入 \frac ab
来快速生成一个 \(\frac ab\) 。
如果分式很复杂,亦可使用 分子 \over 分母
命令,此时分数仅有一层。
分数 | \frac{2}{4}=0.5 | \(\frac{2}{4}=0.5\) |
小型分数 | \tfrac{2}{4} = 0.5 | \(\tfrac{2}{4} = 0.5\) |
连分式(大型嵌套分式) | \cfrac{2}{c + \cfrac{2}{d + \cfrac{2}{4}}} = a | \(\cfrac{2}{c + \cfrac{2}{d + \cfrac{2}{4}}} = a\) |
大型不嵌套分式 | \dfrac{2}{4} = 0.5 \qquad \dfrac{2}{c + \dfrac{2}{d + \dfrac{2}{4}}} = a | \(\dfrac{2}{4} = 0.5 \qquad \dfrac{2}{c + \dfrac{2}{d + \dfrac{2}{4}}} = a\) |
二项式系数 | \dbinom{n}{r}=\binom{n}{n-r}=\mathrm{C}_n^r=\mathrm{C}_n^{n-r} | \(\dbinom{n}{r}=\binom{n}{n-r}=\mathrm{C}_n^r=\mathrm{C}_n^{n-r}\) |
小型二项式系数 | \tbinom{n}{r}=\tbinom{n}{n-r}=\mathrm{C}_n^r=\mathrm{C}_n^{n-r} | \(\tbinom{n}{r}=\tbinom{n}{n-r}=\mathrm{C}_n^r=\mathrm{C}_n^{n-r}\) |
大型二项式系数 | \binom{n}{r}=\dbinom{n}{n-r}=\mathrm{C}_n^r=\mathrm{C}_n^{n-r} | \(\binom{n}{r}=\dbinom{n}{n-r}=\mathrm{C}_n^r=\mathrm{C}_n^{n-r}\) |
在以e为底的指数函数、极限和积分中尽量不要使用 \frac 符号:它会使整段函数看起来很怪,而且可能产生歧义。也正是因此它在专业数学排版中几乎从不出现。 横着写这些分式,中间使用斜线间隔 / (用斜线代替分数线)。 | ||
| \(\begin{array}{cc} \mathrm{Bad} & \mathrm{Better} \\ \hline \\ e^{i\frac{\pi}2} \quad e^{\frac{i\pi}2}& e^{i\pi/2} \\ \int_{-\frac\pi2}^\frac\pi2 \sin x\,dx & \int_{-\pi/2}^{\pi/2}\sin x\,dx \\ \end{array}\) |
矩阵、条件表达式、方程组※
语法:
\begin{类型}
公式内容
\end{类型}
类型可以是:矩阵 matrix
pmatrix
bmatrix
Bmatrix
vmatrix
Vmatrix
、条件表达式 cases
、多行对齐方程式 aligned
、数组 array
。
在公式内容中:在每一行中插入 &
来指定需要对齐的内容,在每行结尾处使用 \\
换行。
无框矩阵※
在开头使用 begin{matrix}
,在结尾使用 end{matrix}
,在中间插入矩阵元素,每个元素之间插入 &
,并在每行结尾处使用 \\
。
| \(\begin{matrix} x & y \\ z & v \end{matrix}\) |
有框矩阵※
在开头将 matrix
替换为 pmatrix
bmatrix
Bmatrix
vmatrix
Vmatrix
。
使用 \cdots
⋯⋯ , \ddots
⋱⋱ , \vdots
⋮⋮ 来输入省略符号。
| \(\begin{vmatrix} x & y \\ z & v \end{vmatrix}\) |
| \(\begin{Vmatrix} x & y \\ z & v \end{Vmatrix}\) |
| \(\begin{bmatrix} 0 & \cdots & 0 \\ \vdots & \ddots & \vdots \\ 0 & \cdots & 0 \end{bmatrix}\) |
| \(\begin{Bmatrix} x & y \\ z & v \end{Bmatrix}\) |
| \(\begin{pmatrix} x & y \\ z & v \end{pmatrix}\) |
| \(\bigl( \begin{smallmatrix} a&b\\ c&d \end{smallmatrix} \bigr)\) |
条件表达式※
| \(f(n) = \begin{cases} n/2, & \text{if }n\text{ is even} \\ 3n+1, & \text{if }n\text{ is odd} \end{cases}\) |
多行等式、同余式※
人们经常想要一列整齐且居中的方程式序列。使用 \begin{aligned}…\end{aligned}
。
| \(\begin{aligned} f(x) & = (m+n)^2 \\ & = m^2+2mn+n^2 \\ \end{aligned}\) |
| \(\begin{aligned} 3^{6n+3}+4^{6n+3} & \equiv (3^3)^{2n+1}+(4^3)^{2n+1}\\ & \equiv 27^{2n+1}+64^{2n+1}\\ & \equiv 27^{2n+1}+(-27)^{2n+1}\\ & \equiv 27^{2n+1}-27^{2n+1}\\ & \equiv 0 \pmod{91}\\ \end{aligned}\) |
| \(\begin{alignedat}{3} f(x) & = (m-n)^2 \\ f(x) & = (-m+n)^2 \\ & = m^2-2mn+n^2 \\ \end{alignedat}\) |
方程组※
| \(\begin{cases} 3x + 5y + z \\ 7x - 2y + 4z \\ -6x + 3y + 2z \end{cases}\) |
| \(\left\{\begin{aligned} 3x + 5y + z \\ 7x - 2y + 4z \\ -6x + 3y + 2z \end{aligned}\right.\) |
数组与表格※
通常,一个格式化后的表格比单纯的文字或排版后的文字更具有可读性。数组和表格均以 \begin{array}
开头,并在其后定义列数及每一列的文本对齐属性,c
l
r
分别代表居中、左对齐及右对齐。若需要插入垂直分割线,在定义式中插入 |
,若要插入水平分割线,在下一行输入前插入 \hline
。与矩阵相似,每行元素间均须要插入 &
,每行元素以 \\
结尾,最后以 \end{array}
结束数组。
| \(\begin{array}{c|lcr} n & \text{左对齐} & \text{居中对齐} & \text{右对齐} \\ \hline 1 & 0.24 & 1 & 125 \\ 2 & -1 & 189 & -8 \\ 3 & -20 & 2000 & 1+10i \end{array}\) |
| \(\begin{array}{lcl} z & = & a \\ f(x,y,z) & = & x + y + z \end{array}\) |
| \(\begin{array}{lcr} z & = & a \\ f(x,y,z) & = & x + y + z \end{array}\) |
| \(\begin{array}{ccc} a & b & S \\ \hline 0&0&1\\ 0&1&1\\ 1&0&1\\ 1&1&0\\ \end{array}\) |
| \(\begin{array}{|c|c||c|} a & b & S \\ \hline 0&0&1\\ 0&1&1\\ 1&0&1\\ 1&1&0\\ \end{array}\) |
嵌套数组或表格※
多个数组/表格可 互相嵌套 并组成一组数组/一组表格。
| \(\begin{array}{c} \begin{array}{cc} \begin{array}{c|cccc} \text{min} & 0 & 1 & 2 & 3\\ \hline 0 & 0 & 0 & 0 & 0\\ 1 & 0 & 1 & 1 & 1\\ 2 & 0 & 1 & 2 & 2\\ 3 & 0 & 1 & 2 & 3 \end{array} & \begin{array}{c|cccc} \text{max}&0&1&2&3\\ \hline 0 & 0 & 1 & 2 & 3\\ 1 & 1 & 1 & 2 & 3\\ 2 & 2 & 2 & 2 & 3\\ 3 & 3 & 3 & 3 & 3 \end{array} \end{array} \\ \begin{array}{c|cccc} \Delta&0&1&2&3\\ \hline 0 & 0 & 1 & 2 & 3\\ 1 & 1 & 0 & 1 & 2\\ 2 & 2 & 1 & 0 & 1\\ 3 & 3 & 2 & 1 & 0 \end{array} \end{array}\) |
用数组实现带分割符号的矩阵※
其中 cc|c
代表在一个三列矩阵中的第二和第三列之间插入分割线。
| \(\left[ \begin{array}{cc|c} 1&2&3\\ 4&5&6 \end{array} \right]\) |
字体※
希腊字母※
输入 \小写希腊字母英文全称
和 \首字母大写希腊字母英文全称
来分别输入小写和大写希腊字母。
| \(\Alpha \Beta \Gamma \Delta \Epsilon \Zeta \Eta \Theta\) |
| \(\Iota \Kappa \Lambda \Mu \Nu \Xi \Omicron \Pi\) |
| \(\Rho \Sigma \Tau \Upsilon \Phi \Chi \Psi \Omega\) |
| \(\alpha \beta \gamma \delta \epsilon \zeta \eta \theta\) |
| \(\iota \kappa \lambda \mu \nu \omicron \xi \pi\) |
| \(\rho \sigma \tau \upsilon \phi \chi \psi \omega\) |
部分字母有变量专用形式,以 \var-
开头。
| \(\varepsilon \digamma \varkappa \varpi\) |
| \(\varrho \varsigma \vartheta \varphi\) |
希伯来符号※
| \(\aleph \beth \gimel \daleth\) |
部分字体的简称※
若要对公式的某一部分字符进行字体转换,可以用 {\字体 {需转换的部分字符}}
命令,其中 \字体
部分可以参照下表选择合适的字体。一般情况下,公式默认为意大利体 italicitalic 。
|\rm|罗马体|SampleSample|\cal|花体|SAMPLESAMPLE| | \(|\rm|罗马体|SampleSample|\cal|花体|SAMPLESAMPLE|\) |
|\it|意大利体|SampleSample|\Bbb|黑板粗体|SAMPLESAMPLE| | \(|\it|意大利体|SampleSample|\Bbb|黑板粗体|SAMPLESAMPLE|\) |
|\bf|粗体|SampleSample|\mit|数学斜体|SAMPLESAMPLE| | \(|\bf|粗体|SampleSample|\mit|数学斜体|SAMPLESAMPLE|\) |
|\sf|等线体|SampleSample|\scr|手写体|SAMPLESAMPLE| | \(|\sf|等线体|SampleSample|\scr|手写体|SAMPLESAMPLE|\) |
|\tt|打字机体|SampleSample|\frak|旧德式字体|SampleSample| | \(|\tt|打字机体|SampleSample|\frak|旧德式字体|SampleSample|\) |
所有字体※
希腊字母 | |
---|---|
\Alpha \Beta \Gamma \Delta \Epsilon \Zeta \Eta \Theta | \(\Alpha \Beta \Gamma \Delta \Epsilon \Zeta \Eta \Theta\) |
\Iota \Kappa \Lambda \Mu \Nu \Xi \Omicron \Pi | \(\Iota \Kappa \Lambda \Mu \Nu \Xi \Omicron \Pi\) |
\Rho \Sigma \Tau \Upsilon \Phi \Chi \Psi \Omega | \(\Rho \Sigma \Tau \Upsilon \Phi \Chi \Psi \Omega\) |
\alpha \beta \gamma \delta \epsilon \zeta \eta \theta | \(\alpha \beta \gamma \delta \epsilon \zeta \eta \theta\) |
\iota \kappa \lambda \mu \nu \xi \omicron \pi | \(\iota \kappa \lambda \mu \nu \xi \omicron \pi\) |
\rho \sigma \tau \upsilon \phi \chi \psi \omega | \(\rho \sigma \tau \upsilon \phi \chi \psi \omega\) |
\varepsilon \digamma \varkappa \varpi | \(\varepsilon \digamma \varkappa \varpi\) |
\varrho \varsigma \vartheta \varphi | \(\varrho \varsigma \vartheta \varphi\) |
希伯来字符 | |
\aleph \beth \gimel \daleth | \(\aleph \beth \gimel \daleth\) |
黑板报粗体 | |
\mathbb{ ABCDEFGHI } | \(\mathbb{ABCDEFGHI}\) |
\mathbb{ JKLMNOPQR } | \(\mathbb{JKLMNOPQR}\) |
\mathbb{ STUVWXYZ } | \(\mathbb{STUVWXYZ}\) |
粗体 | |
\mathbf{ ABCDEFGHI } | \(\mathbf{ABCDEFGHI}\) |
\mathbf{ JKLMNOPQR } | \(\mathbf{JKLMNOPQR}\) |
\mathbf{ STUVWXYZ } | \(\mathbf{STUVWXYZ}\) |
\mathbf{ abcdefghijklm } | \(\mathbf{abcdefghijklm}\) |
\mathbf{ nopqrstuvwxyz } | \(\mathbf{nopqrstuvwxyz}\) |
\mathbf{ 0123456789 } | \(\mathbf{0123456789}\) |
粗体希腊字母 | |
\boldsymbol{\Alpha\Beta\Gamma\Delta\Epsilon\Zeta\Eta\Theta} | \(\boldsymbol{\Alpha\Beta\Gamma\Delta\Epsilon\Zeta\Eta\Theta}\) |
\boldsymbol{\Iota\Kappa\Lambda\Mu\Nu\Xi\Pi\Rho} | \(\boldsymbol{\Iota\Kappa\Lambda\Mu\Nu\Xi\Pi\Rho}\) |
\boldsymbol{\Sigma\Tau\Upsilon\Phi\Chi\Psi\Omega} | \(\boldsymbol{\Sigma\Tau\Upsilon\Phi\Chi\Psi\Omega}\) |
\boldsymbol{\alpha\beta\gamma\delta\epsilon\zeta\eta\theta} | \(\boldsymbol{\alpha\beta\gamma\delta\epsilon\zeta\eta\theta}\) |
\boldsymbol{\iota\kappa\lambda\mu\nu\xi\pi\rho} | \(\boldsymbol{\iota\kappa\lambda\mu\nu\xi\pi\rho}\) |
\boldsymbol{\sigma\tau\upsilon\phi\chi\psi\omega} | \(\boldsymbol{\sigma\tau\upsilon\phi\chi\psi\omega}\) |
\boldsymbol{\varepsilon\digamma\varkappa\varpi} | \(\boldsymbol{\varepsilon\digamma\varkappa\varpi}\) |
\boldsymbol{\varrho\varsigma\vartheta\varphi} | \(\boldsymbol{\varrho\varsigma\vartheta\varphi}\) |
斜体(拉丁字母预设) | |
\mathit{ 0123456789 } | \(\mathit{0123456789}\) |
斜体希腊字母(小写字母预设) | |
\mathit{\Alpha\Beta\Gamma\Delta\Epsilon\Zeta\Eta\Theta} | \(\mathit{\Alpha\Beta\Gamma\Delta\Epsilon\Zeta\Eta\Theta}\) |
\mathit{\Iota\Kappa\Lambda\Mu\Nu\Xi\Pi\Rho} | \(\mathit{\Iota\Kappa\Lambda\Mu\Nu\Xi\Pi\Rho}\) |
\mathit{\Sigma\Tau\Upsilon\Phi\Chi\Psi\Omega} | \(\mathit{\Sigma\Tau\Upsilon\Phi\Chi\Psi\Omega}\) |
罗马体 | |
\mathrm{ ABCDEFGHI } | \(\mathrm{ABCDEFGHI}\) |
\mathrm{ JKLMNOPQR } | \(\mathrm{JKLMNOPQR}\) |
\mathrm{ STUVWXYZ } | \(\mathrm{STUVWXYZ}\) |
\mathrm{ abcdefghijklm } | \(\mathrm{abcdefghijklm}\) |
\mathrm{ nopqrstuvwxyz } | \(\mathrm{nopqrstuvwxyz}\) |
\mathrm{ 0123456789 } | \(\mathrm{0123456789}\) |
无衬线体 | |
\mathsf{ ABCDEFGHI } | \(\mathsf{ABCDEFGHI}\) |
\mathsf{ JKLMNOPQR } | \(\mathsf{JKLMNOPQR}\) |
\mathsf{ STUVWXYZ } | \(\mathsf{STUVWXYZ}\) |
\mathsf{ abcdefghijklm } | \(\mathsf{abcdefghijklm}\) |
\mathsf{ nopqrstuvwxyz } | \(\mathsf{nopqrstuvwxyz}\) |
\mathsf{ 0123456789 } | \(\mathsf{0123456789}\) |
\mathsf{\Alpha \Beta \Gamma \Delta \Epsilon \Zeta \Eta \Theta} | \(\mathsf{\Alpha \Beta \Gamma \Delta \Epsilon \Zeta \Eta \Theta}\) |
\mathsf{\Iota \Kappa \Lambda \Mu \Nu \Xi \Pi \Rho} | \(\mathsf{\Iota \Kappa \Lambda \Mu \Nu \Xi \Pi \Rho}\) |
\mathsf{\Sigma \Tau \Upsilon \Phi \Chi \Psi \Omega} | \(\mathsf{\Sigma \Tau \Upsilon \Phi \Chi \Psi \Omega}\) |
手写体/花体 | |
\mathcal{ ABCDEFGHI } | \(\mathcal{ABCDEFGHI}\) |
\mathcal{ JKLMNOPQR } | \(\mathcal{JKLMNOPQR}\) |
\mathcal{ STUVWXYZ } | \(\mathcal{STUVWXYZ}\) |
Fraktur体 | |
\mathfrak{ ABCDEFGHI } | \(\mathfrak{ABCDEFGHI}\) |
\mathfrak{ JKLMNOPQR } | \(\mathfrak{JKLMNOPQR}\) |
\mathfrak{ STUVWXYZ } | \(\mathfrak{STUVWXYZ}\) |
\mathfrak{ abcdefghijklm } | \(\mathfrak{abcdefghijklm}\) |
\mathfrak{ nopqrstuvwxyz } | \(\mathfrak{nopqrstuvwxyz}\) |
\mathfrak{ 0123456789 } | \(\mathfrak{0123456789}\) |
小型手写体 | |
{\scriptstyle\text{ abcdefghijklm }} | \({\scriptstyle\text{abcdefghijklm}}\) |
注释文本※
使用 \text {文字}
来添加注释文本(注释文本不会被识别为公式,不用斜体显示)。\text {文字}
中仍可以使用 $公式$
插入其它公式。
| \(f(n)= \begin{cases} n/2, & \text {if $n$ is even} \\ 3n+1, &\text{if $n$ is odd} \end{cases}\) |
括号※
()
、[]
和 |
表示符号本身,使用 \{\}
来表示 {}
。
使用 \left
和 \right
来创建自动匹配高度的 (圆括号),[方括号] 和 {花括号} 。
如果括号只有一边,要用 \left.
或 \right.
匹配另一边。
短括号 | \frac{1}{2} | \(\frac{1}{2}\) |
长括号 | \left(\frac{1}{2} \right) | \(\left(\frac{1}{2} \right)\) |
圆括号,小括号 | \left( \frac{a}{b} \right) | \(\left( \frac{a}{b} \right)\) |
方括号,中括号 | \left[ \frac{a}{b} \right] | \(\left[ \frac{a}{b} \right]\) |
花括号,大括号 | \left\{ \frac{a}{b} \right\} | \(\left\{ \frac{a}{b} \right\}\) |
角括号 | \left \langle \frac{a}{b} \right \rangle | \(\left \langle \frac{a}{b} \right \rangle\) |
单竖线,绝对值 | \left| \frac{a}{b} \right| | \(\left| \frac{a}{b} \right|\) |
双竖线,范数 | \left \| \frac{a}{b} \right \| | \(\left \| \frac{a}{b} \right \|\) |
高斯符号 | \left \lbrack \frac{a}{b} \right \rbrack | \(\left \lbrack \frac{a}{b} \right \rbrack\) |
取底符号 | \left \lfloor \frac{a}{b} \right \rfloor | \(\left \lfloor \frac{a}{b} \right \rfloor\) |
取顶符号 | \left \lceil \frac{c}{d} \right \rceil | \(\left \lceil \frac{c}{d} \right \rceil\) |
斜线与反斜线 | \left / \frac{a}{b} \right \backslash | \(\)\(\left / \frac{a}{b} \right \backslash\) |
上下箭头 | \left \uparrow \frac{a}{b} \right \downarrow | \(\left \uparrow \frac{a}{b} \right \downarrow\) |
\left \Uparrow \frac{a}{b} \right \Downarrow | \(\left \Uparrow \frac{a}{b} \right \Downarrow\) | |
\left \updownarrow \frac{a}{b} \right \Updownarrow | \(\left \updownarrow \frac{a}{b} \right \Updownarrow\) | |
混合括号 | \left [ 0,1 \right ) \left \langle \psi \right | | \(\left [ 0,1 \right ) \left \langle \psi \right |\) |
单左括号 | \left \{ \frac{a}{b} \right . | \(\left \{ \frac{a}{b} \right .\) |
单右括号 | \left . \frac{a}{b} \right \} | \(\left . \frac{a}{b} \right \}\) |
备注:
可以使用 \big, \Big, \bigg, \Bigg
控制括号的大小,
比如代码\Bigg ( \bigg [ \Big \{ \big \langle \left | \| \frac{a}{b} \| \right | \big \rangle \Big \} \bigg ] \Bigg )
\(\Bigg ( \bigg [ \Big \{ \big \langle \left | \| \frac{a}{b} \| \right | \big \rangle \Big \} \bigg ] \Bigg )\)
空格※
注意 TeX 能够自动处理大多数的空格,但是您有时候需要自己来控制。
2个quad空格 | \alpha\qquad\beta | αβ | 2m |
quad空格 | \alpha\quad\beta | αβ | m |
大空格 | \alpha\ \beta | α β | m3 |
中等空格 | \alpha\;\beta | αβ | 2m7 |
小空格 | \alpha\,\beta | αβ | m6 |
没有空格 | \alpha\beta | αβ | 0 |
紧贴 | \alpha\!\beta | αβ | −m6 |
颜色※
高亮※
使用 \bbox[底色, (可选)边距, (可选)边框 border: 框宽度 框类型 框颜色]
命令来高亮一行公式。
底色和框颜色支持详见“更改文字颜色”,边距及框宽度支持 绝对像素 px
或 相对大小 em
,框类型支持 实线 solid
或 虚线 dashed
。
这里似乎不支持。
Cmd Markdown 公式指导手册里是这样写的:※
使用 \color{颜色}{文字}
来更改特定的文字颜色。
更改文字颜色 需要浏览器支持 ,如果浏览器不知道你所需的颜色,那么文字将被渲染为黑色。
对于较旧的浏览器(HTML4与CSS2),以下颜色是被支持的:
输入 | 显示 | 输入 | 显示 |
---|---|---|---|
black | texttext | grey | texttext |
silver | texttext | white | texttext |
maroon | texttext | red | texttext |
yellow | texttext | lime | texttext |
olive | texttext | green | texttext |
teal | texttext | auqa | texttext |
blue | texttext | navy | texttext |
purple | texttext | fuchsia | texttext |
对于较新的浏览器(HTML5与CSS3),额外的124种颜色将被支持:
输入 \color {#rgb} {text}
来自定义更多的颜色,其中 #rgb
的 r
g
b
可输入 0-9
和 a-f
来表示红色、绿色和蓝色的纯度(饱和度)。
| \(\begin{array}{|rrrrrrrr|}\hline \verb+#000+ & \color{#000}{text} & \verb+#00F+ & \color{#00F}{text} \\ \verb+#0F0+ & \color{#0F0}{text} & \verb+#0FF+ & \color{#0FF}{text}\\ \verb+#F00+ & \color{#F00}{text} & \verb+#F0F+ & \color{#F0F}{text} \\ \verb+#FF0+ & \color{#FF0}{text} & \verb+#FFF+ & \color{#FFF}{text}\\ \hline \end{array}\) |
| \(\begin{array}{|rrrrrrrr|} \hline \verb+#000+ & \color{#000}{text} & \verb+#005+ & \color{#005}{text} & \verb+#00A+ & \color{#00A}{text} & \verb+#00F+ & \color{#00F}{text} \\ \verb+#500+ & \color{#500}{text} & \verb+#505+ & \color{#505}{text} & \verb+#50A+ & \color{#50A}{text} & \verb+#50F+ & \color{#50F}{text} \\ \verb+#A00+ & \color{#A00}{text} & \verb+#A05+ & \color{#A05}{text} & \verb+#A0A+ & \color{#A0A}{text} & \verb+#A0F+ & \color{#A0F}{text} \\ \verb+#F00+ & \color{#F00}{text} & \verb+#F05+ & \color{#F05}{text} & \verb+#F0A+ & \color{#F0A}{text} & \verb+#F0F+ & \color{#F0F}{text} \\ \hline \verb+#080+ & \color{#080}{text} & \verb+#085+ & \color{#085}{text} & \verb+#08A+ & \color{#08A}{text} & \verb+#08F+ & \color{#08F}{text} \\ \verb+#580+ & \color{#580}{text} & \verb+#585+ & \color{#585}{text} & \verb+#58A+ & \color{#58A}{text} & \verb+#58F+ & \color{#58F}{text} \\ \verb+#A80+ & \color{#A80}{text} & \verb+#A85+ & \color{#A85}{text} & \verb+#A8A+ & \color{#A8A}{text} & \verb+#A8F+ & \color{#A8F}{text} \\ \verb+#F80+ & \color{#F80}{text} & \verb+#F85+ & \color{#F85}{text} & \verb+#F8A+ & \color{#F8A}{text} & \verb+#F8F+ & \color{#F8F}{text} \\ \hline \verb+#0F0+ & \color{#0F0}{text} & \verb+#0F5+ & \color{#0F5}{text} & \verb+#0FA+ & \color{#0FA}{text} & \verb+#0FF+ & \color{#0FF}{text} \\ \verb+#5F0+ & \color{#5F0}{text} & \verb+#5F5+ & \color{#5F5}{text} & \verb+#5FA+ & \color{#5FA}{text} & \verb+#5FF+ & \color{#5FF}{text} \\ \verb+#AF0+ & \color{#AF0}{text} & \verb+#AF5+ & \color{#AF5}{text} & \verb+#AFA+ & \color{#AFA}{text} & \verb+#AFF+ & \color{#AFF}{text} \\ \verb+#FF0+ & \color{#FF0}{text} & \verb+#FF5+ & \color{#FF5}{text} & \verb+#FFA+ & \color{#FFA}{text} & \verb+#FFF+ & \color{#FFF}{text} \\ \hline \end{array}\) |
维基百科的数学公式教程里是这样写的:※
语法:{\color{颜色}表达式}
作者实测:在部分浏览器中,上面的语法可能是错误的(只将表达式的第一个字符着色),\color{颜色}{文字}
的语法才是正确的。例如:
{\color{Red}abc}
显示abcabc \color{Red}{abc}
显示abcabc
支持色调表:这里也能看到当前哪些颜色是支持的
Aquamarine | Bittersweet | Black | |
Blue | BlueGreen | BlueViolet | BrickRed |
Brown | BurntOrange | CadetBlue | CarnationPink |
Cerulean | CornflowerBlue | Cyan | Dandelion |
DarkOrchid | Emerald | ForestGreen | Fuchsia |
Goldenrod | Gray | Green | GreenYellow |
JungleGreen | Lavender | LimeGreen | Magenta |
Mahogany | Maroon | Melon | MidnightBlue |
Mulberry | NavyBlue | OliveGreen | Orange |
OrangeRed | Orchid | Peach | Periwinkle |
PineGreen | Plum | ProcessBlue | Purple |
RawSienna | Red | RedOrange | RedViolet |
Rhodamine | RoyalBlue | RoyalPurple | RubineRed |
Salmon | SeaGreen | Sepia | SkyBlue |
SpringGreen | Tan | TealBlue | Thistle |
Turquoise | Violet | VioletRed | White |
WildStrawberry | Yellow | YellowGreen | YellowOrange |
*注︰输入时第一个字母必需以大写输入,如\color{OliveGreen}
。
例子
{\color{Blue}x^2}+{\color{Brown}2x} - {\color{OliveGreen}1}
\({\color{Blue}x^2}+{\color{Brown}2x} - {\color{OliveGreen}1}\)
x_{\color{Maroon}1,2}=\frac{-b\pm\sqrt{{\color{Maroon}b^2-4ac}}}{2a}
\(x_{\color{Maroon}1,2}=\frac{-b\pm\sqrt{{\color{Maroon}b^2-4ac}}}{2a}\)