在 Sphinx 和 reStructuredText 中使用数字引用数字 [英] Referencing figures with numbers in Sphinx and reStructuredText

查看:52
本文介绍了在 Sphinx 和 reStructuredText 中使用数字引用数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在编写将使用 Sphinx 处理的 RST 时,我无法获得 Sphinx LaTeX 输出在引用数字时使用数字编号.例如,这段代码:

When writing RST that will be processed with Sphinx, I can't get Sphinx LaTeX output to use figure numbers when referencing figures. For instance, this code:

The lemmings are attacking, as can be seen in :ref:`figlem`.

.. _figlem:

.. figure:: _static/lemming_invasion.* 

   They're coming!

会转换成这样:

旅鼠正在攻击,可能是他们来了!

/图片在这里/

图 1.1:他们来了!

Figure 1.1: They're coming!

但我想要的是引用数字的标准"LaTeX 方式,如下所示:

But what I want is the "standard" LaTeX way of referencing figures, like this:

旅鼠正在攻击,可能是见图1.1

The lemmings are attacking, as can be seen in Figure 1.1

我如何实现这一目标?我目前使用的代码是 Sphinx 手册推荐的代码,但它不会产生我想要的输出.

How do I achieve this? The code I'm currently using is what the Sphinx manual recommends, but it doesn't produce the output I want.

推荐答案

numfig扩展正是这样做的.我试过了,对我有用.

The numfig extension does exactly this. I tried it and it worked for me.

这篇关于在 Sphinx 和 reStructuredText 中使用数字引用数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