【发布时间】:2020-08-13 13:47:20
【问题描述】:
在 Sphinx 文档环境中,我正在使用 pdflatex 创建一个 pdf 文档。
为了在源文件之间导航,我在一些文件中添加了使用label 和ref 的链接,它们在HTML 文档中工作得非常好。但是,上述链接不会出现在生成的 pdf 文件中。
我正在复制(部分)我的 .rst 文件,它们之间有 reference:
文件define_ques_list.rst(在此文件中我将文件称为capa.rst)
###################
Question List
###################
**Definition**
Question lists are multilingual collections of questions that are answered during the exe...
:ref:`CAPA <corr-n-prev-action-capa-label>`
.. index:: question list
文件capa.rst
.. _corr-n-prev-action-capa-label:
##########################
CAPA
#########################
Corrective Actions/Preventive Actions
-------------------------------------
**Definition**
*Corrective Actions*
These are actions that are deemed necessary to eliminate the cause of errors that were determined dur...
*Preventive Actions*
These are actions that are deemed necessary to eliminate the causes of possible errors before they ...
.. index:: corrective action CAPA
我检查了文件*.tex 中的(相关)内容,可以看到以下内容:
\chapter{Question List}
\label{\detokenize{modules/definitions/define_ques_list:question-list}}\label{\detokenize{modules/definitions/define_ques_list:question-list-href-label}}\label{\detokenize{modules/definitions/define_ques_list::doc}}
\sphinxstylestrong{Definition}
Question lists are multilingual collections of questions that are answered during the exe...
\DUrole{xref,std,std-ref}{CAPA} <= This is the hyperlink as translated?
\index{question list@\spxentry{question list}}\ignorespaces
我的问题是:为什么我的 pdf 文件中缺少超链接?
【问题讨论】:
-
其实我已经运行了很多次
make latexpdf,但是没有任何变化(链接没有出现)。make latexpdf运行期间没有错误或警告。toctree中不存在的文件在创建 html 文档 (make html) 期间显示为警告。但我相信这些不会对实际导航造成问题(因为我能够在 HTML doc 中的文件之间导航)。一个ref。 -
"目录树中不存在的文件..."。我认为这可能是问题所在。如果具有交叉引用目标的文件不在目录树中,则交叉引用不起作用。我可以重现它。
-
但至少 hyperlink 必须出现在 pdf 中,不是吗? 或者我错了。 我试图将其中一个文件包含在一个已经是 toctree 一部分的文件中。我会在一分钟内回来。
-
否,无法像完成here 那样添加对调用文件的引用。提出:
WARNING: duplicate label corr-n-prev-action-capa-label, other instance in /.../docs/modules/definitions/capa.rst。系统指向我的是什么?什么是重复? -
查看我生成的代码,我有一个
\phantomsection\label\作为目标,在\DUrole之前有一个\sphinxcrossref。但这可能是由于狮身人面像版本不同。我的 RST 语法是一样的,我只使用_而不是-,但我不相信这可能是原因。
标签: hyperlink python-sphinx pdflatex