KaTex 常用公式编辑

原文:https://blog.iyatt.com/?p=7854

注:语法上和 Latex 差不多一样,我是因为 WordPress 上使用 WP Githuber MD 插件,才用的 KaTex(插件里面的 LaTex 模块有 bug,无法渲染)

希腊字母

大写 代码 小写 代码
A A α \alpha
B B β \beta
Γ \Gamma γ \gamma
Δ \Delta δ \delta
E E ϵ \epsilon
Z Z ζ \zeta
H H η \eta
Θ \Theta θ \theta
I I ι \iota
K K κ \kappa
Λ \Lambda λ \lambda
M M μ \mu
N N ν \nu
Ξ \Xi ξ \xi
O O ο \omicron
Π \Pi π \pi
P P ρ \rho
Σ \Sigma σ \sigma
T T τ \tau
Υ Υ υ \upsilon
Φ \Phi ϕ \phi
X X χ \chi
Ψ \Psi ψ \psi
Ω \Omega ω \omega

符号

乘 \times × \times ×
除 \div ÷ \div ÷
加减 \pm ± \pm ±
减加 \mp ∓ \mp
偏导数 \partial ∂ \partial
小于 \lt < \lt <
大于 \gt > \gt >
小于等于 \le ≤ \le
大于等于 \ge ≥ \ge
不等于 \ne ≠ \ne =
加 \not 否定,如 \not \lt ≮ \not \lt <
并集 \cup ∪ \cup
交集 \cap ∩ \cap
子集 subset ⊂ \subset ,subseteq ⊊ \subsetneq
差集 \setminus ∖ \setminus
非子集 \subsetneq ⊊ \subsetneq
父集 \supset ⊃ \supset
属于 \in ∈ \in
不属于 \notin ∉ \notin /
空集 \emptyset ∅ \emptyset
空 \varnothing ∅ \varnothing
虚数 i、j \imath ı \imath , \jmath ȷ \jmath
异或 \oplus ⊕ \oplus
同与 \otimes ⊗ \otimes
同或 \odot ⊙ \odot
与 \land ∧ \land
或 \lor ∨ \lor
非 \lnot ¬ \lnot ¬
点乘 \cdot ⋅ \cdot
平均运算符 \overline{x} x ‾ \overline{x} x
向量(单)\vec{x} x ⃗ \vec{x} x
向量(多)\overrightarrow{xy} x y → \overrightarrow{xy} xy
梯度算子 \nabla ∇ \nabla
空格 \ ,比如 a\ b a   b a\ b a b
任意 \forall ∀ \forall
存在 \exists ∃ \exists
反斜杠 \backslash \ \backslash \

\to → \to
\rightarrow → \rightarrow
\leftarrow ← \leftarrow
\leftrightarrow ↔ \leftrightarrow
\uparrow ↑ \uparrow
\downarrow ↓ \downarrow
\updownarrow ↕ \updownarrow
\Rightarrow ⇒ \Rightarrow
\Leftarrow ⇐ \Leftarrow
\Leftrightarrow ⇔ \Leftrightarrow
\Uparrow ⇑ \Uparrow
\Downarrow ⇓ \Downarrow
\Updownarrow ⇕ \Updownarrow
长箭头,前面加 long 或 Long,比如 \longrightarrow ⟶ \longrightarrow ,\Longrightarrow ⟹ \Longrightarrow

