从入门到放弃:Markdown中的LaTeX使用教程

这篇博客介绍了LaTeX的基本语法,包括行内和居中显示公式,希腊字母,常见数学符号,以及如何书写集合、函数公式、箭头、字体样式、数学公式和矩阵。此外,还讲解了方程组的表示方法以及进阶技巧,如改变公式颜色。适合初学者快速掌握LaTeX。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

LaTeX

基本语法

展现形式

  • 在正文中的LaTeX公式用$...$定义行内公式,$$...$$单独居中显示

希腊字母

显示命令显示命令
α\alphaβ\beta
γ\gammaδ\delta
ε\epsilonζ\zeta
η\etaθ\theta
ι\iotaκ\kappa
λ\lambdaμ\mu
ν\nuξ\xi
π\piρ\rho
σ\sigmaτ\tau
υ\upsilonφ\phi
χ\chiψ\psi
ω\omega
  • 示例:

    $\alpha$ α \alpha α

  • 需要大写希腊字母时,首字母大写即可

    $\Alpha$ A \Alpha A

常见符号

显示命令显示命令
x ⋅ y {x}\cdot{y} xy{x}\cdot{y} x ∗ y {x}*{y} xy{x}*{y}
x  ⁣ : y {x}\colon{y} x:y{x}\colon{y} x × y {x}\times{y} x×y{x}\times{y}
x . y {x}.{y} x.y{x}.{y} x , y {x},{y} x,y{x},{y}
x ± y {x}\pm{y} x±y{x}\pm{y} x y {x}\over{y} yx{x}\over{y}
⋮ \vdots \vdots ⋱ \ddots \ddots
x ˙ \dot{x} x˙\dot{x} x ¨ \ddot{x} x¨\ddot{x}
x ˘ \breve{x} x˘\breve{x} x x x ^ \widehat{xxx} xxx \widehat{xxx}
x ˊ \acute{x} xˊ\acute{x} x ˇ \check{x} xˇ\check{x}
x ˋ \grave{x} xˋ\grave{x} x ~ \tilde{x} x~\tilde{x}
≠ \neq =\neq x ˉ \bar{x} xˉ\bar{x}
x ^ \hat{x} x^\hat{x} x ⋯ y {x}\dotsm{y} xy{x}\dotsm{y}
x ⃗ \vec{x} x \vec{x} x … y {x}\dotso{y} xy{x}\dotso{y}
x x x ~ \widetilde{xxx} xxx \widetilde{xxx}$\dddot{x}$\dddot{x}
\ \backslash \\backslash$\bracevert$\bracevert
∖ \smallsetminus \smallsetminus$\arrowvert$\arrowvert
{ \lbrace {\lbrace ∥ \lVert \lVert
} \rbrace }\rbrace ∥ \rVert \rVert
⟮ \lgroup \lgroup ∣ \lvert \lvert
⟯ \rgroup \rgroup ∣ \rvert \rvert
⟨ \langle \langle ⌊ \lfloor \lfloor
⟩ \rangle \rangle ⌋ \rfloor \rfloor
⎰ \lmoustache \lmoustache ⌈ \lceil \lceil
⎱ \rmoustache \rmoustache ⌉ \rceil \rcei
x y {x}\quad{y} xy{x}\quad{y}

集合

显示命令显示命令
∈ \in \in ∉ \notin /\notin
⊈ \nsubseteqq \nsubseteqq ⊂ \subset \subset
∅ \emptyset \emptyset ⊃ \supset \supset
∇ \nabla \nabla ⊆ \subseteq \subseteq
⊈ \nsubseteqq \nsubseteqq ⊈ \nsubseteq \nsubseteq
⊉ \nsupseteqq \nsupseteqq ⊉ \nsupseteq \nsupseteq
⫋ \subsetneqq \subsetneqq ⊊ \subsetneq \subsetneq
⫌ \supsetneqq \supsetneqq ⊋ \supsetneq \supsetneq
⫋ \varsubsetneqq \varsubsetneqq ⊊ \varsubsetneq \varsubsetneq
⫌ \varsupsetneqq \varsupsetneqq ⊋ \varsupsetneq \varsupsetneq
⋂ \bigcap \bigcap ⋁ \bigvee \bigvee
⋃ \bigcup \bigcup ⋀ \bigwedge \bigwedge
⨄ \biguplus \biguplus ⨆ \bigsqcup \bigsqcup
⋐ \Subset \Subset ⋑ \Supset \Supset
⫅ \subseteqq \subseteqq ⫆ \supseteqq \supseteqq
⊏ \sqsubset \sqsubset ⊐ \sqsupset \sqsupset
∀ \forall \forall ∃ \exists \exists

