在markdown中使用LaTex数学公式

注:文档采用Typora编辑,在CSDN中显示有些问题,有些不支持。

一 内联公式和显式公式

1 内联数学公式

内联公式使用$公式内容$

  • 测试内联公式$1 + 1 = 2$

    ​ 测试内联公式 1 + 1 = 2 1 + 1 = 2 1+1=2

  • 测试内联公式$a^{2} + b^{2} = c^{2}$

    ​ 测试内联公式 a 2 + b 2 = c 2 a^{2} + b^{2} = c^{2} a2+b2=c2

2 显式数学公式

显示公式使用$ $ 公式内容 $ $

$$
a^{2} + b^{2} = c^{2}
$$

a 2 + b 2 = c 2 a^{2} + b^{2} = c^{2} a2+b2=c2

二 常用数学公式

1 和

  • 代码
$$ 
a + b = c
$$

a + b = c a + b = c a+b=c

2 平方

  • 代码
$$ 
a^{2} + b^{2} = c^{2} 
$$
  • 结果

a 2 + b 2 = c 2 a^{2} + b^{2} = c^{2} a2+b2=c2

3 极限

  • 代码
$$
lim_{n\_\infty} \sum_{k=1}^n \frac{1}{k^2} = \frac{\pi^2}
$$
  • 结果

lim ⁡ n → ∞ ∑ k = 1 n 1 k 2 = π 2 6 \lim_{n \to\infty} \sum_{k=1}^n \frac{1}{k^2} = \frac{\pi^2}{6} nlimk=1nk21=6π2

4 符号表示

  • 代码
$$
\forall x \in \mathbf{R}:
\qquad x^2 \geq \theta
$$
  • 结果

∀ x ∈ R : x 2 ≥ θ \forall x \in \mathbf{R}: \qquad x^2 \geq \theta xR:x2θ

$$
x ^2 \geq \theta \qquad
\textrm{for all } x \in \mathbf{R}
$$

x 2 ≥ θ for all  x ∈ R x ^2 \geq \theta \qquad \textrm{for all } x \in \mathbf{R} x2θfor all xR

$$
\forall x \in \mathbf{R}:
\qquad x^2 \geq \theta
$$
$$
x ^2 \geq \theta \qquad
\textrm{for all } x \in \mathbf{R}
$$

∀ x ∈ R : x 2 ≥ θ \forall x \in \mathbf{R}: \qquad x^2 \geq \theta xR:x2θ
x 2 ≥ θ for all  x ∈ R x ^2 \geq \theta \qquad \textrm{for all } x \in \mathbf{R} x2θfor all xR

参考typora数学符号

具体为LaTex,typora支持LaTex公式及符号。

5 不等式

  • 代码
$$
a^x + y \neq a^{x+y}
$$
  • 结果

a x + y ≠ a x + y a^x + y \neq a^{x+y} ax+y=ax+y

6 平方根

  • 代码
$$
\sqrt{x} \qquad
\sqrt{x^x + y} \\
\sqrt[3]{2} \\[3pt]\\
\surd[x^2 + y^2]
$$
  • 结果

x x x + y 2 3 √ [ x 2 + y 2 ] \sqrt{x} \qquad \sqrt{x^x + y} \\ \sqrt[3]{2} \\[3pt]\\ \surd[x^2 + y^2] x xx+y 32 [x2+y2]

7 水平线

  • 代码
$$
\overline{m+n} \\
\underbrace{a+b+\cdots +z}_{26}
$$
  • 结果

m + n ‾ a + b + ⋯ + z ⏟ 26 \overline{m+n} \\ \underbrace{a+b+\cdots +z}_{26} m+n26 a+b++z

8 函数

  • 代码
$$
y = x^2 \\
y'=2x \\
y''=2
$$
  • 结果

y = x 2 y ′ = 2 x y ′ ′ = 2 y = x^2 \\ y'=2x \\ y''=2 y=x2y=2xy=2

9 向量

  • 代码
$$
\vec a \\
\overrightarrow{AB}
$$
  • 结果

a ⃗ A B → \vec a \\ \overrightarrow{AB} a AB

10 点号

  • 代码
$$
v_1 = {\sigma}_1 \cdot {\sigma}_2 \\
v_2 = \tau_1\cdot\tau_2
$$
  • 结果

v 1 = σ 1 ⋅ σ 2 v 2 = τ 1 ⋅ τ 2 v_1 = {\sigma}_1 \cdot {\sigma}_2 \\ v_2 = \tau_1\cdot\tau_2 v1=σ1σ2v2=τ1τ2

11 形如分式 a b \frac{a}{b} ba

  • 代码
$$
\frac{a}{b} \\
\frac{1}{x^2+y^2+z^2} \\
x^{\frac{2}{k+1}}
$$
  • 结果

a b 1 x 2 + y 2 + z 2 x 2 k + 1 \frac{a}{b} \\ \frac{1}{x^2+y^2+z^2} \\ x^{\frac{2}{k+1}} bax2+y2+z21xk+12

12 二项系数,形如 c n k \mathrm{c}_n^k cnk

  • 代码
