Markdown编辑器

前言

  Markdown是网页版的文本编辑器,Markdown 允许您使用易于阅读、易于编写的纯文本格式进行编写,然后将其转换为结构有效的 XHTML(或 HTML)。本文主要讲Markdown文本编辑器的使用,为了更方便写CSDN博客


一、Markdown语法

  Markdown大部分常用基础语法,可以在CSDN的Markdown编辑器的右侧语法说明里面找到,如果自己手打出现问题,可以点击复制来进行比较
在这里插入图片描述

具体可以参考以下链接:
https://www.appinn.com/markdown/

二、基本使用补充

2.1 首行缩进

  在常规文本里面缩进我们会采用空格或者Tab键,但是这在Markdown里都可能不能正常显示,可以使用以下符号进行缩进

  

2.2 醒目文字

  对于突出文字,在语法说明里面可以进行加粗等操作,但是颜色都是黑色,可以采取以下两种方法换色:

  • 方法一:用CSS进行换色
<font color=#900>文字</font>
  • 方法二:加入英文符号`
`文字`

2.3 表格处理

  1. 表格内换行使用<br>
项目 | Value
-- | --
电脑  | 一行<br>二行
项目Value
电脑一行
二行
  1. 使用colspan合并行
<table>
    <tr>
        <td>行/列</td> 
        <td>列2</td> 
        <td>列3</td> 
   </tr>
    <tr>
  		 <td>行2列1</td> 
      	 <td colspan="2">跨两列合并行</td>    
    </tr>
</table>
行/列列2列3
行2列1跨两列合并行
  1. 使用rowspan合并列
<table>
    <tr>
        <td>行1列1</td> 
        <td>行1列2</td> 
   </tr>
    <tr>
        <td rowspan="2">合并两列</td>    
  		 <td>行2列2</td> 
    </tr>
    <tr>
        <td>行3列2</td> 
    </tr>
</table>
行1列1行1列2
合并两列行2列2
行3列2

3.4 文本居中显示

  1. 文本居中
<center>文本居中</center>
文本居中
  1. 标题居中
#  <center>示例数据集</center>

三、特殊字符

  在某时候我们写入一些特殊符号,但是却不能正常显示,比如:在表格里添加|会自动添加列,却不能正常显示该字符。此时我们可以利用Markdown的HTML特性,将这些特殊字符显示出来。HTML 实体是一段以’&#‘开头、加上ASCII码居中、以分号‘;’结尾的文本,如下:

3.1 常用类

字符实体名称实体数字描述
&ensp;半个空白位
&emsp;一个空白位
 &nbsp;&#160;空格
&&amp;&#38;
| &#124;竖线
·&middot;&#183;圆点
¦&brvbar;&#166;断的竖线
&ndash;&#150;短破折号
&mdash;&#151;长破折号
©&copy;&#169;版权标志
®&reg;&#187;注册标志
&trade;&#153;商标标志

3.2 数学类

字符实体名称实体数字描述
<&lt;&#60;小于号
>&gt;&#62;大于号
&le;&#8804;小于等于号
&ge;&#8805;大于等于号
×&times;&#215;乘号
÷&divide;&#247;除号
&minus;&#8722;减号
±&plusmn;&#177;加/减号
&ne;&#8800;不等于号
¹&sup1;&#185;上标1
²&sup2;&#178;上标2
³&sup3;&#179;上标3
½&frac12;&#189;二分之一
¼&frac14;&#188;四分之一
¾&frac34;&#190;四分之三
&permil;&#8240;千分率
°&deg;&#176;
&radic;&#8730;平方根
&infin;&#8734;无限大

3.3 特殊类

字符实体名称实体数字描述
&uarr;&#8593;上箭头
¤&curren;&#164;一般货币符号
$ &#36;美元符号
¢&cent;&#162;
£&pound;&#163;英镑
¥&yen;&#165;人民币元
&euro;&#8364;欧元
«&laquo;&#171;左三角双引号
»&raquo;&#187;右三角双引号
§&sect;&#167;章节标志
&hearts;&#9829;心型
¿&iquest;&#191;反向问号
&larr;&#8592;左箭头
&uarr;&#8593;上箭头
&rarr;&#8594;右箭头
&darr;&#8595;下箭头
&harr;&#8596;左右箭头
α&alpha;η&eta;μ&mu;π&pi;θ&theta;
β&beta;γ&gamma;ψ&psi;υ&upsilon;ς&sigmaf;
ι&iota;ω&omega;ρ&rho;ξ&xi;Δ&Delta;
δ&delta;σ&sigma;ζ&zeta;Γ&Gamma;Λ&Lambda;
&frasl;&sum;&part;&int;&cap;
Π&Pi;Θ&Theta;Ω&Omega;Ξ&Xi;Φ&Phi;
ε&epsilon;λ&lambda;φ&phi;τ&tau;

3.4 其他符号输出方法

  1. 用微软拼音输入单位名称也可以打印符号,如下:
    在这里插入图片描述
  2. 使用强调符号,可以这样*输出*
  3. 使用\转义符号,如\*输出*

四、LaTeX数学公式

4.1 公式的基本使用

4.1.1 插入公式

  行中公式即公式可以与文字在同一行,用单个$开始结尾,注意不要留空格,如:

文字$数学公式$

  公式显示独立占一行,用$$开始结尾

文字$$数学公式$$

4.1.2 输入上下标

  ^表示上标, _ 表示下标。如果上下标的内容多于一个字符,需要用{}将这些内容括成一个整体。

$$ x^{y^z}=(1+{\rm e}^x)^{_2xy^w} $$

x y z = ( 1 + e x ) − 2 x y w x^{y^z}=(1+{\rm e}^x)_{-2xy^w} xyz=(1+ex)2xyw

4.1.3 括号与分隔符

  ()[]|表示符号本身,使用\{\}来表示{}

$$ f(x,y,z) = \{x,y\}+[3y^2z] $$

f ( x , y , z ) = { x , y } + [ 3 y 2 z ] f(x,y,z) = \{x,y\}+[3y^2z] f(x,y,z)={x,y}+[3y2z]

  当要显示大号的括号或分隔符时,要用\left\right命令

$$ \left(3+\frac{7x+5}{1+y^2} \right) = \left. \frac{{\rm d}u}{{\rm d}x} \right| _{x=0} $$

( 3 + 7 x + 5 1 + y 2 ) = d u d x ∣ x = 0 \left( 3+\frac{7x+5}{1+y^2} \right) =\left. \frac{{\rm d}u}{{\rm d}x} \right| _{x=0} (3+1+y27x+5)=dxdu x=0

4.1.4 省略号与空格

  \ldots表示与文本底线对齐的省略号,\cdots表示与文本中线对齐的省略号

$$f(x_1,x_2,\underbrace{\ldots}_{\rm ldots} ,x_n) = x_1^2 + x_2^2 + \underbrace{\cdots}_{\rm cdots} + x_n^2$$

f ( x 1 , x 2 , … ⏟ l d o t s , x n ) = x 1 2 + x 2 2 + ⋯ ⏟ c d o t s + x n 2 f(x_1,x_2,\underbrace{\ldots}_{\rm ldots} ,x_n) = x_1^2 + x_2^2 + \underbrace{\cdots}_{\rm cdots} + x_n^2 f(x1,x2,ldots ,xn)=x12+x22+cdots +xn2
  使用\ddots输入省略号,\vdots来输入省略符号

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

( 1 a 1 a 1 2 ⋯ a 1 n 1 a 2 a 2 2 ⋯ a 2 n ⋮ ⋮ ⋮ ⋱ ⋮ 1 a m a m 2 ⋯ a m n ) \begin{pmatrix} 1 & a_1 & a_1^2 & \cdots & a_1^n \\ 1 & a_2 & a_2^2 & \cdots & a_2^n \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ 1 & a_m & a_m^2 & \cdots & a_m^n \\ \end{pmatrix} 111a1a2ama12a22am2a1na2namn
  有四种宽度的空格可以使用:\,\;\quad\qquad

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

a   b , a    b , a b , a b a \, b,a \; b,a \quad b,a \qquad b ab,ab,ab,ab

4.1.5 添加行标

  在每个公式末尾前使用\tag{行标}来实现行标。

$$f( {1+\{x,y\} } )\tag{1}$$

f ( 1 + { x , y } ) (1) f( {1+\{x,y\} } )\tag{1} f(1+{x,y})(1)

  也可以使用equation环境自动编号

$$\begin{equation}数学公式\end{equation}$$

数学公式 \begin{equation}数学公式\end{equation} 数学公式

4.1.6 注释与文字

  使用\text {文字}可以添加文字,在括号中仍可以使用$公式$插入其它公式。使用%可以添加注释

$$ 
%注释
f(n)= n/2,  \text {if $n$ is even}
$$

f ( n ) = n / 2 , if  n  is even f(n)= n/2, \text {if $n$ is even} %注释 f(n)=n/2,if n is even

4.2 LaTeX字符

4.2.1 希腊字母

输入显示输入显示输入显示输入显示
\alpha α \alpha α\Alpha A \Alpha A\beta β \beta β\Beta B \Beta B
\gamma γ \gamma γ\Gamma Γ \Gamma Γ\delta δ \delta δ\Delta Δ \Delta Δ
\epsilon ϵ \epsilon ϵ\Epsilon E \Epsilon E\zeta ζ \zeta ζ\Zeta Z \Zeta Z
\eta η \eta η\Eta H \Eta H\theta θ \theta θ\Theta Θ \Theta Θ
\iota ι \iota ι\Iota I \Iota I\kappa κ \kappa κ\Kappa K \Kappa K
\lambda λ \lambda λ\Lambda Λ \Lambda Λ\mu μ \mu μ\Mu M \Mu M
\nu ν \nu ν\Nu N \Nu N\xi ξ \xi ξ\Xi Ξ \Xi Ξ
\omicron ο \omicron ο\Omicron O \Omicron O\pi π \pi π\Pi Π \Pi Π
\rho ρ \rho ρ\Rho P \Rho P\sigma σ \sigma σ\Sigma Σ \Sigma Σ
\tau τ \tau τ\Tau T \Tau T\upsilon υ \upsilon υ\Upsilon Υ \Upsilon Υ
\phi ϕ \phi ϕ\Phi Φ \Phi Φ\chi χ \chi χ\Chi X \Chi X
\psi ψ \psi ψ\Psiψ Ψ \Psi Ψ\omega ω \omega ω\Omega Ω \Omega Ω
\varphi φ \varphi φ\varepsilon ε \varepsilon ε\partial ∂ \partial

4.2.2 类型符号

类别输入显示输入显示输入显示
根号\sqrt[n]{n} n n \sqrt[n]{n} nn \sqrt{n} n \sqrt{n} n \thicksim ∼ \thicksim
对数\log log ⁡ \log log\lg lg ⁡ \lg lg\ln ln ⁡ \ln ln
角度30^\circ 3 0 ∘ 30^\circ 30\bot ⊥ \bot \angle A ∠ A \angle A A
三角\sin sin ⁡ \sin sin\csc csc ⁡ \csc csc\arctan arctan ⁡ \arctan arctan

4.2.3 运算符

  1. 极限
      极限使用\lim_{下标}来实现,使用\infty来表示 ∞ \infty ,公式需要配合$$
$$\lim_{n \to +\infty} \frac{1}{n}$$

lim ⁡ n → + ∞ 1 n \lim_{n \to +\infty} \frac{1}{n} n+limn1

  1. 微积分运算符
      使用\int_积分下限^积分上限 {被积表达式}来输入一个积分。\,{\rm d}部分可省略
$$\int_0^1 {x^2} \,{\rm d}x$$

∫ 0 1 x 2   d x \int_0^1 {x^2} \,{\rm d}x 01x2dx

输入显示输入显示输入显示
\int ∫ \int \iint ∬ \iint \iiint ∭ \iiint
\oint ∮ \oint \prime ′ \prime \nabla ∇ \nabla
  1. 关系运算符
      使用\sum_{下标表达式}^{上标表达式} {累加表达式}来输入一个累加。与之类似,使用\prod``\bigcup``\bigcap来分别输入累乘、并集和交集。
$$\sum_{i=1}^n \frac{1}{i^2} \quad$$

∑ i = 1 n 1 i 2 \sum_{i=1}^n \frac{1}{i^2} \quad i=1ni21

输入显示输入显示输入显示输入显示
\pm ± \pm ±\times × \times ×\div ÷ \div ÷\ast ∗ \ast
\cdot ⋅ \cdot \circ ∘ \circ \leq ≤ \leq \geq ≥ \geq
\neq ≠ \neq =\approx ≈ \approx \equiv ≡ \equiv \backslash \ \backslash \
\sum ∑ \sum \prod ∏ \prod \coprod ∐ \coprod \emptyset ∅ \emptyset
\in ∈ \in \notin ∉ \notin /\supset ⊂ \subset \subseteq ⊆ \subseteq
\supseteq ⊇ \supseteq \bigcap ⋂ \bigcap \bigcup ⋃ \bigcup \bigvee ⋁ \bigvee
\bigwedge ⋀ \bigwedge \forall ∀ \forall \exists ∃ \exists \not\subset ⊄ \not\subset
\not< ≮ \not< <\not> ≯ \not> >\not= ≠ \not= =\leqslant ⩽ \leqslant
  1. 逻辑运算符
输入显示输入显示输入显示输入显示
\mid ∣ \mid \nmid ∤ \nmid \bigodot ⨀ \bigodot \bigotimes ⨂ \bigotimes
\bigoplus ⨁ \bigoplus \because ∵ \because \therefore ∴ \therefore

4.2.4 其他符号

  1. 戴帽符号
输入显示输入显示输入显示输入显示
\hat{xy} x y ^ \hat{xy} xy^\widehat{xyz} x y z ^ \widehat{xyz} xyz \tilde{xy} x y ~ \tilde{xy} xy~\widetilde{xyz} x y z ~ \widetilde{xyz} xyz
\check{x} x ˇ \check{x} xˇ\breve{y} y ˘ \breve{y} y˘\grave{x} x ˋ \grave{x} xˋ\acute{y} y ˊ \acute{y} yˊ
  1. 箭头符号
输入显示输入显示输入显示输入显示
\to → \to \iff    ⟺    \iff \implies    ⟹    \implies \impliedby    ⟸    \impliedby
\uparrow ↑ \uparrow \downarrow ↓ \downarrow \leftarrow ← \leftarrow \rightarrow → \rightarrow
\leftrightarrow ↔ \leftrightarrow \longleftarrow ⟵ \longleftarrow \longrightarrow ⟶ \longrightarrow \longleftrightarrow ⟷ \longleftrightarrow
\Uparrow ⇑ \Uparrow \Downarrow ⇓ \Downarrow \Leftarrow ⇐ \Leftarrow \Rightarrow ⇒ \Rightarrow
\Leftrightarrow ⇔ \Leftrightarrow \Longleftarrow ⟸ \Longleftarrow \Longrightarrow ⟹ \Longrightarrow \Longleftrightarrow ⟺ \Longleftrightarrow
  1. 连线符号
输入显示
\fbox{a+b+c+d} a+b+c+d \fbox{a+b+c+d} a+b+c+d
\overleftarrow{a+b+c+d} a + b + c + d ← \overleftarrow{a+b+c+d} a+b+c+d
\overrightarrow{a+b+c+d} a + b + c + d → \overrightarrow{a+b+c+d} a+b+c+d
\overleftrightarrow{a+b+c+d} a + b + c + d ↔ \overleftrightarrow{a+b+c+d} a+b+c+d
\underleftarrow{a+b+c+d} a + b + c + d ← \underleftarrow{a+b+c+d} a+b+c+d
\underrightarrow{a+b+c+d} a + b + c + d → \underrightarrow{a+b+c+d} a+b+c+d
\underleftrightarrow{a+b+c+d} a + b + c + d ↔ \underleftrightarrow{a+b+c+d} a+b+c+d
\overline{a+b+c+d} a + b + c + d ‾ \overline{a+b+c+d} a+b+c+d
\underline{a+b+c+d} a + b + c + d ‾ \underline{a+b+c+d} a+b+c+d
\overbrace{a+b+c+d}^{Sample} a + b + c + d ⏞ S a m p l e \overbrace{a+b+c+d}^{Sample} a+b+c+d Sample
\underbrace{a+b+c+d}_{Sample} a + b + c + d ⏟ S a m p l e \underbrace{a+b+c+d}_{Sample} Sample a+b+c+d
\overbrace{a+\underbrace{b+c}_{1.0}+d}^{2.0} a + b + c ⏟ 1.0 + d ⏞ 2.0 \overbrace{a+\underbrace{b+c}_{1.0}+d}^{2.0} a+1.0 b+c+d 2.0
\underbrace{a\cdot a\cdots a}_{b\text{ times}} a ⋅ a ⋯ a ⏟ b  times \underbrace{a\cdot a\cdots a}_{b\text{ times}} b times aaa
\underrightarrow{1℃/min} 1 ℃ / m i n → \underrightarrow{1℃/min} 1℃/min

4.3 公式的表现形式

4.3.1 函数形式

  使用begin{cases}来创造一组条件表达式,在每一行条件中插入&来指定需要对齐的内容,并在每一行结尾处使用\\,以end{cases}结束。

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

f ( n ) = { n / 2 , if n is even 3 n + 1 , if n is odd f(n) = \begin{cases} n/2, & \text{if n is even} \\ 3n+1, & \text{if n is odd} \end{cases} f(n)={n/2,3n+1,if n is evenif n is odd
  使用\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

4.3.2 矩阵形式

  1. 无框矩阵
      在开头使用begin{matrix},在结尾使用end{matrix},在中间插入矩阵元素,每个元素之间插入&使相应元素对齐,并在每行结尾处使用\\进行换行。
$$
        \begin{matrix}
        1 & x  \\
        1 & y  \\
        \end{matrix}
$$

1 x 1 y \begin{matrix} 1 & x \\ 1 & y \\ \end{matrix} 11xy

  1. 边框矩阵
      在开头将matrix替换为pmatrixbmatrixBmatrixvmatrixVmatrix
$\begin{matrix} 1 & 2 \\ 3 & 4 \\ \end{matrix}$
$\begin{pmatrix} 1 & 2 \\ 3 & 4 \\ \end{pmatrix}$
$\begin{bmatrix} 1 & 2 \\ 3 & 4 \\ \end{bmatrix}$
$\begin{Bmatrix} 1 & 2 \\ 3 & 4 \\ \end{Bmatrix}$
$\begin{vmatrix} 1 & 2 \\ 3 & 4 \\ \end{vmatrix}$
$\begin{Vmatrix} 1 & 2 \\ 3 & 4 \\ \end{Vmatrix}$
pmatrixbmatrixBmatrixvmatrixVmatrix
( 1 2 3 4 ) \begin{pmatrix} 1 & 2 \\ 3 & 4 \\ \end{pmatrix} (1324) [ 1 2 3 4 ] \begin{bmatrix} 1 & 2 \\ 3 & 4 \\ \end{bmatrix} [1324] { 1 2 3 4 } \begin{Bmatrix} 1 & 2 \\ 3 & 4 \\ \end{Bmatrix} {1324} ∣ 1 2 3 4 ∣ \begin{vmatrix} 1 & 2 \\ 3 & 4 \\ \end{vmatrix} 1324 ∥ 1 2 3 4 ∥ \begin{Vmatrix} 1 & 2 \\ 3 & 4 \\ \end{Vmatrix} 1324
  1. 带分割符号的矩阵
      使用{c|cccc}添加1:4竖分隔符,使用\hline添加行分隔符
$$
\begin{array}{c|cccc}
	\text{min} & 0 & 1 & 2 & 3\\
	\hline
	0 & 0 & 0 & 0 & 0\\
	1 & 0 & 1 & 1 & 1\\
	2 & 0 & 1 & 2 & 2\\
	3 & 0 & 1 & 2 & 3
\end{array}
$$

min 0 1 2 3 0 0 0 0 0 1 0 1 1 1 2 0 1 2 2 3 0 1 2 3 \begin{array}{c|cccc} \text{min} & 0 & 1 & 2 & 3\\ \hline 0 & 0 & 0 & 0 & 0\\ 1 & 0 & 1 & 1 & 1\\ 2 & 0 & 1 & 2 & 2\\ 3 & 0 & 1 & 2 & 3 \end{array} min012300000101112012230123

4.3.3 分数形式

  通常使用\frac {分子} {分母}命令产生一个分数,分数可嵌套。如果分式很复杂,亦可使用分子 \over 分母命令,此时分数仅有一层。

$$\frac{a-1}{b-1} \quad and \quad {a+1\over b+1}$$

a − 1 b − 1 a n d a + 1 b + 1 \frac{a-1}{b-1} \quad and \quad {a+1\over b+1} b1a1andb+1a+1

  使用\cfrac来创建一个连分数。

$$
x = a_0 + \cfrac{1^2}{a_1
          + \cfrac{2^2}{a_2
          + \cdots}}
$$

x = a 0 + 1 2 a 1 + 2 2 a 2 + ⋯ x = a_0 + \cfrac{1^2}{a_1 + \cfrac{2^2}{a_2 + \cdots}} x=a0+a1+a2+2212

4.3.4 向量

  使用\vec{矢量}来自动产生一个矢量。

$$\vec{ab} \cdot \vec{b}=0$$

a b ⃗ ⋅ b ⃗ = 0 \vec{ab} \cdot \vec{b}=0 ab b =0
  也可以使用\overrightarrow等命令自定义字母上方的符号。

$$\overleftarrow{xy} \quad and \quad \overleftrightarrow{xy} \quad and \quad \overrightarrow{xy}$$

x y ← a n d x y ↔ a n d x y → \overleftarrow{xy} \quad and \quad \overleftrightarrow{xy} \quad and \quad \overrightarrow{xy} xy andxy andxy

补充

  1. 更详细的语法说明见LaTeX官网
  2. 若找不到需要的符号,使用Detexify来画出想要的符号
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

别问,问就是全会

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值