问题描述
在 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文件中缺少我的超链接?
解决方法
由于@mzjn和@Trendfischer,提出了以下解决方案:
使用 index.rst 中的指令xml
,将 referred 添加到文件 capa.rst 中,如下所示:>
index.rst
:hidden:
通过这种安排,我现在在生成pdf文件时将超链接链接到被调用文件( capa.rst )。