主頁 > 前端設計 > 【博客工具】typora中的數學公式(字典型,用時查閱)

【博客工具】typora中的數學公式(字典型,用時查閱)

2021-03-08 10:24:15 前端設計

文章目錄

      • LaTeX編輯數學公式基本語法元素
        • 1. 各類希臘字母表
        • 2. 如何輸入括號和分隔符
        • 3. 三角運算子
        • 4. 微積分運算子
        • 5. 邏輯運算子
        • 6. 上下標
        • 7. 根號
        • 8. 省略號
        • 9. 運算子
        • 10. 分數
        • 11. 矩陣和行列式
        • 12. 行列式
        • 13. 如何輸入帶分割符號的矩陣
        • 14. 如何輸入向量
        • 15. 如何輸入積分
        • 16. 如何進行字體轉換
        • 17. 如何高亮一行公式
        • 18. 更改文字顏色
        • 19. 添加洗掉線
        • 20. 包圍公式
        • 21. 箭頭
        • 22. 方程式
        • 23. 分隔符
        • 24. 分段函式
        • 25. 如何輸入一個左側對齊的條件運算式
        • 26. 方程組
        • 27. 如何使條件運算式適配行高
        • 28. 陣列與表格使用參考之如何輸入一個陣列或表格
        • 29. 陣列與表格使用參考之如何輸入一個嵌套的陣列或表格
      • 案例
        • 1. 線性模型
        • 2. 均方誤差
        • 3. 批量梯度下降
        • 4. 推導程序
      • 參考檔案

注意:有一些公式在csdn中無法顯示,但是在typora中可以顯示出來,可以自己在本地上的typora上使用體驗一下

LaTeX編輯數學公式基本語法元素

LaTeX中數學模式有兩種形式:inline和display,前者是指正文插入行間數學公式,后者獨立排列,可以有或沒有編號,

行間公式(inline):用 $...$ 將公式括起來
塊間公式(display):用 $$...$$ 將公式括起來,默認顯示在行中間

1. 各類希臘字母表

希臘字母代號希臘字母代號希臘字母代號希臘字母代號
α\alphaθ\thetaooτ\tau
β\beta?\varthetaπ\piυ\upsilon
γ\gammaι\iota?\varpi?\phi
δ\deltaκ\kappaρ\rhoφ\varphi
?\epsilonλ\lambda?\varrhoχ\chi
ε\varepsilonμ\muσ\sigmaψ\psi
ζ\zetaν\nu?\varsigmaω\omega
η\etaξ\xiΣ\SigmaΨ\Psi
Γ\GammaΛ\LambdaΥ\UpsilonΩ\Omega
Δ\DeltaΞ\XiΦ\Phi
Θ\ThetaΠ\Pi

2. 如何輸入括號和分隔符

()[]| 表示符號本身,使用 \{\} 來表示 {} ,當要顯示大號的括號或分隔符時,要用 \left\right 命令,

一些特殊的括號:

輸入顯示輸入顯示
\langle ? \langle ?\rangle ? \rangle ?
\lceil ? \lceil ?\rceil ? \rceil ?
\lfloor ? \lfloor ?\rfloor ? \rfloor ?
\lbrace { \lbrace {\rbrace } \rbrace }
\lvert ∣ \lvert \rvert ∣ \rvert
\lVert ∥ \lVert \rVert ∥ \rVert

有時,我們需要在行內使用兩個豎杠表示向量間的某種空間距離,可以這樣寫
$\lVert \boldsymbol{X}_i - \boldsymbol{S}_j \rVert^2$ ∥ X i ? S j ∥ 2 \lVert \boldsymbol{X}_i - \boldsymbol{S}_j \rVert^2 Xi??Sj?2

示例

$$ 
f(x,y,z) = 3y^2z \left( 3+\frac{7x+5}{1+y^2} \right) 
$$

結果
f ( x , y , z ) = 3 y 2 z ( 3 + 7 x + 5 1 + y 2 ) f(x,y,z) = 3y^2z \left( 3+\frac{7x+5}{1+y^2} \right) f(x,y,z)=3y2z(3+1+y27x+5?)

有時要用 \left.\right. 進行匹配而不顯示本身,

示例

$$
\left. \frac{{\rm d}u}{{\rm d}x} \right| _{x=0} 
$$

結果
d u d x ∣ x = 0 \left. \frac{{\rm d}u}{{\rm d}x} \right| _{x=0} dxdu??x=0?

3. 三角運算子

輸入顯示輸入顯示輸入顯示
\backsim ∽ \backsim \cong ? \cong ?\angle A ∠ A \angle A A
\sin sin ? \sin sin\cos cos ? \cos cos\tan tan ? \tan tan
\csc csc ? \csc csc\sec sec ? \sec sec\cot cot ? \cot cot

4. 微積分運算子

輸入顯示輸入顯示輸入顯示
\int ∫ \int \iint ? \iint ?\iiint ? \iiint ?
\partial ? \partial ?\oint ∮ \oint \prime ′ \prime
\lim lim ? \lim lim\infty ∞ \infty \nabla ? \nabla ?

5. 邏輯運算子

輸入顯示輸入顯示輸入顯示
\because ∵ \because \therefore ∴ \therefore \neg ? \neg ?
\forall ? \forall ?\exists ? \exists ?\not\subset ?? \not\subset ??
\not< <? \not< ?<\not> >? \not> ?>\not= =? \not= ?=

6. 上下標

下標:$x_i$ x i x_i xi?

上標:$x^i$ x i x^i xi

注意 :上下標如果多余一個字母或者符號,需要用一對{}括起來:

多個字母下標:$x_{i1}$ x i 1 x_{i1} xi1?