\twoheadrightarrow ↠ \twoheadrightarrow
\rightarrowtail ↣ \rightarrowtail
\looparrowright ↬ \looparrowright
\curvearrowright ↷ \curvearrowright
\circlearrowright ↻ \circlearrowright
\Rsh ↱ \Rsh
\multimap ⊸ \multimap
\leftrightsquigarrow ↭ \leftrightsquigarrow
\rightsquigarrow ⇝ \rightsquigarrow
\leadsto ⇝ \leadsto
\nearrow ↗ \nearrow
\searrow ↘ \searrow
\swarrow ↙ \swarrow
\nwarrow ↖ \nwarrow
\nleftarrow ↚ \nleftarrow
\nrightarrow ↛ \nrightarrow
\nLeftarrow ⇍ \nLeftarrow
\nRightarrow ⇏ \nRightarrow
\nleftrightarrow ↮ \nleftrightarrow
\nLeftrightarrow ⇎ \nLeftrightarrow
\dashrightarrow ⇢ \dashrightarrow
\dashleftarrow ⇠ \dashleftarrow
\leftleftarrows ⇇ \leftleftarrows
\leftrightarrows ⇆ \leftrightarrows
\twoheadleftarrow ↞ \twoheadleftarrow
\leftarrowtail ↢ \leftarrowtail
\looparrowleft ↫ \looparrowleft
\curvearrowleft ↶ \curvearrowleft
\circlearrowleft ↺ \circlearrowleft
\Lsh ↰ \Lsh
\mapsto ↦ \mapsto
\hookleftarrow ↩ \hookleftarrow
\hookrightarrow ↪ \hookrightarrow
\upharpoonright ↾ \upharpoonright
\upharpoonleft ↿ \upharpoonleft
\downharpoonright ⇂ \downharpoonright
\downharpoonleft ⇃ \downharpoonleft
\leftharpoonup ↼ \leftharpoonup
\rightharpoonup ⇀ \rightharpoonup
\leftharpoondown ↽ \leftharpoondown
\rightharpoondown ⇁ \rightharpoondown
\upuparrows ⇈ \upuparrows
\downdownarrows ⇊ \downdownarrows
\rightrightarrows ⇉ \rightrightarrows
\rightleftarrows ⇄ \rightleftarrows
\rightrightarrows ⇉ \rightrightarrows
\rightleftarrows ⇄ \rightleftarrows
\rightleftharpoons ⇌ \rightleftharpoons
\leftrightharpoons ⇋ \leftrightharpoons

\mapsto ↦ \mapsto
\forall ∀ \forall
\exists ∃ \exists
\top ⊤ \top
\bot ⊥ \bot
\vDash ⊨ \vDash
\star ⋆ \star
\ast ∗ \ast
\bullet ∙ \bullet
约等于 \approx ≈ \approx
波浪号 \sim ∼ \sim
\equiv ≡ \equiv
\prec ≺ \prec
无穷 \infty ∞ \infty
\aleph_o ℵ o \aleph_o o
\aleph_o ℵ o \aleph_o o
\Im ℑ \Im
\Re ℜ \Re
\ldots … \ldots
\cdots ⋯ \cdots
\vdots ⋮ \vdots
\ddots ⋱ \ddots
\hat x x ^ \hat x x^
\widehat {xy} x y ^ \widehat {xy} xy
\dot x x ˙ \dot x x˙
\ddot x x ¨ \ddot x x¨
\dot {\dot x} x ˙ ˙ \dot {\dot x} x˙˙
\mathring{U} U ˚ \mathring{U} U˚

##上下添加公式

\overset{x=9}{=}
= x = 9 \overset{x=9}{=} =x=9

\underset{x=\sin\theta}{=}
= x = sin ⁡ θ \underset{x=\sin\theta}{=} x=sinθ=

\xlongequal[下方公式]{上方公式}
= 下方公式 上方公式 \xlongequal[下方公式]{上方公式} 上方公式 下方公式

上下大括号

\overbrace{a+b+c}^x a + b + c ⏞ x \overbrace{a+b+c}^x a+b+c x

a+\underbrace{b+c}_y a + b + c ⏟ y a+\underbrace{b+c}_y a+y b+c

上下标

A^m_n A n m A_n^m Anm
A_n^m A n m A_n^m Anm
x^2 x 2 x^2 x2
a_n a n a_n an
a_{n+1} a n + 1 a_{n+1} an+1
A{BC} A B C A^{B^C} ABC
{AB}C A B C {A^B}^C ABC

根号

\sqrt{25} 25 \sqrt{25} 25
\sqrt[3]{27} 27 3 \sqrt[3]{27} 327