函数公式表

  • 没有列举的函数可以类推
显示命令显示命令
sin ⁡ \sin sin\sin sin ⁡ − 1 \sin^{-1} sin1\sin^{-1}
cos ⁡ \cos cos\cos​ cos ⁡ − 1 \cos^{-1} cos1\cos^{-1}
tan ⁡ \tan tan\tan tan ⁡ − 1 \tan^{-1} tan1\tan^{-1}
det ⁡ \det det\det dim ⁡ \dim dim\dim
inf ⁡ \inf inf\inf arg ⁡ \arg arg\arg
log ⁡ \log log\log ln ⁡ \ln ln\ln

箭头

  • 太多了。。不定期更新常用的吧
显示命令显示命令
⇔ \Leftrightarrow \Leftrightarrow ⇎ \nLeftrightarrow \nLeftrightarrow
⇒ \Rightarrow \Rightarrow ⇐ \Leftarrow \Leftarrow
↔ \leftrightarrow \leftrightarrow ↮ \nleftrightarrow \nleftrightarrow

修饰

上下标

上标:^ 下标:_

举例:$C_n^2$ C n 2 C_n^2 Cn2

矢量

  • 单个字母矢量:\vec即可(vector)

    $\vec{i}$ or $\vec i$ i ⃗ \vec{i} i

  • 多个字母就不要用空格了

    $\vec{ij}$ : i j ⃗ \vec{ij} ij $\vec ij$ i ⃗ j \vec ij i j

  • 比较复杂的左右箭头

    $\overrightarrow x$ : x → \overrightarrow x x $\overrightarrow {x}$ : x → \overrightarrow {x} x

    $\overleftarrow x$ : x ← \overleftarrow x x $\overleftarrow {x}$ : x ← \overleftarrow {x} x

字体

  • Jacob
显示命令字体
J a c o b \mathbf{Jacob} Jacob\mathbf{Jacob}加粗
J a c o b \mathit{Jacob} Jacob\mathit{Jacob}斜体

数学公式表

显示命令类型
n n − 1 \frac{n}{n-1} n1n\frac{n}{n-1}分式
a b n \sqrt[n]{ab} nab \sqrt[n]{ab}根式
a b \sqrt{ab} ab \sqrt{ab}​根式
log ⁡ a b \log_{a}{b} logab\log_{a}{b}对数
lg ⁡ a b \lg{ab} lgab\lg{ab}对数
∫ \int \int积分
∫ a b \int_{a}^{b} ab\int_{a}^{b}积分
d x d y \frac{\text{d}x}{\text{d}y} dydx\frac{\text{d}x}{\text{d}y}微分
lim ⁡ a → b \lim_{a \rightarrow b} limab\lim_{a \rightarrow b}极限
∑ n = 1 N a n \sum_{n=1}^Na_n n=1Nan\sum_{n=1}^Na_n求和

常见模板

二次方程求解

\mathbf{a*x^2+b*x+c}\\
x=\frac{{-b}\pm{\sqrt{b^2-4ac}}}{2a}\\
x={{-b\pm\sqrt{b^2-4ac}}\over{2a}}

a ∗ x 2 + b ∗ x + c x = − b ± b 2 − 4 a c 2 a x = − b ± b 2 − 4 a c 2 a \mathbf{a*x^2+b*x+c}\\ \quad\\ x=\frac{{-b}\pm{\sqrt{b^2-4ac}}}{2a}\\ \quad\\ x={{-b\pm\sqrt{b^2-4ac}}\over{2a}} ax2+bx+cx=2ab±b24ac x=2ab±b24ac

矩阵

  • 基本示例
\begin{bmatrix}
1&0&0\\
0&1&0\\
0&0&1
\end{bmatrix}

[ 1 0 0 0 1 0 0 0 1 ] \begin{bmatrix} 1&0&0\\ 0&1&0\\ 0&0&1 \end{bmatrix} 100010001

  • 基本语法

    在起始和结束位置可以调整矩阵边框