多個字母上標:$x^{i1}$ x i 1 x^{i1} xi1

另外,如果要在左右兩邊都有上下標,可以使用 \sideset 命令;也可以簡單地在符號前面多打一個上下標,此時會以行內公式渲染,

示例:

$$
\sideset{^1_2}{^3_4}\bigotimes \quad or \quad {^1_2}\bigotimes {^3_4} 
$$

結果
KaTeX parse error: Undefined control sequence: \sideset at position 2: \?s?i?d?e?s?e?t?{^1_2}{^3_4} \b…

7. 根號

根號:$\sqrt[n]{5}$ 5 n \sqrt[n]{5} n5 ?

8. 省略號

省略號:$\dots$ … \dots || $\cdots$ ? \cdots ?

9. 運算子

基本運算子:+ - * /等可以直接輸入,其他特殊的有:

\pm\times\div\cdot\cap\cup\geq\leq\neq\approx\equix
±×÷? ≠ \neq ?=

求和:$\sum_1^n$ ∑ 1 n \sum_1^n 1n?

累乘:$\prod_{n=1}^{99}x_n$ ∏ n = 1 99 x n \prod_{n=1}^{99}x_n n=199?xn?

積分:$\int_1^n$ ∫ 1 n \int_1^n 1n?

極限:$\lim\limits _ {x \to \infty}$ lim ? x → ∞ \lim\limits _ {x \to \infty} xlim?

10. 分數

分數的表示:$\frac{3}{8}$ 3 8 \frac{3}{8} 83?

11. 矩陣和行列式

示例

$$
\begin{matrix}
1&x&x^2\\
1&y&y^2\\
1&z&z^2\\
\end{matrix}
$$

結果
1 x x 2 1 y y 2 1 z z 2 \begin{matrix} 1&x&x^2\\ 1&y&y^2\\ 1&z&z^2\\ \end{matrix} 111?xyz?x2y2z2?

12. 行列式

使用 \cdots , \ddots , \vdots 來輸入省略符號,

示例:

$$
X=\left|
	\begin{matrix}
	x_{11} & x_{12} & \cdots & x_{1d}\\
	x_{21} & x_{22} & \cdots & x_{2d}\\
	\vdots & \vdots & \ddots & \vdots\\
	x_{m1} & x_{m2} & \cdots & x_{md} \\
    \end{matrix}
    \right|
$$

結果
X = ∣ x 11 x 12 ? x 1 d x 21 x 22 ? x 2 d ? ? ? ? x m 1 x m 2 ? x m d ∣ X=\left| \begin{matrix} x_{11} & x_{12} & \cdots & x_{1d}\\ x_{21} & x_{22} & \cdots & x_{2d}\\ \vdots & \vdots & \ddots & \vdots\\ x_{m1} & x_{m2} & \cdots & x_{md} \\ \end{matrix} \right| X=?x11?x21??xm1??x12?x22??xm2???????x1d?x2d??xmd???

在開頭將 matrix 替換為 pmatrix bmatrix Bmatrix vmatrix Vmatrix

示例

$ \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} $

結果

matrixpmatrixbmatrixBmatrixvmatrixVmatrix
$ \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} $

13. 如何輸入帶分割符號的矩陣

示例

$$
\left[    
    \begin{array}{cc|c}        
        1 & 2 & 3 \\        
        4 & 5 & 6 \\    
    \end{array}
\right]
$$

結果
[ 1 2 3 4 5 6 ] \left[ \begin{array}{cc|c} 1 & 2 & 3 \\ 4 & 5 & 6 \\ \end{array}\right] [14?25?36?]

其中 cc|c 代表在一個三列矩陣中的第二和第三列之間插入分割線,

14. 如何輸入向量

使用 \vec{向量} 來自動產生一個向量,也可以使用 \overrightarrow 等命令自定義字母上方的符號,

示例

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

結果
a ? ? b ? = 0 \vec{a} \cdot \vec{b}=0 a ?b =0
示例

$$ 
xy \text{ with arrows:} 
\quad 
\overleftarrow{xy} \;
\mid \;
\overleftrightarrow{xy} \;
\mid \;
\overrightarrow{xy} 
$$

結果
x y with arrows: x y ← ?? ∣ ?? x y ? ?? ∣ ?? x y → xy \text{ with arrows:} \quad \overleftarrow{xy} \; \mid \; \overleftrightarrow{xy} \; \mid \; \overrightarrow{xy} xy with arrows:xy ?xy ?xy ?

15. 如何輸入積分

使用 \int_積分下限^積分上限 {被積運算式} 來輸入一個積分,

示例

$$
\int_0^1 {x^2} \,{\rm d}x 
$$

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

本例中 \,{\rm d} 部分可省略,但加入能使式子更美觀

16. 如何進行字體轉換

若要對公式的某一部分字符進行字體轉換,可以用 {\字體 {需轉換的部分字符}} 命令,其中 \字體 部分可以參照下表選擇合適的字體,一般情況下,公式默認為斜體字 ,

示例中 全部大寫 的字體僅大寫可用,

輸入全字母可用顯示輸入僅大寫可用顯示
\rm羅馬體 s a m p l e \rm {sample} sample\mathcal花體(數學符號等) s a m p l e \mathcal {sample} sample
\it斜體 s a m p l e \it {sample} sample\mathbb黑板粗體(定義域等) s a m p l e \mathbb {sample} sample
\bf粗體 s a m p l e \bf {sample} sample\mit數學斜體KaTeX parse error: Undefined control sequence: \mit at position 1: \?m?i?t? ?{sample}
\sf等線體 s a m p l e \sf {sample} sample\scr手寫體KaTeX parse error: Undefined control sequence: \scr at position 1: \?s?c?r? ?{sample}
\tt打字機體 s a m p l e \tt {sample} sample
\frak舊德式字體 s a m p l e \frak {sample} sample

