【Tools】CSDN中插入数学公式

对于更具体的所有用法,例如希腊字母等等各种符号,可以参考Cmd Markdown 公式指导手册

  • 1.公式或者符号使用$包起来,前后各一个$包起来就是公式。

  • 2.如果想要公式居中,就前后各用两个$包起来。

  • 3.如果想要给公式后面添加编号,那么在公式后添加空格 + \tag{1}就可以了:
    $$z = x^2 + y^2 \tag{1}$$ 显示效果:
    z = x 2 + y 2 (1) z = x^2 + y^2 \tag{1} z=x2+y2(1)

  • 4.给公式添加颜色,可以在要变色部分的前面加上\color{blue}或者\displaystyle\color{blue},例如$\color{blue}a$显示效果 a \color{blue}a a

为了更突出效果,下面的显示效果我都使用了添加蓝色。

  • 5.上标用^,下标用下划线_
    如果上标或者下标不止一个符号,请用{}括起来。
    例如:
    $x^{k+1}$ 显示效果 x k + 1 \displaystyle\color{blue}x^{k+1} xk+1

  • 6.键盘不能直接输入的符号,用\+英文单词
    例如:

  • $\theta$ 显示效果 θ \displaystyle\color{blue}\theta θ

  • $\theta_i$ 显示效果 θ i \displaystyle\color{blue}\theta_i θi

  • 分数的写法有两种:
    $2\over 3$显示效果 2 3 \displaystyle\color{blue}{2\over3} 32
    $\frac{a}{b}$ 显示效果 a b \displaystyle\color{blue}\frac{a}{b} ba

  • $\vec x$显示效果 x ⃗ \displaystyle\color{blue} \vec x x

  • $\begin{matrix} 1&2&3\\ 4&5&6\end{matrix}$显示效果 1 2 3 4 5 6 \displaystyle\color{blue} \begin{matrix} 1&2&3\\ 4&5&6\end{matrix} 142536

  • $\begin{bmatrix} 1&2&3\\ 4&5&6\end{bmatrix}$ 显示效果 [ 1 2 3 4 5 6 ] \begin{bmatrix} 1&2&3\\ 4&5&6\end{bmatrix} [142536]

  • $\begin{pmatrix} 1&2&3\\ 4&5&6\end{pmatrix}$显示效果 ( 1 2 3 4 5 6 ) \begin{pmatrix} 1&2&3\\ 4&5&6\end{pmatrix} (142536)

  • 7.字母头上戴帽子^
    $\hat{X}$显示效果 X ^ \displaystyle\color{blue}\hat{X} X^
    $\hat{XYZ}$显示效果 X Y Z ^ \displaystyle\color{blue}\hat{XYZ} XYZ^
    $\widehat{XYZ}$显示效果 X Y Z ^ \displaystyle\color{blue}\widehat{XYZ} XYZ
    在这里插入图片描述

  • 8.公式换行 \\
    $a\\b$显示效果 :
    a b \displaystyle\color{blue}a\\b ab

  • 9.空格与空行
    \quad是一个空格,显示效果如下: a b \color{blue}a \quad b ab
    \qquad是2个空格,显示效果如下: a b \color{blue}a \qquad b ab
    \\\quad\\是空一行,不仅是换行,由于前面的换行符\\在某些情况下,并不能在公式中空出一行,所以在写矩阵时候,显得行与行之间显得特别紧凑,所以需要空出一行,我自己试出来\\\quad\\可以充当空一行的效果,显示效果如下:
    a b \color{blue}a\\\quad\\ b ab

  • 10.方程组大括号{ 的写法
    必须要在居中的公式中使用,并且每行公式后,必须要加上换行符\\

$$ 
\begin{cases}
y=x+5 \\ \\
y=x^2-4 \\
\end{cases}
$$

显示效果如下:
{ y = x + 5 y = x 2 − 4 \color{blue} \begin{cases} y=x+5 \\ \\ y=x^2-4 \end{cases} y=x+5y=x24

  • 11.公式中等号对齐,使用\begin{aligned}...\end{aligned}&符号
    例如:
$$\color{
    
    red}
\begin{
    
    aligned}
f(x) &=x^2+y^2  \\
     &= (x+y)^2  \\
\end{
    
    aligned}
$$

显示效果如下:
f ( x ) = x 2 + y 2 = ( x + y ) 2 \color{red} \begin{aligned} f(x) &=x^2+y^2 \\ &= (x+y)^2\\ \end{aligned} f(x)=x2+y2=(x+y)2

  • 12.累加 ∑ \color{red}\sum 和累乘 ∏ \color{red}\prod 符号
$$ 
\sum_{i=1}^n i^2    \\\quad \\
\prod_{i=1}^n i^2   \\
$$

∑ i = 1 n i 2 ∏ i = 1 n i 2 \color{red} \sum_{i=1}^n i^2 \\\quad \\ \prod_{i=1}^n i^2 \\ i=1ni2i=1ni2

猜你喜欢

转载自blog.csdn.net/u011754972/article/details/121669264