$$
\binom{n}{k} \\
\mathrm{c}_n^k \\
\int f_N(x) \stackrel{!}{=}1 \\
\sum_{i=1}^{n}x_i \\
\int_{0}^{\frac{\pi}{2}} \\
\prod_\epsilon \\
\sum_{\substack{0<i<n}\\1<j<m} P(i,j) 
	= \sum_{\substack{i\in I}\\{1<j<m}} Q(i,j)
$$
  • 结果

KaTeX parse error: Undefined control sequence: \substack at position 141: …silon \\ \sum_{\̲s̲u̲b̲s̲t̲a̲c̲k̲{0<i<n}\\1<j<m}…

13 数学空格调整

  • 代码
$$
\int\int_{D}g(x,y) \\
\int\!\!\!\int_{D}g(x,y)
$$
  • 结果

∫ ∫ D g ( x , y ) ∫  ⁣ ⁣ ⁣ ∫ D g ( x , y ) \int\int_{D}g(x,y) \\ \int\!\!\!\int_{D}g(x,y) Dg(x,y)Dg(x,y)

14 垂直对齐

(1) 矩阵

  • 代码
$$
\mathbf{X} =
  \left(\begin{array}{ccc}
  x_{11} & x_{12} & \ldots \\
  x_{21} & x_{22} & \ldots \\
  \vdots &\vdots & \ddots
  \end{array} \right)
$$
  • 结果

X = ( x 11 x 12 … x 21 x 22 … ⋮ ⋮ ⋱ ) \mathbf{X} = \left(\begin{array}{ccc} x_{11} & x_{12} & \ldots \\ x_{21} & x_{22} & \ldots \\ \vdots &\vdots & \ddots \end{array} \right) X=x11x21x12x22

  • 代码
$$
\mathbf{Y} = 
\left( 
\begin{array}{ccc}
x_{11} & x_{12} & x_{13} \\
x_{21} & x_{22} & x_{23} \\
x_{31} & x_{32} & x_{33}
\end{array}
\right)
$$
  • 结果

Y = ( x 11 x 12 x 13 x 21 x 22 x 23 x 31 x 32 x 33 ) \mathbf{Y} = \left( \begin{array}{ccc} x_{11} & x_{12} & x_{13} \\ x_{21} & x_{22} & x_{23} \\ x_{31} & x_{32} & x_{33} \end{array} \right) Y=x11x21x31x12x22x32x13x23x33

##(2) 形如$y = \left{ \begin{array}{ll}
a & \textrm{if d > c d>c d>c}\
b+x & \textrm{int the moring}\
l & \textrm{all day long}
\end{array} \right.$

  • 代码
