gpt4 book ai didi

python - 如何在 Sphinx 中正确使用 numref 表?

转载 作者:太空宇宙 更新时间:2023-11-03 13:13:29 24 4
gpt4 key购买 nike

我正在尝试通过 Sphinx 文档中的编号来引用表格。我为表命名并尝试在之后使用 numref,但它错误地显示了表的标签(“modules_classes”)而不是它的编号。

.. _modules_classes:

.. table:: Modules and their corresponding abstract classes

[table content]

Modules and their corresponding abstract classes are presented on table :numref:`modules_classes`.

我也试过这样做,因为我在网上找到了一个例子,但结果是一样的:

.. table:: Modules and their corresponding abstract classes
:name: modules_classes

在我看来,我不需要导入 numfig 包,因为它默认包含在 Sphinx 中。使用命令 :ref: 显示表格的标题,所以我知道引用是正确的。有人可以指出我所做的事情有什么问题吗?

最佳答案

补救措施是在 conf.py 中设置 numfig = True。如果没有此设置,您应该会在运行 sphinx-build 时看到一条消息,内容为 “警告:numfig 已禁用。:numref: 已被忽略”

这适用于 HTML 和 LaTeX 输出。参见 https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-numfig .

关于python - 如何在 Sphinx 中正确使用 numref 表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36949066/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com