【发布时间】:2016-03-18 03:47:47
【问题描述】:
使用 sphinx 1.3.6,我找不到对数字进行编号引用的方法。
根据这里的答案和cmets:Referencing figures with numbers in Sphinx and reStructuredText,
numref 内置在 Sphinx 中。
但这根本行不通:
.. _mylabel
.. figure:: img/fig.jpg
this is the caption
当我在文本中使用:numref:`Figure %s <mylabel>` 时,结果实际上是Figure %s,好像numref 实际上根本没有实现。
我需要在conf.py 或乳胶序言中添加一些内容吗?
【问题讨论】:
-
通过在 conf.py 中设置
numfig = True来启用编号数字。它目前仅适用于 HTML 输出。见sphinx-doc.org/en/stable/config.html#confval-numfig。 -
顺便说一句,标签需要一个尾随冒号:
.. _mylabel:。
标签: python-sphinx