markdown公式编写备忘录

首先展示一下插入公式的两种格式:

(1)插入行内公式:【$ + 空格】组合。

(2)块公式:【$$ + 回车】组合。

行内公式:
$ F(x) = e^x $

块公式:
$$
F(x) = e^x 
$$

行内公式效果:$ F(x) = e^x $

块公式效果:
F ( x ) = e x F(x) = e^x F(x)=ex
这里块内的公式自动进行编号,使用typora进行编写markdown,具体操作可以参考博文【【Typora&Markdown使用】行内公式不显示】。

其次说明,下面的操作中如果是单个字母,就直接进行编写;如果是多个字母,使用 {} 括起来。例如:单个下标(代码:x_i): x i x_i xi;多个字母的下标(代码:x_{max}): x m a x x_{max} xmax

最后再补充一句,行内公式和文本如果有冲突,可以使用转义符号 \ ;公式中,使用 \ ; \quad \qquad 增加间隙。

希腊字母

名称大写Tex小写Tex
alphaAAα\alpha
betaBBβ\beta
gammaΓ\Gammaγ\gamma
deltaΔ\Deltaδ\delta
epsilonEEϵ\epsilon
zetaZZζ\zeta
etaHHη\eta
thetaΘ\Thetaθ\theta
iotaIIι\iota
kappaKKκ\kappa
lambdaΛ\Lambdaλ\lambda
muMMμ\mu
nuNNν\nu
xiΞ\Xiξ\xi
omicronOOο\omicron
piΠ\Piπ\pi
rhoPPρ\rho
sigmaΣ\Sigmaσ\sigma
tauTTτ\tau
phiΦ\Phiϕ\phi
chiXXχ\chi
psiΨ\Psiψ\psi
omegaΩ\Omegaω\omega

上标、下标

说明代码结果
上缀^x^2 x 2 x^2 x2
下缀_x_i x i x_i xi
组合x_i^2 或 x^2_i x i 2 x_i^2 xi2

运算符

语法:\times、\ast、\div、\pm、\mp、\leq、\geq、\lessgtr

效果: × \times × ∗ \ast ÷ \div ÷ ± \pm ± ∓ \mp ≤ \leq ≥ \geq ≶ \lessgtr

累加、累乘、积分及交并集

\infty ∞ \infty

说明代码结果
累加求和\sum ∑ \sum
\sum_{i=0}^\infty i^2 ∑ i = 0 ∞ i 2 \sum_{i=0}^\infty i^2 i=0i2
累乘\prod ∏ \prod
积分\int ∫ \int
并集\bigcup ⋃ \bigcup
交集\bigcap ⋂ \bigcap
二重积分\iint ∬ \iint
三重积分\iiint ∭ \iiint

加上下标(以累加为例):

  • 上标 \sum^n : ∑ n \sum^n n

  • 下标 \sum_{k=1} : ∑ k = 1 \sum_{k=1} k=1

  • 正上 \sum\limits^n : ∑ n \sum\limits^n n

  • 正下 \sum\limits_{k=1} : ∑ k = 1 \sum\limits_{k=1} k=1

    注意,这里正上方和正下方使用的 \limits 只能与操作符(operator)一起使用。如果想在字母或者非操作符正上方或正下方添加,使用 \underset 。如下示例。

\underset {下面的字母}{上面的字母}
示例:$\underset {\theta}{min}$

示例效果: m i n θ \underset {\theta}{min} θmin

分式与根式

说明代码效果
分式表达1\frac{a+1}{b+1} a + 1 b + 1 \frac{a+1}{b+1} b+1a+1
分式表达2a+1\over b+1 a + 1 b + 1 {a+1\over b+1} b+1a+1
根式表达\sqrt[x]y y x \sqrt[x]{y} xy

公式中的括号

代码效果
(\frac{\sqrt x}{y^3}) ( x y 3 ) (\frac{\sqrt x}{y^3}) (y3x )
\left(\frac{\sqrt x}{y^3}\right) ( x y 3 ) \left(\frac{\sqrt x}{y^3}\right) (y3x )
{ x } { x } \{ x \} {x}
\vert x \vert ∣ x ∣ \vert x \vert x
\Vert x \Vert ∥ x ∥ \Vert x \Vert x
\langle x \rangle ⟨ x ⟩ \langle x \rangle x
\lceil x \rceil ⌈ x ⌉ \lceil x \rceil x
\lfloor x \rfloor ⌊ x ⌋ \lfloor x \rfloor x

使用 \left(或\right)使符号大小与邻近的公式相适应(该语句适用于所有括号类型),如上面表格中的第二个。

多行表达式

条件表达式

基本语法
\begin{cases}…\end{cases}

示例:

$$
f(x)=
\begin{cases}
\cfrac n2, & if\ n\ is\ even\\
\cfrac n2 + 1, & if\ n\ is\ odd
\end{cases}
$$

