简书支持的数学公式语法示例

(一)数学符号列表

希腊字母

Symbol Script Symbol Script
A and \alpha A and \alpha N and \nu N and \nu
B and \beta B and \beta \Xi and \xi \Xi and \xi
\Gamma and \gamma \Gamma and \gamma O and o O and o
\Delta and \delta \Delta and \delta \Pi, \pi and \varpi \Pi, \pi and \varpi
E, \epsilon and \varepsilon E, \epsilon and \varepsilon P, \rho and \varrho P, \rho and \varrho
Z and \zeta Z and \zeta \Sigma, \sigma and \varsigma \Sigma, \sigma and \varsigma
H and \eta H and \eta T and \tau T and \tau
\Theta, \theta and \vartheta \Theta, \theta and \vartheta \Upsilon and \upsilon \Upsilon and \upsilon
I and \iota I and \iota \Phi, \phi and \varphi \Phi, \phi and \varphi
K, \kappa and \varkappa K, \kappa and \varkappa X and \chi X and \chi
\Lambda and \lambda \Lambda and \lambda \Psi and \psi \Psi and \psi
M and \mu M and \mu \Omega and \omega \Omega and \omega

三角函数

Symbol Script Symbol Script Symbol Script Symbol Script
\sin \sin \arcsin \arcsin \sinh \sinh \sec \sec
\cos \cos \arccos \arccos \cosh \cosh \csc \csc
\tan \tan \arctan \arctan \tanh \tanh
\cot \cot \coth \coth

关系符号

Symbol Script Symbol Script
< < > >
\leq \leq \geq \geq
\ll \ll \gg \gg
\subset \subset \supset \supset
\subseteq \subseteq \supseteq \supseteq
\nsubseteq \nsubseteq \nsupseteq \nsupseteq
\sqsubset \sqsubset \sqsupset \sqsupset
\sqsubseteq \sqsubseteq \sqsubseteq \sqsubseteq
\preceq \preceq \succeq \succeq
\because \because \therefore \therefore
Symbol Script Symbol Script Symbol Script
= = \parallel \parallel \nparallel \nparallel
\doteq \doteq \asymp \asymp \bowtie \bowtie
\equiv \equiv \vdash \vdash \dashv \dashv
\approx \approx \in \in \ni \ni
\cong \cong \smile \smile \frown \frown
\simeq \simeq \models \models \notin \notin
\sim \sim \perp \perp \mid \mid
\propto \propto \prec \prec \succ \succ
\neq \neq \sphericalangle \sphericalangle \measuredangle \measuredangle

二元运算

Symbol Script Symbol Script Symbol Script Symbol Script
\pm \pm \cap \cap \diamond \diamond \oplus \oplus
\mp \mp \cup \cup \bigtriangleup \bigtriangleup \ominus \ominus
\times \times \uplus \uplus \bigtriangledown \bigtriangledown \otimes \otimes
\div \div \sqcap \sqcap \triangleleft \triangleleft \oslash \oslash
\ast \ast \sqcup \sqcup \triangleright \triangleright \odot \odot
\star \star \vee \vee \bigcirc \bigcirc \circ \circ
\dagger \dagger \wedge \wedge \bullet \bullet \setminus \setminus
\ddagger \ddager \cdot \cdot \wr \wr \amalg \amalg

集合逻辑

Symbol Script Symbol Script
\exists \exists \rightarrow \rightarrow
\nexists \nexists \leftarrow \leftarrow
\forall \forall \mapsto \mapsto
\neg \neg \implies \implies
\subset \subset \Rightarrow \Rightarrow
\supset \supset \leftrightarrow \leftrightarrow
\in \in \iff \iff
\notin \notin \Leftrightarrow \Leftrightarrow
\ni \ni \top \top
\land \land \bot \bot
\lor \lor \emptyset and \varnothing \emptyset and \varnothing
\angle \angle \rightleftharpoons \rightleftharpoons

界限

Symbol Script Symbol Script Symbol Script Symbol Script
\mid \mid / / \backslash \backslash
\{ { \} } \langle \langle \rangle \rangle
\uparrow \uparrow \Uparrow \Uparrow \lceil \lceil \rceil \rceil
\downarrow \downarrow \Downarrow \Downarrow \lfloor \lfloor \rfloor \rfloor

