原表示 | 本文章表示 |
---|---|
\\ |
\\\\ |
| |
`\ |
\{ |
\\{ |
\% |
\\% |
$ |
$$ |
!待整理
參考維基百科的數學公式教程
參考Cmd Markdown 公式指導手冊
本文為 MathJax 在 Markdown 環境下的語法指引。
如何插入公式
\LaTeX 的數學公式有兩種:行中公式和獨立公式(行間公式)。行中公式放在文中與其它文字混編,獨立公式單獨成行。
行中公式可以用如下方法表示:
$ 數學公式 $
(本文無法使用單$
,已經全替換為$$
)
獨立公式可以用如下方法表示:
$$ 數學公式 $$
函式、符號及特殊字元
聲調 / 變音符號
\dot{a}, \ddot{a}, \acute{a}, \grave{a}
{\displaystyle {\dot {a}},{\ddot {a}},{\acute {a}},{\grave {a}}}
\check{a}, \breve{a}, \tilde{a}, \bar{a}
{\displaystyle {\check {a}},{\breve {a}},{\tilde {a}},{\bar {a}}}
\hat{a}, \widehat{a}, \vec{a}
{\displaystyle {\hat {a}},{\widehat {a}},{\vec {a}}}
標準函式
指數
\exp_a b = a^b, \exp b = \mathrm{e}^b, 10^m
{\displaystyle \exp _{a}b=a^{b},\exp b=\mathrm{e}^{b},10^{m}}
對數
\ln c, \lg d, \log \mathrm{e}, \log_{10} f
{\displaystyle \ln c,\lg d,\log e,\log _{10}f}
三角函式
\sin a, \cos b, \tan c, \cot d, \sec e, \csc f
{\displaystyle \sin a,\cos b,\tan c,\cot d,\sec e,\csc f}
\arcsin a, \arccos b, \arctan c
{\displaystyle \arcsin a,\arccos b,\arctan c}
\arccot d, \arcsec e, \arccsc f
{\displaystyle \operatorname {arccot} d,\operatorname {arcsec} e,\operatorname {arccsc} f}
\sinh a, \cosh b, \tanh c, \coth d
{\displaystyle \sinh a,\cosh b,\tanh c,\coth d}
\operatorname{sh}k, \operatorname{ch}l, \operatorname{th}m, \operatorname{coth}n
{\displaystyle \operatorname {sh} k,\operatorname {ch} l,\operatorname {th} m,\operatorname {coth} n}
\operatorname{argsh}o, \operatorname{argch}p, \operatorname{argth}q
{\displaystyle \operatorname {argsh} o,\operatorname {argch} p,\operatorname {argth} q}
符號函式,絕對值
\sgn r, \left\vert s \right\vert
或 \lvert s \rvert
或 \left| s \right|
{\displaystyle \operatorname {sgn} r,\left\vert s\right\vert }
最大值,最小值
\min(x,y), \max(x,y)
{\displaystyle \min(x,y),\max(x,y)}
界限,極限
\min x, \max y, \inf s, \sup t
{\displaystyle \min x,\max y,\inf s,\sup t}
\lim u, \liminf v, \limsup w
{\displaystyle \lim u,\liminf v,\limsup w}
\lim_{x \to \infty} \frac{1}{n(n+1)}
{\displaystyle \lim_{x \to \infty} \frac{1}{n(n+1)}}
\dim p, \deg q, \det m, \ker\phi
{\displaystyle \dim p,\deg q,\det m,\ker \phi}
投射
\Pr j, \hom l, \lVert z \rVert, \arg z
{\displaystyle \Pr j,\hom l,\lVert z\rVert ,\arg z}
微分及導數
dt, \mathrm{d}t, \partial t, \nabla\psi
{\displaystyle 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
{\displaystyle 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
{\displaystyle \prime ,\backprime ,f^{\prime},f’,f’’,f^{(3)}!,{\dot {y}},{\ddot {y}}}
類字母符號及常數
\infty, \aleph, \complement, \backepsilon, \eth, \Finv, \hbar
{\displaystyle \infty ,\aleph ,\complement ,\backepsilon ,\eth ,\Finv ,\hbar}
\Im, \imath, \jmath, \Bbbk, \ell, \mho, \wp, \Re, \circledS
{\displaystyle \Im ,\imath ,\jmath ,\Bbbk ,\ell ,\mho ,\wp ,\Re ,\circledS }
模運算
s_k \equiv 0 \pmod{m}
{\displaystyle s_{k}\equiv 0{\pmod {m}}}
a \bmod b
{\displaystyle a \bmod b}
\gcd(m, n), \operatorname{lcm}(m, n)
{\displaystyle \gcd(m,n),\operatorname {lcm} (m,n)}
\mid, \nmid, \shortmid, \nshortmid
{\displaystyle \mid ,\nmid ,\shortmid ,\nshortmid}
根號
\surd, \sqrt{2}, \sqrt[n]{}, \sqrt[3]{\frac{x^3+y^3}{2}}
{\displaystyle \surd ,{\sqrt {2}},{\sqrt[{n}]{}},{\sqrt[{3}]{\frac {x^{3}+y^{3}}{2}}}}
運算子
+, -, \pm, \mp, \dotplus
{\displaystyle +,-,\pm ,\mp ,\dotplus}
\times, \div, \divideontimes, /, \backslash
{\displaystyle \times ,\div ,\divideontimes ,/,\backslash}
\cdot, * \ast, \star, \circ, \bullet
{\displaystyle \cdot ,*\ast ,\star ,\circ ,\bullet}
\boxplus, \boxminus, \boxtimes, \boxdot
{\displaystyle \boxplus ,\boxminus ,\boxtimes ,\boxdot}
\oplus, \ominus, \otimes, \oslash, \odot
{\displaystyle \oplus ,\ominus ,\otimes ,\oslash ,\odot}
\circleddash, \circledcirc, \circledast
{\displaystyle \circleddash ,\circledcirc ,\circledast}
\bigoplus, \bigotimes, \bigodot
{\displaystyle \bigoplus ,\bigotimes ,\bigodot}
集合 {id=”set”}
\{ \}, \O \empty \emptyset, \varnothing
{\displaystyle {},\emptyset \emptyset \emptyset ,\varnothing }
\in, \notin \not\in, \ni, \not\ni
{\displaystyle \in ,\notin \not \in ,\ni ,\not \ni}
\cap, \Cap, \sqcap, \bigcap
{\displaystyle \cap ,\Cap ,\sqcap ,\bigcap}
\cup, \Cup, \sqcup, \bigcup, \bigsqcup, \uplus, \biguplus
{\displaystyle \cup ,\Cup ,\sqcup ,\bigcup ,\bigsqcup ,\uplus ,\biguplus}
\setminus, \smallsetminus, \times
{\displaystyle \setminus ,\smallsetminus ,\times}
\subset, \Subset, \sqsubset
{\displaystyle \subset ,\Subset ,\sqsubset}
\supset, \Supset, \sqsupset
{\displaystyle \supset ,\Supset ,\sqsupset}
\subseteq, \nsubseteq, \subsetneq, \varsubsetneq, \sqsubseteq
{\displaystyle \subseteq ,\nsubseteq ,\subsetneq ,\varsubsetneq ,\sqsubseteq}
\supseteq, \nsupseteq, \supsetneq, \varsupsetneq, \sqsupseteq
{\displaystyle \supseteq ,\nsupseteq ,\supsetneq ,\varsupsetneq ,\sqsupseteq}
\subseteqq, \nsubseteqq, \subsetneqq, \varsubsetneqq
{\displaystyle \subseteqq ,\nsubseteqq ,\subsetneqq ,\varsubsetneqq}
\supseteqq, \nsupseteqq, \supsetneqq, \varsupsetneqq
{\displaystyle \supseteqq ,\nsupseteqq ,\supsetneqq ,\varsupsetneqq}
關係符號
=, \ne, \neq, \equiv, \not\equiv
{\displaystyle =,\neq ,\neq ,\equiv ,\not \equiv}
\doteq, \doteqdot,
\overset{\underset{\mathrm{def}}{}}{=},
:=
{\displaystyle \doteq ,\doteqdot ,{\overset {\underset {\mathrm {def} }{}}{=}},:=}
\sim, \nsim, \backsim, \thicksim, \simeq, \backsimeq, \eqsim, \cong, \ncong
{\displaystyle \sim ,\nsim ,\backsim ,\thicksim ,\simeq ,\backsimeq ,\eqsim ,\cong ,\ncong}
\approx, \thickapprox, \approxeq, \asymp, \propto, \varpropto
{\displaystyle \approx ,\thickapprox ,\approxeq ,\asymp ,\propto ,\varpropto}
<, \nless, \ll, \not\ll, \lll, \not\lll, \lessdot
{\displaystyle <,\nless ,\ll ,\not \ll ,\lll ,\not \lll ,\lessdot}
>, \ngtr, \gg, \not\gg, \ggg, \not\ggg, \gtrdot
{\displaystyle>,\ngtr ,\gg ,\not \gg ,\ggg ,\not \ggg ,\gtrdot }
\le, \leq, \lneq, \leqq, \nleq, \nleqq, \lneqq, \lvertneqq
{\displaystyle \leq ,\leq ,\lneq ,\leqq ,\nleq ,\nleqq ,\lneqq ,\lvertneqq}
\ge, \geq, \gneq, \geqq, \ngeq, \ngeqq, \gneqq, \gvertneqq
{\displaystyle \geq ,\geq ,\gneq ,\geqq ,\ngeq ,\ngeqq ,\gneqq ,\gvertneqq}
\lessgtr, \lesseqgtr, \lesseqqgtr, \gtrless, \gtreqless, \gtreqqless
{\displaystyle \lessgtr ,\lesseqgtr ,\lesseqqgtr ,\gtrless ,\gtreqless ,\gtreqqless}
\leqslant, \nleqslant, \eqslantless
{\displaystyle \leqslant ,\nleqslant ,\eqslantless}
\geqslant, \ngeqslant, \eqslantgtr
{\displaystyle \geqslant ,\ngeqslant ,\eqslantgtr}
\lesssim, \lnsim, \lessapprox, \lnapprox
{\displaystyle \lesssim ,\lnsim ,\lessapprox ,\lnapprox}
\gtrsim, \gnsim, \gtrapprox, \gnapprox
{\displaystyle \gtrsim ,\gnsim ,\gtrapprox ,\gnapprox}
\prec, \nprec, \preceq, \npreceq, \precneqq
{\displaystyle \prec ,\nprec ,\preceq ,\npreceq ,\precneqq}
\succ, \nsucc, \succeq, \nsucceq, \succneqq
{\displaystyle \succ ,\nsucc ,\succeq ,\nsucceq ,\succneqq}
\preccurlyeq, \curlyeqprec
{\displaystyle \preccurlyeq ,\curlyeqprec}
\succcurlyeq, \curlyeqsucc
{\displaystyle \succcurlyeq ,\curlyeqsucc}
\precsim, \precnsim, \precapprox, \precnapprox
{\displaystyle \precsim ,\precnsim ,\precapprox ,\precnapprox}
\succsim, \succnsim, \succapprox, \succnapprox
{\displaystyle \succsim ,\succnsim ,\succapprox ,\succnapprox}
幾何符號
\parallel, \nparallel, \shortparallel, \nshortparallel
{\displaystyle \parallel ,\nparallel ,\shortparallel ,\nshortparallel}
\perp, \angle, \sphericalangle, \measuredangle, 45^\circ
{\displaystyle \perp ,\angle ,\sphericalangle ,\measuredangle ,45^{\circ}}
\Box, \blacksquare, \diamond, \Diamond \lozenge, \blacklozenge, \bigstar
{\displaystyle \Box ,\blacksquare ,\diamond ,\Diamond \lozenge ,\blacklozenge ,\bigstar}
\bigcirc, \triangle, \bigtriangleup, \bigtriangledown
{\displaystyle \bigcirc ,\triangle ,\bigtriangleup ,\bigtriangledown}
\vartriangle, \triangledown
{\displaystyle \vartriangle ,\triangledown}
\blacktriangle, \blacktriangledown, \blacktriangleleft, \blacktriangleright
{\displaystyle \blacktriangle ,\blacktriangledown ,\blacktriangleleft ,\blacktriangleright}
邏輯符號
\forall, \exists, \nexists
{\displaystyle \forall ,\exists ,\nexists}
\therefore, \because, \And
{\displaystyle \therefore ,\because ,\And}
\or \lor \vee, \curlyvee, \bigvee
{\displaystyle \lor ,\lor ,\vee ,\curlyvee ,\bigvee}
\and \land \wedge, \curlywedge, \bigwedge
{\displaystyle \land ,\land ,\wedge ,\curlywedge ,\bigwedge}
\bar{q}, \bar{abc}, \overline{q}, \overline{abc},
\lnot \neg, \not\operatorname{R}, \bot, \top
{\displaystyle {\bar {q}},{\bar {abc}},{\overline {q}},{\overline {abc}},}
{\displaystyle \lnot \neg ,\not \operatorname {R} ,\bot ,\top }
\vdash \dashv, \vDash, \Vdash, \models
{\displaystyle \vdash ,\dashv ,\vDash ,\Vdash ,\models}
\Vvdash \nvdash \nVdash \nvDash \nVDash
{\displaystyle \Vvdash ,\nvdash ,\nVdash ,\nvDash ,\nVDash}
\ulcorner \urcorner \llcorner \lrcorner
{\displaystyle \ulcorner \urcorner \llcorner \lrcorner}
箭頭
\Rrightarrow, \Lleftarrow
{\displaystyle \Rrightarrow ,\Lleftarrow}
\Rightarrow, \nRightarrow, \Longrightarrow \implies
{\displaystyle \Rightarrow ,\nRightarrow ,\Longrightarrow ,\implies}
\Leftarrow, \nLeftarrow, \Longleftarrow
{\displaystyle \Leftarrow ,\nLeftarrow ,\Longleftarrow}
\Leftrightarrow, \nLeftrightarrow, \Longleftrightarrow \iff
{\displaystyle \Leftrightarrow ,\nLeftrightarrow ,\Longleftrightarrow \iff}
\Uparrow, \Downarrow, \Updownarrow
{\displaystyle \Uparrow ,\Downarrow ,\Updownarrow}
\rightarrow \to, \nrightarrow, \longrightarrow
{\displaystyle \rightarrow \to ,\nrightarrow ,\longrightarrow}
\leftarrow \gets, \nleftarrow, \longleftarrow
{\displaystyle \leftarrow \gets ,\nleftarrow ,\longleftarrow}
\leftrightarrow, \nleftrightarrow, \longleftrightarrow
{\displaystyle \leftrightarrow ,\nleftrightarrow ,\longleftrightarrow}
\uparrow, \downarrow, \updownarrow
{\displaystyle \uparrow ,\downarrow ,\updownarrow}
\nearrow, \swarrow, \nwarrow, \searrow
{\displaystyle \nearrow ,\swarrow ,\nwarrow ,\searrow}
\mapsto, \longmapsto
{\displaystyle \mapsto ,\longmapsto}
\rightharpoonup \rightharpoondown \leftharpoonup \leftharpoondown \upharpoonleft \upharpoonright \downharpoonleft \downharpoonright \rightleftharpoons \leftrightharpoons
{\displaystyle \rightharpoonup ,\rightharpoondown ,\leftharpoonup ,\leftharpoondown ,\upharpoonleft ,\upharpoonright ,\downharpoonleft ,\downharpoonright ,\rightleftharpoons ,\leftrightharpoons}
\curvearrowleft \circlearrowleft \Lsh \upuparrows \rightrightarrows \rightleftarrows \rightarrowtail \looparrowright
{\displaystyle \curvearrowleft ,\circlearrowleft ,\Lsh ,\upuparrows ,\rightrightarrows ,\rightleftarrows ,\rightarrowtail ,\looparrowright}
\curvearrowright \circlearrowright \Rsh \downdownarrows \leftleftarrows \leftrightarrows \leftarrowtail \looparrowleft
{\displaystyle \curvearrowright ,\circlearrowright ,\Rsh ,\downdownarrows ,\leftleftarrows ,\leftrightarrows ,\leftarrowtail ,\looparrowleft}
\hookrightarrow \hookleftarrow \multimap \leftrightsquigarrow \rightsquigarrow \twoheadrightarrow \twoheadleftarrow
{\displaystyle \hookrightarrow ,\hookleftarrow ,\multimap ,\leftrightsquigarrow ,\rightsquigarrow ,\twoheadrightarrow ,\twoheadleftarrow}
特殊符號
省略號:數學公式中常見的省略號有兩種,\ldots
表示與文字底線對齊的省略號,\cdots
表示與文字中線對齊的省略號。
\amalg \% \dagger \ddagger \ldots \cdots
{\displaystyle \amalg \%\dagger \ddagger \ldots \cdots}
\smile \frown \wr \triangleleft \triangleright
{\displaystyle \smile \frown \wr \triangleleft \triangleright}
\diamondsuit, \heartsuit, \clubsuit, \spadesuit, \Game, \flat, \natural, \sharp
{\displaystyle \diamondsuit ,\heartsuit ,\clubsuit ,\spadesuit ,\Game ,\flat ,\natural ,\sharp}
未分類
\diagup \diagdown \centerdot \ltimes \rtimes \leftthreetimes \rightthreetimes
{\displaystyle \diagup ,\diagdown ,\centerdot ,\ltimes ,\rtimes ,\leftthreetimes ,\rightthreetimes}
\eqcirc \circeq \triangleq \bumpeq \Bumpeq \doteqdot \risingdotseq \fallingdotseq
{\displaystyle \eqcirc ,\circeq ,\triangleq ,\bumpeq ,\Bumpeq ,\doteqdot ,\risingdotseq ,\fallingdotseq}
\intercal \barwedge \veebar \doublebarwedge \between \pitchfork
{\displaystyle \intercal ,\barwedge ,\veebar ,\doublebarwedge ,\between ,\pitchfork}
\vartriangleleft \ntriangleleft \vartriangleright \ntriangleright
{\displaystyle \vartriangleleft ,\ntriangleleft ,\vartriangleright ,\ntriangleright}
\trianglelefteq \ntrianglelefteq \trianglerighteq \ntrianglerighteq
{\displaystyle \trianglelefteq ,\ntrianglelefteq ,\trianglerighteq ,\ntrianglerighteq}
關於這些符號的更多語義,參閱 TeX Cookbook 的簡述。
上標、下標及積分等
功能|語法|效果
^
表示上標, _
表示下標。如果上下標的內容多於一個字元,需要用 {}
將這些內容括成一個整體。上下標可以巢狀,也可以同時使用。
上標
a^2
{\displaystyle a^{2}}
下標
a_2
{\displaystyle a_{2}}
組合
a^{2+2}
{\displaystyle a^{2+2}}
a_{i,j}
{\displaystyle a_{i,j}}
結合上下標
x_2^3
{\displaystyle x_{2}^{3}}
前置上下標
{}_1^2\!X_3^4
{\displaystyle {}{1}^{2}!X{3}^{4}}
導數(HTML)
x'
{\displaystyle x’}
導數(PNG)
x^\prime
{\displaystyle x^{\prime}}
導數(錯誤)
x\prime
{\displaystyle x\prime}
導數點
\dot{x}
{\displaystyle {\dot {x}}}
\ddot{y}
{\displaystyle {\ddot {y}}}
向量
\vec{c}
(只有一個字母)
{\displaystyle {\vec {c}}}
\overleftarrow{a b}
{\displaystyle {\overleftarrow {ab}}}
\overrightarrow{c d}
{\displaystyle {\overrightarrow {cd}}}
\overleftrightarrow{a b}
{\displaystyle {\overleftrightarrow {ab}}}
\widehat{e f g}
{\displaystyle {\widehat {efg}}}
上弧
(注: 正確應該用 \overarc,但在這裡行不通。要用建議的語法作為解決辦法。)(使用 \ overarc 時需要引入 {arcs} 包。)
\overset{\frown} {AB}
{\displaystyle {\overset {\frown}{AB}}}
上劃線
\overline{h i j}
{\displaystyle {\overline {hij}}}
下劃線
\underline{k l m}
{\displaystyle {\underline {klm}}}
上括號
\overbrace{1+2+\cdots+100}
{\displaystyle \overbrace {1+2+\cdots +100} }
\begin{matrix} 5050 \\\\ \overbrace{ 1+2+\cdots+100 } \end{matrix}
{\displaystyle {\begin{matrix}5050\\\overbrace {1+2+\cdots +100} \end{matrix}}}
下括號
\underbrace{a+b+\cdots+z}
{\displaystyle \underbrace {a+b+\cdots +z} }
\begin{matrix} \underbrace{ a+b+\cdots+z } \\\\ 26 \end{matrix}
{\displaystyle {\begin{matrix}\underbrace {a+b+\cdots +z} \\26\end{matrix}}}
求和(累加)
\sum_{k=1}^N k^2
{\displaystyle \sum _{k=1}^{N}k^{2}}
\begin{matrix} \sum_{k=1}^N k^2 \end{matrix}
{\displaystyle {\begin{matrix}\sum _{k=1}^{N}k^{2}\end{matrix}}}
求積(累乘)
\prod_{i=1}^N x_i
{\displaystyle \prod {i=1}^{N}x{i}}
\begin{matrix} \prod_{i=1}^N x_i \end{matrix}
{\displaystyle {\begin{matrix}\prod {i=1}^{N}x{i}\end{matrix}}}
上積
\coprod_{i=1}^N x_i
{\displaystyle \coprod {i=1}^{N}x{i}}
\begin{matrix} \coprod_{i=1}^N x_i \end{matrix}
{\displaystyle {\begin{matrix}\coprod {i=1}^{N}x{i}\end{matrix}}}
極限
\lim_{n \to \infty}x_n
{\displaystyle \lim {n\to \infty}x{n}}
\begin{matrix} \lim_{n \to \infty}x_n \end{matrix}
{\displaystyle {\begin{matrix}\lim {n\to \infty }x{n}\end{matrix}}}
積分
\int_{-N}^{N} e^x\, {\rm d}x
{\displaystyle \int _{-N}^{N}e^{x},{\rm d} x}
本例中 \,
和 {\rm d}
部分可省略,但建議加入,能使式子更美觀。{\rm d}
可以用\mathrm{d}
等價替換。
\begin{matrix} \int_{-N}^{N} e^x\, \mathrm{d}x \end{matrix}
(矩陣中積分符號變小)
{\displaystyle {\begin{matrix}\int _{-N}^{N}e^{x},\mathrm {d} x\end{matrix}}}
雙重積分
\iint_{D}^{W} \, \mathrm{d}x\,\mathrm{d}y
{\displaystyle \iint _{D}^{W},\mathrm {d} x,\mathrm {d} y}
三重積分
\iiint_{E}^{V} \, \mathrm{d}x\,\mathrm{d}y\,\mathrm{d}z
{\displaystyle \iiint _{E}^{V},\mathrm {d} x,\mathrm {d} y,\mathrm {d} z}
閉合的曲線、曲面積分
\oint_{C} x^3\, \mathrm{d}x + 4y^2\, \mathrm{d}y
{\displaystyle \oint _{C}x^{3},\mathrm {d} x+4y^{2},\mathrm {d} y}
交集
\bigcap_1^{n} p
{\displaystyle \bigcap _{1}^{n}p}
並集
\bigcup_1^{k} p
{\displaystyle \bigcup _{1}^{k}p}
分數
通常使用 \frac {分子} {分母}
命令產生一個分數,分數可巢狀。
便捷情況可直接輸入 \frac ab
來快速生成一個 $\frac ab$ 。
如果分式很複雜,亦可使用 分子 \over 分母
命令,此時分數僅有一層。
功能|語法|效果
分數
\frac{2}{4}=0.5
{\displaystyle {\frac {2}{4}}=0.5}
小型分數
\tfrac{2}{4} = 0.5
{\displaystyle {\tfrac {2}{4}}=0.5}
連分式(大型巢狀分式)
\cfrac{2}{c + \cfrac{2}{d + \cfrac{2}{4}}} = a
{\displaystyle {\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
{\displaystyle {\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}
{\displaystyle {\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}
{\displaystyle {\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}
{\displaystyle {\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{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}
{\displaystyle {\begin{matrix}x&y\\z&v\end{matrix}}}
有框矩陣
在開頭將 matrix
替換為 pmatrix
bmatrix
Bmatrix
vmatrix
Vmatrix
。
\begin{vmatrix}
x & y \\\\
z & v
\end{vmatrix}
{\displaystyle {\begin{vmatrix}x&y\\z&v\end{vmatrix}}}
\begin{Vmatrix}
x & y \\\\
z & v
\end{Vmatrix}
{\displaystyle {\begin{Vmatrix}x&y\\z&v\end{Vmatrix}}}
使用 \cdots
$\cdots$ , \ddots
$\ddots$ , \vdots
$\vdots$ 來輸入省略符號。
\begin{bmatrix}
0 & \cdots & 0 \\\\
\vdots & \ddots & \vdots \\\\
0 & \cdots & 0
\end{bmatrix}
{\displaystyle {\begin{bmatrix}0&\cdots &0\\\vdots &\ddots &\vdots \\0&\cdots &0\end{bmatrix}}}
\begin{Bmatrix}
x & y \\\\
z & v
\end{Bmatrix}
{\displaystyle {\begin{Bmatrix}x&y\\z&v\end{Bmatrix}}}
\begin{pmatrix}
x & y \\\\
z & v
\end{pmatrix}
{\displaystyle {\begin{pmatrix}x&y\\z&v\end{pmatrix}}}
條件表示式
f(n) =
\begin{cases}
n/2, & \text{if }n\text{ is even} \\\\
3n+1, & \text{if }n\text{ is odd}
\end{cases}
{\displaystyle 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}
{\displaystyle {\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}
{\displaystyle {\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}
{\displaystyle {\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}
{\displaystyle {\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.
\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}{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}
- 顯示:
{\displaystyle {\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}
- 顯示:
{\displaystyle {\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}
- 顯示:
{\displaystyle {\begin{array}{ccc}a&b&S\\\hline 0&0&1\\0&1&1\\1&0&1\\1&1&0\\\end{array}}}
巢狀陣列或表格
多個陣列/表格可 互相巢狀 並組成一組陣列/一組表格。
使用巢狀前必須宣告 $$
符號。
- 例子:
% outer vertical array of arrays 外層垂直表格
\begin{array}{c}
% inner horizontal array of arrays 內層水平表格
\begin{array}{cc}
% inner array of minimum values 內層"最小值"陣列
\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}
&
% inner array of maximum values 內層"最大值"陣列
\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}
% 內層第一行表格組結束
\\\\
% inner array of delta values 內層第二行Delta值陣列
\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}
- 顯示:
$$
% outer vertical array of arrays 外層垂直表格
\begin{array}{c}
% inner horizontal array of arrays 內層水平表格
\begin{array}{cc}
&% inner array of minimum values 內層"最小值"陣列 \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}
\end{array}% inner array of maximum values 內層"最大值"陣列 \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}
% 內層第一行表格組結束
\\
% inner array of delta values 內層第二行Delta值陣列
\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} % 內層第二行表格組結束
$$
用陣列實現帶分割符號的矩陣
- 例子:
$$
\left[
\begin{array}{cc|c}
1&2&3\\\\
4&5&6
\end{array}
\right]
$$
- 顯示:
$$
\left[
\begin{array}{cc|c}
\end{array}1&2&3\\\\ 4&5&6
\right]
$$
其中 cc|c
代表在一個三列矩陣中的第二和第三列之間插入分割線。
字型
希臘字母
輸入 \小寫希臘字母英文全稱
和 \首字母大寫希臘字母英文全稱
來分別輸入小寫和大寫希臘字母。
\Alpha \Beta \Gamma \Delta \Epsilon \Zeta \Eta \Theta
{\displaystyle \mathrm {A} \mathrm {B} \Gamma \Delta \mathrm {E} \mathrm {Z} \mathrm {H} \Theta }
\Iota \Kappa \Lambda \Mu \Nu \Xi \Omicron \Pi
{\displaystyle \mathrm {I} \mathrm {K} \Lambda \mathrm {M} \mathrm {N} \mathrm {O} \Xi \Pi }
\Rho \Sigma \Tau \Upsilon \Phi \Chi \Psi \Omega
{\displaystyle \mathrm {P} \Sigma \mathrm {T} \Upsilon \Phi \mathrm {X} \Psi \Omega }
\alpha \beta \gamma \delta \epsilon \zeta \eta \theta
{\displaystyle \alpha \beta \gamma \delta \epsilon \zeta \eta \theta}
\iota \kappa \lambda \mu \nu \omicron \xi \pi
{\displaystyle \iota \kappa \lambda \mu \nu \mathrm {o} \xi \pi }
\rho \sigma \tau \upsilon \phi \chi \psi \omega
{\displaystyle \rho \sigma \tau \upsilon \phi \chi \psi \omega}
部分字母有變數專用形式,以 \var-
開頭。
\varepsilon \digamma \varkappa \varpi
{\displaystyle \varepsilon \digamma \varkappa \varpi}
\varrho \varsigma \vartheta \varphi
{\displaystyle \varrho \varsigma \vartheta \varphi}
希伯來符號
\aleph \beth \gimel \daleth
{\displaystyle \aleph \beth \gimel \daleth}
部分字型的簡稱
若要對公式的某一部分字元進行字型轉換,可以用 {\字型 {需轉換的部分字元}}
命令,其中 \字型
部分可以參照下表選擇合適的字型。一般情況下,公式預設為義大利體 $italic$ 。
| 輸入 | 說明 | 顯示 | 輸入 | 說明 | 顯示 |
| :—: | :—: | :—: | :—: | :—: | :—: ||
| \rm | 羅馬體 | $\rm{Sample}$$ | \cal | 花體 | $\cal{SAMPLE}$$ |
| \it | 義大利體 | $\it{Sample}$$ | \Bbb | 黑板粗體 | $\Bbb{SAMPLE}$$ |
| \bf | 粗體 | $\bf{Sample}$$ | \mit | 數學斜體 | $\mit{SAMPLE}$$ |
| \sf | 等線體 | $\sf{Sample}$$ | \scr | 手寫體 | $\scr{SAMPLE}$$ |
| \tt | 打字機體 | $\tt{Sample}$$ | \frak | 舊德式字型 | $\frak{Sample}$$ |
所有字型
黑板報粗體
\mathbb{ABCDEFGHI}
{\displaystyle \mathbb {ABCDEFGHI} }
\mathbb{JKLMNOPQR}
{\displaystyle \mathbb {JKLMNOPQR} }
\mathbb{STUVWXYZ}
{\displaystyle \mathbb {STUVWXYZ} }
粗體
\mathbf{ABCDEFGHI}
{\displaystyle \mathbf {ABCDEFGHI} }
\mathbf{JKLMNOPQR}
{\displaystyle \mathbf {JKLMNOPQR} }
\mathbf{STUVWXYZ}
{\displaystyle \mathbf {STUVWXYZ} }
\mathbf{abcdefghijklm}
{\displaystyle \mathbf {abcdefghijklm} }
\mathbf{nopqrstuvwxyz}
{\displaystyle \mathbf {nopqrstuvwxyz} }
\mathbf{0123456789}
{\displaystyle \mathbf {0123456789} }
粗體希臘字母
\boldsymbol{\Alpha\Beta\Gamma\Delta\Epsilon\Zeta\Eta\Theta}
{\displaystyle {\boldsymbol {\mathrm {A} \mathrm {B} \Gamma \Delta \mathrm {E} \mathrm {Z} \mathrm {H} \Theta }}}
\boldsymbol{\Iota\Kappa\Lambda\Mu\Nu\Xi\Pi\Rho}
{\displaystyle {\boldsymbol {\mathrm {I} \mathrm {K} \Lambda \mathrm {M} \mathrm {N} \Xi \Pi \mathrm {P} }}}
\boldsymbol{\Sigma\Tau\Upsilon\Phi\Chi\Psi\Omega}
{\displaystyle {\boldsymbol {\Sigma \mathrm {T} \Upsilon \Phi \mathrm {X} \Psi \Omega }}}
\boldsymbol{\alpha\beta\gamma\delta\epsilon\zeta\eta\theta}
{\displaystyle {\boldsymbol {\alpha \beta \gamma \delta \epsilon \zeta \eta \theta}}}
\boldsymbol{\iota\kappa\lambda\mu\nu\xi\pi\rho}
{\displaystyle {\boldsymbol {\iota \kappa \lambda \mu \nu \xi \pi \rho}}}
\boldsymbol{\sigma\tau\upsilon\phi\chi\psi\omega}
{\displaystyle {\boldsymbol {\sigma \tau \upsilon \phi \chi \psi \omega}}}
\boldsymbol{\varepsilon\digamma\varkappa\varpi}
{\displaystyle {\boldsymbol {\varepsilon \digamma \varkappa \varpi}}}
\boldsymbol{\varrho\varsigma\vartheta\varphi}
{\displaystyle {\boldsymbol {\varrho \varsigma \vartheta \varphi}}}
斜體(拉丁字母預設)
\mathit{0123456789}
{\displaystyle {\mathit {0123456789}}}
斜體希臘字母(小寫字母預設)
\mathit{\Alpha\Beta\Gamma\Delta\Epsilon\Zeta\Eta\Theta}
{\displaystyle {\mathit {\mathrm {A} \mathrm {B} \Gamma \Delta \mathrm {E} \mathrm {Z} \mathrm {H} \Theta }}}
\mathit{\Iota\Kappa\Lambda\Mu\Nu\Xi\Pi\Rho}
{\displaystyle {\mathit {\mathrm {I} \mathrm {K} \Lambda \mathrm {M} \mathrm {N} \Xi \Pi \mathrm {P} }}}
\mathit{\Sigma\Tau\Upsilon\Phi\Chi\Psi\Omega}
{\displaystyle {\mathit {\Sigma \mathrm {T} \Upsilon \Phi \mathrm {X} \Psi \Omega }}}
羅馬體
\mathrm{ABCDEFGHI}
{\displaystyle \mathrm {ABCDEFGHI} }
\mathrm{JKLMNOPQR}
{\displaystyle \mathrm {JKLMNOPQR} }
\mathrm{STUVWXYZ}
{\displaystyle \mathrm {STUVWXYZ} }
\mathrm{abcdefghijklm}
{\displaystyle \mathrm {abcdefghijklm} }
\mathrm{nopqrstuvwxyz}
{\displaystyle \mathrm {nopqrstuvwxyz} }
\mathrm{0123456789}
{\displaystyle \mathrm {0123456789} }
無襯線體
\mathsf{ABCDEFGHI}
{\displaystyle {\mathsf {ABCDEFGHI}}}
\mathsf{JKLMNOPQR}
{\displaystyle {\mathsf {JKLMNOPQR}}}
\mathsf{STUVWXYZ}
{\displaystyle {\mathsf {STUVWXYZ}}}
\mathsf{abcdefghijklm}
{\displaystyle {\mathsf {abcdefghijklm}}}
\mathsf{nopqrstuvwxyz}
{\displaystyle {\mathsf {nopqrstuvwxyz}}}
\mathsf{0123456789}
{\displaystyle {\mathsf {0123456789}}}
無襯線體希臘字母(僅大寫)
\mathsf{\Alpha \Beta \Gamma \Delta \Epsilon \Zeta \Eta \Theta}
{\displaystyle {\mathsf {\mathrm {A} \mathrm {B} \Gamma \Delta \mathrm {E} \mathrm {Z} \mathrm {H} \Theta }}}
\mathsf{\Iota \Kappa \Lambda \Mu \Nu \Xi \Pi \Rho}
{\displaystyle {\mathsf {\mathrm {I} \mathrm {K} \Lambda \mathrm {M} \mathrm {N} \Xi \Pi \mathrm {P} }}}
\mathsf{\Sigma \Tau \Upsilon \Phi \Chi \Psi \Omega}
{\displaystyle {\mathsf {\Sigma \mathrm {T} \Upsilon \Phi \mathrm {X} \Psi \Omega }}}
手寫體 / 花體
\mathcal{ABCDEFGHI}
{\displaystyle {\mathcal {ABCDEFGHI}}}
\mathcal{JKLMNOPQR}
{\displaystyle {\mathcal {JKLMNOPQR}}}
\mathcal{STUVWXYZ}
{\displaystyle {\mathcal {STUVWXYZ}}}
Fraktur 體
\mathfrak{ABCDEFGHI}
{\displaystyle {\mathfrak {ABCDEFGHI}}}
\mathfrak{JKLMNOPQR}
{\displaystyle {\mathfrak {JKLMNOPQR}}}
\mathfrak{STUVWXYZ}
{\displaystyle {\mathfrak {STUVWXYZ}}}
\mathfrak{abcdefghijklm}
{\displaystyle {\mathfrak {abcdefghijklm}}}
\mathfrak{nopqrstuvwxyz}
{\displaystyle {\mathfrak {nopqrstuvwxyz}}}
\mathfrak{0123456789}
{\displaystyle {\mathfrak {0123456789}}}
小型手寫體
{\scriptstyle\text{abcdefghijklm}}
{\displaystyle {\scriptstyle {\text{abcdefghijklm}}}}
混合字型
特徵|語法|渲染效果
斜體字元(忽略空格)
x y z
{\displaystyle xyz}
非斜體字元
\text{x y z}
{\displaystyle {\text{x y z}}}
混合斜體(差)
\text{if} n \text{is even}
{\displaystyle {\text{if}}n{\text{is even}}}
混合斜體(好)
\text{if }n\text{ is even}
{\displaystyle {\text{if }}n{\text{ is even}}}
混合斜體(替代品:~
或者 \
強制空格)
\text{if}~n\ \text{is even}
{\displaystyle {\text{if}}~n\ {\text{is even}}}
註釋文字
使用 \text {文字}
來新增註釋文字(註釋文字不會被識別為公式,不用斜體顯示)。\text {文字}
中仍可以使用 $公式$
插入其它公式。
例子:
f(n)= \begin{cases} n/2, & \text {if $n$ is even} \\\\ 3n+1, &\text{if $n$ is odd} \end{cases}
顯示:
f(n)= \begin{cases} n/2, & \text {if}\ n\ \text{is even} \\ 3n+1, & \text {if}\ n\ \text{is odd} \end{cases}
括號
()
、[]
和 |
表示符號本身,使用 \{\}
來表示 {}
。
功能|語法|顯示
短括號
\frac{1}{2}
{\displaystyle ({\frac {1}{2}})}
長括號
\left(\frac{1}{2} \right
{\displaystyle \left({\frac {1}{2}}\right)}
使用 \left
和 \right
來建立自動匹配高度的 (圓括號),[方括號] 和 {花括號} 。
功能|語法|顯示
圓括號,小括號
\left( \frac{a}{b} \right)
{\displaystyle \left({\frac {a}{b}}\right)}
方括號,中括號
\left[ \frac{a}{b} \right]
{\displaystyle \left[{\frac {a}{b}}\right]}
花括號,大括號
\left{ \frac{a}{b} \right}
{\displaystyle \left\{\frac {a}{b}\right\}}
角括號
\left \langle \frac{a}{b} \right \rangle
{\displaystyle \left\langle {\frac {a}{b}}\right\rangle }
單豎線,絕對值
\left| \frac{a}{b} \right|
{\displaystyle \left| \frac{a}{b} \right|}
雙豎線,範
\left \| \frac{a}{b} \right \|
{\displaystyle \left|{\frac {a}{b}}\right|}
取整函式
\left \lfloor \frac{a}{b} \right \rfloor
{\displaystyle \left\lfloor {\frac {a}{b}}\right\rfloor }
取頂函式
\left \lceil \frac{c}{d} \right \rceil
{\displaystyle \left\lceil {\frac {c}{d}}\right\rceil }
斜線與反斜線
\left / \frac{a}{b} \right \backslash
{\displaystyle \left/{\frac {a}{b}}\right\backslash }
上下箭頭
\left \uparrow \frac{a}{b} \right \downarrow
{\displaystyle \left\uparrow {\frac {a}{b}}\right\downarrow }
\left \Uparrow \frac{a}{b} \right \Downarrow
{\displaystyle \left\Uparrow {\frac {a}{b}}\right\Downarrow }
\left \updownarrow \frac{a}{b} \right \Updownarrow
{\displaystyle \left\updownarrow {\frac {a}{b}}\right\Updownarrow }
混合括號
\left[ 0,1 \right)
{\displaystyle \left[0,1\right)}
\left \langle \psi \right |
$\left \langle \psi \right |$
如果括號只有一邊,要用 \left.
或 \right.
匹配另一邊。
單左括號
\left \{\frac{a}{b} \right.
{\displaystyle \left{{\frac {a}{b}}\right.}
單右括號
\left. \frac{a}{b} \right \}
{\displaystyle \left.{\frac {a}{b}}\right\}}
備註:
可以使用
\big, \Big, \bigg, \Bigg
控制括號的大小,比如程式碼\Bigg ( \bigg [ \Big \{ \big \langle \left | \| \frac{a}{b} \| \right | \big \rangle \Big \} \bigg ] \Bigg )
顯示︰
$\Big(\Big)$
\Bigg ( \bigg [ \Big \{ \big \langle \left | \| \frac{a}{b} \| \right | \big \rangle \Big \} \bigg ] \Bigg )
空格
注意 TeX 能夠自動處理大多數的空格,但是您有時候需要自己來控制。
功能|語法|顯示|寬度
2 個 quad 空格
\alpha\qquad\beta
{\displaystyle \alpha \qquad \beta}
{\displaystyle mm}
quad 空格
\alpha\quad\beta
{\displaystyle \alpha \quad \beta}
{\displaystyle m}
大空格
\alpha\ \beta
{\displaystyle \alpha \ \beta}
{\displaystyle {\frac{m}{3}}}
中等空格
\alpha\;\beta
{\displaystyle \alpha ;\beta}
{\displaystyle {\frac {2m}{7}}}
小空格
\alpha\,\beta
{\displaystyle \alpha ,\beta}
{\displaystyle {\frac {m}{6}}}
沒有空格
\alpha\beta
{\displaystyle \alpha \beta }
{\displaystyle 0}
緊貼
\alpha\!\beta
{\displaystyle \alpha !\beta}
{\displaystyle -{\frac {m}{6}}}
顏色
Cmd Markdown 公式指導手冊裡是這樣寫的:
使用 \color{顏色}{文字}
來更改特定的文字顏色。
更改文字顏色 需要瀏覽器支援 ,如果瀏覽器不知道你所需的顏色,那麼文字將被渲染為黑色。
對於較舊的瀏覽器(HTML4與CSS2),以下顏色是被支援的:
輸入 | 顯示 | 輸入 | 顯示 |
---|---|---|---|
black | $\color{black}{text}$$ | grey | $\color{grey}{text}$$ |
silver | $\color{silver}{text}$$ | white | $\color{white}{text}$$ |
maroon | $\color{maroon}{text}$$ | red | $\color{red}{text}$$ |
yellow | $\color{yellow}{text}$$ | lime | $\color{lime}{text}$$ |
olive | $\color{olive}{text}$$ | green | $\color{green}{text}$$ |
teal | $\color{teal}{text}$$ | auqa | $\color{auqa}{text}$$ |
blue | $\color{blue}{text}$$ | navy | $\color{navy}{text}$$ |
purple | $\color{purple}{text}$$ | fuchsia | $\color{fuchsia}{text}$$ |
對於較新的瀏覽器(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+#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}
顯示:
\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}
顯示{\color{Red}abc}\color{Red}{abc}
顯示$\color{Red}{abc}$$
支援色調錶:
{\displaystyle \color {Apricot}{\text{Apricot}}}
{\displaystyle \color {Aquamarine}{\text{Aquamarine}}}
{\displaystyle \color {Bittersweet}{\text{Bittersweet}}}
{\displaystyle \color {Black}{\text{Black}}}
{\displaystyle \color {Blue}{\text{Blue}}}
{\displaystyle \color {BlueGreen}{\text{BlueGreen}}}
{\displaystyle \color {BlueViolet}{\text{BlueViolet}}}
{\displaystyle \color {BrickRed}{\text{BrickRed}}}
{\displaystyle \color {Brown}{\text{Brown}}}
{\displaystyle \color {BurntOrange}{\text{BurntOrange}}}
{\displaystyle \color {CadetBlue}{\text{CadetBlue}}}
{\displaystyle \color {CarnationPink}{\text{CarnationPink}}}
{\displaystyle \color {Cerulean}{\text{Cerulean}}}
{\displaystyle \color {CornflowerBlue}{\text{CornflowerBlue}}}
{\displaystyle \color {Cyan}{\text{Cyan}}}
{\displaystyle \color {Dandelion}{\text{Dandelion}}}
{\displaystyle \color {DarkOrchid}{\text{DarkOrchid}}}
{\displaystyle \color {Emerald}{\text{Emerald}}}
{\displaystyle \color {ForestGreen}{\text{ForestGreen}}}
{\displaystyle \color {Fuchsia}{\text{Fuchsia}}}
{\displaystyle \color {Goldenrod}{\text{Goldenrod}}}
{\displaystyle \color {Gray}{\text{Gray}}}
{\displaystyle \color {Green}{\text{Green}}}
{\displaystyle \color {GreenYellow}{\text{GreenYellow}}}
{\displaystyle \color {JungleGreen}{\text{JungleGreen}}}
{\displaystyle \color {Lavender}{\text{Lavender}}}
{\displaystyle \color {LimeGreen}{\text{LimeGreen}}}
{\displaystyle \color {Magenta}{\text{Magenta}}}
{\displaystyle \color {Mahogany}{\text{Mahogany}}}
{\displaystyle \color {Maroon}{\text{Maroon}}}
{\displaystyle \color {Melon}{\text{Melon}}}
{\displaystyle \color {MidnightBlue}{\text{MidnightBlue}}}
{\displaystyle \color {Mulberry}{\text{Mulberry}}}
{\displaystyle \color {NavyBlue}{\text{NavyBlue}}}
{\displaystyle \color {OliveGreen}{\text{OliveGreen}}}
{\displaystyle \color {Orange}{\text{Orange}}}
{\displaystyle \color {OrangeRed}{\text{OrangeRed}}}
{\displaystyle \color {Orchid}{\text{Orchid}}}
{\displaystyle \color {Peach}{\text{Peach}}}
{\displaystyle \color {Periwinkle}{\text{Periwinkle}}}
{\displaystyle \color {PineGreen}{\text{PineGreen}}}
{\displaystyle \color {Plum}{\text{Plum}}}
{\displaystyle \color {ProcessBlue}{\text{ProcessBlue}}}
{\displaystyle \color {Purple}{\text{Purple}}}
{\displaystyle \color {RawSienna}{\text{RawSienna}}}
{\displaystyle \color {Red}{\text{Red}}}
{\displaystyle \color {RedOrange}{\text{RedOrange}}}
{\displaystyle \color {RedViolet}{\text{RedViolet}}}
{\displaystyle \color {Rhodamine}{\text{Rhodamine}}}
{\displaystyle \color {RoyalBlue}{\text{RoyalBlue}}}
{\displaystyle \color {RoyalPurple}{\text{RoyalPurple}}}
{\displaystyle \color {RubineRed}{\text{RubineRed}}}
{\displaystyle \color {Salmon}{\text{Salmon}}}
{\displaystyle \color {SeaGreen}{\text{SeaGreen}}}
{\displaystyle \color {Sepia}{\text{Sepia}}}
{\displaystyle \color {SkyBlue}{\text{SkyBlue}}}
{\displaystyle \color {SpringGreen}{\text{SpringGreen}}}
{\displaystyle \color {Tan}{\text{Tan}}}
{\displaystyle \color {TealBlue}{\text{TealBlue}}}
{\displaystyle \color {Thistle}{\text{Thistle}}}
{\displaystyle \color {Turquoise}{\text{Turquoise}}}
{\displaystyle \color {Violet}{\text{Violet}}}
{\displaystyle \color {VioletRed}{\text{VioletRed}}}
{\displaystyle \color {White}{\text{White}}}
{\displaystyle \color {WildStrawberry}{\text{WildStrawberry}}}
{\displaystyle \color {Yellow}{\text{Yellow}}}
{\displaystyle \color {YellowGreen}{\text{YellowGreen}}}
{\displaystyle \color {YellowOrange}{\text{YellowOrange}}}
*注︰輸入時第一個字母必需以大寫輸入,如\color{OliveGreen}
。
例子
{\color{Blue}x^2}+{\color{Brown}2x} - {\color{OliveGreen}1}
{\displaystyle {\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}
{\displaystyle x_{\color {Maroon}1,2}={\frac {-b\pm {\sqrt {\color {Maroon}b^{2}-4ac}}}{2a}}}
外部連結
一個介紹 $\TeX$ 的 PDF 文件(英文): www.ctan.org/tex-archive/info/gentl...
手畫符號搜尋 $\LaTeX$ 程式碼: detexify.kirelabs.org/classify.html
本作品採用《CC 協議》,轉載必須註明作者和本文連結