markdown数学公式基本语法

数学公式语法

Tags: Markdown语法


越来越喜欢markdown这个轻量级的编辑语言了,对记笔记真的是很方便。

以下给出数学公式输入的基本语法,供平时查阅,如果有遇到新的重要语法将继续补充在这里。

说明: 
每个部分均是先展示语法,然后展示效果,而非完全一一对应。 
部分语句仅为展示效果,没有实际意义。

1、块级公式使用$$...$$表示

$$ \sum_{i=0}^ni^2 = \frac{n(n+1)(2n+1)}{6}$$
  • 1

i=0ni2=n(n+1)(2n+1)6

2、希腊字母的大小写(详见附录)

$$\alpha \Omega$$
  • 1

αΩ

3、下标、上标

$$\log_{2x}{x^2}$$
$$x^{{5^6}^7}$$
  • 1
  • 2

log2xx2

x567

$$32^\circ$$
  • 1

32

4、各种括号

$$(2+33)(4+5)[4+4]\{4+4\}$$

$$
f\left(
   \left[ 
     \frac{
       1+\left\{x,y\right\}
     }{
       \left(
          \frac{x}{y}+\frac{y}{x}
       \right)
       \left(u+1\right)
     }+a
   \right]^{3/2}
\right)
$$
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16

(2+33)(4+5)[4+4]{4+4}

f1+{x,y}(xy+yx)(u+1)+a3/2

5、分式

$$\frac{\sqrt{x}^3}{y^z}$$
$$\left(\frac{\sqrt{x}^3}{y^z}\right)$$
  • 1
  • 2

x3yz

(x3yz)

6、绝对值与范数

lvert/rvert
lVert/rVert
langle/rangle
lceil/rceil
lfloor/rfloor
$$\bbox[yellow]{\frac{|x|\lvert x \rvert}{\lVert x\rVert \langle x \rangle}\lceil x \rceil \lfloor x \rfloor}$$
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

|x|xxxxx

7、求和与积分

$$\prod_{i=0}^\infty i^2$$
$$\int_{a}^{b}f(x) = F(b) - F(a)$$
$$\int_e^f\int_c^d\int_{a}^b$$
$$\bigcup_{a=0}^{+\infty}\bigcap_{b=0}^{-\infty}$$
$$\oint$$
  • 1
  • 2
  • 3
  • 4
  • 5

i=0i2

baf(x)=F(b)F(a)

fedcba

a=0+b=0

8、开方

$$\sqrt[a]{b^2}$$
  • 1

b2a

9、极限、导数

$$\lim_{x \to 0}$$
$$\frac{\partial y}{\partial x} = 3x$$
  • 1
  • 2

limx0

yx=3x

10、比较运算符

lt/gt
le/ge
approx
$$a \lt b \\ c\neq d\\e \ge f$$
$$a \approx {b \cdot d}$$
  • 1
  • 2
  • 3
  • 4
  • 5

a<bcdef

abd

11、排列、组合

$$A_a^b\\C_a^b\\\binom a b$$
  • 1

AbaCba(ab)

12、四则运算符

$$a \pm b \\ c \mp b \\ e \times d \\ e \div f \\ a \cdot b$$
  • 1

a±bcbe×de÷fab

13、集合

$$A \cup B \\ C \cap D \\ E \setminus F$$
$$a \in A \\ b \notin A$$
$$A \subset B \\ C \subseteq D \\ E \subsetneq F$$
$$A \supset B$$
$$A = \emptyset \\ B = \varnothing$$
  • 1
  • 2
  • 3
  • 4
  • 5

ABCDEF

aAbA

ABCDEF

AB

A=B=

14、箭头

$$a \to 0 \\ a \rightarrow 0 \\ b \leftarrow 0$$
$$a \Leftarrow 0\\ b \Rightarrow 1$$
  • 1
  • 2

a0a0b0

a0b1

15、逻辑关系

$$p \land q \\ p \lor q \\  \lnot q$$
$$\forall x\\\exists a \in A$$
$$\bbox[pink]{\text{对∀x,∃a∈A}}$$
$$A \bigodot B$$
$$A \bigotimes B$$
$$A \bigoplus B$$
$$A \bigvee B$$
$$A \bigwedge B$$
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

pqpq¬q

xaA

∀x,∃a∈A

AB

AB

AB

AB

