latex output doesn't set tocdepth

Erich Blume avatarErich Blume created an issue

I am new to Sphinx and may be going about this the wrong way, but it seemed to me like Sphinx's latex output mode isn't setting the tocdepth counter appropriately. The result is that the toctree is properly built to honor the :maxdepth: variable, BUT the latex \tableofcontents doesn't follow that same depth.

Steps to reproduce

  1. Create a toctree infrastructure which generates more than 3 levels of document structure. (Mine happened to have 4)
  2. Either do not set :maxdepth: or else make it something huge
  3. run `make latexpdf' and note that the resulting latex document's table of contents only goes to a depth of 2 (the latex default).


For now I have the following in my file:

latex_elements = {
    'preamble': r'\setcounter{tocdepth}{10}',

This works fine and produces the intended result but you'll notice that it is simply using a dummy 'large' value, 10. It would be much better if Sphinx detected the toctree :maxdepth: argument and inserted the appropriate \secounter{tocdepth}{#} decleration. (I believe that latex has a maximum value for this counter above which higher values have no additional effect - this could be used as the value to specify when :maxdepth: is not given.)

Comments (0)

  1. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.