其他

Symbol Script Symbol Script Symbol Script Symbol Script Symbol Script
\partial \partial \imath \imath \Re \Re \nabla \nabla \aleph \aleph
\eth \eth \jmath \jmath \Im \Im \Box \Box \beth \beth
\hbar \hbar \ell \ell \wp \wp \infty \infty \gimel \gimel

求和积分

Symbol Script Symbol Script Symbol Script
\sum \sum \prod \prod \coprod \coprod
\bigoplus \bigoplus \bigotimes \bigotimes \bigodot \bigodot
\bigcup \bigcup \bigcap \bigcap \biguplus \biguplus
\bigsqcup \bigsqcup \bigvee \bigvee \bigwedge \bigwedge
\int \int \oint \oint \iint \iint
\iiint \iiint \iiiint \iiiint \idotsint \idotsint

自定义操作符

$\operatorname{arg\,max}_a f(a)  = \operatorname*{arg\,max}_b f(b)$
$\DeclareMathOperator*{\argmax}{arg\,max}
\argmax_c f(c)$

\operatorname{arg\,max}_a f(a) = \operatorname*{arg\,max}_b f(b)
\DeclareMathOperator*{\argmax}{arg\,max} \argmax_c f(c)

(二)上下标

上标^
下标_

  • 例子一
    k_{n+1} = n^2 + k_n^2 - k_{n-1}
    k_{n+1} = n^2 + k_n^2 - k_{n-1}
  • 例子二
    n^{22}
    n^{22}
  • 例子三
    f(n) = n^5 + 4n^2 + 2 |_{n=17}
    f(n) = n^5 + 4n^2 + 2 |_{n=17}

(三)分数与二项式

分数\frac{numerator}{denominator}
二项式\binom{numerator}{numerator}

  • 例子一
    \frac{n!}{k!(n-k)!} = \binom{n}{k}
    \frac{n!}{k!(n-k)!} = \binom{n}{k}
  • 例子二
    \frac{\frac{1}{x}+\frac{1}{y}}{y-z}
    \frac{\frac{1}{x}+\frac{1}{y}}{y-z}
  • 例子三
    ^3/_7
    ^3/_7
  • 连分数
\begin{equation}
  x = a_0 + \cfrac{1}{a_1 
          + \cfrac{1}{a_2 
          + \cfrac{1}{a_3 + \cfrac{1}{a_4} } } }
\end{equation}

\begin{equation} x = a_0 + \cfrac{1}{a_1 + \cfrac{1}{a_2 + \cfrac{1}{a_3 + \cfrac{1}{a_4} } } } \end{equation}

  • 两数相乘
\begin{equation}
\frac{
    \begin{array}[b]{r}
      \left( x_1 x_2 \right)\\
      \times \left( x'_1 x'_2 \right)
    \end{array}
  }{
    \left( y_1y_2y_3y_4 \right)
  }
\end{equation}

\begin{equation} \frac{ \begin{array}[b]{r} \left( x_1 x_2 \right)\\ \times \left( x'_1 x'_2 \right) \end{array} }{ \left( y_1y_2y_3y_4 \right) } \end{equation}

(四)根

\sqrt

  • 例子一
    \sqrt{\frac{a}{b}}
    \sqrt{\frac{a}{b}}
  • 例子二
    \sqrt[n]{1+x+x^2+x^3+\dots+x^n}
    \sqrt[n]{1+x+x^2+x^3+\dots+x^n}

(五)求和积分

求和\sum
积分\int

  • 例子一
    \sum_{i=1}^{10} t_i
    \sum_{i=1}^{10} t_i
  • 例子二
    \int_0^\infty \mathrm{e}^{-x}\,\mathrm{d}x
    \int_0^\infty \mathrm{e}^{-x}\,\mathrm{d}x
  • \substack用法
\sum_{\substack{
   0<i<m \\
   0<j<n
  }} 
 P(i,j)

\sum_{\substack{ 0<i<m \\ 0<j<n }} P(i,j)

  • 改变位置
    \int\limits_a^b
    \int\limits_a^b

(六)括号分割符

