3.3.3. Markdown LaTeX

行内数学

示例1

$N$ 张尺寸为 $H \times W$ RGB 图像帧组成

  • 展示: N 张尺寸为 H×W 的 RGB 图像帧组成

示例2:

  • $...x \times y...$

  • 展示: ...x×y...

块级数学

示例1:

$$
\{ I_i \in \mathbb{R}^{H \times W \times 3} \}_{i=1}^{N}
$$
  • 展示

{IiRH×W×3}i=1N

示例2:

\begin{gather*}
a_1=b_1+c_1\\
a_2=b_2+c_2-d_2+e_2
\end{gather*}

\begin{align}
\{ I_i \in \mathbb{R}^{H \times W \times 3} \}_{i=1}^{N}
\end{align}
a1=b1+c1a2=b2+c2d2+e2
(1){IiRH×W×3}i=1N

示例3

    ```{math}
        y    & = ax^2 + bx + c \\
        f(x) & = x^2 + 2xy + y^2
    ```
y=ax2+bx+cf(x)=x2+2xy+y2

示例4:

$$
\{ I_i \in \mathbb{R}^{H \times W \times 3} \}_{i=1}^{N}
$$
  • 展示

{IiRH×W×3}i=1N

示例4(不生效):

<script type="math/tex; mode=display">
\{ I_i \in \mathbb{R}^{H \times W \times 3} \}_{i=1}^{N}
</script>

Sphinx 扩展

  1. 安装 sphinx.ext.mathjax

  2. 在你的 conf.py 文件中,确认启用了 mathjax 扩展:

extensions = [
    'sphinx.ext.mathjax',
    # 其他扩展...
]
  1. 如果希望保留 $...$ 语法,你可以在 conf.py 中加入

mathjax3_config = {
    'tex': {
        'inlineMath': [['$', '$'], ['\$', '\$']],
        'displayMath': [['$$', '$$'], ['\$$
', '\
$$']],
    }
}