@lymd \boldsymbol{\alpha} 用來表示向量或者矩陣的加粗斜體,如向量 ,

轉換字體十分常用,例如在積分中:

示例

\begin{array}{cc}
    \mathrm{Bad} & \mathrm{Better} \\    
    \hline \\    
    \int_0^1 x^2 dx & \int_0^1 x^2 \,{\rm d}x
\end{array}

結果

B a d B e t t e r ∫ 0 1 x 2 d x ∫ 0 1 x 2 ? d x \begin{array}{cc} \mathrm{Bad} & \mathrm{Better} \\ \hline \\ \int_0^1 x^2 dx & \int_0^1 x^2 \,{\rm d}x\end{array} Bad01?x2dx?Better01?x2dx??
注意比較兩個式子間 與 的不同,
使用 \operatorname 命令也可以達到相同的效果,

17. 如何高亮一行公式

使用 \bbox[底色, (可選)邊距, (可選)邊框 border: 框寬度 框型別 框顏色] 命令來高亮一行公式,
邊距及框寬度支持 絕對像素 px相對大小 em,框型別支持 實線 solid虛線 dashed

示例

$$
\bbox[yellow]{    e^x=\lim_{n\to\infty} \left( 1+\frac{x}{n} \right)^n \qquad (1)}
$$