( a ), [ b ], \{ c \}, | d |, \ |e\ |, \langle f \rangle, \lfloor g \rfloor, \lceil h \rceil, \ulcorner i \urcorner

  • 自动调整大小
    \left\right\middle
    \left(\frac{x^2}{y^3}\right)
    \left(\frac{x^2}{y^3}\right)
    P\left(A=2\middle|\frac{A^2}{B}>4\right)
    P\left(A=2\middle|\frac{A^2}{B}>4\right)
    \left\{\frac{x^2}{y^3}\right\}
    \left\{\frac{x^2}{y^3}\right\}
    \left.\frac{x^3}{3}\right|_0^1
    \left.\frac{x^3}{3}\right|_0^1
  • 手动调整大小
    ( \big( \Big( \bigg( \Bigg(
    ( \big( \Big( \bigg( \Bigg(
    \frac{\mathrm d}{\mathrm d x} \left( k g(x) \right)
    \frac{\mathrm d}{\mathrm d x} \left( k g(x) \right)
    \frac{\mathrm d}{\mathrm d x} \big( k g(x) \big)
    \frac{\mathrm d}{\mathrm d x} \big( k g(x) \big)

(七)矩阵

  • 例子
\begin{matrix}
  a & b & c \\
  d & e & f \\
  g & h & i
 \end{matrix}

\begin{matrix} a & b & c \\ d & e & f \\ g & h & i \end{matrix}

  • 矩阵类型与对齐(不支持对齐)
名称 分隔符
pmatrix ( )
pmatrix* ( )
bmatrix [ ]
bmatrix* [ ]
Bmatrix { }
Bmatrix* { }
vmatrix | |
vmatrix* | |
Vmatrix || ||
Vmatrix* || ||
  • 例子
A_{m,n} = 
 \begin{pmatrix}
  a_{1,1} & a_{1,2} & \cdots & a_{1,n} \\
  a_{2,1} & a_{2,2} & \cdots & a_{2,n} \\
  \vdots  & \vdots  & \ddots & \vdots  \\
  a_{m,1} & a_{m,2} & \cdots & a_{m,n} 
 \end{pmatrix}

A_{m,n} = \begin{pmatrix} a_{1,1} & a_{1,2} & \cdots & a_{1,n} \\ a_{2,1} & a_{2,2} & \cdots & a_{2,n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{m,1} & a_{m,2} & \cdots & a_{m,n} \end{pmatrix}

\begin{array}{c|c}
  1 & 2 \\ 
  \hline
  3 & 4
 \end{array}

\begin{array}{c|c} 1 & 2 \\ \hline 3 & 4 \end{array}

  • 增加间隔
M = \begin{bmatrix}
       \frac{5}{6} & \frac{1}{6} & 0           \\[0.3em]
       \frac{5}{6} & 0           & \frac{1}{6} \\[0.3em]
       0           & \frac{5}{6} & \frac{1}{6}
     \end{bmatrix}

M = \begin{bmatrix} \frac{5}{6} & \frac{1}{6} & 0 \\[0.3em] \frac{5}{6} & 0 & \frac{1}{6} \\[0.3em] 0 & \frac{5}{6} & \frac{1}{6} \end{bmatrix}

  • smallmatrix
A matrix in text must be set smaller:
$\bigl(\begin{smallmatrix}
a&b \\ c&d
\end{smallmatrix} \bigr)$
to not increase leading in a portion of text.

A matrix in text must be set smaller:
\bigl(\begin{smallmatrix} a&b \\ c&d \end{smallmatrix} \bigr)
to not increase leading in a portion of text.

(八)文本格式

  • 文本
    50 \textrm{ apples} \times 100 \textbf{ apples} = \textit{lots of apples}^2
  • 字体
公式 例子
\mathrm{…} \mathrm{ABCDEF abcdef 123456}
\mathit{…} \mathit{ABCDEF abcdef 123456}
\mathbf{…} \mathbf{ABCDEF abcdef 123456}
\mathsf{…} \mathsf{ABCDEF abcdef 123456}
\mathtt{…} \mathtt{ABCDEF abcdef 123456}
\mathfrak{…} \mathfrak{ABCDEF abcdef 123456}
\mathcal{…} \mathcal{ABCDEF abcdef 123456}
\mathbb{…} \mathbb{ABCDEF abcdef 123456}
\mathscr{…} \mathscr{ABCDEF abcdef 123456}
  • 例子
    \boldsymbol{\beta} = (\beta_1,\beta_2,\dotsc,\beta_n)
  • 强调
公式 例子 公式 例子
a' a' a'' a''
\hat{a} \hat{a} \bar{a} \bar{a}
\grave{a} \grave{a} \acute{a} \acute{a}
\dot{a} \dot{a} \ddot{a} \ddot{a}
\not{a} \not{a} \mathring{a} \mathring{a}
\overrightarrow{a} \overrightarrow{a} \overleftarrow{a} \overleftarrow{a}
a''' a''' a'''' a''''
\overline{aaa} \overline{aaa} \check{a} \check{a}
\breve{a} \breve{a} \vec{a} \vec{a}
\dddot{a} \dddot{a} \ddddot{a} \ddddot{a}
\widehat{AAA} \widehat{AAA} \widetilde{AAA} \widetilde{AAA}
\stackrel\frown{AAA} \stackrel\frown{AAA}
\tilde{a} \tilde{a} \underline{a} \underline{a}

(九)颜色

k = {\color{red}x} \mathbin{\color{blue}-} 2
k = {\color{red}x} \mathbin{\color{blue}-} 2

颜色 代码
\color{black}{text} \color{black}{text}
\color{gray}{text} \color{gray}{text}
\color{silver}{text} \color{silver}{text}
\color{white}{text} \color{white}{text}
\color{maroon}{text} \color{maroon}{text}
\color{red}{text} \color{red}{text}
\color{yellow}{text} \color{yellow}{text}
\color{lime}{text} \color{lime}{text}
\color{olive}{text} \color{olive}{text}
\color{green}{text} \color{green}{text}
\color{teal}{text} \color{teal}{text}
\color{aqua}{text} \color{aqua}{text}
\color{blue}{text} \color{blue}{text}
\color{navy}{text} \color{navy}{text}
\color{purple}{text} \color{purple}{text}
\color{fuchsia}{text} \color{fuchsia}{text}

(十)控制

f(n) =
  \begin{cases}
    n/2       & \quad \text{if } n \text{ is even}\\
    -(n+1)/2  & \quad \text{if } n \text{ is odd}
  \end{cases}

f(n) = \begin{cases} n/2 & \quad \text{if } n \text{ is even}\\ -(n+1)/2 & \quad \text{if } n \text{ is odd} \end{cases}

  • 空格
公式 大小
\, 3/18 of a quad
\: 4/18 of a quad
\; 5/18 of a quad
\! -3/18 of a quad
\quad a quad
\qquad 2 quad

\int y\, \mathrm{d}x
\int y\, \mathrm{d}x
\int y\: \mathrm{d}x
\int y\: \mathrm{d}x
\int y\; \mathrm{d}x
\int y\; \mathrm{d}x

  • 例子
\left(
    \begin{array}{c}
      n \\
      r
    \end{array}
  \right) = \frac{n!}{r!(n-r)!}

\left( \begin{array}{c} n \\ r \end{array} \right) = \frac{n!}{r!(n-r)!}

\left(\!
    \begin{array}{c}
      n \\
      r
    \end{array}
  \!\right) = \frac{n!}{r!(n-r)!}

\left(\! \begin{array}{c} n \\ r \end{array} \!\right) = \frac{n!}{r!(n-r)!}

  • 定义新命令
    \newcommand{\dd}{\mathop{}\,\mathrm{d}}\int x^2 \dd x
  • 例子
\begin{equation}
   C^i_j = {\textstyle \sum_k} A^i_k B^k_j
\end{equation}

\begin{equation} C^i_j = {\textstyle \sum_k} A^i_k B^k_j \end{equation}

例子 公式
\dots \dots
\ldots \ldots
\cdots \cdots
\vdots \vdots
\ddots \ddots
  • 例子
$A_1,A_2,\dotsc,$
$A_1+\dotsb+A_N$
$A_1 \dotsm A_N$
$\int_a^b \dotsi$
$A_1\dotso A_N$

A_1,A_2,\dotsc,
A_1+\dotsb+A_N
A_1 \dotsm A_N
\int_a^b \dotsi
A_1\dotso A_N

(十一)特殊用法

  • 其他位置标记
    \overset\underset
A \overset{!}{=} B; A \stackrel{!}{=} B

A \overset{!}{=} B; A \stackrel{!}{=} B

\lim_{x\to 0}{\frac{e^x-1}{2x}}
 \overset{\left[\frac{0}{0}\right]}{\underset{\mathrm{H}}{=}}
 \lim_{x\to 0}{\frac{e^x}{2}}={\frac{1}{2}}

\lim_{x\to 0}{\frac{e^x-1}{2x}} \overset{\left[\frac{0}{0}\right]}{\underset{\mathrm{H}}{=}} \lim_{x\to 0}{\frac{e^x}{2}}={\frac{1}{2}}
\overbrace\underbrace

z = \overbrace{
   \underbrace{x}_\text{real} + i
   \underbrace{y}_\text{imaginary}
  }^\text{complex number}

z = \overbrace{ \underbrace{x}_\text{real} + i \underbrace{y}_\text{imaginary} }^\text{complex number}

y = a + f(\underbrace{b x}_{
                    \ge 0 \text{ by assumption}}) 

y = a + f(\underbrace{b x}_{ \ge 0 \text{ by assumption}})

A \xleftarrow{\text{this way}} B 
  \xrightarrow[\text{or that way}]{ } C

A \xleftarrow{\text{this way}} B \xrightarrow[\text{or that way}]{ } C

  • 对齐
$\begin{align*}
 f(x)  &= a x^2+b x +c   &   g(x)  &= d x^3 \\
 f'(x) &= 2 a x +b       &   g'(x) &= 3 d x^2
\end{align*}$

\begin{align*} f(x) &= a x^2+b x +c & g(x) &= d x^3 \\ f'(x) &= 2 a x +b & g'(x) &= 3 d x^2 \end{align*}

  • case
f(x) = \left\{
  \begin{array}{lr}
    x^2 & : x < 0\\
    x^3 & : x \ge 0
  \end{array}
\right.

f(x) = \left\{ \begin{array}{lr} x^2 & : x < 0\\ x^3 & : x \ge 0 \end{array} \right.

u(x) = 
  \begin{cases} 
   \exp{x} & \text{if } x \geq 0 \\
   1       & \text{if } x < 0
  \end{cases}

u(x) = \begin{cases} \exp{x} & \text{if } x \geq 0 \\ 1 & \text{if } x < 0 \end{cases}

\begin{equation}
 \left.\begin{aligned}
        B'&=-\partial \times E,\\
        E'&=\partial \times B - 4\pi j,
       \end{aligned}
 \right\}
 \qquad \text{Maxwell's equations}
\end{equation}

\begin{equation} \left.\begin{aligned} B'&=-\partial \times E,\\ E'&=\partial \times B - 4\pi j, \end{aligned} \right\} \qquad \text{Maxwell's equations} \end{equation}

\begin{alignat}{2}
 \sigma_1 &= x + y  &\quad \sigma_2 &= \frac{x}{y} \\   
 \sigma_1' &= \frac{\partial x + y}{\partial x} & \sigma_2' 
    &= \frac{\partial \frac{x}{y}}{\partial x}
\end{alignat}

\begin{alignat}{2} \sigma_1 &= x + y &\quad \sigma_2 &= \frac{x}{y} \\ \sigma_1' &= \frac{\partial x + y}{\partial x} & \sigma_2' &= \frac{\partial \frac{x}{y}}{\partial x} \end{alignat}

\begin{gather*}
a_0=\frac{1}{\pi}\int\limits_{-\pi}^{\pi}f(x)\,\mathrm{d}x\\[6pt]
\begin{split}
a_n=\frac{1}{\pi}\int\limits_{-\pi}^{\pi}f(x)\cos nx\,\mathrm{d}x=\\
=\frac{1}{\pi}\int\limits_{-\pi}^{\pi}x^2\cos nx\,\mathrm{d}x
\end{split}\\[6pt]
\begin{split}
b_n=\frac{1}{\pi}\int\limits_{-\pi}^{\pi}f(x)\sin nx\,\mathrm{d}x=\\
=\frac{1}{\pi}\int\limits_{-\pi}^{\pi}x^2\sin nx\,\mathrm{d}x
\end{split}\\[6pt]
\end{gather*}

\begin{gather*} a_0=\frac{1}{\pi}\int\limits_{-\pi}^{\pi}f(x)\,\mathrm{d}x\\[6pt] \begin{split} a_n=\frac{1}{\pi}\int\limits_{-\pi}^{\pi}f(x)\cos nx\,\mathrm{d}x=\\ =\frac{1}{\pi}\int\limits_{-\pi}^{\pi}x^2\cos nx\,\mathrm{d}x \end{split}\\[6pt] \begin{split} b_n=\frac{1}{\pi}\int\limits_{-\pi}^{\pi}f(x)\sin nx\,\mathrm{d}x=\\ =\frac{1}{\pi}\int\limits_{-\pi}^{\pi}x^2\sin nx\,\mathrm{d}x \end{split}\\[6pt] \end{gather*}

begin{equation}
 \boxed{x^2+y^2 = z^2}
\end{equation}

\begin{equation} \boxed{x^2+y^2 = z^2} \end{equation}

\begin{equation}
  \lim_{a\to \infty} \tfrac{1}{a}
\end{equation}

\begin{equation} \lim_{a\to \infty} \tfrac{1}{a} \end{equation}

\begin{equation}
  \lim\nolimits_{a\to \infty} \tfrac{1}{a}
\end{equation}

\begin{equation} \lim\nolimits_{a\to \infty} \tfrac{1}{a} \end{equation}

\begin{equation}
  \int_a^b x^2  \mathrm{d} x
\end{equation}

\begin{equation} \int_a^b x^2 \mathrm{d} x \end{equation}

\begin{equation}
  \int\limits_a^b x^2  \mathrm{d} x
\end{equation}

\begin{equation} \int\limits_a^b x^2 \mathrm{d} x \end{equation}

\begin{equation}
  \lim_{a \underset{>}{\to} 0} \frac{1}{a}
\end{equation}

\begin{equation} \lim_{a \underset{>}{\to} 0} \frac{1}{a} \end{equation}

\begin{equation}
  \sum\nolimits' C_n
\end{equation}

\begin{equation} \sum\nolimits' C_n \end{equation}

\begin{equation}
  \sum_{n=1}\nolimits' C_n
\end{equation}

\begin{equation} \sum_{n=1}\nolimits' C_n \end{equation}

\begin{equation}
  \sideset{}{'}\sum_{n=1}C_n
\end{equation}

\begin{equation} \sideset{}{'}\sum_{n=1}C_n \end{equation}

\begin{equation}
  \sideset{_a^b}{_c^d}\sum
\end{equation}

\begin{equation} \sideset{_a^b}{_c^d}\sum \end{equation}

\begin{equation}
  {\sum\limits_{n=1} }'C_n
\end{equation}

\begin{equation} {\sum\limits_{n=1} }'C_n \end{equation}

  • 字体大小
命令 例子
\displaystyle {ABCDabcd1234} \displaystyle {ABCDabcd1234}
\textstyle{ABCDabcd1234} \textstyle{ABCDabcd1234}
\scriptstyle{ABCDabcd1234} \scriptstyle{ABCDabcd1234}
\scriptscriptstyle{ABCDabcd1234} \scriptscriptstyle{ABCDabcd1234}
\begin{equation}
  x = a_0 + \frac{1}{a_1 + \frac{1}{a_2 + \frac{1}{a_3 + a_4}}}
\end{equation}

\begin{equation} x = a_0 + \frac{1}{a_1 + \frac{1}{a_2 + \frac{1}{a_3 + a_4}}} \end{equation}

\begin{equation}
  x = a_0 + \frac{1}{\displaystyle a_1 
          + \frac{1}{\displaystyle a_2 
          + \frac{1}{\displaystyle a_3 + a_4}}}
\end{equation}

\begin{equation} x = a_0 + \frac{1}{\displaystyle a_1 + \frac{1}{\displaystyle a_2 + \frac{1}{\displaystyle a_3 + a_4}}} \end{equation}
$a \equiv b \pmod n$
a \equiv b \pmod n

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。