-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Open
Description
Describe the bug
Adding genindex (or any other special docname) works perfectly with the html builder, but, despite producing the expected output for the latexpdf builder, it always warns:
WARNING: toctree contains ref to nonexisting file 'genindex' [toc.not_readable]
Possibly an unrelated issue, I then tried this with no change, which means the only directive somehow works differently when it guards a toctree directive or maybe its block is still evaluated before being discarded.
.. only:: html
.. toctree::
:hidden:
genindexEither way I see no way of cleanly suppressing the warning, which is annoying since I wanted to compile with -W.
How to Reproduce
$ cat index.rst
.. toctree::
genindex
$ cat conf.py
$ sphinx-build -M html . html/ # this is fine
$ sphinx-build -M latexpdf . pdf/ # this is not fine
Environment Information
Platform: linux; (Linux-6.15.6-arch1-1-x86_64-with-glibc2.41)
Python version: 3.13.5 (main, Jun 21 2025, 09:35:00) [GCC 15.1.1 20250425])
Python implementation: CPython
Sphinx version: 8.2.3
Docutils version: 0.21.2
Jinja2 version: 3.1.6
Pygments version: 2.19.2
Sphinx extensions
Additional context
No response
Paebbels