前言

本文为 MathJax/KaTex 在 Markdown 环境下的语法指引,内容完全参考自博客樱花赞:LaTeX公式手册(全网最全)。为了方便个人查找和添加规则,故拷贝至此。

参考文档:

如何插入公式

LaTeX\LaTeX 的数学公式有两种:行中公式和独立公式(行间公式)。行中公式放在文中与其它文字混编,独立公式单独成行。

行中公式可以用如下方法表示:$ 数学公式 $,示例:行中数学公式

独立公式可以用如下方法表示:$$ 数学公式 $$,示例:

独立数学公式

函数、符号及特殊字符

声调 / 变音符号

\dot{a}, \ddot{a}, \acute{a}, \grave{a}

a˙,a¨,aˊ,aˋ{\displaystyle {\dot {a}},{\ddot {a}},{\acute {a}},{\grave {a}}}

\check{a}, \breve{a}, \tilde{a}, \bar{a}

aˇ,a˘,a~,aˉ{\displaystyle {\check {a}},{\breve {a}},{\tilde {a}},{\bar {a}}}

\hat{a}, \widehat{a}, \vec{a}

a^,a^,a{\displaystyle {\hat {a}},{\widehat {a}},{\vec {a}}}

标准函数

指数

\exp_a b = a^b, \exp b = e^b, 10^m

expab=ab,expb=eb,10m{\displaystyle \exp _{a}b=a^{b},\exp b=e^{b},10^{m}}

对数

\ln c, \lg d = \log e, \log_{10} f

lnc,lgd=loge,log10f{\displaystyle \ln c,\lg d=\log e,\log _{10}f}

三角函数

\sin a, \cos b, \tan c, \cot d, \sec e, \csc f

sina,cosb,tanc,cotd,sece,cscf{\displaystyle \sin a,\cos b,\tan c,\cot d,\sec e,\csc f}

\arcsin a, \arccos b, \arctan c

arcsina,arccosb,arctanc{\displaystyle \arcsin a,\arccos b,\arctan c}

\arccot d, \arcsec e, \arccsc f

arccotd,arcsece,arccscf{\displaystyle \operatorname {arccot} d,\operatorname {arcsec} e,\operatorname {arccsc} f}

\sinh a, \cosh b, \tanh c, \coth d

sinha,coshb,tanhc,cothd{\displaystyle \sinh a,\cosh b,\tanh c,\coth d}

\operatorname{sh}k, \operatorname{ch}l, \operatorname{th}m, \operatorname{coth}n

shk,chl,thm,cothn{\displaystyle \operatorname {sh} k,\operatorname {ch} l,\operatorname {th} m,\operatorname {coth} n}

\operatorname{argsh}o, \operatorname{argch}p, \operatorname{argth}q

argsho,argchp,argthq{\displaystyle \operatorname {argsh} o,\operatorname {argch} p,\operatorname {argth} q}

符号函数,绝对值

\sgn r, \left\vert s \right\vert

sgnr,s{\displaystyle \operatorname {sgn} r,\left\vert s\right\vert }

最大值,最小值

\min(x,y), \max(x,y)

min(x,y),max(x,y){\displaystyle \min(x,y),\max(x,y)}

界限,极限

\min x, \max y, \inf s, \sup t

minx,maxy,infs,supt{\displaystyle \min x,\max y,\inf s,\sup t}

\lim u, \liminf v, \limsup w

limu,lim infv,lim supw{\displaystyle \lim u,\liminf v,\limsup w}

\lim_{x \to \infty} \frac{1}{n(n+1)}

limx1n(n+1){\displaystyle \lim_{x \to \infty} \frac{1}{n(n+1)}}

\dim p, \deg q, \det m, \ker\phi

dimp,degq,detm,kerϕ{\displaystyle \dim p,\deg q,\det m,\ker \phi}

投射

\Pr j, \hom l, \lVert z \rVert, \arg z

Prj,homl,z,argz{\displaystyle \Pr j,\hom l,\lVert z\rVert ,\arg z}

微分及导数

dt, \mathrm{d}t, \partial t, \nabla\psi

dt,dt,t,ψ{\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

dy/dx,dy/dx,dydx,dydx,2x1x2y{\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

,,f,f,f,f(3) ⁣,y˙,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

,ı,ȷ,k,,,,,{\displaystyle \Im ,\imath ,\jmath ,\Bbbk ,\ell ,\mho ,\wp ,\Re ,\circledS }

模运算

s_k \equiv 0 \pmod{m}

sk0(modm){\displaystyle s_{k}\equiv 0{\pmod {m}}}

a \bmod b

amodb{\displaystyle a \bmod b}

\gcd(m, n), \operatorname{lcm}(m, n)

gcd(m,n),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}}

,2,n,x3+y323{\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}

集合

\{ \}, \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}}{}}{=}, :=

,,=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

,,,,45{\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}, \overline{q}, \overline{abc},

\lnot \neg, \not\operatorname{R}, \bot, \top

