KaTeX数学公式整理

分隔符

⌈ ⌉ ⌈ ⌉ ⌈ ⌉ ⌈ \lceil \lceil ⌉ \rceil \rceil
↑ \uparrow \uparrow [ ] [ ] [] [ ] [ \lbrack [ \lbrack
] \rbrack ] \rbrack ⌊ ⌋ ⌊ ⌋ ⌊ ⌋ ⌊ \lfloor \lfloor
⌋ \rfloor \rfloor ↓ \downarrow \downarrow { } \{ \} {} \{ \}
{ \lbrace { \lbrace } \rbrace } \rbrace ⎰ ⎱ ⎰⎱ ⎰⎱
⎰ \lmoustache \lmoustache ⎱ \rmoustache \rmoustache ↕ \updownarrow \updownarrow
⟨ ⟩ ⟨ ⟩ ⟨ ⟩ ⟨ \langle \langle ⟩ \rangle \rangle
⟮ ⟯ ⟮ ⟯ ⟮ ⟯ ⟮ \lgroup \lgroup ⟯ \rgroup \rgroup
⇑ \Uparrow \Uparrow $ $ |
┌ ┐ ┌ ┐ ┌ ┐ ┌ \ulcorner \ulcorner ┐ \urcorner \urcorner
⇓ \Downarrow \Downarrow ∥ \| \| ∥ \Vert \Vert
└ ┘ └ ┘ └ ┘ └ \llcorner \llcorner ┘ \lrcorner \lrcorner
⇕ \Updownarrow \Updownarrow ∣ \lvert \lvert ∣ \rvert \rvert
∥ \lVert \lVert ∥ \rVert \rVert \ \backslash \ \backslash
⟨ \lang \lang ⟩ \rang \rang < > \lt \gt <> \lt \gt

希腊字母

A \Alpha A \Alpha B \Beta B \Beta Γ \Gamma Γ \Gamma
Δ \Delta Δ \Delta E \Epsilon E \Epsilon Z \Zeta Z \Zeta
H \Eta H \Eta Θ \Theta Θ \Theta I \Iota I \Iota
K \Kappa K \Kappa Λ \Lambda Λ \Lambda M \Mu M \Mu
N \Nu N \Nu Ξ \Xi Ξ \Xi O \Omicron O \Omicron
Π \Pi Π \Pi Σ \Sigma Σ \Sigma T \Tau T \Tau
Υ \Upsilon Υ \Upsilon Φ \Phi Φ \Phi X \Chi X \Chi
Ψ \Psi Ψ \Psi Ω \Omega Ω \Omega Γ \varGamma Γ \varGamma
Δ \varDelta Δ \varDelta Θ \varTheta Θ \varTheta Λ \varLambda Λ \varLambda
Ξ \varXi Ξ \varXi Π \varPi Π \varPi Σ \varSigma Σ \varSigma
Υ \varUpsilon Υ \varUpsilon Φ \varPhi Φ \varPhi Ψ \varPsi Ψ \varPsi
Ω \varOmega Ω \varOmega α \alpha α \alpha β \beta β \beta
γ \gamma γ \gamma δ \delta δ \delta ϵ \epsilon ϵ \epsilon
ζ \zeta ζ \zeta η \eta η \eta θ \theta θ \theta
ι \iota ι \iota κ \kappa κ \kappa λ \lambda λ \lambda
μ \mu μ \mu ν \nu ν \nu ξ \xi ξ \xi
ο \omicron ο \omicron π \pi π \pi ρ \rho ρ \rho
σ \sigma σ \sigma τ \tau τ \tau υ \upsilon υ \upsilon
ϕ \phi ϕ \phi χ \chi χ \chi ψ \psi ψ \psi
ω \omega ω \omega ε \varepsilon ε \varepsilon ϰ \varkappa ϰ \varkappa
ϑ \vartheta ϑ \vartheta ϑ \thetasym ϑ \thetasym ϖ \varpi ϖ \varpi
ϱ \varrho ϱ \varrho ς \varsigma ς \varsigma φ \varphi φ \varphi
ϝ \digamma ϝ \digamma

注解