結果
KaTeX parse error: Undefined control sequence: \bbox at position 2: \?b?b?o?x?[yellow]{ e^…
示例

$$
\bbox[#9ff, 5px]{ #此處向外添加 5 像素的邊距    
e^x=\lim_{n\to\infty} \left( 1+\frac{x}{n} \right)^n \qquad (1)}
$$

結果
KaTeX parse error: Undefined control sequence: \bbox at position 2: \?b?b?o?x?[#9ff, 5px]{e^x…

示例

$$
#此處使用 0.5 倍行高作為邊距,附加 2 像素的實線邊框(Ctrl+Alt+Y 可見)
\bbox[#2f3542, 0.5em, border:2px solid #f1f2f6]{    \color{#f1f2f6}{e^x=\lim_{n\to\infty} \left( 1+\frac{x}{n} \right)^n \qquad (1)}}
$$

結果
KaTeX parse error: Undefined control sequence: \bbox at position 2: \?b?b?o?x?[#2f3542, 0.5em…

18. 更改文字顏色

使用 \color{顏色}{文字} 來更改特定的文字顏色,

更改文字顏色需要瀏覽器支持 ,如果瀏覽器不知道你所需的顏色,那么文字將被渲染為黑色,對于較舊的瀏覽器(HTML4 & CSS2),以下顏色是被支持的:

輸入顯示輸入顯示
black s a m p l e \color{black}{sample} samplegrey s a m p l e \color{grey}{sample} sample
silver s a m p l e \color{silver}{sample} samplewhite s a m p l e \color{white}{sample} sample
maroon s a m p l e \color{maroon}{sample} samplered s a m p l e \color{red}{sample} sample
yellow s a m p l e \color{yellow}{sample} samplelime s a m p l e \color{lime}{sample} sample
olive s a m p l e \color{olive}{sample} samplegreen s a m p l e \color{green}{sample} sample
teal s a m p l e \color{teal}{sample} sampleauqa s a m p l e \color{auqa}{sample} sample
blue s a m p l e \color{blue}{sample} samplenavy s a m p l e \color{navy}{sample} sample
purple s a m p l e \color{purple}{sample} samplefuchsia s a m p l e \color{fuchsia}{sample} sample

對于較新的瀏覽器(HTML5 & CSS3),HEX 顏色將被支持:

輸入 \color {#rgb} {text} 來自定義更多的顏色,其中 #rgb#rrggbbr g b 可輸入 0-9a-f 來表示紅色、綠色和藍色的純度(飽和度),

示例

\begin{array}
    {|rrrrrrrr|}
    \hline
    \verb+#000+ & \color{#000}{text} & & &    \verb+#00F+ & \color{#00F}{text} & & \\
    & & \verb+#0F0+ & \color{#0F0}{text} &    & & \verb+#0FF+ & \color{#0FF}{text} \\
    \verb+#F00+ & \color{#F00}{text} & & &    \verb+#F0F+ & \color{#F0F}{text} & & \\
    & & \verb+#FF0+ & \color{#FF0}{text} &    & & \verb+#FFF+ & \color{#FFF}{text} \\
    \hline
\end{array}

結果
#000 t e x t #00F t e x t #0F0 t e x t #0FF t e x t #F00 t e x t #F0F t e x t #FF0 t e x t #FFF t e x t \begin{array}{|rrrrrrrr|}\hline \verb+#000+ & \color{#000}{text} & & & \verb+#00F+ & \color{#00F}{text} & & \\ & & \verb+#0F0+ & \color{#0F0}{text} & & & \verb+#0FF+ & \color{#0FF}{text} \\ \verb+#F00+ & \color{#F00}{text} & & & \verb+#F0F+ & \color{#F0F}{text} & & \\ & & \verb+#FF0+ & \color{#FF0}{text} & & & \verb+#FFF+ & \color{#FFF}{text} \\\hline\end{array} #000#F00?texttext?#0F0#FF0?texttext?#00F#F0F?texttext?#0FF#FFF?texttext??

示例

\begin{array}{|rrrrrrrr|}
    \hline
    \verb+#000+ & \color{#000}{text} & \verb+#005+ & \color{#005}{text} & \verb+#00A+ & \color{#00A}{text} & \verb+#00F+ & \color{#00F}{text}  \\
    \verb+#500+ & \color{#500}{text} & \verb+#505+ & \color{#505}{text} & \verb+#50A+ & \color{#50A}{text} & \verb+#50F+ & \color{#50F}{text}  \\
    \verb+#A00+ & \color{#A00}{text} & \verb+#A05+ & \color{#A05}{text} & \verb+#A0A+ & \color{#A0A}{text} & \verb+#A0F+ & \color{#A0F}{text}  \\
    \verb+#F00+ & \color{#F00}{text} & \verb+#F05+ & \color{#F05}{text} & \verb+#F0A+ & \color{#F0A}{text} & \verb+#F0F+ & \color{#F0F}{text}  \\
    \hline
    \verb+#080+ & \color{#080}{text} & \verb+#085+ & \color{#085}{text} & \verb+#08A+ & \color{#08A}{text} & \verb+#08F+ & \color{#08F}{text}  \\
    \verb+#580+ & \color{#580}{text} & \verb+#585+ & \color{#585}{text} & \verb+#58A+ & \color{#58A}{text} & \verb+#58F+ & \color{#58F}{text}  \\
    \verb+#A80+ & \color{#A80}{text} & \verb+#A85+ & \color{#A85}{text} & \verb+#A8A+ & \color{#A8A}{text} & \verb+#A8F+ & \color{#A8F}{text}  \\
    \verb+#F80+ & \color{#F80}{text} & \verb+#F85+ & \color{#F85}{text} & \verb+#F8A+ & \color{#F8A}{text} & \verb+#F8F+ & \color{#F8F}{text}  \\
    \hline
    \verb+#0F0+ & \color{#0F0}{text} & \verb+#0F5+ & \color{#0F5}{text} & \verb+#0FA+ & \color{#0FA}{text} & \verb+#0FF+ & \color{#0FF}{text}  \\
    \verb+#5F0+ & \color{#5F0}{text} & \verb+#5F5+ & \color{#5F5}{text} & \verb+#5FA+ & \color{#5FA}{text} & \verb+#5FF+ & \color{#5FF}{text}  \\
    \verb+#AF0+ & \color{#AF0}{text} & \verb+#AF5+ & \color{#AF5}{text} & \verb+#AFA+ & \color{#AFA}{text} & \verb+#AFF+ & \color{#AFF}{text}  \\
    \verb+#FF0+ & \color{#FF0}{text} & \verb+#FF5+ & \color{#FF5}{text} & \verb+#FFA+ & \color{#FFA}{text} & \verb+#FFF+ & \color{#FFF}{text}  \\
    \hline
\end{array}

結果

#000 t e x t #005 t e x t #00A t e x t #00F t e x t #500 t e x t #505 t e x t #50A t e x t #50F t e x t #A00 t e x t #A05 t e x t #A0A t e x t #A0F t e x t #F00 t e x t #F05 t e x t #F0A t e x t #F0F t e x t #080 t e x t #085 t e x t #08A t e x t #08F t e x t #580 t e x t #585 t e x t #58A t e x t #58F t e x t #A80 t e x t #A85 t e x t #A8A t e x t #A8F t e x t #F80 t e x t #F85 t e x t #F8A t e x t #F8F t e x t #0F0 t e x t #0F5 t e x t #0FA t e x t #0FF t e x t #5F0 t e x t #5F5 t e x t #5FA t e x t #5FF t e x t #AF0 t e x t #AF5 t e x t #AFA t e x t #AFF t e x t #FF0 t e x t #FF5 t e x t #FFA t e x t #FFF t e x t \begin{array}{|rrrrrrrr|}\hline \verb+#000+ & \color{#000}{text} & \verb+#005+ & \color{#005}{text} & \verb+#00A+ & \color{#00A}{text} & \verb+#00F+ & \color{#00F}{text} \\ \verb+#500+ & \color{#500}{text} & \verb+#505+ & \color{#505}{text} & \verb+#50A+ & \color{#50A}{text} & \verb+#50F+ & \color{#50F}{text} \\ \verb+#A00+ & \color{#A00}{text} & \verb+#A05+ & \color{#A05}{text} & \verb+#A0A+ & \color{#A0A}{text} & \verb+#A0F+ & \color{#A0F}{text} \\ \verb+#F00+ & \color{#F00}{text} & \verb+#F05+ & \color{#F05}{text} & \verb+#F0A+ & \color{#F0A}{text} & \verb+#F0F+ & \color{#F0F}{text} \\\hline \verb+#080+ & \color{#080}{text} & \verb+#085+ & \color{#085}{text} & \verb+#08A+ & \color{#08A}{text} & \verb+#08F+ & \color{#08F}{text} \\ \verb+#580+ & \color{#580}{text} & \verb+#585+ & \color{#585}{text} & \verb+#58A+ & \color{#58A}{text} & \verb+#58F+ & \color{#58F}{text} \\ \verb+#A80+ & \color{#A80}{text} & \verb+#A85+ & \color{#A85}{text} & \verb+#A8A+ & \color{#A8A}{text} & \verb+#A8F+ & \color{#A8F}{text} \\ \verb+#F80+ & \color{#F80}{text} & \verb+#F85+ & \color{#F85}{text} & \verb+#F8A+ & \color{#F8A}{text} & \verb+#F8F+ & \color{#F8F}{text} \\\hline \verb+#0F0+ & \color{#0F0}{text} & \verb+#0F5+ & \color{#0F5}{text} & \verb+#0FA+ & \color{#0FA}{text} & \verb+#0FF+ & \color{#0FF}{text} \\ \verb+#5F0+ & \color{#5F0}{text} & \verb+#5F5+ & \color{#5F5}{text} & \verb+#5FA+ & \color{#5FA}{text} & \verb+#5FF+ & \color{#5FF}{text} \\ \verb+#AF0+ & \color{#AF0}{text} & \verb+#AF5+ & \color{#AF5}{text} & \verb+#AFA+ & \color{#AFA}{text} & \verb+#AFF+ & \color{#AFF}{text} \\ \verb+#FF0+ & \color{#FF0}{text} & \verb+#FF5+ & \color{#FF5}{text} & \verb+#FFA+ & \color{#FFA}{text} & \verb+#FFF+ & \color{#FFF}{text} \\\hline\end{array} #000#500#A00#F00#080#580#A80#F80#0F0#5F0#AF0#FF0?texttexttexttexttexttexttexttexttexttexttexttext?#005#505#A05#F05#085#585#A85#F85#0F5#5F5#AF5#FF5?texttexttexttexttexttexttexttexttexttexttexttext?#00A#50A#A0A#F0A#08A#58A#A8A#F8A#0FA#5FA#AFA#FFA?texttexttexttexttexttexttexttexttexttexttexttext?#00F#50F#A0F#F0F#08F#58F#A8F#F8F#0FF#5FF#AFF#FFF?texttexttexttexttexttexttexttexttexttexttexttext??

19. 添加洗掉線

使用洗掉線功能必須宣告 $$ 符號,

在公式內使用 \require{cancel} 來允許片段洗掉線的顯示,
宣告片段洗掉線后,使用 \cancel{字符}\bcancel{字符}\xcancel{字符}\cancelto{字符} 來實作各種片段洗掉線效果,

示例

$$
\require{cancel}
\begin{array}{rl}
    \verb|y+\cancel{x}| & y+\cancel{x} \\
    \verb|\cancel{y+x}| & \cancel{y+x} \\
    \verb|y+\bcancel{x}| & y+\bcancel{x} \\
    \verb|y+\xcancel{x}| & y+\xcancel{x} \\
    \verb|y+\cancelto{0}{x}| & y+\cancelto{0}{x} \\
    \verb+\frac{1\cancel9}{\cancel95} = \frac15+& \frac{1\cancel9}{\cancel95} = \frac15 \\
\end{array}
$$

結果
KaTeX parse error: Undefined control sequence: \require at position 2: \?r?e?q?u?i?r?e?{cancel} \begin…

20. 包圍公式

分別使用 circleroundedbox 包圍的公式

示例

$$
\require{enclose}
\begin{array}{c}
    \enclose{circle}{f(\top),\, f^2(\top),\, f^3(\top) \,\cdots\, f^n(\top)} \\
    \enclose{roundedbox}{f(\bot),\, f^2(\bot),\, f^3(\bot) \,\cdots\, f^n(\bot)} \\
\end{array}
$$

結果
$$
$$
\require{enclose}
\begin{array}{c}
\enclose{circle}{f(\top),, f^2(\top),, f^3(\top) ,\cdots, f^n(\top)} \
\enclose{roundedbox}{f(\bot),, f^2(\bot),, f^3(\bot) ,\cdots, f^n(\bot)} \
\end{array}

使用 box 框住所有公式

示例

$$
\require{enclose}
\enclose{box}{
    \begin{array}{c}
        f(\top),\, f^2(\top),\, f^3(\top) \,\cdots\, f^n(\top) \\
        f(\bot),\, f^2(\bot),\, f^3(\bot) \,\cdots\, f^n(\bot) \\
    \end{array}
}
$$

結果
$$
$$
\require{enclose}
\enclose{box}{
\begin{array}{c}
f(\top),, f^2(\top),, f^3(\top) ,\cdots, f^n(\top) \
f(\bot),, f^2(\bot),, f^3(\bot) ,\cdots, f^n(\bot) \
\end{array}
}

21. 箭頭

符號運算式符號運算式
\lefrarrow?\longleftarrow
\rightarrow?\longrightarrow
?\leftrightarrow?\longleftrightarrow
?\Leftarrow?\Longleftarrow
?\Rightarrow?\Longrightarrow
?\Leftrightarrow?\Longleftrightarrow

22. 方程式

示例

$$
\begin{equation}
E=mc^2
\end{equation}
$$

結果
KaTeX parse error: No such environment: equation at position 8: \begin{?e?q?u?a?t?i?o?n?}? E=mc^2 \end{eq…

23. 分隔符

各種括號用 () [] { } \langle\rangle 等命令表示,注意花括號通常用來輸入命令和環境的引數,所以在數學公式中它們前面要加 \,可以在上述分隔符前面加 \big \Big \bigg \Bigg 等命令來調整大小,

示例

$$
\max \limits_{a<x<b} \Bigg\{f(x)\Bigg\}
$$

結果
max ? a < x < b { f ( x ) } \max \limits_{a<x<b} \Bigg\{f(x)\Bigg\} a<x<bmax?{f(x)}
示例

\quad #空格
$$
\max \limits_{a<x<b} \Bigg\{\quad f(x)\quad\Bigg\}
$$

max ? a < x < b { f ( x ) } \max \limits_{a<x<b} \Bigg\{\quad f(x)\quad\Bigg\} a<x<bmax?{f(x)}

24. 分段函式

示例

$$
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?

25. 如何輸入一個左側對齊的條件運算式

若想讓文字在左側對齊顯示,則有如下方式:

示例

$$
	\left.
    	\begin{array}{l}
    		\text{if $n$ is even:} & n/2 \\
    		\text{if $n$ is odd:} & 3n+1 \\
    	\end{array}
    \right\}
    =f(n)
$$

結果

if n is even: n / 2 if n is odd: 3 n + 1 } = f ( n ) \left. \begin{array}{l} \text{if $n$ is even:} & n/2 \\ \text{if $n$ is odd:} & 3n+1 \\ \end{array} \right\} =f(n) if n is even:if n is odd:?n/23n+1?}=f(n)

26. 方程組

示例

$$
\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. # 注意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. ????a1?x+b1?y+c1?z=d1?a2?x+b2?y+c2?z=d2?a3?x+b3?y+c3?z=d3??

27. 如何使條件運算式適配行高

在一些情況下,條件運算式中某些行的行高為非標準高度,此時使用 \\[2ex] 陳述句代替該行末尾的 \\ 來讓編輯器適配,

  • 例子:

不適配[2ex]

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

適配[2ex]

$$
f(n) =
	\begin{cases}        
		\frac{n}{2}, & \text{if $n$ is even} \\
		3n+1,        & \text{if $n$ is odd} \\    
	\end{cases}
$$
  • 顯示:
不適配[2ex]適配[2ex]
$f(n) = \begin{cases} \frac{n}{2}, & \text{if n n n is even} \ 3n+1, & \text{if n n n is odd} \ \end{cases}$$f(n) = \begin{cases} \frac{n}{2}, & \text{if n n n is even} \ 3n+1, & \text{if n n n is odd} \ \end{cases}$

一個 [ex] 指一個 “X-Height”,即 x 字母高度,可以根據情況指定多個 [ex],如 [3ex][4ex] 等,
其實可以在任意換行處使用 \\[2ex] 陳述句,只要你覺得合適,

28. 陣列與表格使用參考之如何輸入一個陣列或表格

通常,一個格式化后的表格比單純的文字或排版后的文字更具有可讀性,
陣列和表格均以 \begin{array} 開頭,并在其后定義列數及每一列的文本對齊屬性,c l r 分別代表居中、左對齊及右對齊,若需要插入垂直分割線,在定義式中插入 | ,若要插入水平分割線,在下一行輸入前插入 \hline
與矩陣相似,每行元素間均須要插入 & ,每行元素以 \\ 結尾,最后以 \ end{array} 結束陣列,
使用單個陣列或表格時無需宣告 $$$ 符號,

示例

\begin{array}{c|lcr}    
	n & \text{左對齊} & \text{居中對齊} & \text{右對齊} \\    
	\hline    
	1 & 0.24 & 1 & 125 \\    
	2 & -1 & 189 & -8 \\    
	3 & -20 & 2000 & 1+10i \\
\end{array}

結果
n 左對齊 居中對齊 右對齊 1 0.24 1 125 2 ? 1 189 ? 8 3 ? 20 2000 1 + 10 i \begin{array}{c|lcr} n & \text{左對齊} & \text{居中對齊} & \text{右對齊} \\ \hline 1 & 0.24 & 1 & 125 \\ 2 & -1 & 189 & -8 \\ 3 & -20 & 2000 & 1+10i \\ \end{array} n123?左對齊0.24?1?20?居中對齊11892000?右對齊125?81+10i??

左對齊居中對齊右對齊

29. 陣列與表格使用參考之如何輸入一個嵌套的陣列或表格

多個陣列\表格可 互相嵌套 并組成一組陣列或表格,
使用嵌套前必須宣告 $$ 符號,

示例

$$
\begin{array}{c} % 總表格    
\begin{array}{cc} % 第一行內分成兩列        
\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}
&
\begin{array}{c|cccc} % 第二列"最大值"陣列
\text{max} & 0 & 1 & 2 & 3 \\
\hline
0 & 0 & 1 & 2 & 3 \\
1 & 1 & 1 & 2 & 3 \\
2 & 2 & 2 & 2 & 3 \\
3 & 3 & 3 & 3 & 3 \\
\end{array}
\end{array} % 第一行表格組結束    \\    
\begin{array}{c|cccc} % 第二行 Delta 值陣列        
\Delta & 0 & 1 & 2 & 3 \\        
\hline        
0 & 0 & 1 & 2 & 3 \\
1 & 1 & 0 & 1 & 2 \\
2 & 2 & 1 & 0 & 1 \\
3 & 3 & 2 & 1 & 0 \\
\end{array} % 第二行表格結束
\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 max 0 1 2 3 0 0 1 2 3 1 1 1 2 3 2 2 2 2 3 3 3 3 3 3 Δ 0 1 2 3 0 0 1 2 3 1 1 0 1 2 2 2 1 0 1 3 3 2 1 0 \begin{array}{c} \begin{array}{cc} \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} & \begin{array}{c|cccc} \text{max} & 0 & 1 & 2 & 3 \\ \hline 0 & 0 & 1 & 2 & 3 \\ 1 & 1 & 1 & 2 & 3 \\ 2 & 2 & 2 & 2 & 3 \\ 3 & 3 & 3 & 3 & 3 \\ \end{array} \end{array} \\ \begin{array}{c|cccc} \Delta & 0 & 1 & 2 & 3 \\ \hline 0 & 0 & 1 & 2 & 3 \\ 1 & 1 & 0 & 1 & 2 \\ 2 & 2 & 1 & 0 & 1 \\ 3 & 3 & 2 & 1 & 0 \\ \end{array} \end{array} min0123?00000?10111?20122?30123???max0123?00123?11123?22223?33333???Δ0123?00123?11012?22101?33210???

