本文为Latex数学公式在 Markdown 环境下的语法指引,以帮助每一个写文的人便利地把数学公式完整的编辑出来,并作出优美的排版。
 

1. Markdown中的Latex格式

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

1.1 行内公式

$E=mc^2$
$E=mc^2$

1.2 独立公式

$$E=mc^2$$
$$E=mc^2$$

2.Latex数学公式

2.1 函数、符号及特殊字符

  • 指数
    $\exp_a b = a^b, \exp b = e^b, 10^m$
    $\exp_a b = a^b, \exp b = e^b, 10^m$
  • 对数
    \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, \tanh c, \coth d
    $\sinh a, \cosh b, \tanh c, \coth d$

    \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$)

2.2 界限,极限

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

\lim u, \liminf v, \limsup w
$\lim u, \liminf v, \limsup w$

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

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

2.3 投射

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

2.4 微积分和导数

dt, \mathrm{d}t, \partial t, \nabla\psi
$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, \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
$\prime, \backprime, f^\prime, f', f'', f^{(3)}, \dot y, \ddot y$

2.5 类字母符号及常数

\infty, \aleph, \complement, \backepsilon, \eth, \Finv, \hbar
$\infty, \aleph, \complement, \backepsilon, \eth, \Finv, \hbar$

\Im, \imath, \jmath, \Bbbk, \ell, \mho, \wp, \Re, \circledS
$\Im, \imath, \jmath, \Bbbk, \ell, \mho, \wp, \Re, \circledS$

2.6 模运算

s_k \equiv 0 \pmod{m}
$s_k \equiv 0 \pmod{m}$

a \bmod b
$a \bmod b$

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

\mid, \nmid, \shortmid, \nshortmid
$\mid, \nmid, \shortmid, \nshortmid$

2.7 根号

\surd, \sqrt{2}, \sqrt[n]{}, \sqrt[3]{\frac{x^3+y^3}{2}}
$\surd, \sqrt{2}, \sqrt[n]{}, \sqrt[3]{\frac{x^3+y^3}{2}}$

2.8 集合

\empty, \emptyset, \varnothing
$\empty, \emptyset, \varnothing$

\in, \notin \not\in, \ni, \not\ni
$\in, \notin \not\in, \ni, \not\ni$

\cap, \Cap, \sqcap, \bigcap
$\cap, \Cap, \sqcap, \bigcap$

\cup, \Cup, \sqcup, \bigcup, \bigsqcup, \uplus, \biguplus
$\cup, \Cup, \sqcup, \bigcup, \bigsqcup, \uplus, \biguplus$

\setminus, \smallsetminus, \times
$\setminus, \smallsetminus, \times$

\subset, \Subset, \sqsubset
$\subset, \Subset, \sqsubset$

\supset, \Supset, \sqsupset
$\supset, \Supset, \sqsupset$

\subseteq, \nsubseteq, \subsetneq, \varsubsetneq, \sqsubseteq
$\subseteq, \nsubseteq, \subsetneq, \varsubsetneq, \sqsubseteq$

\supseteq, \nsupseteq, \supsetneq, \varsupsetneq, \sqsupseteq
$\supseteq, \nsupseteq, \supsetneq, \varsupsetneq, \sqsupseteq$

\subseteqq, \nsubseteqq, \subsetneqq, \varsubsetneqq
$\subseteqq, \nsubseteqq, \subsetneqq, \varsubsetneqq$

\supseteqq, \nsupseteqq, \supsetneqq, \varsupsetneqq
$\supseteqq, \nsupseteqq, \supsetneqq, \varsupsetneqq$

2.9 运算符

+, -, \pm, \mp, \dotplus
$+, -, \pm, \mp, \dotplus$

\times, \div, \divideontimes, /, \backslash
$\times, \div, \divideontimes, /, \backslash$

\cdot, * \ast, \star, \circ, \bullet
$\cdot, * \ast, \star, \circ, \bullet$

\boxplus, \boxminus, \boxtimes, \boxdot
$\boxplus, \boxminus, \boxtimes, \boxdot$

\oplus, \ominus, \otimes, \oslash, \odot
$\oplus, \ominus, \otimes, \oslash, \odot$

\circleddash, \circledcirc, \circledast
$\circleddash, \circledcirc, \circledast$

\bigoplus, \bigotimes, \bigodot
$\bigoplus, \bigotimes, \bigodot$

2.10 关系符号

=, \ne, \neq, \equiv, \not\equiv
$=, \ne, \neq, \equiv, \not\equiv$
\doteq, \doteqdot, ``\overset{\underset{\mathrm{def}}{}}{=},``:=
$\doteq, \doteqdot, \overset{\underset{\mathrm{def}}{}}{=},:=$

\sim, \nsim, \backsim, \thicksim, \simeq, \backsimeq, \eqsim, \cong, \ncong
$\sim, \nsim, \backsim, \thicksim, \simeq, \backsimeq, \eqsim, \cong, \ncong$

