Markdown数学公式语法、常用符号与字体

如果以下没有你需要的数学公式,你还可以从这里寻找short-cn.pdf

常用语法

标志 符号 显示
上标 x^y x y x^y
下标 x_y x y x_y
四周标注 \sideset{^1_2}Y{^3_4}Y KaTeX parse error: Expected 'EOF', got '\sideset' at position 1: \̲s̲i̲d̲e̲s̲e̲t̲{^1_2}{^3_4}Y
分数 \frac{1}{x+1} 1 x + 1 \frac{1}{x+1}
分数 1\over{x+1} 1 x + 1 1\over{x+1}
开方 \sqrt[2]{3} 3 2 \sqrt[2]{3}
开方 \sqrt{3} 3 \sqrt{3}
省略号(下边) x_1, x_2, \ldots, x_n x 1 , x 2 , , x n x_1, x_2, \ldots, x_n
省略号(中间) x_1, x_2, \cdots, x_n x 1 , x 2 ,   , x n x_1, x_2, \cdots, x_n
矢量 \vec{a} a \vec{a}
积分 \int_0^1x{\rm d}x $\int_0^1x{\rm d}x $
极限 \lim_{n\rightarrow0}n lim n 0 n \lim_{n\rightarrow0}n
累加 \sum_1^n\frac{1}{x} 1 n 1 x \sum_1^n\frac{1}{x}
累乘 \prod_{i=0}^n\frac{1}{x^2} i = 0 n 1 x 2 \prod_{i=0}^n\frac{1}{x^2}

插入公式

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

行中公式可以用如下两种方法表示:

\(数学公式\) 或 $数学公式$

独立公式可以用如下两种方法表示:

\[数学公式\] 或 $$数学公式$$

例子:
$$J_\alpha(x) = \sum_{m=0}^\infty \frac{(-1)^m}{m! \Gamma (m + \alpha + 1)} {\left({ \frac{x}{2} }\right)}^{2m + \alpha}$$

显示效果:

J α ( x ) = m = 0 ( 1 ) m m ! Γ ( m + α + 1 ) ( x 2 ) 2 m + α J_\alpha(x) = \sum_{m=0}^\infty \frac{(-1)^m}{m! \Gamma (m + \alpha + 1)} {\left({ \frac{x}{2} }\right)}^{2m + \alpha}

标号与引用

使用\begin{eqnarray} \end{eqnarray}进行自动编号,若加上\tag{3}则优先使用其中的数字进行编号,如下所示:

$$\begin{eqnarray} 
  \sigma(z) \equiv \frac{1}{1+e^{-z}}.
\end{eqnarray}$$

显示结果:

KaTeX parse error: No such environment: eqnarray at position 7: \begin{̲e̲q̲n̲a̲r̲r̲a̲y̲}̲ \sigma(z) \…

自动编号的时候,引用公式使用$({1})$,如 ( 1 ) ({1}) ;也可以不加上括号${1}$,如 1 {1}

$$\begin{eqnarray} 
  \sigma(z) \equiv \frac{1}{1+e^{-z}}.
\tag{3}\end{eqnarray}$$

显示结果:

KaTeX parse error: No such environment: eqnarray at position 7: \begin{̲e̲q̲n̲a̲r̲r̲a̲y̲}̲ \sigma(z) \…

当使用\tag{}的时候,\begin{eqnarray} \end{eqnarray}可以省略。

使用\tag{}编号的时候,引用公式使用$({3})$,如 ( 3 ) ({3}) ;也可以不加上括号${3}$,如 3 {3}

公式换行

\\表示公式换行,例如

$$x = \cos(t) \\
y = \sin(t)$$

x = cos ( t ) y = sin ( t ) x = \cos(t) \\ y = \sin(t)

使用大括号

