首页 > 解决方案 > 方程式编号如何为狮身人面像工作?

问题描述

我对 sphinx 比较陌生,我刚刚创建了两个文件来测试带有编号的方程交叉引用。

我在 conf.py 中进行以下配置

numfig = True
math_numfig = True
numfig_secnum_depth = 2
math_eqref_format = "Eq.{number}"

第一个文件是

1. Test File 1 Main
=============

Inline math examples: :math:`\color{blue}{\sigma_{1}}` equals :math:`\colorbox{yellow}{\sigma_{2}}` then etc, etc.

Any text.

.. math::
 x^2+y^2=1
 :label: eq_a

Math block example with label:

.. math::
 e^{i\pi} + 1 = 0
 :label: eq_b


1.1 Some Examples
****************

.. math::
 \color{red}{x^2}+y^2=3
 :label: eq_c

第二个是

2. Test File 2 Main
=============

Refer to :eq:`eq_a`

Refer to :eq:`eq_b`

Refer to :eq:`eq_c`

输出是 HTML。它不适用于编号,所有标签都丢失(但链接很好)。

文件 1 html 输出: 在此处输入图像描述

文件 2 html 输出: 在此处输入图像描述

我错过了什么吗?我也很困惑如何自动给章节编号。测试中的部分编号是手动添加的。是因为我需要配置部分编号才能显示方程式编号吗?这样做的正确方法是什么?谢谢!

标签: python-sphinxrestructuredtext

解决方案


推荐阅读