转载自https://blog.csdn.net/jzj_c_love/article/details/122279703

代码都可以在typora中运行,给出的图片链接语法是Ketax,可能有少数的不适用,但基本可以。

一、基本公式

1. 上下标

plaintext

A_1^2
\\
B_{12}
\\
2^{x^2+y}

(1)A12B122x2+y

2. 分数

plaintext
$$
\frac{x}{1+x^2}
\\
\frac{\frac{1}{2}+x}{y}
\\
\tfrac{a}{b}
\frac{a}{b}
$$

(2)x1+x212+xyabab

3. 开根号

plaintext
$$
\sqrt{x}
\sqrt[3]{x}
$$

(3)xx3

4. 组合数

plaintext
$$
\binom{n}{k}
\tbinom{n}{k}
$$

(4)(nk)(nk)

5. 导数

plaintext
$$
a'
a''
a^{\prime}
$$

(5)aaa

6. 取模

plaintext
$$
x \pmod a
\\
2\mod{x}
$$

(6)x(moda)2modx

7. 积分

plaintext
$$
\int_{1}^{2}
\intop_{2}^{1}
\oint
\smallint
\\
\iint
\oiint
\iiint
\oiiint
$$

(7)1221\oiint\oiiint

8.微分

plaintext
$$
\nabla  
\partial x  
\mathrm{d}x
\dot x  
\ddot y
\Delta
$$

Misplaced &

9.累积/累乘/极限

plaintext
$$
\sum_{i=1}^{k}
\displaystyle\sum_{i=1}^n
\textstyle\sum_{i=1}^n
\\
\prod_{i=1}^{k}
\displaystyle\prod_{i=1}^n
\textstyle\prod_{i=1}^n
\\
\lim_{k \to \infty}
\lim\limits_{k \to \infty}
\lim\nolimits_{k \to \infty}]
$$

(8)i=1ki=1ni=1ni=1ki=1ni=1nlimklimklimk]

二、修饰符号

1. 简单的帽子

plaintext
\hat{\theta}
\widehat{AB}
\\
\bar{y}
\overline{AB}
\\
\tilde{a}
\widetilde{ac}
\\
\bar{a}
\acute{a}
\check{a}
\grave{a}
\\
\dot{a}
\ddot{a}
\\
\vec{a}
\overline{a}
\underline{a}
\underset{min}{a}
\\
\hat{a}
\widehat{a}
\\
\mathring{a}\dddot{a}
\\
\ddddot{a}

