测试
测试数学公式块
$$
f(x) = a+b
$$
$$
\sqrt{x} + \sqrt{x^{2}+\sqrt{y}} = \sqrt[3]{k_{i}} - \frac{x}{m}
$$
$$
\vec{a} + \overrightarrow{AB} + \overleftarrow{DE}
$$
$$
\lim_{x \to \infty} x^2_{22} - \int_{1}^{5}x\mathrm{d}x + \sum_{n=1}^{20} n^{2} = \prod_{j=1}^{3} y_{j} + \lim_{x \to -2} \frac{x-2}{x}
$$
$$
\begin{bmatrix}
1 & 2 & \cdots \\
67 & 95 & \cdots \\
\vdots & \vdots & \ddots \\
\end{bmatrix}
$$
$$
\alpha^{2} + \beta = \Theta
$$
测试内联公式
如果在文字中出现公式,如$\alpha$
或,显示不一定正确。
可以使用官方推荐的格式\\( \int x dx = \frac{x^2}{2} + C \\)
可以生成内联公式为:\( \int x dx = \frac{x^2}{2} + C \),这样内联公式就可以正确显示了。
也可以用这种方法写公式块,用下面代码:
\\[ \mu = \frac{1}{N} \sum_{i=0} x_i \\]
将生成下面的公式块格式: \[ \mu = \frac{1}{N} \sum_{i=0} x_i \]
如果启用katex插件
公式都可以统一成两种方式:
- 内联公式使用
$\alpha$
的方式 - 公式块使用
$$ $$
的方式
以下为测试,内联公式$\int x dx = \frac{x^2}{2} + C$
生成公式。
代码块:
$$
\mu = \frac{1}{N} \sum_{i=0} x_i
$$
默认启用katex插件,可以用下面公式代码测试是否正确配置了插件:
Here is an inline example, $ \pi(\theta) $,
an equation,
$$ \nabla f(x) \in \mathbb{R}^n, $$
and a regular \$ symbol.
显示如下:
Here is an inline example, ,
an equation,
and a regular $ symbol.
如果启用mermaid插件
可以使用mermaid
语法绘制丰富的框图等图表,以下为几个典型的示例:
流程图示例,代码如下:
流程图1
flowchart TD
A[Christmas] -->|Get money| B(Go shopping)
B --> C{Let me think}
C -->|One| D[Laptop]
C -->|Two| E[iPhone]
C -->|Three| F[fa:fa-car Car]
flowchart TD A[Christmas] -->|Get money| B(Go shopping) B --> C{Let me think} C -->|One| D[Laptop] C -->|Two| E[iPhone] C -->|Three| F[fa:fa-car Car]
流程图2
graph LR
A[Square Rect] -- Link text --> B((Circle))
A --> C(Round Rect)
B --> D{Rhombus}
C --> D
graph LR A[Square Rect] -- Link text --> B((Circle)) A --> C(Round Rect) B --> D{Rhombus} C --> D
面向对象编程语言的类图示例,代码如下:
类图
classDiagram
Animal <|-- Duck
Animal <|-- Fish
Animal <|-- Zebra
Animal : +int age
Animal : +String gender
Animal: +isMammal()
Animal: +mate()
class Duck{
+String beakColor
+swim()
+quack()
}
class Fish{
-int sizeInFeet
-canEat()
}
class Zebra{
+bool is_wild
+run()
}
classDiagram Animal <|-- Duck Animal <|-- Fish Animal <|-- Zebra Animal : +int age Animal : +String gender Animal: +isMammal() Animal: +mate() class Duck{ +String beakColor +swim() +quack() } class Fish{ -int sizeInFeet -canEat() } class Zebra{ +bool is_wild +run() }
思维导图示例,代码如下:
思维导图
mindmap
root((mindmap))
Origins
Long history
::icon(fa fa-book)
Popularisation
British popular psychology author Tony Buzan
Research
On effectivness<br/>and features
On Automatic creation
Uses
Creative techniques
Strategic planning
Argument mapping
Tools
Pen and paper
Mermaid
mindmap root((mindmap)) Origins Long history ::icon(fa fa-book) Popularisation British popular psychology author Tony Buzan Research On effectivness<br/>and features On Automatic creation Uses Creative techniques Strategic planning Argument mapping Tools Pen and paper Mermaid