如何在 Sphinx 文档生成器生成的 pdf 中正确显示超链接

How to correctly show hyperlinks in pdf generated from Sphinx documentation builder

Sphinx 文档环境中,我正在使用 pdflatex.

创建一个 pdf 文档

为了在源文件之间导航,我在一些文件中添加了使用 labelref 的链接,这些链接在 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 中的指令 :hidden:,将 referred 添加到文件 capa.rst如图:

index.rst

.. xyz documentation master file, created by
   sphinx-quickstart on...
   You can adapt this file....

XYZ documentation
===================

.. toctree::
   :maxdepth: 2
   :caption: Help Contents:

   modules/abc.rst
   modules/definitions/define_ques_list.rst
   help_on_help.rst

.. toctree::    <= New line
   :hidden:     <= New line

   modules/definitions/capa.rst.   <= New line

通过这种安排,当 pdf 文件是生成。