其次,\left\{ \right.表示左边大括号右边无括号,显示结果为 { \left\{ \right. ;\left\{ \right\}表示左边大括号右边大括号,显示结果为 { } \left\{ \right\} ;

最后,大括号通常有多行公式,一共有下面三种表示方式,下面的&符号表示的是空格

方法一:
$$ f(x)=\left\{
\begin{aligned}
x & = & \cos(t) \\
y & = & \sin(t) \\
z & = & \frac xy
\end{aligned}
\right.
$$
方法二:
$$ F^{HLLC}=\left\{
\begin{array}{rcl}
F_L       &      & {0      <      S_L}\\
F^*_L     &      & {S_L \leq 0 < S_M}\\
F^*_R     &      & {S_M \leq 0 < S_R}\\
F_R       &      & {S_R \leq 0}
\end{array} \right. $$
方法三:
$$f(x)=
\begin{cases}
0& \text{x=0}\\
1& \text{x!=0}
\end{cases}$$

方法一:
f ( x ) = { x = cos ( t ) y = sin ( t ) z = x y f(x)=\left\{ \begin{aligned} x &amp; = &amp; \cos(t) \\ y &amp; = &amp; \sin(t) \\ z &amp; = &amp; \frac xy \end{aligned} \right.

方法二:
F H L L C = { F L 0 &lt; S L F L S L 0 &lt; S M F R S M 0 &lt; S R F R S R 0 F^{HLLC}=\left\{ \begin{array}{rcl} F_L &amp; &amp; {0 &lt; S_L}\\ F^*_L &amp; &amp; {S_L \leq 0 &lt; S_M}\\ F^*_R &amp; &amp; {S_M \leq 0 &lt; S_R}\\ F_R &amp; &amp; {S_R \leq 0} \end{array} \right.

方法三:
f ( x ) = { 0 x=0 1 x!=0 f(x)= \begin{cases} 0&amp; \text{x=0}\\ 1&amp; \text{x!=0} \end{cases}

使用大分隔符

使用的是\right|,例如$\left. \frac{{\rm d}u}{{\rm d}x} \right| _{x=0}$,显示结果 d u d x x = 0 \left. \frac{{\rm d}u}{{\rm d}x} \right| _{x=0}

三角运算符

显示 符号
sin \sin \sin
cos \cos \cos
tan \tan \tan
\bot \bot
\angle \angle
cot \cot \cot
sec \sec \sec
csc \csc \csc
3 0 30^\circ 30^\circ

对数运算符

显示 符号
log \log \log
log 2 10 \log_2 10 \log_2 10
lg \lg \lg
lg 7 \lg7 \lg7
ln \ln \ln
ln 15 \ln15 \ln15

关系运算符

显示 符号
± \pm \pm
× \times \times
÷ \div \div
\mid \mid
\nmid \nmid
\cdot \cdot
\circ \circ
\ast \ast
\sum \sum
\prod \prod
\neq \neq
\leq \leq
\geq \geq
\approx \approx
\equiv \equiv
\coprod \coprod

希腊字符

显示 符号 显示 符号
α \alpha \alpha β \beta \beta
γ \gamma \gamma Γ \Gamma \Gamma
δ \delta \delta ϵ \epsilon \epsilon
ε \varepsilon \varepsilon ζ \zeta \zeta
η \eta \eta θ \theta \theta
Θ \Theta \Theta ϑ \vartheta \vartheta
ι \iota \iota κ \kappa \kappa
λ \lambda \lambda Λ \Lambda \Lambda
μ \mu \mu ξ \xi \xi
Ξ \Xi \Xi π \pi \pi
ϖ \varpi \varpi ρ \rho \rho
σ \sigma \sigma Σ \Sigma \Sigma
ς \varsigma $\varsigma$ τ \tau \tau
υ \upsilon $\upsilon$ Υ \Upsilon \Upsilon
ϕ \phi \phi Φ \Phi \Phi
φ \varphi \varphi χ \chi \chi
ψ \psi \psi Ψ \Psi \Psi
ω \omega \omega Ω \Omega \Omega

集合运算符

显示 符号
\emptyset \emptyset
\in \in
\notin \notin
\subset \subset
\supset \supset
\subseteq \subseteq
\supseteq \supseteq
\bigcap \bigcap
\bigcup \bigcup
\bigvee \bigvee
\bigwedge \bigwedge
\biguplus \biguplus
\bigsqcup \bigsqcup

微积分运算符

显示 符号
\prime \prime
\int \int
\iint \iint
\iiint \iiint
KaTeX parse error: Expected 'EOF', got '\iiiint' at position 1: \̲i̲i̲i̲i̲n̲t̲ \iiiint
\oint \oint
lim \lim \lim
\infty \infty
\nabla \nabla
\partial \partial

逻辑运算符

显示 符号
\because \because
\therefore \therefore
\forall \forall
\exists \exists
̸ = \not= \not=
̸ &gt; \not&gt; \not>
̸ \not\subset \not\subset

戴帽符号

显示 符号
y ^ \hat{y} \hat{y}
y ˇ \check{y} \check{y}
y ˘ \breve{y} \breve{y}

连线符号

显示 符号
a + b + c + d \overline{a+b+c+d} \overline{a+b+c+d}
a + b + c + d \underline{a+b+c+d} \underline{a+b+c+d}
a + b + c 1.0 + d 2.0 \overbrace{a+\underbrace{b+c}_{1.0}+d}^{2.0} \overbrace{a+\underbrace{b+c}_{1.0}+d}^{2.0}

箭头符号

显示 符号
\uparrow \uparrow
\downarrow \downarrow
\Uparrow \Uparrow
\Downarrow \Downarrow
\rightarrow \rightarrow
\leftarrow \leftarrow
\Rightarrow \Rightarrow
\Leftarrow \Leftarrow
\longrightarrow \longrightarrow
\longleftarrow \longleftarrow
\Longrightarrow \Longrightarrow
\Longleftarrow \Longleftarrow

其它符号

显示 符号
\cdot \cdot
\cdots \cdots
\circ \circ
\ast \ast
\bigodot \bigodot
\bigotimes \bigotimes
\bigoplus \bigoplus
\coprod \coprod

要输出字符 空格 # $ % & _ { } ,用命令:\空格 # $ % & _ { }

字体转换

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

标志 符号 显示
罗马体 \rm x x \rm x
意大利体 \it x x \it x
黑体 \bf x x \bf x
花体 \cal x KaTeX parse error: Expected 'EOF', got '\cal' at position 1: \̲c̲a̲l̲ ̲x
倾斜体 \sl x KaTeX parse error: Expected 'EOF', got '\sl' at position 1: \̲s̲l̲ ̲x
等线体 \sf x x \sf x
数字斜体 \mit x KaTeX parse error: Expected 'EOF', got '\mit' at position 1: \̲m̲i̲t̲ ̲x
打字机字体 \tt x x \tt x
小体大写字母 \sc x KaTeX parse error: Expected 'EOF', got '\sc' at position 1: \̲s̲c̲ ̲x

参考

CSDN-MarkDown编辑器使用手册(4)— 数学公式 - CSDN博客
Markdown中数学公式整理 - CSDN博客
Markdown- 常用数学公式

猜你喜欢

转载自blog.csdn.net/zdaiot/article/details/84710591