(9)θ^AB^y¯ABa~ac~a¯a´aˇa`a˙a¨aaaamina^a^a˚aa

2. 帽子和袜子

plaintext
$$
\overleftarrow{AB}
\overrightarrow{AB}
\overleftrightarrow{AB}
\\
\underleftarrow{AB}
\underrightarrow{AB}
\underleftrightarrow{AB}
\\
\overbrace{AB}
\underbrace{AB}
\\
\overline{AB}
\underline{AB}
$$

(10)ABABABABABABABABABAB

3. 盒子和帽子

plaintext
$$
\overbrace{a+b+c}^{\text{note}}
\\
\underbrace{a+b+c}_{\text{note}}
\\
\boxed{\pi=3.14}
$$

(11)a+b+cnotea+b+cnoteπ=3.14

4. 各种括号

plaintext
$$
(
\big(
\Big(
\bigg(
\Bigg(
$$

(12)(((((

plaintext
$$
[]
<>
|-2|
\{\}
$$

(13)[]<>|2|{}

plaintext
$$
\lgroup x \rgroup
\lVert a \rVert
\lceil 2.6 \rceil
\lfloor 1.2 \rfloor
\ulcorner
\urcorner
\llcorner
\lrcorner
$$

(14)xa2.61.2

三、字母

1、数学环境默认字体

(15)mathnormalABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890

2、意大利体

(16)mathitABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890

##3、罗马体

(17)mathrmABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890

4、粗体

(18)mathbfABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890

5、无衬线体

(19)mathsfABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890

6、打印机体

(20)mathttABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890

7、手写体

(21)mathcalABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890

8、黑板粗体

(22)mathbbABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890

9、花体

(23)mathscrABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890

10、哥特体

(24)mathfrakABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890

11、其他字母

plaintext
\text{字母}
\bf{字母}
\mathit{字母}
\pmb{字母}
\cal{字母}

(25)RACLRACLRACLRRAACCLLRACL

plaintext
\tiny ABCabc
\small ABCabc
\normalsize ABCabc
\large ABCabc
\Large ABCabc
\huge ABCabc
\Huge ABCabc
{\tiny ABC} {\large ABC}

(26)ABCabcABCabcABCabcABCabcABCabcABCabcABCabcABCABC

12、希腊字母

(27)αβγδϵζηθικλμνξπρστυϕχψωΓΓγϝΔΔδϵεΘΘθϑκϰΞΞξΠΠπϖρϱΣΣσςΥΥυΦΦϕφΨΨψΩΩω

image
image

13、希伯来字母

(28)

$$

$$

四、算术运算符号

plaintext
\times
\div
\cdot
\%
\circ
\ast
\star
\otimes
\oplus
\odot
\oslash
\pm
\mp
\dotplus
\divideontimes
\textbackslash

(29)×÷%±\textbackslash

五、比较运算符

(30)=≠≠<≮>≯≤≤≰≦≥≥≱≧≲⋦⪅⪉≳⋧⪆⪊≺⊀≻⊁∈∉∋∋≪⋘≫⋙∼≁≃≅≇≈≡≐⊂⊆⊈⊊⊃⊇⊉⊋⌣⌢⊥⊨∣∤∣∤∥∦⊢⊬⊣⊭⊪⊩⊮⊯∝⋈⋈⊲⋪⊴⋬⊳⋫⊵⋭

六、集合运算符

plaintext
\in
\owns \not
\subset \not
\supset
\subseteq
\supseteq
\\
\cap
\cup
\land
\lor
\\
\neg
\emptyset
\varnothing
\\
\because
\forall
\exists
\therefore
\cap
\cup
\land
\lor
\sqcup
\sqcap

(31)∈∋⊄⊅⊆⊇¬

七、各种箭头

plaintext
\gets
\leftarrow
\to
\rightarrow
\leftrightarrow
\\
\uparrow
\downarrow
\updownarrow
\Leftarrow
\Rightarrow
\Leftrightarrow
\iff
\\
\Uparrow
\Downarrow
\Updownarrow
\nearrow
\searrow
\swarrow
\nwarrow
\longleftarrow
\longrightarrow
\longleftrightarrow
\Longleftarrow
\Longrightarrow
\Longleftrightarrow
\longmapsto
\xrightarrow{over}
\xrightarrow[over]{}
\xrightarrow[under]{over}
\xleftarrow[]{over}
\xleftarrow[under]{}
\xleftarrow[under]{over}

(32)←←→↔↑↓↕⇐⇒⇔⇑⇓⇕↗↘↙↖⟵⟶⟷⟸⟹⟺⟼overoverunderoveroverunderunderover

(33)→↛⟶⇒⇏⟹←↚⟵⇐⇍⟸↔↮⇔⇎⟷↑↓↕⇑⇓↗↙↖↘⇀⇁↼↽↿⇃↾⇂↶↷↺↻↰↱⇈⇊⇇⇉

七、空间间距

plaintext
A\!B
\\
AB
\\
A\thinspace B
\\
A\:B
\\
A\ B
\\
A \enspace B
\\
A\quad B
\\
A\qquad B

(34)ABABABABA BABABAB

八、矩阵

plaintext
A=
\begin{pmatrix}
a & b & \cdots & c \\
d & e & \cdots & f \\
\vdots & \vdots & \ddots & \vdots \\
g & h & \cdots & j
\end{pmatrix}
\tag{5.1}

(5.1)A=(abcdefghj)

plaintext
A = \begin{matrix}
a & b\\
c & d
\end{matrix}

(35)A=abcd

plaintext
B = \begin{pmatrix}
a & b\\
c & d
\end{pmatrix}

(36)B=(abcd)

plaintext
C = \begin{vmatrix}
a & b\\
c & d
\end{vmatrix}

(37)C=|abcd|

plaintext
D = \begin{bmatrix}
a & b\\
c & d
\end{bmatrix}

(38)D=[abcd]

plaintext
E = \begin{Vmatrix}
a & b\\
c & d
\end{Vmatrix}

(39)E=abcd

plaintext
\begin{aligned}
f(x) &= (x+1)^2\\
&= x^2 + 2x + 1
\end{aligned}

(40)f(x)=(x+1)2=x2+2x+1

plaintext
f(x) = \begin{cases}
a &\text{if b}\\
b &\text{if a}\\
\end{cases}

(41)f(x)={aifbbif a

plaintext
\begin{cases}
\begin{aligned}
x + 2y &= 1\\
3x - y &= 5
\end{aligned}
\end{cases}

(42){x+2y=13xy=5

plaintext
g(x,y)=\left\{
\begin{array}{rcl}
\frac{M_g - d}{M_f-b}[f(x,y)-b]+d & & {b \leq f(x,y) \leq M_f}\\
F^*_L & & {S_L \leq 0 < S_M}\\
F^*_R & & {S_M \leq 0 < S_R}\\
F_R & & {S_R \leq 0}
\end{array} \right.

(43)g(x,y)={MgdMfb[f(x,y)b]+dbf(x,y)MfFLSL0<SMFRSM0<SRFRSR0

九、修改字体大小

plaintext
AB
\Huge AB
\huge AB
\\
AB
\LARGE AB
\Large AB
\large AB
\\
AB
\small AB
\tiny AB

(44)ABABABABABABABABABAB

十、划掉

plaintext
\cancel{5}
\bcancel{5}
\xcancel{ABC}
\not =

(45)55ABC

十一、常见图形

plaintext
\Box
\square
\blacksquare
\triangle
\triangledown
\blacktriangle
\diamond
\Diamond
\star
\bigstar
\circ
\bullet
\bigcirc
\bigodot
\diamondsuit
\clubsuit
\heartsuit
\spadesuit
\angle
\measuredangle
\top
\bot
\infty
\checkmark
\dagger
\ddagger
\yen
\$

\[\Box\square\blacksquare\triangle\triangledown\blacktriangle\diamond\Diamond\star\bigstar\circ\bullet\bigcirc\bigodot\diamondsuit\clubsuit\heartsuit\spadesuit\angle\measuredangle\top\bot\infty\checkmark\dagger\ddagger\yen\]$

十二、声明宏

对于一些复杂但是只有少许不同的表达式,可以声明一个函数来调用,提高源码的可读性,减少出错

plaintext
\def\macroname#1#2{
your command
}

宏允许带任意数量的参数(也可以不带参),必须是#1,#2,……这样的命名格式,同时注意再定义宏的时候注意让#1与,否则会解析成#。再调用的时候格式为,可以参考一下的例子

plaintext
\def\Normal#1#2#3{
\frac{1}{\sqrt{2\pi}\ #3}\exp{[-\frac{(#1 - #2)^2}{2\ #3^2}]}
}
f(x)=\Normal{x}{u_1}{\sigma_1}\\
f(y)=\Normal{y}{u_2}{\sigma_2}\\

(46)f(x)=12π σ1exp[(xu1)22 σ12]f(y)=12π σ2exp[(yu2)22 σ22]

plaintext
\def\EXP{
e^x = 1 + x + \frac{1}{2!}x^2 + \frac{1}{3!}x^3 + \cdots
}
\EXP

(47)ex=1+x+12!x2+13!x3+

十三、其他

1、排版

公式居中:

plaintext
E=mc^2\\

(48)E=mc2

添加标签:

plaintext
cos\theta+isin\theta=e^{i\theta}\tag{1.1}

(1.1)cosθ+isinθ=eiθ

(49)E=mc2

等号对齐:

plaintext
\begin{align}f(x)=&x-1\\=&(x-1)(x^2+x+1)\end{align}\\

(50)f(x)=x1(51)=(x1)(x2+x+1)

plaintext
\begin{equation} \begin{split}
a &= b + c - d \\
&= e - f \\
&= g + h \\
&= i
\end{split} \end{equation}\\

(52)a=b+cd=ef=g+h=i

2、公式加方框行号 (53)a2=b2+c22bccosA

(54)求导数: y=sin2(1x)2x.

plaintext
\ldots \quad \cdots \quad \vdots \quad \ddots \quad \dotsc

(55)

3、 求和符号下多行限制条件

plaintext
\prod_{k_0,k_1,\ldots>0\atop 
   k_0+k_1+\cdots=n}
  {A_{k_0}A_{k_0}\cdots}

Misplaced &

4、上下标记

plaintext
\overline{x+y} \qquad \underline{a+b} \qquad \overbrace{1+2+\cdots+n}^{n个} \qquad \underbrace{a+b+\cdots+z}_{共有26个}

(56)x+ya+b1+2++nna+b++z26

5、显示长方程

plaintext
\begin{multline}
p(x) = 3x^6 + 14x^5y + 590x^4y^2 + 19x^3y^3\\
- 12x^2y^4 - 12xy^5 + 2y^6 - a^3b^3
\end{multline}

p(x)=3x6+14x5y+590x4y2+19x3y3(57)12x2y412xy5+2y6a3b3

6、普通数学符号 $$

(58)7(59)8

\

\

$$

9、LaTex二元运算符

(60)⨿÷±×

10、AMS二元运算符 (61)⊲⊴⊳⊵

11、其他 (62)0Sq(X;G)ϕSq(X;G)ψSq(X;G)00Sq1(X;G)ϕSq1(X;G)ψSq1(X;G)0

(63)0GϕGψG0

(64)BCA3B1C1

$$x x \

$$