5 \cancel{5} 5 \cancel{5} a + b + c ⏞ note \overbrace{a+b+c}^{\text{note}} a+b+c note \overbrace{a+b+c}^{\text{note}} 5 \bcancel{5} 5 \bcancel{5}
a + b + c ⎵ note \underbrace{a+b+c}_{\text{note}} note a+b+c \underbrace{a+b+c}_{\text{note}} A B C \xcancel{ABC} ABC \xcancel{ABC} ̸ = \not = ̸= \not =
a b c \sout{abc} abc \sout{abc} π = c d \boxed{\pi=\frac c d} π=dc \boxed{\pi=\frac c d}

\tag{hi} x+y^{2x}
(hi) x + y 2 x \tag{hi} x+y^{2x} x+y2x(hi)
\tag*{hi} x+y^{2x}
hi x + y 2 x \tag*{hi} x+y^{2x} x+y2xhi

垂直布局

x n x_n xn x_n = ! \stackrel{!}{=} =! \stackrel{!}{=} a b a \atop b ba a \atop b
e x e^x ex e^x = ! \overset{!}{=} =! \overset{!}{=} a b c a\raisebox{0.25em}{b}c abc a\raisebox{0.25em}{b}c
u o _u^o uo _u^o = ! \underset{!}{=} != \underset{!}{=}

重叠和间隙

= /   {=}\mathllap{/\,} =/ {=}\mathllap{/\,} ( x 2 ) \left(x^{\smash{2}}\right) (x2) \left(x^{\smash{2}}\right)   / = \mathrlap{\,/}{=} /= \mathrlap{\,/}{=}
y \sqrt{\smash[b]{y}} y \sqrt{\smash[b]{y}}

\sum_{\mathclap{1\le i\le j\le n}} x_{ij}
∑ 1 ≤ i ≤ j ≤ n x i j \sum_{\mathclap{1\le i\le j\le n}} x_{ij} 1ijnxij

逻辑和集合

∀ \forall \forall ∁ \complement \complement ∴ \therefore \therefore
∅ \emptyset \emptyset ∃ \exists \exists ⊂ \subset \subset
∵ \because \because ∅ \empty \empty ∃ \exist \exist
⊃ \supset \supset ↦ \mapsto \mapsto ∅ \varnothing \varnothing
∄ \nexists \nexists ∣ \mid \mid → \to \to
   ⟹    \implies \implies ∈ \in \in ∧ \land \land
← \gets \gets    ⟸    \impliedby \impliedby ∈ \isin \isin
∨ \lor \lor ↔ \leftrightarrow \leftrightarrow    ⟺    \iff \iff
∉ \notin / \notin ∋ \ni \ni ∌ \notni ̸ \notni
¬ \neg ¬ \neg ¬ \lnot ¬ \lnot

大运算符

∑ \sum \sum ∏ \prod \prod ⨂ \bigotimes \bigotimes
⋁ \bigvee \bigvee ∫ \int \int ∐ \coprod \coprod
⨁ \bigoplus \bigoplus ⋀ \bigwedge \bigwedge ∬ \iint \iint
∫ \intop \intop ⨀ \bigodot \bigodot ⋂ \bigcap \bigcap
∭ \iiint \iiint ∫ \smallint \smallint ⨄ \biguplus \biguplus
⋃ \bigcup \bigcup ∮ \oint \oint ∯ \oiint \oiint
∰ \oiiint \oiiint ⨆ \bigsqcup \bigsqcup

二元运算符

+ + + + ⋅ \cdot \cdot ⋗ \gtrdot \gtrdot
x ( m o d a ) x \pmod a x(moda) x \pmod a − - - ⋅ \cdotp \cdotp
⊺ \intercal \intercal x ( a ) x \pod a x(a) x \pod a / / / /
⋅ \centerdot \centerdot ∧ \land \land ⊳ \rhd \rhd
∗ * * ∘ \circ \circ ⋋ \leftthreetimes \leftthreetimes
⋌ \rightthreetimes \rightthreetimes ⨿ \amalg ⨿ \amalg ⊛ \circledast \circledast
. \ldotp . \ldotp ⋊ \rtimes \rtimes & \And & \And
⊚ \circledcirc \circledcirc ∨ \lor \lor ∖ \setminus \setminus
∗ \ast \ast ⊝ \circleddash \circleddash ⋖ \lessdot \lessdot
∖ \smallsetminus \smallsetminus ⊼ \barwedge \barwedge ⋓ \Cup \Cup
⊲ \lhd \lhd ⊓ \sqcap \sqcap ◯ \bigcirc \bigcirc
∪ \cup \cup ⋉ \ltimes \ltimes ⊔ \sqcup \sqcup
  m o d   \bmod mod \bmod ⋎ \curlyvee \curlyvee x m o d    a x\mod a xmoda x\mod a
