Model

目录

外链

你可以通过 StackBlitz在新窗口打开 在你的浏览器里直接使用 VuePress 。

自定义容器

注意

VuePress v2 目前仍处于

提示

示例 `.gitignore` 文件
# VuePress 默认临时文件目录
.vuepress/.temp
# VuePress 默认缓存目录
.vuepress/.cache
# VuePress 默认构建生成的静态文件目录
.vuepress/dist

这是添加的标题

tip 后直接跟标题

无序列表

  • 当前工作目录 cwd 下:
    • vuepress.config.ts
    • vuepress.config.js
    • vuepress.config.mjs
  • 源文件目录 sourceDir 下:
    • .vuepress/config.ts
    • .vuepress/config.js
    • .vuepress/config.mjs

  • 红色
  • 绿色
    • 红色
    • 绿色
  • 蓝色

有序列表

  1. 红色
  2. 绿色
  3. 蓝色

内置CodeGroup、CodeGroupItem

pnpm create vuepress vuepress-starter
yarn create vuepress vuepress-starter
npm init vuepress vuepress-starter

引用文字

这是一个有两段的块引用。这是第一段。 这是第二段。Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. 这是另一个只有一个段落的块引用。有三个空行分隔两个块引用。

水平线



强调(斜体)

单个星号

单个下划线

*这个文字被文字星号包围*

要在用作强调分隔符的位置生成文字星号或下划线,可以用反斜杠转义

粗体

双星号

双重下划线

代码

使用printf()函数。

删除线

错误的文字。 变成 错误的文字。

下划线

下划线 变成 下划线

表情符号

😄 😢

HTML

this text is red

表格

类别名称
颜色红色
黄色
姓氏
CSW 命令状态封包
偏移
7 6 5 4 3 2 1 0

组件

你可以在 Markdown 中直接使用 Vue 组件。

输入

这是默认主题内置的 `<Badge />` 组件 <Badge text="演示" />

输出

这是默认主题内置的 <Badge /> 组件 演示

代码标题

你可以在代码块添加一个 title 键值对来为代码块设置标题。

- module.exports = {
-   theme: '@vuepress/theme-default',
-   themeConfig: {
-     // 默认主题配置
-   },
- }

+ import { defaultTheme } from '@vuepress/theme-default'
+ import { defineUserConfig } from 'vuepress'
+
+ export default defineUserConfig({
+   theme: defaultTheme({
+     // 默认主题配置
+   })
+ })

显示反撇号`

`

md代码为四个````

```ts{1,7-9}
import { defaultTheme } from '@vuepress/theme-default'
import { defineUserConfig } from 'vuepress'

export default defineUserConfig({
  title: '你好, VuePress',

  theme: defaultTheme({
    logo: 'https://vuejs.org/images/logo.png',
  }),
})
```

居中

徽章

制作徽章在新窗口打开

@vuepress/cli@vuepress/plugin-register-components

vue

你好, Markdown 中的 Vue

当前计数为: 0

数学公式

1 行内公式

在两个美元符号中输入公式即可。

$E=m\times c^2$ 效果:E=m×c2E=m\times c^2 (注:\times是乘的意思)

2 整行公式

在四个美元符号中输入公式,如果想要给公式后面添加编号,那么在公式后添加空格 + \tag{1}就可以了。

$$ \sum_{i=0}^n i^2=\frac{(n^2+n)(2n+1)}{6} \tag{1} $$,效果:

{[(x1+x2)2(y1y2)4]×w}×(z12z22)(4) \{[(x_1+x_2)^2-(y_1-y_2)^4]\times w\}\times (z_1^2-z_2^2) \tag{4}

3 希腊字母

imgimg

4 上标与下标

用_表示下标,^表示上标。

$$ x_i^3+y_i^3=z_i^3 \tag{2} $$,效果:

xi3+yi3=zi3(2) x_i^3+y_i^3=z_i^3 \tag{2}

$$ MSE=\sum_{i=1}^n (w\times x_i+b-y_i)^2 \tag{3} $$,效果:

MSE=i=1n(w×xi+byi)2(3) MSE=\sum_{i=1}^n (w\times x_i+b-y_i)^2 \tag{3}

5 括号

()[] 可以直接输入,但花括号{ }前面需要加转义符号\。

$$ \{[(x_1+x_2)^2-(y_1-y_2)^4]\times w\}\times (z_1^2-z_2^2) \tag{4} $$ ,效果:

{[(x1+x2)2(y1y2)4]×w}×(z12z22)(4) \{[(x_1+x_2)^2-(y_1-y_2)^4]\times w\}\times (z_1^2-z_2^2) \tag{4}

6 累加、累乘、并集和交集

累加:使用 \sum_{下标表达式}^{上标表达式} {累加表达式}

$$ Y_i=\sum_{i=0}^{n} X_i \tag{5} $$,效果:

Yi=i=0nXi(5) Y_i=\sum_{i=0}^{n} X_i \tag{5}

与累加类似,

累乘使用 $\prod$并集使用 $\bigcup$交集使用 $\bigcap$例如:

i=1n1i2andi=1n1i2andi=12Randi=13Xi(6) \sum_{i=1}^n \frac{1}{i^2} \quad and \quad \prod_{i=1}^n \frac{1}{i^2} \quad and \quad \bigcup_{i=1}^{2} \Bbb{R} \quad and \quad \bigcap_{i=1}^3 X_i \tag{6}

7 对数

$\log_2 10$,效果:log210\log_2 10

$\lg 10^3$,效果:lg103\lg 10^3

$\ln (\pi+2)$,效果:ln(π+2)\ln (\pi+2)

8 三角函数

$$ \sin(x+y)+\cos(y+z)+\tan(z+x)+\arcsin(x+y+z) \tag{7}$$,效果:

sin(x+y)+cos(y+z)+tan(z+x)+arcsin(x+y+z)(7) \sin(x+y)+\cos(y+z)+\tan(z+x)+\arcsin(x+y+z) \tag{7}

9 运算符、积分、导数

$g(x)=\frac{\partial f(x,y)}{\partial x}$,效果:g(x)=f(x,y)xg(x)=\frac{\partial f(x,y)}{\partial x}

$\int_a^{+\infty} x^2 \sin(x^3 +1)dx$,效果:a+x2sin(x3+1)dx\int_a^{+\infty} x^2 \sin(x^3 +1)dx

$$\displaystyle\int_0^{+\infty} \frac{1}{\sqrt{2\pi}}e^{-\frac {x^2}{2}}dx=\frac{1}{2} \tag{8}$$,效果:

0+12πex22dx=12(8) \displaystyle\int_0^{+\infty} \frac{1}{\sqrt{2\pi}}e^{-\frac {x^2}{2}}dx=\frac{1}{2} \tag{8}

img

10 根式

$\sqrt{x+y}$,效果:x+y\sqrt{x+y}

$\sqrt[n]{a + b}$,效果:x+y\sqrt{x+y}

typora常用的数学公式编辑语法

一、基本格式

1. 上下标

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

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

2. 分数(fraction)

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

x1+x212+xyabab \frac{x}{1+x^2} \\ \frac{\frac{1}{2}+x}{y} \\ \tfrac{a}{b} \frac{a}{b}

3. 开根号(square root calculations)

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

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

4. 组合数(combinatorial number)

\binom{n}{k}
\tbinom{n}{k}

(nk)(nk) \binom{n}{k} \tbinom{n}{k}

5. 导数(derivative)

a'
a''
a^{\prime}

aaa a' a'' a^{\prime}

6. 取模(mod)

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

x(moda)2modx x \pmod a \\ 2\mod{x}

7. 积分

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

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

8.微分

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

xdxx˙y¨Δ \nabla \partial x \mathrm{d}x \dot x \ddot y \Delta

9.累积/累乘/极限

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

i=1ki=1ni=1ni=1ki=1ni=1nlimklimklimk] \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}]

二、修饰符号

1. 简单的帽子