AB

16、余数

$$a\equiv b \pmod n$$
  • 1

ab(modn)

17、空格

$$a  b\\ a \, b\\a \; b\\ a \quad b\\a \qquad b$$
  • 1

ababababab

18、省略号

$$a \ldots b\\ a \cdots b\\ a \ddots b$$
  • 1

ababab

19、修饰符

$$\hat x \\ \hat {xy} \\ \widehat {xyz}$$
$$\vec {xy} \\ \overrightarrow {xyz} \\ \overleftrightarrow {xyz}$$
$$x \dot x \\ x \ddot {x}$$
$$\tilde {x} ,\check {x} ,\grave {x}$$
  • 1
  • 2
  • 3
  • 4

x^xy^xyzˆ

xyxyzxyz

xx˙xx¨

x~,xˇ,x`

20、反义表示

$$\$\\ \_\\ \backslash$$
  • 1

$_

21、矩阵与行列式

$$
	\begin{bmatrix}
	1 & x & \cdots & x^2 \\
	\vdots & \vdots  & \ddots & \vdots\\
	2 & y & \cdots & {y^2}
	\end{bmatrix}
$$
$$\begin{vmatrix}
	2 & 5\\
	3 & 4
	\end{vmatrix}
$$

pmatrix ()
Vmatrix || ||

$$ \left[
    \begin{array}{cc|c}
      1&2&3\\
      4&5&6
    \end{array}
\right] $$
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22

12xyx2y2

2354

pmatrix () 
Vmatrix || ||

[142536]

22、连等式

$$
	\begin{align}
	\sqrt 37 & = \sqrt[2]{\frac{73^2-1}{12^2}} \\
	& \approx \frac{12}{73}(1-\frac{1}{2\cdot73^2})
	\end{align}
$$
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

23、分段函数

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

$$
\left.
\begin{array}{1}
\text{if $n$ is even} & n/2 \\
\text{if $n$ is odd} & 3n+1
\end{array}
\right\}
=f(n)
$$
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17

f(n)={n/2,3n+1,if n is evenif n is odd

if n is evenif n is oddn/23n+1}=f(n)

24、表格

$$
\begin{array}{c|llll}
n & \text{Left} & \text{Middle} & \text{Right} & \text{No} \\
\hline
1 & 0.24 & 1 & 125 & 1\\
2 & -1 & 189 & 8 & 2\\
3 & -20 & 2000 & 1+10i & 3
\end{array}
$$
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

n123Left0.24120Middle11892000Right12581+10iNo123

25、上下标号

$$\underbrace{a \cdots a}_\text{b times}$$
$$\overbrace{a \cdots a}_\text{b times}$$

$$\overline {AAA}$$
$$\underline {BBB}$$
  • 1
  • 2
  • 3
  • 4
  • 5

aab times

aab times

AAA¯¯¯¯¯¯¯¯

BBB

26、公式编号

$$ a := x^2-y^2 \tag{*} $$
  • 1

a:=x2y2(*)

27、方程组

$$
\left\{ 
\begin{array}{l}
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.
$$
或者
$$\begin{cases}
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{cases}
$$

对齐
$$
\left\{
\begin{array}{ll}
a_1x+b_1y+c_1z &=d_1+e_1 \\ 
a_2x+b_2y &=d_2 \\ 
a_3x+b_3y+c_3z &=d_3 
\end{array} 
\right.
$$
  • 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

a1x+b1y+c1z=d1a2x+b2y+c2z=d2a3x+b3y+c3z=d3

或者 
a1x+b1y+c1z=d1a2x+b2y+c2z=d2a3x+b3y+c3z=d3

对齐 

a1x+b1y+c1za2x+b2ya3x+b3y+c3z=d1+e1=d2=d3

28、等式上标

$$ a+y^3 \stackrel{{\Delta}}= x^2 $$
  • 1

a+y3=Δx2

29、流图、化学方程式

$\require{AMScd}$
\begin{CD}
...
\end{CD}
  • 1
  • 2
  • 3
  • 4
@>>> is used for arrow right

@<<< is used for arrow left

@VVV is used for arrow down

@AAA is used for arrow up

@= is used for horizontal double line

@| is used for vertical double line

@. is used for no arrow
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
$\require{AMScd}$
\begin{CD}
    A @>a>> B\\
    @V b V V= @VV c V\\
    C @>>d> D
\end{CD}

\begin{CD}
        A @>>> B @>{\text{very long label}}>> C \\
        @. @AbigAA @| \\
        D @= E @<<small< F
\end{CD}

$\require{AMScd}$
\begin{CD}
      RCOHR'SO_3Na @>{\text{Hydrolysis,$\Delta, Dil.HCl$}}>> (RCOR')+NaCl+SO_2+ H_2O 
\end{CD}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17

 

 

RCOHRSO3NaHydrolysis,Δ,Dil.HCl(RCOR)+NaCl+SO2+H2O

30、卡牌

$$\spadesuit, \heartsuit, \diamondsuit, \clubsuit,\color{red}{\heartsuit}$$
  • 1

,,,,

31、长除法

$$
\require{enclose}
\begin{array}{r}
                    13  \\[-3pt]
4 \enclose{longdiv}{52} \\[-3pt]
         \underline{4}\phantom{2} \\[-3pt]
                    12  \\[-3pt]
         \underline{12} \\
         0
\end{array}
$$
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

13452412120

附录:基本数学符号表(继续补充)

1、文本颜色

$$\color{black}{one}$$
$$\color{white}{one}$$
$$\color{gray}{one}$$
$$\color{silver}{one}$$
$$\color{maroon}{one}$$
$$\color{red}{one}$$
$$\color{yellow}{one}$$
$$\color{pink}{one}$$
$$\color{purple}{one}$$
$$\color{blue}{one}$$
$$\color{green}{one}$$
$$\color{orange}{one}$$
$$\color{teal}{one}$$
$$\color{olive}{one}$$
$$\color{navy}{one}$$
$$\color{fuchsia}{one}$$
$$\color{aqua}{one}$$
$$\color{lime}{one}$$
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18

one

one

one

one

one

one

one

one

one

one

one

one

one

one

one

one

one

one

2、希腊字母

$$\alpha$$
$$\beta$$
$$\omega$$
$$\gamma$$
$$\delta$$
$$\epsilon$$
$$\eta$$
$$\xi$$
$$\phi$$
$$\sigma$$
$$\pi$$
$$\mu$$
$$\lambda$$
$$\theta$$
$$\kappa$$
$$\rho$$
$$\nu$$
$$\upsilon$$
$$\tau$$
$$\varphi$$
$$\chi$$
$$\psi$$
$$\iota$$
$$\zeta$$
$$\varepsilon$$
$$\varpi$$

$$\Gamma$$
$$\Delta$$
$$\Omega$$
$$\Lambda$$
$$\Phi$$
$$\Psi$$
$$\Sigma$$
$$\Pi$$
$$\Upsilon$$
$$\Theta$$
  • 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

α

β

ω

γ

δ

ϵ

η

ξ

ϕ

σ

π

μ

λ

θ

κ

ρ

ν

υ

τ

φ

χ

ψ

ι

ζ

ε

ϖ

Γ

Δ

Ω

Λ

Φ

Ψ

Σ

Π

Υ

Θ

3、函数

$$\arccos\arcsin\arctan\arg\cos\cosh\cot\coth\csc\deg$$
$$\det\dim\exp\gcd\hom\inf\ker\lg\lim$$
$$\liminf\limsup\ln\log\max\min\Pr\sec\sin\sinh\sup\tan\tanh$$
  • 1
  • 2
  • 3

arccosarcsinarctanargcoscoshcotcothcscdeg

detdimexpgcdhominfkerlglim

lim inflim suplnlogmaxminPrsecsinsinhsuptantanh

4、分隔符号

$$\uparrow\\ \Uparrow\\ \downarrow \\\Downarrow \{ \}$$
$$\updownarrow \\\Updownarrow\\ \lfloor\\ \rfloor$$
$$\lceil\\ \rceil \\\langle \\\rangle / \,\backslash $$
$$|{x} | \ddots\|{x_1}\|$$

大分隔符
$$\arrowvert \Arrowvert$$ 
$$\bracevert$$
$$\lgroup \rgroup$$
$$\lmoustache \rmoustache$$
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

{}


/

|x|x1

大分隔符 




参考网站:

  1. MathJax
  2. 及时澍雨Timely的博客:LaTeX数学公式的符号表示

猜你喜欢

转载自blog.csdn.net/jshazhang/article/details/79399354