× \times × \times ⊡ \boxdot \boxdot ⋏ \curlywedge \curlywedge
∓ \mp \mp ⊴ \unlhd \unlhd ⊟ \boxminus \boxminus
÷ \div ÷ \div ⊙ \odot \odot ⊵ \unrhd \unrhd
⊞ \boxplus \boxplus ⋇ \divideontimes \divideontimes ⊖ \ominus \ominus
⊎ \uplus \uplus ⊠ \boxtimes \boxtimes ∔ \dotplus \dotplus
⊕ \oplus \oplus ∨ \vee \vee ∙ \bullet \bullet
⩞ \doublebarwedge \doublebarwedge ⊗ \otimes \otimes ⊻ \veebar \veebar
⋒ \Cap \Cap ⋒ \doublecap \doublecap ⊘ \oslash \oslash
∧ \wedge \wedge ∩ \cap \cap ⋓ \doublecup \doublecup
± \pm ± \pm ± \plusmn ± \plusmn ≀ \wr \wr

分数和二项式

a b \frac{a}{b} ba \frac{a}{b} a b \tfrac{a}{b} ba \tfrac{a}{b} ( a a + 1 ] \genfrac ( ] {2pt}{1}a{a+1} (a+1a] \genfrac ( ] {2pt}{1}a{a+1}
a b {a \over b} ba {a \over b} a b \dfrac{a}{b} ba \dfrac{a}{b} a b + 1 {a \above{2pt} b+1} b+1a {a \above{2pt} b+1}
a / b a/b a/b a/b a 1 + 1 b \cfrac{a}{1 + \cfrac{1}{b}} 1+b1a \cfrac{a}{1 + \cfrac{1}{b}}
( n k ) \binom{n}{k} (kn) \binom{n}{k} ( n k ) \dbinom{n}{k} (kn) \dbinom{n}{k} \{ n k \} {n\brace k} {kn} {n\brace k}
( n k ) {n \choose k} (kn) {n \choose k} ( n k ) \tbinom{n}{k} (kn) \tbinom{n}{k} [ n k ] {n\brack k} [kn] {n\brack k}

数学运算符

arcsin ⁡ \arcsin arcsin \arcsin cotg ⁡ \cotg cotg \cotg ln ⁡ \ln ln \ln
det ⁡ \det det \det arccos ⁡ \arccos arccos \arccos coth ⁡ \coth coth \coth
log ⁡ \log log \log gcd ⁡ \gcd gcd \gcd arctan ⁡ \arctan arctan \arctan
csc ⁡ \csc csc \csc sec ⁡ \sec sec \sec inf ⁡ \inf inf \inf
arctg ⁡ \arctg arctg \arctg ctg ⁡ \ctg ctg \ctg sin ⁡ \sin sin \sin
lim ⁡ \lim lim \lim arcctg ⁡ \arcctg arcctg \arcctg cth ⁡ \cth cth \cth
sinh ⁡ \sinh sinh \sinh lim inf ⁡ \liminf liminf \liminf arg ⁡ \arg arg \arg
deg ⁡ \deg deg \deg sh ⁡ \sh sh \sh lim sup ⁡ \limsup limsup \limsup
ch ⁡ \ch ch \ch dim ⁡ \dim dim \dim tan ⁡ \tan tan \tan
max ⁡ \max max \max cos ⁡ \cos cos \cos exp ⁡ \exp exp \exp
tanh ⁡ \tanh tanh \tanh min ⁡ \min min \min cosec ⁡ \cosec cosec \cosec
hom ⁡ \hom hom \hom tg ⁡ \tg tg \tg Pr ⁡ \Pr Pr \Pr
cosh ⁡ \cosh cosh \cosh ker ⁡ \ker ker \ker th ⁡ \th th \th
sup ⁡ \sup sup \sup cot ⁡ \cot cot \cot lg ⁡ \lg lg \lg
f ⁡ \operatorname{f} f \operatorname{f} arg ⁡ m a x \arg max argmax \arg max arg ⁡ m i n \arg min argmin \arg min

