Skip to content

Commit 6422f7b

Browse files
committed
Fix #3742: missing Index bookmark and TOC entry in PDF builds at RTD
The trick is to create an Index TOC/bookmarks entry in anticipation of makeindex execution, as RTD (currently) does only one pdflatex run after makeindex. readthedocs/readthedocs.org#2857 The workaround works for Sphinx own docs, which uses ``'manual'`` docclass and puts the general index at very end of document.
1 parent f06a7e4 commit 6422f7b

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

CHANGES

+5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ Bugs fixed
1717
* #3756: epub: Entity 'mdash' not defined
1818
* #3758: Sphinx crashed if logs are emitted in conf.py
1919
* #3755: incorrectly warns about dedent with literalinclude
20+
* #3742: `RTD <https://readthedocs.org/>`_ PDF builds of Sphinx own docs are
21+
missing an index entry in the bookmarks and table of contents. This is
22+
`rtfd/readthedocs.org#2857
23+
<https://github.com/rtfd/readthedocs.org/issues/2857>`_ issue, a workaround
24+
is obtained using some extra LaTeX code in Sphinx's own :file:`conf.py`
2025

2126
Testing
2227
--------

doc/conf.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,12 @@
5656
latex_elements = {
5757
'fontpkg': '\\usepackage{palatino}',
5858
'passoptionstopackages': '\\PassOptionsToPackage{svgnames}{xcolor}',
59-
'printindex': '\\footnotesize\\raggedright\\printindex',
59+
# fix missing index entry due to RTD doing only once pdflatex after makeindex
60+
'printindex': r'''
61+
\IfFileExists{\jobname.ind}
62+
{\footnotesize\raggedright\printindex}
63+
{\begin{sphinxtheindex}\end{sphinxtheindex}}
64+
''',
6065
}
6166
latex_show_urls = 'footnote'
6267

0 commit comments

Comments
 (0)