matrix  :无边框
pmatrix :小括号边框
bmatrix :中括号边框
Bmatrix :大括号边框
vmatrix :单竖线边框
Vmatrix :双竖线边框
  • 省略元素矩阵示例
\begin{bmatrix}
{a_{11}}&{a_{12}}&{\cdots}&{a_{1n}}\\
{a_{21}}&{a_{22}}&{\cdots}&{a_{2n}}\\
{\vdots}&{\vdots}&{\ddots}&{\vdots}\\
{a_{m1}}&{a_{m2}}&{\cdots}&{a_{mn}}\\
\end{bmatrix}

[ a 11 a 12 ⋯ a 1 n a 21 a 22 ⋯ a 2 n ⋮ ⋮ ⋱ ⋮ a m 1 a m 2 ⋯ a m n ] \begin{bmatrix} {a_{11}}&{a_{12}}&{\cdots}&{a_{1n}}\\ {a_{21}}&{a_{22}}&{\cdots}&{a_{2n}}\\ {\vdots}&{\vdots}&{\ddots}&{\vdots}\\ {a_{m1}}&{a_{m2}}&{\cdots}&{a_{mn}}\\ \end{bmatrix} a11a21am1a12a22am2a1na2namn

方程组

  • 比较复杂,记住模板即可
  • equation环境
\begin{equation}
% \begin{equation*}'*'去掉公式编号
\left\{
\begin{aligned}     %请使用'aligned''align*'
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{aligned}
\right.
\end{equation}
% \end{equation*}'*'去掉公式编号

% 注意:在 markdown 环境下,某些特殊字符,如'\', '*'等,会首先被 markdown 语法转义,然后再被 Latex 转义。
% 因此有时候 '\{'需要写作'\\{''*'需要写作'\*''\\'需要写作'\\\\'等,视不同的解释环境而定

{ 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 \begin{cases} \begin{aligned} %请使用'aligned'或'align*' 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{aligned} \end{cases} a1x+b1y+c1za2x+b2y+c2za3x+b3y+c3z=d1=d2=d3

  • cases环境
\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}

{ 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 \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} a1x+b1y+c1za2x+b2y+c2za3x+b3y+c3z===d1d2d3

进阶技巧

行间公式和独立公式

//行间公式
$...$
    
//独立公式
$$
...
$$

但是有很多同时有上下标的公式,在行间和独立下的形式是不同的:

对于:p = \sum_{n=1}^Na_n

  • 行间

p = ∑ n = 1 N a n p = \sum_{n=1}^Na_n p=n=1Nan

  • 独立

p = ∑ n = 1 N a n p = \sum_{n=1}^Na_n p=n=1Nan

这是由于行间和独立具有默认的变现形式,可以理解为行间 \nolimits 的上下标;独立是 \limits 的上下标。

因此在 p = \sum_{n=1}^Na_n 中, p = \sum 后面加入 \nolimits\limits 可以改变原有默认的格式。

  • $p = \sum\limits_{n=1}^Na_n$

p = ∑ n = 1 N a n p = \sum\limits_{n=1}^Na_n p=n=1Nan

  • $p = \sum\nolimits_{n=1}^Na_n$

p = ∑ n = 1 N a n p = \sum\nolimits_{n=1}^Na_n p=n=1Nan

改变公式颜色

先敲一段麦克斯韦方程组
e i x = cos ⁡ x + i sin ⁡ x e^{ix} = \cos x + i\sin x eix=cosx+isinx

  • 字体颜色关键词 \color 然后填入需要的颜色即可

    \color{red} e^{ix} = \cos x + i\sin x

e i x = cos ⁡ x + i sin ⁡ x \color{red} e^{ix} = \cos x + i\sin x eix=cosx+isinx

  • 局部更改,就需要用 {} 将需要改变颜色的内容\color括起来就即可

    e^{i\color{red}{x} = \cos color{red}{x} + i\sin color{red}{x}

e i x = cos ⁡ x + i sin ⁡ x e^{i{\color{red}x}} = \cos {\color{red}x} + i\sin {\color{red}x} eix=cosx+isinx

更新日志

  • 20210823
    首次在CSDN发布
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

Jacob-xyb

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

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

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

打赏作者

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

抵扣说明:

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

余额充值