分式

\frac{a+b}{a-b} a + b a − b \frac{a+b}{a-b} aba+b
\frac{4}{5} 4 5 \frac{4}{5} 54

括号

(), [] 直接使用,{ 和 } 有特殊含义,需要使用 { 和 } 表示。

尖括号使用
\langle ⟨ \langle
\rangle ⟩ \rangle

求和

\sum_{i=1}^n ∑ i = 1 n \sum_{i=1}^n i=1n
\sum_{j=0}^k ∑ j = 0 k \sum_{j=0}^k j=0k

连乘

\prod_{i=0}^nx ∏ i = 0 n \prod_{i=0}^n i=0n

积分

\int_0^x ∫ 0 x \int_0^x 0x
\iint_0^x ∬ 0 x \iint_0^x 0x
\iiint_0^x ∭ 0 x \iiint_0^x 0x

极限

\lim_{x \to \infty}(1 + \frac{1}{x})^x
lim ⁡ x → ∞ ( 1 + 1 x ) x \lim_{x \to \infty}(1 + \frac{1}{x})^x xlim(1+x1)x

换行等号对齐

\begin{aligned}
19&=10+9 \\
&=11+8 \\
&=12+7
\end{aligned}

19 = 10 + 9 = 11 + 8 = 12 + 7 \begin{aligned} 19&=10+9 \\ &=11+8 \\ &=12+7 \end{aligned} 19=10+9=11+8=12+7

分类

f(x)=
\begin{cases}
x+1, &x<0\\
0, &x=0\\
2x-1, &x>0
\end{cases}