$$
y = \left\{ \begin{array}{ll}
    a & \textrm{if $d>c$}\\
    b+x & \textrm{int the moring}\\
    l & \textrm{all day long}
    \end{array} \right.
$$
  • 结果

y = { a if  d > c b + x int the moring l all day long y = \left \{ \begin{array}{cc} a & \textrm{if $d > c$} \\ b+x & \textrm{int the moring} \\ l & \textrm{all day long} \end{array} \right. y=ab+xlif d>cint the moringall day long

(3)形如KaTeX parse error: No such environment: eqnarray at position 7: \begin{̲e̲q̲n̲a̲r̲r̲a̲y̲}̲ f(x) & = & \co…

通过eqnarray对齐公式.

  • 代码
$$
\begin{eqnarray}
f(x) & = & \cos x \\
f’(x) & = & -\sin x \\
\int_{0}^{x} f(y)dy &
= & \sin x
\end{eqnarray}
$$
  • 结果

KaTeX parse error: No such environment: eqnarray at position 8: \begin{̲e̲q̲n̲a̲r̲r̲a̲y̲}̲ f(x) & = & \co…

(3)长公式,换行对齐

  • 代码
$$
\begin{eqnarray}
\lefteqn{\cos x = 1-\frac{x^{2}}{2!} +{} }
\nonumber\\
& & {}+\frac{x^{4}}{4!}-\frac{x^{6}}{6!}+{}\cdots
\end{eqnarray}
$$
  • 结果

KaTeX parse error: No such environment: eqnarray at position 8: \begin{̲e̲q̲n̲a̲r̲r̲a̲y̲}̲ \lefteqn{\cos …

注:使用 \lefteqn没有成功。

15 公式编号

利用 \tag{}为公式添加编号

  • 公式
$$
y = x^2 + b \tag{1}
$$

  • 结果

y = x 2 + b (1) y = x^2 + b \tag{1} y=x2+b(1)

16 调整缩进

利用 \quad调整缩进

  • 代码
$$
\begin{align*}
P(i,j,k)[i\mu_p+\lambda_s+\lambda_p+j\mu_s] = \\
(j+1)\mu_sP(i,j+1,k)+ \\
(i+1)\mu_pP(i+1,j,k)+ \\
\lambda_s[1-\delta(j)P(j,j-1,k)]
\end{align*}
$$
$$
\begin{align*}
P(i,j,k)[i\mu_p+\lambda_s+\lambda_p+j\mu_s] = \\
(j+1)\mu_sP(i,j+1,k)+ \\
(i+1)\mu_pP(i+1,j,k)+ \\
\lambda_s[1-\delta(j)P(j,j-1,k)]
\end{align*} \quad\quad\quad\quad\quad\quad
$$
  • 结果

KaTeX parse error: No such environment: align* at position 8: \begin{̲a̲l̲i̲g̲n̲*̲}̲ P(i,j,k)[i\mu_…

KaTeX parse error: No such environment: align* at position 8: \begin{̲a̲l̲i̲g̲n̲*̲}̲ P(i,j,k)[i\mu_…

17 粗体符号

  • 代码
$$
\mu,M \qquad \mathbf{M} \qquad \mbox{\boldmath $\mu,M$}
$$
$$
\mu,M \qquad \boldsymbel{\mu},\boldsymbol{M}
$$

18 多行公式的换行和对齐

  • 代码
$$
\begin{align*}
y = y(x,t) &= Ae^{i\theta}\\
&= A(\cos\theta+i\sin\theta) \\
&= A\cos(\frac{2\pi}{\lambda}x-\frac{2\pi v}{\lambda}t)+iA\sin(\frac{2\pi}{\lambda}-\frac{2\pi v}{\lambda}t) \\
&= A\cos\frac{2\pi}{\lambda}(x-vt)+iA\sin\frac{2\pi}{\lambda}(x-vt)
\end{align*}
$$
  • 结果

KaTeX parse error: No such environment: align* at position 8: \begin{̲a̲l̲i̲g̲n̲*̲}̲ y = y(x,t) &= …

  • 结果

KaTeX parse error: Undefined control sequence: \mbox at position 33: …thbf{M} \qquad \̲m̲b̲o̲x̲{\boldmath $\mu…

KaTeX parse error: Undefined control sequence: \boldsymbel at position 15: \mu,M \qquad \̲b̲o̲l̲d̲s̲y̲m̲b̲e̲l̲{\mu},\boldsymb…

注:\boldmath没有起作用;\boldsymbel作用于单独的字母起作用,而作用于 μ \mu μ不起作用

三 练习

  • 题目

在这里插入图片描述

  • 代码
### 二、导数的定义

1. 函数在一点处的导数与导函数

从上面所讨论的两个问题看出,非匀速直线运动的速度和切线的斜率都归结为如下的极限:
$$
\lim_{x\to x_\epsilon}\frac{f(x)-f(x_0)}{x-x_0},  \tag{3}
$$

这里$x-x_0$he $f(x)-f(x_0)$分别式函数$y=f(x)$的自变量的增量$\Delta x$和函数的增量$\Delta y$:
$$
\Delta x = x - x_0,
$$

$$
\Delta y = f(x)-f(x_0)=f(x_0+\Delta x)-f(x_0).
$$

因此$x\to x_0$相当于$\Delta x \to 0$,故(3)式也可写成
$$
\lim_{\Delta x \to 0}\frac{\Delta y}{\Delta x} \quad或\quad 
\lim_{\Delta x \to 0}\frac{f(x_0 + \Delta x)-f(x_0)}{\Delta x}
$$
  • 结果

二、导数的定义

  1. 函数在一点处的导数与导函数

从上面所讨论的两个问题看出,非匀速直线运动的速度和切线的斜率都归结为如下的极限:
lim ⁡ x → x ϵ f ( x ) − f ( x 0 ) x − x 0 , (3) \lim_{x\to x_\epsilon}\frac{f(x)-f(x_0)}{x-x_0}, \tag{3} xxϵlimxx0f(x)f(x0),(3)

这里 x − x 0 x-x_0 xx0he f ( x ) − f ( x 0 ) f(x)-f(x_0) f(x)f(x0)分别式函数 y = f ( x ) y=f(x) y=f(x)的自变量的增量 Δ x \Delta x Δx和函数的增量 Δ y \Delta y Δy:
Δ x = x − x 0 , \Delta x = x - x_0, Δx=xx0,

Δ y = f ( x ) − f ( x 0 ) = f ( x 0 + Δ x ) − f ( x 0 ) . \Delta y = f(x)-f(x_0)=f(x_0+\Delta x)-f(x_0). Δy=f(x)f(x0)=f(x0+Δx)f(x0).

因此 x → x 0 x\to x_0 xx0相当于 Δ x → 0 \Delta x \to 0 Δx0,故(3)式也可写成
lim ⁡ Δ x → 0 Δ y Δ x 或 lim ⁡ Δ x → 0 f ( x 0 + Δ x ) − f ( x 0 ) Δ x \lim_{\Delta x \to 0}\frac{\Delta y}{\Delta x} \quad或\quad \lim_{\Delta x \to 0}\frac{f(x_0 + \Delta x)-f(x_0)}{\Delta x} Δx0limΔxΔyΔx0limΔxf(x0+Δx)f(x0)

四 参考资料

1、Latex之数学公式基本使用格式

2、typora-数学符号

  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值