sqrt

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

关系

= = = = ≖ \eqcirc \eqcirc ⋚ \lesseqgtr \lesseqgtr
⊐ \sqsupset \sqsupset < < < < − : \eqcolon : \eqcolon
⪋ \lesseqqgtr \lesseqqgtr ⊒ \sqsupseteq \sqsupseteq > > > >
− : : \Eqcolon :: \Eqcolon ≶ \lessgtr \lessgtr ⋐ \Subset \Subset
: : : : = : \eqqcolon =: \eqqcolon ≲ \lesssim \lesssim
⊂ \subset \subset ⊂ \sub \sub ≈ \approx \approx
= : : \Eqqcolon =:: \Eqqcolon ≪ \ll \ll ⊆ \subseteq \subseteq
⊆ \sube \sube ≊ \approxeq \approxeq ≂ \eqsim \eqsim
⋘ \lll \lll ⫅ \subseteqq \subseteqq ≍ \asymp \asymp
⪖ \eqslantgtr \eqslantgtr ⋘ \llless \llless ≻ \succ \succ
∍ \backepsilon \backepsilon ⪕ \eqslantless \eqslantless < \lt < \lt
⪸ \succapprox \succapprox ∽ \backsim \backsim ≡ \equiv \equiv
∣ \mid \mid ≽ \succcurlyeq \succcurlyeq ⋍ \backsimeq \backsimeq
≒ \fallingdotseq \fallingdotseq ⊨ \models \models ⪰ \succeq \succeq
≬ \between \between ⌢ \frown \frown ⊸ \multimap \multimap
≿ \succsim \succsim ⋈ \bowtie \bowtie ≥ \ge \ge
∋ \owns \owns ⋑ \Supset \Supset ≏ \bumpeq \bumpeq
≥ \geq \geq ∥ \parallel \parallel ⊃ \supset \supset
≎ \Bumpeq \Bumpeq ≧ \geqq \geqq ⊥ \perp \perp
⊇ \supseteq \supseteq ⊇ \supe \supe ≗ \circeq \circeq
⩾ \geqslant \geqslant ⋔ \pitchfork \pitchfork ⫆ \supseteqq \supseteqq
: ≈ \colonapprox : \colonapprox ≫ \gg \gg ≺ \prec \prec
≈ \thickapprox \thickapprox : : ≈ \Colonapprox :: \Colonapprox ⋙ \ggg \ggg
⪷ \precapprox \precapprox ∼ \thicksim \thicksim : − \coloneq : \coloneq
⋙ \gggtr \gggtr ≼ \preccurlyeq \preccurlyeq ⊴ \trianglelefteq \trianglelefteq
: : − \Coloneq :: \Coloneq > \gt > \gt ⪯ \preceq \preceq
≜ \triangleq \triangleq : = \coloneqq := \coloneqq ⪆ \gtrapprox \gtrapprox
≾ \precsim \precsim ⊵ \trianglerighteq \trianglerighteq : : = \Coloneqq ::= \Coloneqq
⋛ \gtreqless \gtreqless ∝ \propto \propto ∝ \varpropto \varpropto
: ∼ \colonsim : \colonsim ⪌ \gtreqqless \gtreqqless ≓ \risingdotseq \risingdotseq
△ \vartriangle \vartriangle : : ∼ \Colonsim :: \Colonsim ≷ \gtrless \gtrless
∣ \shortmid \shortmid ⊲ \vartriangleleft \vartriangleleft ≅ \cong \cong
≳ \gtrsim \gtrsim ∥ \shortparallel \shortparallel ⊳ \vartriangleright \vartriangleright
⋞ \curlyeqprec \curlyeqprec ∈ \in \in ∈ \isin \isin
∼ \sim \sim : \vcentcolon : \vcentcolon ⋟ \curlyeqsucc \curlyeqsucc
⋈ \Join \Join ≃ \simeq \simeq ⊢ \vdash \vdash
⊣ \dashv \dashv ≤ \le \le ⌢ \smallfrown \smallfrown
⊨ \vDash \vDash : : \dblcolon :: \dblcolon ≤ \leq \leq
⌣ \smallsmile \smallsmile ⊩ \Vdash \Vdash ≐ \doteq \doteq
≦ \leqq \leqq ⌣ \smile \smile ⊪ \Vvdash \Vvdash
≑ \Doteq \Doteq ⩽ \leqslant \leqslant ⊏ \sqsubset \sqsubset
≑ \doteqdot \doteqdot ⪅ \lessapprox \lessapprox ⊑ \sqsubseteq \sqsubseteq