qˉ,q,abc,{\displaystyle {\bar {q}},{\overline {q}},{\overline {abc}},}

¬¬,̸R,,{\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, \impliedby

,,,    {\displaystyle \Leftarrow ,\nLeftarrow ,\Longleftarrow, \impliedby}

\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}

\xrightarrow[下方公式]{上方公式} \xleftarrow[下方公式]{上方公式}

ab,  aba \xrightarrow[下方公式]{上方公式} b, \; a\xleftarrow[下方公式]{上方公式} b

\xRightarrow[下方公式]{上方公式} \xLeftarrow[下方公式]{上方公式}

ab,  aba \xRightarrow[下方公式]{上方公式} b, \; a\xLeftarrow[下方公式]{上方公式} b

特殊符号

省略号:数学公式中常见的省略号有两种,\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

a2{\displaystyle a^{2}}

下标

a_2

a2{\displaystyle a_{2}}

组合

a^{2+2}

a2+2{\displaystyle a^{2+2}}

a_{i,j}

ai,j{\displaystyle a_{i,j}}

结合上下标

x_2^3

x23{\displaystyle x_{2}^{3}}

前置上下标

{}_1^2\!X_3^4

12 ⁣X34{\displaystyle {}_{1}^{2}\!X_{3}^{4}}