\approx, \thickapprox, \approxeq, \asymp, \propto, \varpropto
$\approx, \thickapprox, \approxeq, \asymp, \propto, \varpropto$

<, \nless, \ll, \not\ll, \lll, \not\lll, \lessdot
$<, \nless, \ll, \not\ll, \lll, \not\lll, \lessdot$

&gt;, \ngtr, \gg, \not\gg, \ggg, \not\ggg, \gtrdot
$>, \ngtr, \gg, \not\gg, \ggg, \not\ggg, \gtrdot$
\le, \leq, \lneq, \leqq, \nleq, \nleqq, \lneqq, \lvertneqq
$\le, \leq, \lneq, \leqq, \nleq, \nleqq, \lneqq, \lvertneqq$

\ge, \geq, \gneq, \geqq, \ngeq, \ngeqq, \gneqq, \gvertneqq
$\ge, \geq, \gneq, \geqq, \ngeq, \ngeqq, \gneqq, \gvertneqq$

\lessgtr, \lesseqgtr, \lesseqqgtr, \gtrless, \gtreqless, \gtreqqless
$\lessgtr, \lesseqgtr, \lesseqqgtr, \gtrless, \gtreqless, \gtreqqless$

\leqslant, \nleqslant, \eqslantless``\geqslant, \ngeqslant, \eqslantgtr
$\leqslant, \nleqslant, \eqslantless,\geqslant, \ngeqslant, \eqslantgtr$

\lesssim, \lnsim, \lessapprox, \lnapprox``\gtrsim, \gnsim, \gtrapprox, \gnapprox
$\lesssim, \lnsim, \lessapprox, \lnapprox, \gtrsim, \gnsim, \gtrapprox, \gnapprox$

\prec, \nprec, \preceq, \npreceq, \precneqq``\succ, \nsucc, \succeq, \nsucceq, \succneqq
$\prec, \nprec, \preceq, \npreceq, \precneqq,\succ, \nsucc, \succeq, \nsucceq, \succneqq$

\preccurlyeq, \curlyeqprec``\succcurlyeq, \curlyeqsucc
$\preccurlyeq, \curlyeqprec,\succcurlyeq, \curlyeqsucc$

\precsim, \precnsim, \precapprox, \precnappro``\succsim, \succnsim, \succapprox, \succnapprox
$\precsim, \precnsim, \precapprox, \precnappro,\succsim, \succnsim, \succapprox, \succnapprox$

2.11 几何符号

\parallel, \nparallel, \shortparallel, \nshortparallel
$\parallel, \nparallel, \shortparallel, \nshortparallel$

\perp, \angle, \sphericalangle, \measuredangle, 45^\circ
$\perp, \angle, \sphericalangle, \measuredangle, 45^\circ$

\Box, \blacksquare, \diamond, \Diamond \lozenge, \blacklozenge, \bigstar
$\Box, \blacksquare, \diamond, \Diamond \lozenge, \blacklozenge, \bigstar$

\bigcirc, \triangle, \bigtriangleup, \bigtriangledown
$\bigcirc, \triangle, \bigtriangleup, \bigtriangledown$

\vartriangle, \triangledown``\blacktriangle, \blacktriangledown, \blacktriangleleft, \blacktriangleright
$\vartriangle, \triangledown,\blacktriangle, \blacktriangledown, \blacktriangleleft, \blacktriangleright$

2.12 逻辑符号

\forall, \exists, \nexists
$\forall, \exists, \nexists$
\therefore, \because, \And
$\therefore, \because, \And$

\lor, \vee, \curlyvee, \bigvee
$\lor, \vee, \curlyvee, \bigvee$

\bar{q}, \bar{abc}, \overline{q}, \overline{abc},``\lnot \neg, \not\operatorname{R}, \bot, \top
$\bar{q}, \bar{abc}, \overline{q}, \overline{abc},\lnot \neg, \not\operatorname{R}, \bot, \top$

\vdash, \dashv, \vDash, \Vdash, \models
$\vdash, \dashv, \vDash, \Vdash, \models$

\Vvdash, \nvdash ,\nVdash ,\nvDash ,\nVDash
$\Vvdash, \nvdash, \nVdash ,\nvDash ,\nVDash$

\ulcorner \urcorner \llcorner \lrcorner
$\ulcorner \urcorner \llcorner \lrcorner$

2.13 箭头

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

2.13 特殊符号

省略号:数学公式中常见的省略号有两种,\ldots 表示与文本底线对齐的省略号,\cdots 表示与文本中线对齐的省略号。

\amalg \% \dagger \ddagger \ldots \cdots
$\amalg \% \dagger \ddagger \ldots \cdots$

\smile \frown \wr \triangleleft \triangleright
$\smile \frown \wr \triangleleft \triangl…