案例

1. 線性模型

示例

$$
h(\theta)=\sum_{j=0}^n \theta_j x_j
$$

結果
h ( θ ) = ∑ j = 0 n θ j x j h(\theta)=\sum_{j=0}^n \theta_j x_j h(θ)=j=0n?θj?xj?

2. 均方誤差

示例

$$
J(\theta) = \frac{1}{2m} \sum_{i=0}^m (y^i-h_\theta (x^i))^2
$$

結果
J ( θ ) = 1 2 m ∑ i = 0 m ( y i ? h θ ( x i ) ) 2 J(\theta) = \frac{1}{2m} \sum_{i=0}^m (y^i-h_\theta (x^i))^2 J(θ)=2m1?i=0m?(yi?hθ?(xi))2

3. 批量梯度下降

示例

$$
\frac{\partial J(\theta)}{\partial\theta_j} = -\frac{1}{m}\sum_{i=0}^m (y^i - h_\theta (x^i))x^i_j
$$

結果
? J ( θ ) ? θ j = ? 1 m ∑ i = 0 m ( y i ? h θ ( x i ) ) x j i \frac{\partial J(\theta)}{\partial\theta_j} = -\frac{1}{m}\sum_{i=0}^m (y^i - h_\theta (x^i))x^i_j ?θj??J(θ)?=?m1?i=0m?(yi?hθ?(xi))xji?

