Joh*_*acs 6 python latex restructuredtext docutils python-sphinx
我正在尝试使用latexpdf输出将编号数字用于我的Sphinx文档项目.我在这里安装了Sphinx numfig.py扩展程序https://bitbucket.org/arjones6/sphinx-numfig
但是,每当我使用:num:标签时,它应该提供与图形编号I的交叉引用,而不是得到以下内容
RST
.. _fig_logo:
.. figure:: logo.*
        Example of a figure
Reference to logo :num:`figure #fig_logo`
生成输出:
参考徽标图?
难道我做错了什么?
似乎如果您的标签名称中有下划线(如in fig_logo),则sphinx将其替换为减号(-这有意义,因为乳胶在下划线的情况下有时会表现得很奇怪),而引用仍然使用下划线.因此乳胶无法找到所引用的标签.
这是由sphinx生成的结果tex代码:
\includegraphics{logo.png}
\caption{Example of a figure}\label{index:fig-logo}\end{figure}
Reference to logo \hyperref[index:fig_logo]{figure  \ref*{index:fig_logo}}
(注意fig-logo标签和fig_logo参考之间的区别.)
例如,如果用负号替换下划线
.. _fig-logo:
.. figure:: logo.png
        Example of a figure
Reference to logo :num:`figure #fig-logo`
tex代码如下所示:
\includegraphics{pandas_bar.png}
\caption{Example of a figure}\label{index:fig-logo}\end{figure}
Reference to logo \hyperref[index:fig-logo]{figure  \ref*{index:fig-logo}}
并在生成的pdf中解析为
参考徽标图1
如果您不想更改可以更新的所有标签numfig:添加该行应该足够了
target = target.replace('_', '-')
就在你的扩展名副本第27行之前.
我在bitbucket上打开了一个问题.
| 归档时间: | 
 | 
| 查看次数: | 2064 次 | 
| 最近记录: |