LaTeX forum ⇒ Page LayoutTable of contents : different depth for different sections

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
bluesmanu
Posts: 2
Joined: Mon Jan 26, 2009 12:48 pm

Table of contents : different depth for different sections

Postby bluesmanu » Mon Jan 26, 2009 12:50 pm

Hi all,

I would like my toc to display different subsection depth for different sections, how can I do that?
Or, is there a way to do the table of contents by hand rather than with \tableofcontents ?

Thank you

ET

phi
Posts: 577
Joined: Tue Oct 21, 2008 8:10 pm

Postby phi » Mon Jan 26, 2009 2:35 pm

Hi,
I don't really understand what you mean. Do you want all subsection entries in one section to have different indentations than all subsection entries in another section? Or do you want all subsection entries with one indentation and all section entries with another?

bluesmanu
Posts: 2
Joined: Mon Jan 26, 2009 12:48 pm

Postby bluesmanu » Tue Jan 27, 2009 10:17 am

What I want is the following :
For section 1, I want to see the section, subsections and subsubsections.
For section 2, I want to see only the section and subsections, not the subsubsections.

phi
Posts: 577
Joined: Tue Oct 21, 2008 8:10 pm

Postby phi » Tue Jan 27, 2009 1:27 pm

For this you have to redefine the tocdepth counter inside the toc file:
  1. \documentclass[english]{article}
  2. \usepackage{babel}
  3. \usepackage{blindtext}
  4.  
  5. \begin{document}
  6. \tableofcontents
  7. \addtocontents{toc}{\setcounter{tocdepth}{3}}
  8. \Blinddocument
  9. \addtocontents{toc}{\setcounter{tocdepth}{2}}
  10. \Blinddocument
  11. \end{document}

daleif
Posts: 199
Joined: Wed Nov 19, 2008 12:46 am

Postby daleif » Sat Jan 31, 2009 8:16 pm

if you are using memoir you can use cfthooks and cftcode, they are build for this kind of stuff, see the memoir manual for syntax


Return to “Page Layout”

Who is online

Users browsing this forum: No registered users and 6 guests