导数(HTML

x'

x{\displaystyle x'}

导数(PNG

x^\prime

x{\displaystyle x^{\prime}}

导数(错误

x\prime

x{\displaystyle x\prime}

导数点

\dot{x}

x˙{\displaystyle {\dot {x}}}

\ddot{y}

y¨{\displaystyle {\ddot {y}}}

向量

\vec{c}(只有一个字母)

c{\displaystyle {\vec {c}}}

\overleftarrow{a b}

ab{\displaystyle {\overleftarrow {ab}}}

\overrightarrow{c d}

cd{\displaystyle {\overrightarrow {cd}}}

\overleftrightarrow{a b}

ab{\displaystyle {\overleftrightarrow {ab}}}

\widehat{e f g}

efg^{\displaystyle {\widehat {efg}}}

上弧

(注:正确应该用 \overarc,但在这里行不通。要用建议的语法作为解决办法。)(使用 \ overarc 时需要引入 {arcs} 包。)

\overset{\frown} {AB}

AB{\displaystyle {\overset {\frown}{AB}}}

上划线

\overline{h i j}

hij{\displaystyle {\overline {hij}}}

下划线

\underline{k l m}

klm{\displaystyle {\underline {klm}}}

上括号

\overbrace{1+2+\cdots+100}

1+2++100{\displaystyle \overbrace {1+2+\cdots +100} }

\begin{matrix} 5050 \\ \overbrace{ 1+2+\cdots+100 } \end{matrix}

50501+2++100{\displaystyle {\begin{matrix}5050\\\overbrace {1+2+\cdots +100} \end{matrix}}}

下括号

\underbrace{a+b+\cdots+z}

a+b++z{\displaystyle \underbrace {a+b+\cdots +z} }

\begin{matrix} \underbrace{ a+b+\cdots+z } \\ 26 \end{matrix}

a+b++z26{\displaystyle {\begin{matrix}\underbrace {a+b+\cdots +z} \\26\end{matrix}}}

求和(累加)

\sum_{k=1}^N k^2

k=1Nk2{\displaystyle \sum _{k=1}^{N}k^{2}}

\begin{matrix} \sum_{k=1}^N k^2 \end{matrix}

k=1Nk2{\displaystyle {\begin{matrix}\sum _{k=1}^{N}k^{2}\end{matrix}}}

求积(累乘)

\prod_{i=1}^N x_i

i=1Nxi{\displaystyle \prod _{i=1}^{N}x_{i}}

\begin{matrix} \prod_{i=1}^N x_i \end{matrix}

i=1Nxi{\displaystyle {\begin{matrix}\prod _{i=1}^{N}x_{i}\end{matrix}}}

上积

\coprod_{i=1}^N x_i

i=1Nxi{\displaystyle \coprod _{i=1}^{N}x_{i}}

\begin{matrix} \coprod_{i=1}^N x_i \end{matrix}

i=1Nxi{\displaystyle {\begin{matrix}\coprod _{i=1}^{N}x_{i}\end{matrix}}}

极限

\lim_{n \to \infty}x_n

limnxn{\displaystyle \lim _{n\to \infty}x_{n}}

\begin{matrix} \lim_{n \to \infty}x_n \end{matrix}

limnxn{\displaystyle {\begin{matrix}\lim _{n\to \infty }x_{n}\end{matrix}}}

积分

\int_{-N}^{N} e^x\, {\rm d}x

NNexdx{\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}(矩阵中积分符号变小)

NNexdx{\displaystyle {\begin{matrix}\int _{-N}^{N}e^{x}\,\mathrm {d} x\end{matrix}}}

双重积分

\iint_{D}^{W} \, \mathrm{d}x\,\mathrm{d}y

DWdxdy{\displaystyle \iint _{D}^{W}\,\mathrm {d} x\,\mathrm {d} y}

三重积分

\iiint_{E}^{V} \, \mathrm{d}x\,\mathrm{d}y\,\mathrm{d}z

EVdxdydz{\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

Cx3dx+4y2dy{\displaystyle \oint _{C}x^{3}\,\mathrm {d} x+4y^{2}\,\mathrm {d} y}

交集

\bigcap_1^{n} p

1np{\displaystyle \bigcap _{1}^{n}p}

并集

\bigcup_1^{k} p

1kp{\displaystyle \bigcup _{1}^{k}p}

分数

通常使用 \frac {分子} {分母} 命令产生一个分数,分数可嵌套。
便捷情况可直接输入 \frac ab 来快速生成一个 ab\frac ab
如果分式很复杂,亦可使用 分子 \over 分母 命令,此时分数仅有一层。

功能 | 语法 | 效果

分数

\frac{2}{4}=0.5

24=0.5{\displaystyle {\frac {2}{4}}=0.5}

小型分数

\tfrac{2}{4} = 0.5

24=0.5{\displaystyle {\tfrac {2}{4}}=0.5}

连分式(大型嵌套分式)

\cfrac{2}{c + \cfrac{2}{d + \cfrac{2}{4}}} = a

2c+2d+24=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

24=0.52c+2d+24=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}

(nr)=(nnr)=Cnr=Cnnr{\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}

(nr)=(nnr)=Cnr=Cnnr{\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}

(nr)=(nnr)=Cnr=Cnnr{\displaystyle {\binom {n}{r}}={\dbinom {n}{n-r}}=\mathrm {C} _{n}^{r}=\mathrm {C} _{n}^{n-r}}

在以 e 为底的指数函数、极限和积分中尽量不要使用 \frac 符号:它会使整段函数看起来很怪,而且可能产生歧义。也正是因此它在专业数学排版中几乎从不出现。
横着写这些分式,中间使用斜线间隔 /(用斜线代替分数线)。

  • 例子:
1
2
3
4
5
6
\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}
  • 显示:

BadBettereiπ2eiπ2eiπ/2π2π2sinxdxπ/2π/2sinxdx\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}

括号

()[]| 表示符号本身,使用 \{\} 来表示 {}

功能 | 语法 | 显示

短括号

\frac{1}{2}

(12){\displaystyle ({\frac {1}{2}})}

长括号

\left(\frac{1}{2} \right

(12){\displaystyle \left({\frac {1}{2}}\right)}

使用 \left\right 来创建自动匹配高度的 (圆括号),[方括号] 和 {花括号} 。

功能 | 语法 | 显示

圆括号,小括号

\left( \frac{a}{b} \right)

(ab){\displaystyle \left({\frac {a}{b}}\right)}

方括号,中括号

\left[ \frac{a}{b} \right]

[ab]{\displaystyle \left[{\frac {a}{b}}\right]}

花括号,大括号

\left{ \frac{a}{b} \right}

{ab}{\displaystyle \left \{ {\frac {a}{b}}\right \} }

角括号

\left \langle \frac{a}{b} \right \rangle

ab{\displaystyle \left\langle {\frac {a}{b}}\right\rangle }

单竖线,绝对值

\left| \frac{a}{b} \right|

ab{\displaystyle \left| \frac{a}{b} \right|}

双竖线,范

\left \| \frac{a}{b} \right \|

ab{\displaystyle \left\|{\frac {a}{b}}\right\|}

取整函数

\left \lfloor \frac{a}{b} \right \rfloor

ab{\displaystyle \left\lfloor {\frac {a}{b}}\right\rfloor }

取顶函数

\left \lceil \frac{c}{d} \right \rceil

cd{\displaystyle \left\lceil {\frac {c}{d}}\right\rceil }

斜线与反斜线

\left / \frac{a}{b} \right \backslash

/ab\{\displaystyle \left/{\frac {a}{b}}\right\backslash }

上下箭头

\left \uparrow \frac{a}{b} \right \downarrow

ab{\displaystyle \left\uparrow {\frac {a}{b}}\right\downarrow }

\left \Uparrow \frac{a}{b} \right \Downarrow

ab{\displaystyle \left\Uparrow {\frac {a}{b}}\right\Downarrow }

\left \updownarrow \frac{a}{b} \right \Updownarrow

ab{\displaystyle \left\updownarrow {\frac {a}{b}}\right\Updownarrow }

混合括号

\left[ 0,1 \right)

[0,1){\displaystyle \left[0,1\right)}

\left \langle \psi \right |

ψ\left \langle \psi \right |

如果括号只有一边,要用 \left.\right. 匹配另一边。

单左括号

\left \{\frac{a}{b} \right.

{ab{\displaystyle \left \{ {\frac {a}{b}} \right.}

单右括号

\left. \frac{a}{b} \right \}

ab}{\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 )

    显示︰

    ([{ab}])\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}

mm{\displaystyle mm}

quad 空格

\alpha\quad\beta

αβ{\displaystyle \alpha \quad \beta}

m{\displaystyle m}

大空格

\alpha\ \beta

α β{\displaystyle \alpha \ \beta}

m3{\displaystyle {\frac{m}{3}}}

中等空格

\alpha\;\beta

α  β{\displaystyle \alpha \;\beta}

2m7{\displaystyle {\frac {2m}{7}}}

小空格

\alpha\,\beta

αβ{\displaystyle \alpha \,\beta}

m6{\displaystyle {\frac {m}{6}}}

没有空格

\alpha\beta

αβ{\displaystyle \alpha \beta }

0{\displaystyle 0}

紧贴

\alpha\!\beta

α ⁣β{\displaystyle \alpha \!\beta}

m6{\displaystyle -{\frac {m}{6}}}

矩阵、条件表达式、方程组

语法:

1
2
3
\begin{类型}
公式内容
\end{类型}

类型可以是:矩阵 matrix pmatrix bmatrix Bmatrix vmatrix Vmatrix、条件表达式 cases、多行对齐方程式 aligned、数组 array

在公式内容中:在每一行中插入 & 来指定需要对齐的内容,在每行结尾处使用 \\ 换行

无框矩阵

在开头使用 begin{matrix},在结尾使用 end{matrix},在中间插入矩阵元素,每个元素之间插入 & ,并在每行结尾处使用 \\

1
2
3
4
\begin{matrix}
x & y \\
z & v
\end{matrix}

xyzv{\displaystyle {\begin{matrix}x&y\\z&v\end{matrix}}}

有框矩阵

在开头将 matrix 替换为 pmatrixbmatrixBmatrixvmatrixVmatrix

1
2
3
4
\begin{vmatrix}
x & y \\
z & v
\end{vmatrix}

xyzv{\displaystyle {\begin{vmatrix}x&y\\z&v\end{vmatrix}}}

1
2
3
4
\begin{Vmatrix}
x & y \\
z & v
\end{Vmatrix}

xyzv{\displaystyle {\begin{Vmatrix}x&y\\z&v\end{Vmatrix}}}

使用 \cdots \cdots , \ddots \ddots , \vdots \vdots 来输入省略符号

1
2
3
4
5
\begin{bmatrix}
0 & \cdots & 0 \\
\vdots & \ddots & \vdots \\
0 & \cdots & 0
\end{bmatrix}

[0000]{\displaystyle {\begin{bmatrix}0&\cdots &0\\\vdots &\ddots &\vdots \\0&\cdots &0\end{bmatrix}}}

1
2
3
4
\begin{Bmatrix}
x & y \\
z & v
\end{Bmatrix}

{xyzv}{\displaystyle {\begin{Bmatrix}x&y\\z&v\end{Bmatrix}}}

1
2
3
4
\begin{pmatrix}
x & y \\
z & v
\end{pmatrix}

(xyzv){\displaystyle {\begin{pmatrix}x&y\\z&v\end{pmatrix}}}

条件表达式

1
2
3
4
5
f(n) =
\begin{cases}
n/2, & \text{if }n\text{ is even} \\
3n+1, & \text{if }n\text{ is odd}
\end{cases}

f(n)={n/2,if n is even3n+1,if n is odd{\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}

1
2
3
4
\begin{aligned}
f(x) & = (m+n)^2 \\
& = m^2+2mn+n^2 \\
\end{aligned}

f(x)=(m+n)2=m2+2mn+n2{\displaystyle {\begin{aligned}f(x)&=(m+n)^{2}\\&=m^{2}+2mn+n^{2}\\\end{aligned}}}

1
2
3
4
5
6
7
8
\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}

36n+3+46n+3(33)2n+1+(43)2n+1272n+1+642n+1272n+1+(27)2n+1272n+1272n+10(mod91){\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}}}

1
2
3
4
5
\begin{alignedat}{3}
f(x) & = (m-n)^2 \\
f(x) & = (-m+n)^2 \\
& = m^2-2mn+n^2 \\
\end{alignedat}

f(x)=(mn)2f(x)=(m+n)2=m22mn+n2{\displaystyle {\begin{alignedat}{3}f(x)&=(m-n)^{2}\\f(x)&=(-m+n)^{2}\\&=m^{2}-2mn+n^{2}\\\end{alignedat}}}

方程组

1
2
3
4
5
\begin{cases}
3x + 5y + z \\
7x - 2y + 4z \\
-6x + 3y + 2z
\end{cases}

{3x+5y+z7x2y+4z6x+3y+2z{\displaystyle {\begin{cases}3x+5y+z\\7x-2y+4z\\-6x+3y+2z\end{cases}}}

1
2
3
4
5
\left\{\begin{aligned}
3x + 5y + z \\
7x - 2y + 4z \\
-6x + 3y + 2z
\end{aligned}\right.

{3x+5y+z7x2y+4z6x+3y+2z\left\{\begin{aligned} 3x + 5y + z \\ 7x - 2y + 4z \\ -6x + 3y + 2z \end{aligned}\right.

数组与表格

通常,一个格式化后的表格比单纯的文字或排版后的文字更具有可读性。数组和表格均以 \begin{array} 开头,并在其后定义列数及每一列的文本对齐属性,c l r 分别代表居中、左对齐及右对齐。若需要插入垂直分割线,在定义式中插入 | ,若要插入水平分割线,在下一行输入前插入 \hline 。与矩阵相似,每行元素间均须要插入 & ,每行元素以 \\ 结尾,最后以 \end{array} 结束数组。

  • 例子:
1
2
3
4
5
6
7
\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}
  • 显示:

n左对齐居中对齐右对齐10.24112521189832020001+10i\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}

  • 例子:
1
2
3
4
\begin{array}{lcl}
z & = & a \\
f(x,y,z) & = & x + y + z
\end{array}
  • 显示:

z=af(x,y,z)=x+y+z{\displaystyle {\begin{array}{lcl}z&=&a\\f(x,y,z)&=&x+y+z\end{array}}}

  • 例子:
1
2
3
4
\begin{array}{lcr}
z & = & a \\
f(x,y,z) & = & x + y + z
\end{array}
  • 显示:

z=af(x,y,z)=x+y+z{\displaystyle {\begin{array}{lcr}z&=&a\\f(x,y,z)&=&x+y+z\end{array}}}

  • 例子:
1
2
3
4
5
6
7
8
\begin{array}{ccc}
a & b & S \\
\hline
0&0&1\\
0&1&1\\
1&0&1\\
1&1&0\\
\end{array}
  • 显示:

abS001011101110{\displaystyle {\begin{array}{ccc}a&b&S\\\hline 0&0&1\\0&1&1\\1&0&1\\1&1&0\\\end{array}}}

嵌套数组或表格

多个数组/表格可 互相嵌套 并组成一组数组/一组表格。
使用嵌套前必须声明 $$ 符号。

  • 例子:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
% 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}
  • 显示:

min012300000101112012230123max012300123111232222333333Δ012300123110122210133210% 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}

用数组实现带分割符号的矩阵

  • 例子:
1
2
3
4
5
6
7
8
$$
\left[
\begin{array}{cc|c}
1&2&3\\
4&5&6
\end{array}
\right]
$$
  • 显示:

[123456]\left[ \begin{array}{cc|c} 1&2&3\\ 4&5&6 \end{array} \right]

其中 cc|c 代表在一个三列矩阵中的第二和第三列之间插入分割线。

字体

希腊字母

输入 \小写希腊字母英文全称\首字母大写希腊字母英文全称 来分别输入小写和大写希腊字母。

\Alpha \Beta \Gamma \Delta \Epsilon \Zeta \Eta \Theta

ABΓΔEZHΘ{\displaystyle \mathrm {A} \mathrm {B} \Gamma \Delta \mathrm {E} \mathrm {Z} \mathrm {H} \Theta }

\Iota \Kappa \Lambda \Mu \Nu \Xi \Omicron \Pi

IKΛMNOΞΠ{\displaystyle \mathrm {I} \mathrm {K} \Lambda \mathrm {M} \mathrm {N} \mathrm {O} \Xi \Pi }

\Rho \Sigma \Tau \Upsilon \Phi \Chi \Psi \Omega

PΣTΥΦXΨΩ{\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

ικλμνoξπ{\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}

部分字体的简称

若要对公式的某一部分字符进行字体转换,可以用 {\字体 {需转换的部分字符}} 命令,其中 \字体 部分可以参照下表选择合适的字体。一般情况下,公式默认为意大利体 italicitalic

输入 说明 显示 输入 说明 显示
\rm 罗马体 Sample\rm{Sample} \cal 花体 \cal{SAMPLE}
\it 意大利体 Sample\it{Sample} \Bbb 黑板粗体 SAMPLE\Bbb{SAMPLE}
\bf 粗体 Sample\bf{Sample} \mit 数学斜体 \mit{SAMPLE}
\sf 等线体 Sample\sf{Sample} \scr 手写体 \scr{SAMPLE}
\tt 打字机体 Sample\tt{Sample} \frak 旧德式字体 Sample\frak{Sample}

所有字体

黑板报粗体

\mathbb{ABCDEFGHI}

ABCDEFGHI{\displaystyle \mathbb {ABCDEFGHI} }

\mathbb{JKLMNOPQR}

JKLMNOPQR{\displaystyle \mathbb {JKLMNOPQR} }

\mathbb{STUVWXYZ}

STUVWXYZ{\displaystyle \mathbb {STUVWXYZ} }

粗体

\mathbf{ABCDEFGHI}

ABCDEFGHI{\displaystyle \mathbf {ABCDEFGHI} }

\mathbf{JKLMNOPQR}

JKLMNOPQR{\displaystyle \mathbf {JKLMNOPQR} }

\mathbf{STUVWXYZ}

STUVWXYZ{\displaystyle \mathbf {STUVWXYZ} }

\mathbf{abcdefghijklm}

abcdefghijklm{\displaystyle \mathbf {abcdefghijklm} }

\mathbf{nopqrstuvwxyz}

nopqrstuvwxyz{\displaystyle \mathbf {nopqrstuvwxyz} }

\mathbf{0123456789}

0123456789{\displaystyle \mathbf {0123456789} }

粗体希腊字母

\boldsymbol{\Alpha\Beta\Gamma\Delta\Epsilon\Zeta\Eta\Theta}

ABΓΔEZHΘ{\displaystyle {\boldsymbol {\mathrm {A} \mathrm {B} \Gamma \Delta \mathrm {E} \mathrm {Z} \mathrm {H} \Theta }}}

\boldsymbol{\Iota\Kappa\Lambda\Mu\Nu\Xi\Pi\Rho}

IKΛMNΞΠP{\displaystyle {\boldsymbol {\mathrm {I} \mathrm {K} \Lambda \mathrm {M} \mathrm {N} \Xi \Pi \mathrm {P} }}}

\boldsymbol{\Sigma\Tau\Upsilon\Phi\Chi\Psi\Omega}

ΣTΥΦXΨΩ{\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}

0123456789{\displaystyle {\mathit {0123456789}}}

斜体希腊字母(小写字母默认)

\mathit{\Alpha\Beta\Gamma\Delta\Epsilon\Zeta\Eta\Theta}

ABΓΔEZHΘ{\displaystyle {\mathit {\mathrm {A} \mathrm {B} \Gamma \Delta \mathrm {E} \mathrm {Z} \mathrm {H} \Theta }}}

\mathit{\Iota\Kappa\Lambda\Mu\Nu\Xi\Pi\Rho}

IKΛMNΞΠP{\displaystyle {\mathit {\mathrm {I} \mathrm {K} \Lambda \mathrm {M} \mathrm {N} \Xi \Pi \mathrm {P} }}}

\mathit{\Sigma\Tau\Upsilon\Phi\Chi\Psi\Omega}

ΣTΥΦXΨΩ{\displaystyle {\mathit {\Sigma \mathrm {T} \Upsilon \Phi \mathrm {X} \Psi \Omega }}}

罗马体

\mathrm{ABCDEFGHI}

ABCDEFGHI{\displaystyle \mathrm {ABCDEFGHI} }

\mathrm{JKLMNOPQR}

JKLMNOPQR{\displaystyle \mathrm {JKLMNOPQR} }

\mathrm{STUVWXYZ}

STUVWXYZ{\displaystyle \mathrm {STUVWXYZ} }

\mathrm{abcdefghijklm}

abcdefghijklm{\displaystyle \mathrm {abcdefghijklm} }

\mathrm{nopqrstuvwxyz}

nopqrstuvwxyz{\displaystyle \mathrm {nopqrstuvwxyz} }

\mathrm{0123456789}

0123456789{\displaystyle \mathrm {0123456789} }

无衬线体

\mathsf{ABCDEFGHI}

ABCDEFGHI{\displaystyle {\mathsf {ABCDEFGHI}}}

\mathsf{JKLMNOPQR}

JKLMNOPQR{\displaystyle {\mathsf {JKLMNOPQR}}}

\mathsf{STUVWXYZ}

STUVWXYZ{\displaystyle {\mathsf {STUVWXYZ}}}

\mathsf{abcdefghijklm}

abcdefghijklm{\displaystyle {\mathsf {abcdefghijklm}}}

\mathsf{nopqrstuvwxyz}

nopqrstuvwxyz{\displaystyle {\mathsf {nopqrstuvwxyz}}}

\mathsf{0123456789}

0123456789{\displaystyle {\mathsf {0123456789}}}

无衬线体希腊字母(仅大写)

\mathsf{\Alpha \Beta \Gamma \Delta \Epsilon \Zeta \Eta \Theta}

ABΓΔEZHΘ{\displaystyle {\mathsf {\mathrm {A} \mathrm {B} \Gamma \Delta \mathrm {E} \mathrm {Z} \mathrm {H} \Theta }}}

\mathsf{\Iota \Kappa \Lambda \Mu \Nu \Xi \Pi \Rho}

IKΛMNΞΠP{\displaystyle {\mathsf {\mathrm {I} \mathrm {K} \Lambda \mathrm {M} \mathrm {N} \Xi \Pi \mathrm {P} }}}

\mathsf{\Sigma \Tau \Upsilon \Phi \Chi \Psi \Omega}

ΣTΥΦXΨΩ{\displaystyle {\mathsf {\Sigma \mathrm {T} \Upsilon \Phi \mathrm {X} \Psi \Omega }}}

手写体 / 花体

\mathcal{ABCDEFGHI}

ABCDEFGHI{\displaystyle {\mathcal {ABCDEFGHI}}}

\mathcal{JKLMNOPQR}

JKLMNOPQR{\displaystyle {\mathcal {JKLMNOPQR}}}

\mathcal{STUVWXYZ}

STUVWXYZ{\displaystyle {\mathcal {STUVWXYZ}}}

Fraktur 体

\mathfrak{ABCDEFGHI}

ABCDEFGHI{\displaystyle {\mathfrak {ABCDEFGHI}}}

\mathfrak{JKLMNOPQR}

JKLMNOPQR{\displaystyle {\mathfrak {JKLMNOPQR}}}

\mathfrak{STUVWXYZ}

STUVWXYZ{\displaystyle {\mathfrak {STUVWXYZ}}}

\mathfrak{abcdefghijklm}

abcdefghijklm{\displaystyle {\mathfrak {abcdefghijklm}}}

\mathfrak{nopqrstuvwxyz}

nopqrstuvwxyz{\displaystyle {\mathfrak {nopqrstuvwxyz}}}

\mathfrak{0123456789}

0123456789{\displaystyle {\mathfrak {0123456789}}}

小型手写体

{\scriptstyle\text{abcdefghijklm}}

abcdefghijklm{\displaystyle {\scriptstyle {\text{abcdefghijklm}}}}

混合字体

特征 | 语法 | 渲染效果

斜体字符(忽略空格)

x y z

xyz{\displaystyle xyz}

非斜体字符

\text{x y z}

x y z{\displaystyle {\text{x y z}}}

混合斜体(差)

\text{if} n \text{is even}

ifnis even{\displaystyle {\text{if}}n{\text{is even}}}

混合斜体(好)

\text{if }n\text{ is even}

if n is even{\displaystyle {\text{if }}n{\text{ is even}}}

混合斜体(替代品:~ 或者 \ 强制空格)

\text{if}~n\ \text{is even}

if n is even{\displaystyle {\text{if}}~n\ {\text{is even}}}

注释文本

使用 \text {文字} 来添加注释文本(注释文本不会被识别为公式,不用斜体显示)。\text {文字}中仍可以使用 $公式$ 插入其它公式。

  • 例子:
1
2
3
4
f(n)= \begin{cases}
n/2, & \text {if $n$ is even} \\
3n+1, &\text{if $n$ is odd}
\end{cases}
  • 显示:

f(n)={n/2,if n is even3n+1,if n is oddf(n)= \begin{cases} n/2, & \text {if}\ n\ \text{is even} \\ 3n+1, & \text {if}\ n\ \text{is odd} \end{cases}

颜色

Cmd Markdown

使用 \color{颜色}{文字} 来更改特定的文字颜色。
更改文字颜色 需要浏览器支持 ,如果浏览器不知道你所需的颜色,那么文字将被渲染为黑色。

对于较旧的浏览器(HTML4 与 CSS2),以下颜色是被支持的:

输入 显示 输入 显示
black text\color{black}{text} grey text\color{grey}{text}
silver text\color{silver}{text} white text\color{white}{text}
maroon text\color{maroon}{text} red text\color{red}{text}
yellow text\color{yellow}{text} lime text\color{lime}{text}
olive text\color{olive}{text} green text\color{green}{text}
teal text\color{teal}{text} auqa text\color{auqa}{text}
blue text\color{blue}{text} navy text\color{navy}{text}
purple text\color{purple}{text} fuchsia text\color{fuchsia}{text}

对于较新的浏览器(HTML5 与 CSS3),额外的 124 种颜色将被支持:

1
\color {#rgb} {text}

来自定义更多的颜色,其中 #rgbr g b 可输入 0-9a-f 来表示红色、绿色和蓝色的纯度(饱和度)。

  • 例子:
1
2
3
4
5
6
7
8
9
10
11
\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}

维基百科

语法:{\color{颜色}表达式}

作者实测:在部分浏览器中,上面的语法可能是错误的(只将表达式的第一个字符着色),\color{颜色}{文字}的语法才是正确的。例如:

{\color{Red}abc}显示abc{\color{Red}abc}
\color{Red}{abc}显示abc\color{Red}{abc}

支持色调表:

Apricot{\displaystyle \color {Apricot}{\text{Apricot}}}

Aquamarine{\displaystyle \color {Aquamarine}{\text{Aquamarine}}}

Bittersweet{\displaystyle \color {Bittersweet}{\text{Bittersweet}}}

Black{\displaystyle \color {Black}{\text{Black}}}

Blue{\displaystyle \color {Blue}{\text{Blue}}}

BlueGreen{\displaystyle \color {BlueGreen}{\text{BlueGreen}}}

BlueViolet{\displaystyle \color {BlueViolet}{\text{BlueViolet}}}

BrickRed{\displaystyle \color {BrickRed}{\text{BrickRed}}}

Brown{\displaystyle \color {Brown}{\text{Brown}}}

BurntOrange{\displaystyle \color {BurntOrange}{\text{BurntOrange}}}

CadetBlue{\displaystyle \color {CadetBlue}{\text{CadetBlue}}}

CarnationPink{\displaystyle \color {CarnationPink}{\text{CarnationPink}}}

Cerulean{\displaystyle \color {Cerulean}{\text{Cerulean}}}

CornflowerBlue{\displaystyle \color {CornflowerBlue}{\text{CornflowerBlue}}}

Cyan{\displaystyle \color {Cyan}{\text{Cyan}}}

Dandelion{\displaystyle \color {Dandelion}{\text{Dandelion}}}

DarkOrchid{\displaystyle \color {DarkOrchid}{\text{DarkOrchid}}}

Emerald{\displaystyle \color {Emerald}{\text{Emerald}}}

ForestGreen{\displaystyle \color {ForestGreen}{\text{ForestGreen}}}

Fuchsia{\displaystyle \color {Fuchsia}{\text{Fuchsia}}}

Goldenrod{\displaystyle \color {Goldenrod}{\text{Goldenrod}}}

Gray{\displaystyle \color {Gray}{\text{Gray}}}

Green{\displaystyle \color {Green}{\text{Green}}}

GreenYellow{\displaystyle \color {GreenYellow}{\text{GreenYellow}}}

JungleGreen{\displaystyle \color {JungleGreen}{\text{JungleGreen}}}

Lavender{\displaystyle \color {Lavender}{\text{Lavender}}}

LimeGreen{\displaystyle \color {LimeGreen}{\text{LimeGreen}}}

Magenta{\displaystyle \color {Magenta}{\text{Magenta}}}

Mahogany{\displaystyle \color {Mahogany}{\text{Mahogany}}}

Maroon{\displaystyle \color {Maroon}{\text{Maroon}}}

Melon{\displaystyle \color {Melon}{\text{Melon}}}

MidnightBlue{\displaystyle \color {MidnightBlue}{\text{MidnightBlue}}}

Mulberry{\displaystyle \color {Mulberry}{\text{Mulberry}}}

NavyBlue{\displaystyle \color {NavyBlue}{\text{NavyBlue}}}

OliveGreen{\displaystyle \color {OliveGreen}{\text{OliveGreen}}}

Orange{\displaystyle \color {Orange}{\text{Orange}}}

OrangeRed{\displaystyle \color {OrangeRed}{\text{OrangeRed}}}

Orchid{\displaystyle \color {Orchid}{\text{Orchid}}}

Peach{\displaystyle \color {Peach}{\text{Peach}}}

Periwinkle{\displaystyle \color {Periwinkle}{\text{Periwinkle}}}

PineGreen{\displaystyle \color {PineGreen}{\text{PineGreen}}}

Plum{\displaystyle \color {Plum}{\text{Plum}}}

ProcessBlue{\displaystyle \color {ProcessBlue}{\text{ProcessBlue}}}

Purple{\displaystyle \color {Purple}{\text{Purple}}}

RawSienna{\displaystyle \color {RawSienna}{\text{RawSienna}}}

Red{\displaystyle \color {Red}{\text{Red}}}

RedOrange{\displaystyle \color {RedOrange}{\text{RedOrange}}}

RedViolet{\displaystyle \color {RedViolet}{\text{RedViolet}}}

Rhodamine{\displaystyle \color {Rhodamine}{\text{Rhodamine}}}

RoyalBlue{\displaystyle \color {RoyalBlue}{\text{RoyalBlue}}}

RoyalPurple{\displaystyle \color {RoyalPurple}{\text{RoyalPurple}}}

RubineRed{\displaystyle \color {RubineRed}{\text{RubineRed}}}

Salmon{\displaystyle \color {Salmon}{\text{Salmon}}}

SeaGreen{\displaystyle \color {SeaGreen}{\text{SeaGreen}}}

Sepia{\displaystyle \color {Sepia}{\text{Sepia}}}

SkyBlue{\displaystyle \color {SkyBlue}{\text{SkyBlue}}}

SpringGreen{\displaystyle \color {SpringGreen}{\text{SpringGreen}}}

Tan{\displaystyle \color {Tan}{\text{Tan}}}

TealBlue{\displaystyle \color {TealBlue}{\text{TealBlue}}}

Thistle{\displaystyle \color {Thistle}{\text{Thistle}}}

Turquoise{\displaystyle \color {Turquoise}{\text{Turquoise}}}

Violet{\displaystyle \color {Violet}{\text{Violet}}}

VioletRed{\displaystyle \color {VioletRed}{\text{VioletRed}}}

White{\displaystyle \color {White}{\text{White}}}

WildStrawberry{\displaystyle \color {WildStrawberry}{\text{WildStrawberry}}}

Yellow{\displaystyle \color {Yellow}{\text{Yellow}}}

YellowGreen{\displaystyle \color {YellowGreen}{\text{YellowGreen}}}

YellowOrange{\displaystyle \color {YellowOrange}{\text{YellowOrange}}}

注︰输入时第一个字母必需以大写输入,如\color{OliveGreen}

例子

  • {\color{Blue}x^2}+{\color{Brown}2x} - {\color{OliveGreen}1}

    x2+2x1{\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}

    x1,2=b±b24ac2a{\displaystyle x_{\color {Maroon}1,2}={\frac {-b\pm {\sqrt {\color {Maroon}b^{2}-4ac}}}{2a}}}

外部链接