121 lines
5.5 KiB
Markdown
121 lines
5.5 KiB
Markdown
# MathJax数学公式
|
||
|
||
| 名称 | LaTeX语法 | 显示效果 | 用途说明 |
|
||
| ------------ | ----------------------- | ------------------------------ | ------------ |
|
||
| 加号 | `+` | $+$ | |
|
||
| 减号 | `-` | $-$ | |
|
||
| 乘号 | `\times` | $\times$ | |
|
||
| 除号 | `\div` | $\div$ | |
|
||
| 等号 | `=` | $=$ | |
|
||
| 小于号 | `\lt` | $\lt$ | |
|
||
| 大于号 | `\gt` | $\gt$ | |
|
||
| 属于 | `\in` | $\in$ | |
|
||
| 求和 | `\sum_{n=1}^{100}{n}` | $\sum_{n=1}^{100}{n}$ | |
|
||
| | `` | $$ | |
|
||
| | `` | $$ | |
|
||
| 普通字体 | `\mathnormal{N}` | $\mathnormal{N}$ | |
|
||
| 手写字体 | `\mathcal{N}` | $\mathcal{N}$ | |
|
||
| 空心粗体 | `\mathbb{N}`或`\Bbb{N}` | $\mathbb{N}$ | 表示数集 |
|
||
| 紧贴 | `a\!b` | $a\!b$ | 缩进1/6m宽度 |
|
||
| 无空格 | `ab` | $ab$ | 无间距 |
|
||
| 小空格 | `a\,b` | $a\,b$ | 间距1/6m宽度 |
|
||
| 大空格 | `a\ b` | $a\ b$ | 间距1/3m宽度 |
|
||
| quad空格 | `a \quad b` | $a \quad b$ | 间距1m宽度 |
|
||
| 两个quad空格 | `a \qquad b` | $a \qquad b$ | 间距2m宽度 |
|
||
| 上标 | `a^b` | $a^b$ | 指数 |
|
||
| 下标 | `a_b` | $a_b$ | |
|
||
| 向量 | `\vec{a}` | $\vec{a}$ | 矢量 |
|
||
| 上左箭头 | `\overleftarrow{ab}` | $\overleftarrow{ab}$ | |
|
||
| 上右箭头 | `\overrightarrow{ab}` | $\overrightarrow{ab}$ | |
|
||
| 向下取整 | `\lfloor x \rfloor` | $\lfloor x \rfloor$ | |
|
||
| 向上取整 | `\lceil x \rceil` | $\lceil x \rceil$ | |
|
||
| 分数 | `\frac{a}{b}` | $\frac{a}{b}$ | |
|
||
| 大分数 | `\dfrac{a}{b}` | $\dfrac{a}{b}$ | |
|
||
| 对数 | `\log_{a}{b}` | $\log_{a}{b}$ | |
|
||
| 自然对数 | `\ln{a}` | $\ln{a}$ | |
|
||
| 开方 | `\sqrt{x}` | $\sqrt{x}$ | |
|
||
| 带文字的箭头 | `\xrightarrow{加热}` | $水 \xrightarrow{加热} 水蒸汽$ | |
|
||
| | | | |
|
||
|
||
一元二次方程求根公式:$ x_{1,2} = \dfrac{-b \pm \sqrt{b^2 - 4ac}}{2a} $
|
||
|
||
斐波那契数列通项公式
|
||
$$
|
||
f(n) =
|
||
\frac{1}{\sqrt{5}}
|
||
\left[ \left( \frac{1 + \sqrt{5}}{2} \right)^n - \left( \frac{1 - \sqrt{5}}{2} \right)^n \right]
|
||
$$
|
||
|
||
n维空间中两个向量 A(a1,a2,…,an) 和 B(b1,b2,…,bn) 之间的欧式距离是:
|
||
|
||
$$
|
||
d(A,B) = \sqrt{\sum_{i=1}^n{(a_i-b_i)^2}}
|
||
$$
|
||
|
||
求平面中两点 $(x_1,y_1)$ 和 $(x_2,y_2)$ 之间的直线距离(即欧式距离):
|
||
|
||
$$
|
||
\sqrt{(x_1-x_2)^2 + (y_1-y_2)^2} \tag{欧式距离公式}
|
||
$$
|
||
|
||
冰雹函数
|
||
|
||
$$
|
||
f(n) =
|
||
\begin{cases}
|
||
n/2, & \text{if $n$ is even} \\\\
|
||
3n+1, & \text{if $n$ is odd}
|
||
\end{cases}
|
||
$$
|
||
|
||
$$
|
||
\begin{equation}
|
||
E = mc^2 \tag{质能方程}
|
||
\end{equation}
|
||
$$
|
||
|
||
- $ 3^2+4^2=5^2 $
|
||
- $ 3^3+4^3+5^3=6^3 $
|
||
- $ 10^2+11^2+12^2=13^2+14^2 $
|
||
- $ 11^3+12^3+13^3+14^3=20^3 $
|
||
- $ 21^2+22^2+23^2+24^2=25^2+26^2+27^2 $
|
||
- $ 36^2+37^2+38^2+39^2+40^2=41^2+42^2+43^2+44^2 $
|
||
- $ 55^2+56^2+57^2+58^2+59^2+60^2=61^2+62^2+63^2+64^2+65^2 $
|
||
|
||
## 在线资料
|
||
|
||
- [MathJax官方网站](https://www.mathjax.org/)
|
||
- [KaTeX语法支持表](https://katex.org/docs/support_table.html)
|
||
- [ChinaTeX数学排版常见问题集](http://static.latexstudio.net/wp-content/uploads/2018/02/ChinaTeXMathFAQ_V1.1.pdf)
|
||
|
||
应用到Gitea中添加以下内容到:`templates/custom/header.tmpl`
|
||
|
||
```html
|
||
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
|
||
<script>
|
||
MathJax = {
|
||
tex: {
|
||
inlineMath: [['$', '$'], ['\\(', '\\)']]
|
||
}
|
||
};
|
||
</script>
|
||
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
|
||
```
|
||
|
||
```js
|
||
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
|
||
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: {inlineMath: [['$', '$']]}, messageStyle: "none" });</script>
|
||
```
|
||
|
||
```js
|
||
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
|
||
<script>
|
||
MathJax = {
|
||
tex: {
|
||
inlineMath: [['$', '$'], ['\\(', '\\)']]
|
||
}
|
||
};
|
||
</script>
|
||
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
|
||
```
|