效果展示:
f ( x ) = { n 2 , i f   n   i s   e v e n n 2 + 1 , i f   n   i s   o d d f(x)= \begin{cases} \cfrac n2, & if\ n\ is\ even\\ \cfrac n2 + 1, & if\ n\ is\ odd \end{cases} f(x)= 2n,2n+1,if n is evenif n is odd
其中,\cfrac 增加垂直间距,& 指示对齐分类条件,\ 为条件中的空格。

方程组表达式

基本语法

\begin{array}...\end{array}\left \{\right.组合使用。

示例:

$$
\left \{ 
\begin{array}{c}
a_1x+b_1y+c_1z=d_1 \\ 
a_2x+b_2y+c_2z=d_2 \\ 
a_3x+b_3y+c_3z=d_3
\end{array}
\right.
$$

{ a 1 x + b 1 y + c 1 z = d 1 a 2 x + b 2 y + c 2 z = d 2 a 3 x + b 3 y + c 3 z = d 3 \left \{ \begin{array}{c} a_1x+b_1y+c_1z=d_1 \\ a_2x+b_2y+c_2z=d_2 \\ a_3x+b_3y+c_3z=d_3 \end{array} \right. a1x+b1y+c1z=d1a2x+b2y+c2z=d2a3x+b3y+c3z=d3

特殊符号

代码效果
\lt, \gt, \le, \ge, \neq,\not\lt <   >   ≤   ≥   ≠ , ≮ \lt\, \gt\, \le\, \ge\, \neq,\not\lt <>=,<
\times, \div, \pm, \mp ×   ÷   ±   ∓ \times\, \div\, \pm\, \mp ×÷±
\cup, \cap, \setminus, \subset, \subseteq ,\subsetneq ,\supset, \in, \notin, \emptyset, \varnothing ∪   ∩   ∖   ⊂   ⊆   ⊊   ⊃   ∈   ∉   ∅   ∅ \cup\, \cap\, \setminus\, \subset\, \subseteq \,\subsetneq \,\supset\, \in\, \notin\, \emptyset\, \varnothing /
\to, \rightarrow, \leftarrow, \Rightarrow, \Leftarrow, \mapsto →   →   ←   ⇒   ⇐   ↦ \to\, \rightarrow\, \leftarrow\, \Rightarrow\, \Leftarrow\, \mapsto
\land, \lor, \lnot, \forall, \exists, \top, \bot, \vdash, \vDash ∧   ∨   ¬   ∀   ∃   ⊤   ⊥   ⊢   ⊨ \land\, \lor\, \lnot\, \forall\, \exists\, \top\, \bot\, \vdash\, \vDash ¬
\star, \ast, \oplus, \circ, \bullet ⋆   ∗   ⊕   ∘   ∙ \star\, \ast\, \oplus\, \circ\, \bullet
\approx, \sim , \simeq, \cong, \equiv, \prec, \lhd ≈   ∼   ≃   ≅   ≡   ≺ , ⊲ \approx\, \sim \, \simeq\, \cong\, \equiv\, \prec, \lhd ,
\hat x x ^ \hat x x^
\widehat{xy} x y ^ \widehat{xy} xy
\bar x x ˉ \bar x xˉ
\overline{xyz} x y z ‾ \overline{xyz} xyz
\vec x x ⃗ \vec x x
\overrightarrow{xy} x y → \overrightarrow{xy} xy
\dot x^2 x ˙ 2 \dot x^2 x˙2
\ddot x x ¨ \ddot x x¨

极限和三角

极限(利用上面特殊符号中的箭头符号):\lim_{x\to 0} 效果:$\lim_{x\to 0} $

三角(直接加\):\sin \theta 效果: sin ⁡ θ \sin \theta sinθ

矩阵

基本语法

\begin{matrix}…\end{matrix}

$$
\begin{matrix}
1 & 1 & 1 \\
x & y & z \\
x^2 & y^2 & z^2 \\
\end{matrix}
$$

1 1 1 x y z x 2 y 2 z 2 \begin{matrix} 1 & 1 & 1 \\ x & y & z \\ x^2 & y^2 & z^2 \\ \end{matrix} 1xx21yy21zz2

矩阵中的括号

示例代码:

(1)\begin{pmatrix} 1 & 2 \\ 3 & 4 \\ \end{pmatrix}
(2)\begin{bmatrix}1 & 2 \\ 3 & 4\\ \end{bmatrix}
(3)\begin{Bmatrix}1 & 2 \\ 3 & 4\\ \end{Bmatrix}
(4)\begin{vmatrix}1 & 2 \\ 3 & 4\\ \end{vmatrix}
(5)\begin{Vmatrix}1 & 2 \\ 3 & 4\\ \end{Vmatrix}

示例效果:
(1) ( 1 2 3 4 ) \begin{pmatrix} 1 & 2 \\ 3 & 4 \\ \end{pmatrix} (1324) - - - 》pmatrix

(2) [ 1 2 3 4 ] \begin{bmatrix}1 & 2 \\ 3 & 4\\ \end{bmatrix} [1324] - - - 》bmatrix

(3) { 1 2 3 4 } \begin{Bmatrix}1 & 2 \\ 3 & 4\\ \end{Bmatrix} {1324} - - - 》Bmatrix

(4) ∣ 1 2 3 4 ∣ \begin{vmatrix}1 & 2 \\ 3 & 4\\ \end{vmatrix} 1324 - - - 》vmatrix

(5) ∥ 1 2 3 4 ∥ \begin{Vmatrix}1 & 2 \\ 3 & 4\\ \end{Vmatrix} 1324 - - - 》Vmatrix

矩阵中的省略

基本语法

\cdots ⋯ \cdots

\ddots ⋱ \ddots

\vdots ⋮ \vdots

$$
\begin{pmatrix}
1&1&1&\cdots&1\\
a_1&a_2&a_3&\cdots&a_m\\
\vdots&\vdots&\vdots&\ddots&\vdots\\
a_1^n&a_2^n&a_3^n&\cdots&a_m^n\\
\end{pmatrix}
$$

( 1 1 1 ⋯ 1 a 1 a 2 a 3 ⋯ a m ⋮ ⋮ ⋮ ⋱ ⋮ a 1 n a 2 n a 3 n ⋯ a m n ) \begin{pmatrix} 1&1&1&\cdots&1\\ a_1&a_2&a_3&\cdots&a_m\\ \vdots&\vdots&\vdots&\ddots&\vdots\\ a_1^n&a_2^n&a_3^n&\cdots&a_m^n\\ \end{pmatrix} 1a1a1n1a2a2n1a3a3n1amamn

  • 21
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值