否定关系

⪊ \gnapprox \gnapprox  \ngeqslant \ngeqslant ⊈ \nsubseteq \nsubseteq
⪵ \precneqq \precneqq ⪈ \gneq \gneq ≯ \ngtr \ngtr
 \nsubseteqq \nsubseteqq ⋨ \precnsim \precnsim ≩ \gneqq \gneqq
≰ \nleq \nleq ⊁ \nsucc \nsucc ⊊ \subsetneq \subsetneq
⋧ \gnsim \gnsim  \nleqq \nleqq ⋡ \nsucceq \nsucceq
⫋ \subsetneqq \subsetneqq  \gvertneqq \gvertneqq  \nleqslant \nleqslant
⊉ \nsupseteq \nsupseteq ⪺ \succnapprox \succnapprox ⪉ \lnapprox \lnapprox
≮ \nless \nless  \nsupseteqq \nsupseteqq ⪶ \succneqq \succneqq
⪇ \lneq \lneq ∤ \nmid \nmid ⋪ \ntriangleleft \ntriangleleft
⋩ \succnsim \succnsim ≨ \lneqq \lneqq ∉ \notin / \notin
⋬ \ntrianglelefteq \ntrianglelefteq ⊋ \supsetneq \supsetneq ⋦ \lnsim \lnsim
∌ \notni ̸ \notni ⋫ \ntriangleright \ntriangleright ⫌ \supsetneqq \supsetneqq
 \lvertneqq \lvertneqq ∦ \nparallel \nparallel ⋭ \ntrianglerighteq \ntrianglerighteq
 \varsubsetneq \varsubsetneq ≆ \ncong \ncong ⊀ \nprec \nprec
⊬ \nvdash \nvdash  \varsubsetneqq \varsubsetneqq ≠ \ne ̸= \ne
⋠ \npreceq \npreceq ⊭ \nvDash \nvDash  \varsupsetneq \varsupsetneq
≠ \neq ̸= \neq  \nshortmid \nshortmid ⊯ \nVDash \nVDash
 \varsupsetneqq \varsupsetneqq ≱ \ngeq \ngeq  \nshortparallel \nshortparallel
⊮ \nVdash \nVdash  \ngeqq \ngeqq ≁ \nsim \nsim
⪹ \precnapprox \precnapprox

箭头

