Search code examples
referencelatexpython-sphinxrestructuredtext

How to make internal links work in Sphinx output (latexpdf)?


I insert links following this manual:

http://sphinx-doc.org/markup/inline.html#ref-role

However, while the internal links work perfectly in the HTML output, they don't work in PDF. The text supposed to be the clickable link only become italics.

Here's my rst:

This is my :ref:`reference <file-table3>`.

.. _file-table3:

.. container:: centeredtextbody

    .. table:: There is my table

When I build the html (make html), everything is as expected. When I build the pdf through latex (make latexpdf), no links in my file (except for the TOC ones)

What am I doing wrong? I would like for the links to appear in both html and pdf output.


Solution

  • So, I figured my problem.

    My architecture was:

    index.rst
    
        text
    
        ..include: File.rst
    
    
    File.rst
    
        links stuff
    

    The problem was, I think, that sphinx was parsing my rst document twice (once as a rst file, once as an included file). This caused apparently the links to become \emph in latex, for unknown reasons.

    Changing File.rst to File.txt solved the problem.