\hat{\theta}
\widehat{AB}
\\
\bar{y}
\overline{AB}
\\
\tilde{a}
\widetilde{ac}
\\
\bar{a}
\acute{a}
\check{a}
\grave{a}
\\
\dot{a}
\ddot{a}

θ^AB^yˉABa~ac~aˉaˊaˇaˋa˙a¨ \hat{\theta} \widehat{AB} \\ \bar{y} \overline{AB} \\ \tilde{a} \widetilde{ac} \\ \bar{a} \acute{a} \check{a} \grave{a} \\ \dot{a} \ddot{a}

3. 盒子和帽子

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

a+b+cnotea+b+cnoteπ=3.14 \overbrace{a+b+c}^{\text{note}} \\ \underbrace{a+b+c}_{\text{note}} \\ \boxed{\pi=3.14}

4. 各种括号

(
\big(
\Big(
\bigg(
\Bigg(

((((( ( \big( \Big( \bigg( \Bigg(

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

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

\lgroup x \rgroup
\lVert a \rVert
\lceil 2.6 \rceil
\lfloor 1.2 \rfloor

xa2.61.2 \lgroup x \rgroup \lVert a \rVert \lceil 2.6 \rceil \lfloor 1.2 \rfloor

\ulcorner
\urcorner
\llcorner
\lrcorner

\ulcorner \urcorner \llcorner \lrcorner

三、希腊字母

e6a627023fa735a129f1725b85da1fa3

99c3a73a6e705c382b6b2acc99920392

四、算术运算符号

+
-
\times
/
\div
\cdot
\#
\%

+×/÷#% + - \times / \div \cdot \# \%

\circ
\ast
\star
\otimes
\oplus
\odot

\circ \ast \star \otimes \oplus \odot

\pm
\mp
\dotplus
\divideontimes

± \pm \mp \dotplus \divideontimes

五、比较运算符

=
= \not
\equiv
\approx
\approxeq
\cong
\sim
\neq
\not=

==≢ = = \not \equiv \approx \approxeq \cong \sim \neq \not=

<
>
\le
\ge
\gg
\ll

<> < > \le \ge \gg \ll

\curlyeqprec
\curlyeqsucc
\prec
\succ
\preceq
\succeq

\curlyeqprec \curlyeqsucc \prec \succ \preceq \succeq

六、集合运算符

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

⊄⊅¬ \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

\cap \cup \land \lor \sqcup \sqcap

七、各种箭头

\gets
\leftarrow
\to
\rightarrow
\leftrightarrow
\\
\uparrow
\downarrow
\updownarrow

\gets \leftarrow \to \rightarrow \leftrightarrow \\ \uparrow \downarrow \updownarrow

\Leftarrow
\Rightarrow
\Leftrightarrow
\iff
\\
\Uparrow
\Downarrow
\Updownarrow

     \Leftarrow \Rightarrow \Leftrightarrow \iff \\ \Uparrow \Downarrow \Updownarrow

\nearrow
\searrow
\swarrow
\nwarrow

\nearrow \searrow \swarrow \nwarrow

\longleftarrow
\longrightarrow
\longleftrightarrow
\Longleftarrow
\Longrightarrow
\Longleftrightarrow
\longmapsto

\longleftarrow \longrightarrow \longleftrightarrow \Longleftarrow \Longrightarrow \Longleftrightarrow \longmapsto

\xrightarrow{over}
\xrightarrow[over]{}
\xrightarrow[under]{over}
\xleftarrow[]{over}
\xleftarrow[under]{}
\xleftarrow[under]{over}

overoverunderoveroverunderunderover \xrightarrow{over} \xrightarrow[over]{} \xrightarrow[under]{over} \xleftarrow[]{over} \xleftarrow[under]{} \xleftarrow[under]{over}

八、空间间距

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

A ⁣BABABABA BABABAB A\!B \\ AB \\ A\thinspace B \\ A\:B \\ A\ B \\ A \enspace B \\ A\quad B \\ A\qquad B

九、矩阵

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

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

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

B=(abcd) B = \begin{pmatrix} a & b\\ c & d \end{pmatrix}

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

D=[abcd] D = \begin{bmatrix} a & b\\ c & d \end{bmatrix}

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

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

F = \begin{Bmatrix}
a & b\\
c & d
\end{Bmatrix}

F={abcd} F = \begin{Bmatrix} a & b\\ c & d \end{Bmatrix}

[A\ b] =
\begin{bmatrix}
\begin{array}{c c c|c}
a_{11} & a_{12} & a_{13} & b_1\\
a_{21} & a_{22} & a_{23} & b_2\\
a_{31} & a_{32} & a_{33} & b_3\\
\end{array}
\end{bmatrix}

[A b]=[a11a12a13b1a21a22a23b2a31a32a33b3] [A\ b] = \begin{bmatrix} \begin{array}{c c c|c} a_{11} & a_{12} & a_{13} & b_1\\ a_{21} & a_{22} & a_{23} & b_2\\ a_{31} & a_{32} & a_{33} & b_3\\ \end{array} \end{bmatrix}

\begin{array}{c:c:c}
a & b & c \\
\hline
d & e & f \\
\hdashline
 g & h & i
\end{array}

abcdefghi \begin{array}{c:c:c} a & b & c \\ \hline d & e & f \\ \hdashline g & h & i \end{array}

L_{n\times n} = \begin{bmatrix}
a_{11} & a_{12} & \cdots & a_{1n} \\
a_{21} & a_{22} & \cdots & a_{2n} \\
\vdots & \vdots &\ddots & \vdots\\
a_{n1} & a_{n2} & \cdots & a_{nn} \\
\end{bmatrix}

Ln×n=[a11a12a1na21a22a2nan1an2ann] L_{n\times n} = \begin{bmatrix} a_{11} & a_{12} & \cdots & a_{1n} \\ a_{21} & a_{22} & \cdots & a_{2n} \\ \vdots & \vdots &\ddots & \vdots\\ a_{n1} & a_{n2} & \cdots & a_{nn} \\ \end{bmatrix}

十、列式/方程组

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

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

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

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

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

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

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.

g(x,y)={MgdMfb[f(x,y)b]+dbf(x,y)MfFLSL0<SMFRSM0<SRFRSR0 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.

十一、修改颜色和字体大小

\textcolor{blue}{F=ma}
\\
\textcolor{#00ff00}{F=ma}
\\
\textcolor{#ff0000}{F=ma}
\\
\color{blue} one\ line
\\
nothing

F=maF=maF=maone linenothing \textcolor{blue}{F=ma} \\ \textcolor{#00ff00}{F=ma} \\ \textcolor{#ff0000}{F=ma} \\ \color{blue} one\ line \\ nothing

\colorbox{#00ff00}{F=ma}
\\
\colorbox{aqua}{A}
\\
\fcolorbox{red}{aqua}{A}

F=maAA \colorbox{#00ff00}{F=ma} \\ \colorbox{aqua}{A} \\ \fcolorbox{red}{aqua}{A}

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

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

十二、划掉

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

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

十三、常见图形

\Box
\square
\blacksquare
\triangle
\triangledown
\blacktriangle
\diamond
\Diamond
\star
\bigstar
\circ
\bullet
\bigcirc
\bigodot

\Box \square \blacksquare \triangle \triangledown \blacktriangle \diamond \Diamond \star \bigstar \circ \bullet \bigcirc \bigodot

\diamondsuit
\clubsuit
\heartsuit
\spadesuit

\diamondsuit \clubsuit \heartsuit \spadesuit

\angle
\measuredangle
\top
\bot
\infty

\angle \measuredangle \top \bot \infty

\checkmark
\dagger
\ddagger
\yen
\$

¥$ \checkmark \dagger \ddagger \yen \$

十四、声明宏

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

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

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

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

f(x)=12π σ1exp[(xu1)22 σ12]f(y)=12π σ2exp[(yu2)22 σ22] \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}\\

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

ex=1+x+12!x2+13!x3+ \def\EXP{ e^x = 1 + x + \frac{1}{2!}x^2 + \frac{1}{3!}x^3 + \cdots } \EXP