↺ \circlearrowleft \circlearrowleft ↼ \leftharpoonup \leftharpoonup ⇒ \rArr \rArr
↻ \circlearrowright \circlearrowright ⇇ \leftleftarrows \leftleftarrows → \rarr \rarr
↶ \curvearrowleft \curvearrowleft ↔ \leftrightarrow \leftrightarrow ↾ \restriction \restriction
↷ \curvearrowright \curvearrowright ⇔ \Leftrightarrow \Leftrightarrow → \rightarrow \rightarrow
⇓ \Darr \Darr ⇆ \leftrightarrows \leftrightarrows ⇒ \Rightarrow \Rightarrow
⇓ \dArr \dArr ⇋ \leftrightharpoons \leftrightharpoons ↣ \rightarrowtail \rightarrowtail
↓ \darr \darr ↭ \leftrightsquigarrow \leftrightsquigarrow ⇁ \rightharpoondown \rightharpoondown
⇠ \dashleftarrow \dashleftarrow ⇚ \Lleftarrow \Lleftarrow ⇀ \rightharpoonup \rightharpoonup
⇢ \dashrightarrow \dashrightarrow ⟵ \longleftarrow \longleftarrow ⇄ \rightleftarrows \rightleftarrows
↓ \downarrow \downarrow ⟸ \Longleftarrow \Longleftarrow ⇌ \rightleftharpoons \rightleftharpoons
⇓ \Downarrow \Downarrow ⟷ \longleftrightarrow \longleftrightarrow ⇉ \rightrightarrows \rightrightarrows
⇊ \downdownarrows \downdownarrows ⟺ \Longleftrightarrow \Longleftrightarrow ⇝ \rightsquigarrow \rightsquigarrow
⇃ \downharpoonleft \downharpoonleft ⟼ \longmapsto \longmapsto ⇛ \Rrightarrow \Rrightarrow
⇂ \downharpoonright \downharpoonright ⟶ \longrightarrow \longrightarrow ↱ \Rsh \Rsh
← \gets \gets ⟹ \Longrightarrow \Longrightarrow ↘ \searrow \searrow
⇔ \Harr \Harr ↫ \looparrowleft \looparrowleft ↙ \swarrow \swarrow
⇔ \hArr \hArr ↬ \looparrowright \looparrowright → \to \to
↔ \harr \harr ⇔ \Lrarr \Lrarr ↞ \twoheadleftarrow \twoheadleftarrow
↩ \hookleftarrow \hookleftarrow ⇔ \lrArr \lrArr ↠ \twoheadrightarrow \twoheadrightarrow
↪ \hookrightarrow \hookrightarrow ↔ \lrarr \lrarr ⇑ \Uarr \Uarr
   ⟺    \iff \iff ↰ \Lsh \Lsh ⇑ \uArr \uArr
   ⟸    \impliedby \impliedby ↦ \mapsto \mapsto ↑ \uarr \uarr
   ⟹    \implies \implies ↗ \nearrow \nearrow ↑ \uparrow \uparrow
⇐ \Larr \Larr ↚ \nleftarrow \nleftarrow ⇑ \Uparrow \Uparrow
⇐ \lArr \lArr ⇍ \nLeftarrow \nLeftarrow ↕ \updownarrow \updownarrow
← \larr \larr ↮ \nleftrightarrow \nleftrightarrow ⇕ \Updownarrow \Updownarrow
⇝ \leadsto \leadsto ⇎ \nLeftrightarrow \nLeftrightarrow ↿ \upharpoonleft \upharpoonleft
← \leftarrow \leftarrow ↛ \nrightarrow \nrightarrow ↾ \upharpoonright \upharpoonright
⇐ \Leftarrow \Leftarrow ⇏ \nRightarrow \nRightarrow ⇈ \upuparrows \upuparrows
↢ \leftarrowtail \leftarrowtail ↖ \nwarrow \nwarrow ↽ \leftharpoondown \leftharpoondown
⇒ \Rarr \Rarr

箭头拓展

← a b c \xleftarrow{abc} abc \xleftarrow{abc} → u n d e r o v e r \xrightarrow[under]{over} over under \xrightarrow[under]{over} ⇐ a b c \xLeftarrow{abc} abc \xLeftarrow{abc}
⇒ a b c \xRightarrow{abc} abc \xRightarrow{abc} ↔ a b c \xleftrightarrow{abc} abc \xleftrightarrow{abc} ⇔ a b c \xLeftrightarrow{abc} abc \xLeftrightarrow{abc}
↩ a b c \xhookleftarrow{abc} abc \xhookleftarrow{abc} ↪ a b c \xhookrightarrow{abc} abc \xhookrightarrow{abc} ↞ a b c \xtwoheadleftarrow{abc} abc \xtwoheadleftarrow{abc}
↠ a b c \xtwoheadrightarrow{abc} abc \xtwoheadrightarrow{abc} ↼ a b c \xleftharpoonup{abc} abc \xleftharpoonup{abc} ⇀ a b c \xrightharpoonup{abc} abc \xrightharpoonup{abc}
↽ a b c \xleftharpoondown{abc} abc \xleftharpoondown{abc} ⇁ a b c \xrightharpoondown{abc} abc \xrightharpoondown{abc} ⇋ a b c \xleftrightharpoons{abc} abc \xleftrightharpoons{abc}
⇌ a b c \xrightleftharpoons{abc} abc \xrightleftharpoons{abc} ⇄ a b c \xtofrom{abc} abc \xtofrom{abc} ↦ a b c \xmapsto{abc} abc \xmapsto{abc}
= a b c \xlongequal{abc} abc \xlongequal{abc}

