Setting the depth of the sidebar TOC

3,691 views
Skip to first unread message

Gilmorez

unread,
Dec 23, 2010, 1:40:05 PM12/23/10
to sphinx-dev
It is very easy to set the depth of the TOC on an index page, and that
is very handy.

So far, in my attempts to figure out how to do the same for the
sidebar TOC, I'm finding it difficult.

We are using localtoc, and I would like to limit it to two levels so
that long parameter and class names in our documentation do not appear
there and spill over into the main frame.

If anyone can point me in the right direction on how to control that,
it is much much appreciated.

Georg Brandl

unread,
Jan 8, 2011, 6:37:45 PM1/8/11
to sphin...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You can do this by putting this at the top of the file:

:tocdepth: 2


cheers,
Georg
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (GNU/Linux)

iEYEARECAAYFAk0o9UkACgkQN9GcIYhpnLDNugCgjDWQQPS09YUbkjluJ6owIN/4
wMgAn3zjOSSbB1XDT/grWPT7N1MPXSjX
=TEZQ
-----END PGP SIGNATURE-----

Eric Gilmore

unread,
Jan 10, 2011, 11:20:04 AM1/10/11
to sphin...@googlegroups.com
Georg, I tried that, and it only affected the TOC tree in the index page -- not the side bar. 

*Should* that setting affect the side bar as well, and there is something wrong with my setup?

The "stickysidebar" setting does basically solve my problem of long parameters spilling over.  But I'm still curious about controlling the depth of the side bar.

Thanks very much for your attention to my message :)


--
You received this message because you are subscribed to the Google Groups "sphinx-dev" group.
To post to this group, send email to sphin...@googlegroups.com.
To unsubscribe from this group, send email to sphinx-dev+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sphinx-dev?hl=en.




--
Eric Gilmore
Consulting Technical Writer
Riptano, Inc.
Ph: 510 684 9786  (cell)

Georg Brandl

unread,
Jan 10, 2011, 2:24:47 PM1/10/11
to sphin...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Are you sure you put ":tocdepth: 2" at the *top* of the *file*?

Georg

Am 10.01.2011 17:20, schrieb Eric Gilmore:
> Georg, I tried that, and it only affected the TOC tree in the index page -- not
> the side bar.
>
> *Should* that setting affect the side bar as well, and there is something wrong
> with my setup?
>
> The "stickysidebar" setting does basically solve my problem of long parameters
> spilling over. But I'm still curious about controlling the depth of the side bar.
>
> Thanks very much for your attention to my message :)
>
> On Sat, Jan 8, 2011 at 3:37 PM, Georg Brandl <ge...@python.org
> <mailto:ge...@python.org>> wrote:
>
> Am 23.12.2010 19:40, schrieb Gilmorez:
>> It is very easy to set the depth of the TOC on an index page, and that
>> is very handy.
>
>> So far, in my attempts to figure out how to do the same for the
>> sidebar TOC, I'm finding it difficult.
>
>> We are using localtoc, and I would like to limit it to two levels so
>> that long parameter and class names in our documentation do not appear
>> there and spill over into the main frame.
>
>> If anyone can point me in the right direction on how to control that,
>> it is much much appreciated.
>
> You can do this by putting this at the top of the file:
>
> :tocdepth: 2
>
>
> cheers,
> Georg

- --


You received this message because you are subscribed to the Google Groups
"sphinx-dev" group.
To post to this group, send email to sphin...@googlegroups.com

<mailto:sphin...@googlegroups.com>.


To unsubscribe from this group, send email to
sphinx-dev+...@googlegroups.com

<mailto:sphinx-dev%2Bunsu...@googlegroups.com>.


For more options, visit this group at
http://groups.google.com/group/sphinx-dev?hl=en.


> --
> *Eric Gilmore
> *


> Consulting Technical Writer
> Riptano, Inc.
> Ph: 510 684 9786 (cell)

> --

> You received this message because you are subscribed to the Google Groups
> "sphinx-dev" group.
> To post to this group, send email to sphin...@googlegroups.com.
> To unsubscribe from this group, send email to
> sphinx-dev+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/sphinx-dev?hl=en.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iEYEARECAAYFAk0rXP4ACgkQN9GcIYhpnLBn7wCeJZ0Wh9x36xtXnyD0jtlZiec+
kPMAoJKsPxpm+K4kf9+8Z/GOcTmEKMgj
=bOTT
-----END PGP SIGNATURE-----

Eric Gilmore

unread,
Jan 10, 2011, 2:34:58 PM1/10/11
to sphin...@googlegroups.com
Hm, here are some things I'm 100% sure of:

1) When I change the value to 1, with the toctree markup in this position in index.rst, I see the on-page TOC reduced to a depth of 1 but no change at all in the depth reflected in the sidebar:

    ************************************************
    ************************************************
    .. _apache-cassandra:

    Apache Cassandra |release|
    ==========================

    .. toctree::
       :maxdepth: 1

       introduction/index
       getting_started/index

    ************************************************
    ************************************************

By the same token, if I set that to :maxdepth: 3, I can see all three levels in the on-page TOC for index.html, but no change in the sidebar.

2)  If I place the toctree markup at the very, very top of the page -- ahead of the heading and the reference -- then there is no TOC markup  at all, and the entries are listed thus on the page:

     introduction/index getting_started/index configuration/index data_model/index api/index consistency/index map_reduce/index operations/index           troubleshooting/index utilities/index

3)  If I place the same toctree markup in either position inside one of the content pages (not index.rst), it (as expected, I think) has no effect at all.

Given all this, do you see why I reached the conclusion that the toctree markup *does* affect the outline on index.html, but *does not* seem to have a corresponding effect on the sidebar? 
Eric Gilmore

Georg Brandl

unread,
Jan 10, 2011, 2:53:26 PM1/10/11
to sphin...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Yes, that's all nice, but I wasn't talking about toctree at all :)

Just put

:tocdepth: 2

at the top of the file. Nothing else. Example::

:tocdepth: 2

Title of the file
=================

Some text.


HTH,
Georg

iEYEARECAAYFAk0rY7UACgkQN9GcIYhpnLAb2gCdFBNBBW6q3VXyS1K6niQyxvVd
2mYAoLD2nkok+2ATOFFeBtOSazFv5cOx
=mU6b
-----END PGP SIGNATURE-----

Eric Gilmore

unread,
Jan 10, 2011, 3:50:16 PM1/10/11
to sphin...@googlegroups.com
Doh!  I really need to read things a little more closely . . . "RTFT," with the second T for "text."

I appreciate your patience Georg -- it does of course work.  :) 

Cheers,

Eric
Eric Gilmore

Erin Kelly

unread,
Jul 13, 2017, 7:13:40 PM7/13/17
to sphinx-users, sphin...@googlegroups.com
I've seen this answer before and I still don't know _which_ file I need to put this in! ??? 

The index file? Every single file in my doc set? 

From experimentation it looks like it works to set it for one particular file, but why can't I set it for the whole doc set? 
Reply all
Reply to author
Forward
0 new messages