4. 推導程序

示例:

$$
\begin{align}
    \frac{\partial J(\theta)}{\partial \theta_j}
    & = - \frac{1}{m} \sum_{i=0}^m (y^i-h_\theta(x^i))\frac{\partial}{\partial\theta_j}(y^i-h_\theta(x^i))\\
    & = -\frac{1}{m}\sum_{i=0}^m(y^i-h_\theta(x^i))\frac{\partial}{\partial\theta_j}(\sum_{j=0}^n\theta_j x^i_j - y^i)\\
    & = - \frac{1}{m}\sum_{i=0}^m(y^i-h_\theta (x^i))x^i_j
\end{align}
$$

結果
KaTeX parse error: No such environment: align at position 8: \begin{?a?l?i?g?n?}? \frac{\partial…

參考檔案

Cmd Markdown 公式指導手冊

轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/267390.html

標籤:其他

上一篇:JavaScript制作日歷

下一篇:【無門檻入門】從0開始使用html整合markdown開發,絕對肝貨

標籤雲
其他(157675) Python(38076) JavaScript(25376) Java(17977) C(15215) 區塊鏈(8255) C#(7972) AI(7469) 爪哇(7425) MySQL(7132) html(6777) 基礎類(6313) sql(6102) 熊猫(6058) PHP(5869) 数组(5741) R(5409) Linux(5327) 反应(5209) 腳本語言(PerlPython)(5129) 非技術區(4971) Android(4554) 数据框(4311) css(4259) 节点.js(4032) C語言(3288) json(3245) 列表(3129) 扑(3119) C++語言(3117) 安卓(2998) 打字稿(2995) VBA(2789) Java相關(2746) 疑難問題(2699) 细绳(2522) 單片機工控(2479) iOS(2429) ASP.NET(2402) MongoDB(2323) 麻木的(2285) 正则表达式(2254) 字典(2211) 循环(2198) 迅速(2185) 擅长(2169) 镖(2155) 功能(1967) .NET技术(1958) Web開發(1951) python-3.x(1918) HtmlCss(1915) 弹簧靴(1913) C++(1909) xml(1889) PostgreSQL(1872) .NETCore(1853) 谷歌表格(1846) Unity3D(1843) for循环(1842)

熱門瀏覽
  • vue移動端上拉加載

    可能做得過于簡單或者比較low,請各位大佬留情,一起探討技術 ......

    uj5u.com 2020-09-10 04:38:07 more
  • 優美網站首頁,頂部多層導航

    一個個人用的瀏覽器首頁,可以把一下常用的網站放在這里,平常打開會比較方便。 第一步,HTML代碼 <script src=https://www.cnblogs.com/szharf/p/"js/jquery-3.4.1.min.js"></script> <div id="navigate"> <ul> <li class="labels labels_1"> ......

    uj5u.com 2020-09-10 04:38:47 more
  • 頁面為要加<!DOCTYPE html>

    最近因為寫一個js函式,需要用到$(window).height(); 由于手寫demo的時候,過于自信,其實對前端方面的認識也不夠體系,用文本檔案直接敲出來的html代碼,第一行沒有加上<!DOCTYPE html> 導致了$(window).height();的結果直接是整個document的高 ......

    uj5u.com 2020-09-10 04:38:52 more
  • WordPress網站程式手動升級要做好資料備份

    WordPress博客網站程式在進行升級前,必須要做好網站資料的備份,這個問題良家佐言是遇見過的;在剛開始接觸WordPress博客程式的時候,因為升級問題和博客網站的修改的一些嘗試,良家佐言是吃盡了苦頭。因為購買的是西部數碼的空間和域名,每當佐言把自己的WordPress博客網站搞到一塌糊涂的時候 ......

    uj5u.com 2020-09-10 04:39:30 more
  • WordPress程式不能升級為5.4.2版本的原因

    WordPress是一款個人博客系統,受到英文博客愛好者和中文博客愛好者的追捧,并逐步演化成一款內容管理系統軟體;它是使用PHP語言和MySQL資料庫開發的,用戶可以在支持PHP和MySQL資料庫的服務器上使用自己的博客。每一次WordPress程式的更新,就會牽動無數WordPress愛好者的心, ......

    uj5u.com 2020-09-10 04:39:49 more
  • 使用CSS3的偽元素進行首字母下沉和首行改變樣式

    網頁中常見的一種效果,首字改變樣式或者首行改變樣式,效果如下圖。 代碼: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, ......

    uj5u.com 2020-09-10 04:40:09 more
  • 關于a標簽的講解

    什么是a標簽? <a> 標簽定義超鏈接,用于從一個頁面鏈接到另一個頁面。 <a> 元素最重要的屬性是 href 屬性,它指定鏈接的目標。 a標簽的語法格式:<a href=https://www.cnblogs.com/summerxbc/p/"指定要跳轉的目標界面的鏈接">需要展示給用戶看見的內容</a> a標簽 在所有瀏覽器中,鏈接的默認外觀如下: 未被訪問的鏈接帶 ......

    uj5u.com 2020-09-10 04:40:11 more
  • 前端輪播圖

    在需要輪播的頁面是引入swiper.min.js和swiper.min.css swiper.min.js地址: 鏈接:https://pan.baidu.com/s/15Uh516YHa4CV3X-RyjEIWw 提取碼:4aks swiper.min.css地址 鏈接:https://pan.b ......

    uj5u.com 2020-09-10 04:40:13 more
  • 如何設定html中的背景圖片(全屏顯示,且不拉伸)

    1 <style>2 body{background-image:url(https://uploadbeta.com/api/pictures/random/?key=BingEverydayWallpaperPicture); 3 background-size:cover;background ......

    uj5u.com 2020-09-10 04:40:16 more
  • Java學習——HTML詳解(上)

    HTML詳解 初識HTML Hyper Text Markup Language(超文本標記語言) 1 <!--DOCTYPE:告訴瀏覽器我們要使用什么規范--> 2 <!DOCTYPE html> 3 <html lang="en"> 4 <head> 5 <!--meta 描述性的標簽,描述一些 ......

    uj5u.com 2020-09-10 04:40:33 more
最新发布
  • 我的第一個NPM包:panghu-planebattle-esm(胖虎飛機大戰)使用說明

    好家伙,我的包終于開發完啦 歡迎使用胖虎的飛機大戰包!! 為你的主頁添加色彩 這是一個有趣的網頁小游戲包,使用canvas和js開發 使用ES6模塊化開發 效果圖如下: (覺得圖片太sb的可以自己改) 代碼已開源!! Git: https://gitee.com/tang-and-han-dynas ......

    uj5u.com 2023-04-20 07:59:23 more
  • 生產事故-走近科學之消失的JWT

    入職多年,面對生產環境,盡管都是小心翼翼,慎之又慎,還是難免捅出簍子。輕則滿頭大汗,面紅耳赤。重則系統停擺,損失資金。每一個生產事故的背后,都是寶貴的經驗和教訓,都是專案成員的血淚史。為了更好地防范和遏制今后的各類事故,特開此專題,長期更新和記錄大大小小的各類事故。有些是親身經歷,有些是經人耳傳口授 ......

    uj5u.com 2023-04-18 07:55:04 more
  • 記錄--Canvas實作打飛字游戲

    這里給大家分享我在網上總結出來的一些知識,希望對大家有所幫助 打開游戲界面,看到一個畫面簡潔、卻又富有挑戰性的游戲。螢屏上,有一個白色的矩形框,里面不斷下落著各種單詞,而我需要迅速地輸入這些單詞。如果我輸入的單詞與螢屏上的單詞匹配,那么我就可以獲得得分;如果我輸入的單詞錯誤或者時間過長,那么我就會輸 ......

    uj5u.com 2023-04-04 08:35:30 more
  • 了解 HTTP 看這一篇就夠

    在學習網路之前,了解它的歷史能夠幫助我們明白為何它會發展為如今這個樣子,引發探究網路的興趣。下面的這張圖片就展示了“互聯網”誕生至今的發展歷程。 ......

    uj5u.com 2023-03-16 11:00:15 more
  • 藍牙-低功耗中心設備

    //11.開啟藍牙配接器 openBluetoothAdapter //21.開始搜索藍牙設備 startBluetoothDevicesDiscovery //31.開啟監聽搜索藍牙設備 onBluetoothDeviceFound //30.停止監聽搜索藍牙設備 offBluetoothDevi ......

    uj5u.com 2023-03-15 09:06:45 more
  • canvas畫板(滑鼠和觸摸)

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>canves</title> <style> #canvas { cursor:url(../images/pen.png),crosshair; } #canvasdiv{ bo ......

    uj5u.com 2023-02-15 08:56:31 more
  • 手機端H5 實作自定義拍照界面

    手機端 H5 實作自定義拍照界面也可以使用 MediaDevices API 和 <video> 標簽來實作,和在桌面端做法基本一致。 首先,使用 MediaDevices.getUserMedia() 方法獲取攝像頭媒體流,并將其傳遞給 <video> 標簽進行渲染。 接著,使用 HTML 的 < ......

    uj5u.com 2023-01-12 07:58:22 more
  • 記錄--短視頻滑動播放在 H5 下的實作

    這里給大家分享我在網上總結出來的一些知識,希望對大家有所幫助 短視頻已經無數不在了,但是主體還是使用 app 來承載的。本文講述 H5 如何實作 app 的視頻滑動體驗。 無聲勝有聲,一圖頂百辯,且看下圖: 網址鏈接(需在微信或者手Q中瀏覽) 從上圖可以看到,我們主要實作的功能也是本文要講解的有: ......

    uj5u.com 2023-01-04 07:29:05 more
  • 一文讀懂 HTTP/1 HTTP/2 HTTP/3

    從 1989 年萬維網(www)誕生,HTTP(HyperText Transfer Protocol)經歷了眾多版本迭代,WebSocket 也在期間萌芽。1991 年 HTTP0.9 被發明。1996 年出現了 HTTP1.0。2015 年 HTTP2 正式發布。2020 年 HTTP3 或能正... ......

    uj5u.com 2022-12-24 06:56:02 more
  • 【HTML基礎篇002】HTML之form表單超詳解

    ??一、form表單是什么

    ??二、form表單的屬性

    ??三、input中的各種Type屬性值

    ??四、標簽 ......

    uj5u.com 2022-12-18 07:17:06 more