颜色

F = m a \color{blue} F=ma F=ma \color{blue} F=ma

F = m a \textcolor{#228B22}{F=ma} F=ma \textcolor{#228B22}{F=ma}

A \colorbox{aqua}{A} A \colorbox{aqua}{A}

A \fcolorbox{red}{aqua}{A} A \fcolorbox{red}{aqua}{A}

字体

A b 0 \mathrm{Ab0} Ab0 \mathrm{Ab0} A b 0 \mathbf{Ab0} Ab0 \mathbf{Ab0} A b \mathit{Ab} Ab \mathit{Ab}
$ A B 0 \mathcal{AB0} AB0 \mathcal{AB0} Ab0 \textbf{Ab0} Ab0 \textbf{Ab0} Ab \textit{Ab} Ab \textit{Ab}
Ab0 \textrm{Ab0} Ab0 \textrm{Ab0} A b 0 \bf Ab0 Ab0 \bf Ab0 A b \it Ab Ab \it Ab
A b 0 \rm Ab0 Ab0 \rm Ab0 A b 0 \bold{Ab0} Ab0 \bold{Ab0} A B \Bbb{AB} AB \Bbb{AB}
Ab0 \textnormal{Ab0} Ab0 \textnormal{Ab0} A b \boldsymbol{Ab} Ab \boldsymbol{Ab} A B \mathbb{AB} AB \mathbb{AB}
Ab0 \text{Ab0} Ab0 \text{Ab0} A b \bm{Ab} Ab \bm{Ab} A b 0 \frak{Ab0} Ab0 \frak{Ab0}
A b 0 \mathsf{Ab0} Ab0 \mathsf{Ab0} A b 0 \mathtt{Ab0} Ab0 \mathtt{Ab0} A b 0 \mathfrak{Ab0} Ab0 \mathfrak{Ab0}
Ab0 \textsf{Ab0} Ab0 \textsf{Ab0} Ab0 \texttt{Ab0} Ab0 \texttt{Ab0}

大小

A B \Huge AB AB \Huge AB A B \normalsize AB AB \normalsize AB
A B \huge AB AB \huge AB A B \small AB AB \small AB
A B \LARGE AB AB \LARGE AB A B \footnotesize AB AB \footnotesize AB
A B \Large AB AB \Large AB A B \scriptsize AB AB \scriptsize AB
A B \large AB AB \large AB A B \tiny AB AB \tiny AB

风格

∑ i = 1 n \displaystyle\sum_{i=1}^n i=1n \displaystyle\sum_{i=1}^n ∑ i = 1 n \textstyle\sum_{i=1}^n i=1n \textstyle\sum_{i=1}^n
x \scriptstyle x x \scriptstyle x x \scriptscriptstyle x x \scriptscriptstyle x
lim ⁡ x \lim\limits_x xlim \lim\limits_x lim ⁡ x \lim\nolimits_x limx \lim\nolimits_x
x^2 \verb!x^2! x^2 \verb!x^2!

符号和标点

% comment % comment … \dots \dots KaTeX \KaTeX KATEX \KaTeX
% \% % \% ⋯ \cdots \cdots LaTeX \LaTeX LATEX \LaTeX
# \# # \# ⋱ \ddots \ddots TeX \TeX TEX \TeX
& \& & \& … \ldots \ldots ∇ \nabla \nabla
_ \_ _ \_ ⋮ \vdots \vdots ∞ \infty \infty
_ \text{\textunderscore} _ \text{\textunderscore} ⋯ \dotsb \dotsb ∞ \infin \infin
– \text{--} \text{--} … \dotsc \dotsc ✓ \checkmark \checkmark
– \text{\textendash} \text{\textendash} ​ ⋯ \dotsi \dotsi † \dag \dag
— \text{---} \text{---} ⋯ \dotsm \dotsm † \dagger \dagger
— \text{\textemdash} \text{\textemdash} … \dotso \dotso † \text{\textdagger} \text{\textdagger}
~ \text{\textasciitilde} ~ \text{\textasciitilde} ⋅ \sdot \sdot ‡ \ddag \ddag
‡ \text{\textdaggerdbl} \text{\textdaggerdbl} … \mathellipsis \mathellipsis ‡ \ddagger \ddagger
… \text{\textellipsis} \text{\textellipsis} □ \Box \Box ‡ \Dagger \Dagger
‘ \lq \lq □ \square \square ∠ \angle \angle
’ \text{\textquoteright} \text{\textquoteright} ■ \blacksquare \blacksquare ∡ \measuredangle \measuredangle
′ \rq \rq △ \triangle \triangle ∢ \sphericalangle \sphericalangle
“ \text{\textquotedblleft} \text{\textquotedblleft} ▽ \triangledown \triangledown ⊤ \top \top
" " " " ◃ \triangleleft \triangleleft ⊥ \bot \bot
” \text{\textquotedblright} \text{\textquotedblright} ▹ \triangleright \triangleright $$$ \$
​ : \colon : \colon ▽ \bigtriangledown \bigtriangledown $ \text{\textdollar} $ \text{\textdollar}
‵ \backprime \backprime △ \bigtriangleup \bigtriangleup £ \pounds £ \pounds
′ \prime \prime ▲ \blacktriangle \blacktriangle £ \mathsterling £ \mathsterling
< \text{\textless} < \text{\textless} ▼ \blacktriangledown \blacktriangledown £ \text{\textsterling} £ \text{\textsterling}
> \text{\textgreater} > \text{\textgreater} ◀ \blacktriangleleft \blacktriangleleft ¥ \yen ¥ \yen
| \text{\textbar} | \text{\textbar} ▶ \blacktriangleright \blacktriangleright √ \surd \surd
∥ \text{\textbardbl} \text{\textbardbl} ⋄ \diamond \diamond ° \degree ° \degree
{ \text{\textbraceleft} { \text{\textbraceleft} ◊ \Diamond \Diamond ° \text{\textdegree} ° \text{\textdegree}
} \text{\textbraceright} } \text{\textbraceright} ◊ \lozenge \lozenge ℧ \mho \mho
✠ \maltese \maltese ⧫ \blacklozenge \blacklozenge ╲ \diagdown \diagdown
¶ \text{\P} \text{\P} ⋆ \star \star ╱ \diagup \diagup
§ \text{\S} § \text{\S} ★ \bigstar \bigstar ♭ \flat \flat
§ \text{\sect} § \text{\sect} ♣ \clubsuit \clubsuit ♮ \natural \natural
© \copyright c \copyright ♣ \clubs \clubs ♯ \sharp \sharp
® \circledR ® \circledR ♢ \diamondsuit \diamondsuit ♡ \heartsuit \heartsuit
® \text{\textregistered} R \text{\textregistered} ♢ \diamonds \diamonds ♡ \hearts \hearts
Ⓢ \circledS \circledS ♠ \spadesuit \spadesuit ♠ \spades \spades
a ◯ \text{\textcircled a} a \text{\textcircled a}

参考:https://katex.org/docs/supported.html#math-operators

表格转化:

from bs4 import BeautifulSoup

num = 3

html = open('html.txt', encoding='utf-8')
soup = BeautifulSoup(html, "lxml")
all_code = soup.find_all('code')
codes = list(map(lambda x: x.get_text(strip=True), all_code))

for i in range(len(codes)//num+1):
    code_list = list(map(lambda x: ' ${0}$ `{0}` '.format(x), codes[i*num:(i+1)*num]))
    print('|'.join(code_list))
    if i == 0:
        print('|:--:|:--:|:--:|:--:|')

你可能感兴趣的:(工具类)