f ( x ) = { x + 1 , x < 0 0 , x = 0 2 x − 1 , x > 0 f(x)= \begin{cases} x+1, &x<0\\ 0, &x=0\\ 2x-1, &x>0 \end{cases} f(x)= x+1,0,2x1,x<0x=0x>0

方程组

\left \{
\begin{array}{l} % l 靠左、c 居中、r 靠右
x+y+z=6 \\
2x-y+z=3 \\
x+y-z=0
\end{array}
\right.

{ x + y + z = 6 2 x − y + z = 3 x + y − z = 0 \left \{ \begin{array}{l} x+y+z=6 \\ 2x-y+z=3 \\ x+y-z=0 \end{array} \right. x+y+z=62xy+z=3x+yz=0

多列对齐

\begin{array}{l l} % l 靠左、c 居中、r 靠右
x+y+z=6 & x+y+z=6\\
2x-y+z=3 & 2x-y+z=3 \\
x+y-z=0 & x+y-z=0
\end{array}

x + y + z = 6 x + y + z = 6 2 x − y + z = 3 2 x − y + z = 3 x + y − z = 0 x + y − z = 0 \begin{array}{l l} % l 靠左、c 居中、r 靠右 x+y+z=6 & x+y+z=6\\ 2x-y+z=3 & 2x-y+z=3 \\ x+y-z=0 & x+y-z=0 \end{array} x+y+z=62xy+z=3x+yz=0x+y+z=62xy+z=3x+yz=0

矩阵

\begin{matrix}
1&2&3 \\
4&5&6 \\
7&8&9
\end{matrix}

1 2 3 4 5 6 7 8 9 \begin{matrix} 1&2&3 \\ 4&5&6 \\ 7&8&9 \end{matrix} 147258369

\left \{
\begin{matrix}
1&2&3 \\
4&5&6 \\
7&8&9
\end{matrix}
\right \}

{ 1 2 3 4 5 6 7 8 9 } \left \{ \begin{matrix} 1&2&3 \\ 4&5&6 \\ 7&8&9 \end{matrix} \right \} 147258369

\left |
\begin{matrix}
1&2&3 \\
4&5&6 \\
7&8&9
\end{matrix}
\right |

∣ 1 2 3 4 5 6 7 8 9 ∣ \left | \begin{matrix} 1&2&3 \\ 4&5&6 \\ 7&8&9 \end{matrix} \right | 147258369

\left (
\begin{matrix}
1&2&3 \\
4&5&6 \\
7&8&9
\end{matrix}
\right )

( 1 2 3 4 5 6 7 8 9 ) \left ( \begin{matrix} 1&2&3 \\ 4&5&6 \\ 7&8&9 \end{matrix} \right ) 147258369

上面是使用 \left 和 \right 来添加的左右括号,也可以不用这对符号,将 \begin 和 \end 后面的词分别换为 pmatrix、bmatrix、Bmatrix、vmatrix、Vmatrix,分别对应小括号、中括号、大括号、单竖线、双竖线,如:

\begin{pmatrix}
1&2&3 \\
4&5&6 \\
7&8&9
\end{pmatrix}

( 1 2 3 4 5 6 7 8 9 ) \begin{pmatrix} 1&2&3 \\ 4&5&6 \\ 7&8&9 \end{pmatrix} 147258369

\begin{array} {c c | c} % c 居中,r 右对齐,l 左对齐,竖线为插入竖线的位置
1&2&3 \\
\hline % 插入横线
4&5&6 \\
7&8&9
\end{array}

1 2 3 4 5 6 7 8 9 \begin{array} {c c | c} 1&2&3 \\ \hline 4&5&6 \\ 7&8&9 \end{array} 147258369

表格

\begin{array}{c|lcr}
n & \text{Left} & \text{Center} & \text{Right} \\
\hline
1 & 2 & 1 & 4 \\
4 & 3 & 2 & 1 \\
1.0 & 2.0 & 3000 & 3\times10^5 \\
\end{array}

n Left Center Right 1 2 1 4.0 4 3 2 1 1.0 2.0 3000 3 × 1 0 5 \begin{array}{c|lcr} n & \text{Left} & \text{Center} & \text{Right} \\ \hline 1 & 2 & 1 & 4.0 \\ 4 & 3 & 2 & 1 \\ 1.0 & 2.0 & 3000 & 3\times10^5 \\ \end{array} n141.0Left232.0Center123000Right4.013×105

\begin{array}{|c|c|}
\hline
\text{公式1} & \text{公式2} \\
\hline
\begin{aligned}
a &= b + c \\
  &= d + e
\end{aligned}
&
\begin{aligned}
f &= g + h \\
  &= i + j
\end{aligned} \\
\hline
\end{array}

公式1 公式2 a = b + c = d + e f = g + h = i + j \begin{array}{|c|c|} \hline \text{公式1} & \text{公式2} \\ \hline \begin{aligned} a &= b + c \\ &= d + e \end{aligned} & \begin{aligned} f &= g + h \\ &= i + j \end{aligned} \\ \hline \end{array} 公式1a=b+c=d+e公式2f=g+h=i+j

字体

黑板粗体

一般用于表示数学和物理学中的向量或集合

\mathbb{ABCDEFGHIJKLMNOPQRSTUVWXYZ} A B C D E F G H I J K L M N O P Q R S T U V W X Y Z \mathbb{ABCDEFGHIJKLMNOPQRSTUVWXYZ} ABCDEFGHIJKLMNOPQRSTUVWXYZ
\mathbb{abcdefghijklmnopqrstuvwxyz} a b c d e f g h i j k l m n o p q r s t u v w x y z \mathbb{abcdefghijklmnopqrstuvwxyz} abcdefghijklmnopqrstuvwxyz

正粗体

\mathbf{ABCDEFGHIJKLMNOPQRSTUVWXYZ} A B C D E F G H I J K L M N O P Q R S T U V W X Y Z \mathbf{ABCDEFGHIJKLMNOPQRSTUVWXYZ} ABCDEFGHIJKLMNOPQRSTUVWXYZ
\mathbf{abcdefghijklmnopqrstuvwxyz} a b c d e f g h i j k l m n o p q r s t u v w x y z \mathbf{abcdefghijklmnopqrstuvwxyz} abcdefghijklmnopqrstuvwxyz

罗马体

\mathrm{ABCDEFGHIJKLMNOPQRSTUVWXYZ} A B C D E F G H I J K L M N O P Q R S T U V W X Y Z \mathrm{ABCDEFGHIJKLMNOPQRSTUVWXYZ} ABCDEFGHIJKLMNOPQRSTUVWXYZ
\mathrm{abcdefghijklmnopqrstuvwxyz} a b c d e f g h i j k l m n o p q r s t u v w x y z \mathrm{abcdefghijklmnopqrstuvwxyz} abcdefghijklmnopqrstuvwxyz

哥特体

\mathfrak{ABCDEFGHIJKLMNOPQRSTUVWXYZ} A B C D E F G H I J K L M N O P Q R S T U V W X Y Z \mathfrak{ABCDEFGHIJKLMNOPQRSTUVWXYZ} ABCDEFGHIJKLMNOPQRSTUVWXYZ
\mathfrak{abcdefghijklmnopqrstuvwxyz} a b c d e f g h i j k l m n o p q r s t u v w x y z \mathfrak{abcdefghijklmnopqrstuvwxyz} abcdefghijklmnopqrstuvwxyz

打印体

\mathtt{ABCDEFGHIJKLMNOPQRSTUVWXYZ} A B C D E F G H I J K L M N O P Q R S T U V W X Y Z \mathtt{ABCDEFGHIJKLMNOPQRSTUVWXYZ} ABCDEFGHIJKLMNOPQRSTUVWXYZ
\mathtt{abcdefghijklmnopqrstuvwxyz} a b c d e f g h i j k l m n o p q r s t u v w x y z \mathtt{abcdefghijklmnopqrstuvwxyz} abcdefghijklmnopqrstuvwxyz

手写体

\mathcal{ABCDEFGHIJKLMNOPQRSTUVWXYZ} A B C D E F G H I J K L M N O P Q R S T U V W X Y Z \mathcal{ABCDEFGHIJKLMNOPQRSTUVWXYZ} ABCDEFGHIJKLMNOPQRSTUVWXYZ
\mathcal{abcdefghijklmnopqrstuvwxyz} a b c d e f g h i j k l m n o p q r s t u v w x y z \mathcal{abcdefghijklmnopqrstuvwxyz} abcdefghijklmnopqrstuvwxyz

相关推荐

  1. KaTex 公式编辑

    2024-04-01 01:16:01       17 阅读
  2. KaTeX/LaTeX数学公式(持续更新ing...)

    2024-04-01 01:16:01       42 阅读
  3. KaTex在博客中显示数学公式

    2024-04-01 01:16:01       8 阅读
  4. es查询编辑

    2024-04-01 01:16:01       32 阅读
  5. 机器学习评价指标的公式和含义

    2024-04-01 01:16:01       9 阅读
  6. PC端公共样式

    2024-04-01 01:16:01       30 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-04-01 01:16:01       19 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-04-01 01:16:01       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-04-01 01:16:01       20 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-04-01 01:16:01       20 阅读

热门阅读

  1. synchronized的使用方式

    2024-04-01 01:16:01       15 阅读
  2. 单台服务器(非集群节点)向Hadoop集群传输数据

    2024-04-01 01:16:01       16 阅读
  3. C++计算资本市场收益及成本分配数学方程

    2024-04-01 01:16:01       16 阅读
  4. nginx配置

    2024-04-01 01:16:01       15 阅读
  5. nginx如何清理页面缓存

    2024-04-01 01:16:01       14 阅读
  6. Linux进程的基本概念

    2024-04-01 01:16:01       15 阅读
  7. VPP添加接口IP地址

    2024-04-01 01:16:01       14 阅读
  8. Activity入门1

    2024-04-01 01:16:01       11 阅读
  9. 【c++20】CPP-20-STL-Cookbook 学习笔记

    2024-04-01 01:16:01       20 阅读
  10. Leetcode 3100. Water Bottles II

    2024-04-01 01:16:01       16 阅读