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).
Post Reply
bluesmanu
Posts: 2
Joined: Mon Jan 26, 2009 12:48 pm

Table of contents : different depth for different sections

Post by bluesmanu »

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

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
phi
Posts: 577
Joined: Tue Oct 21, 2008 8:10 pm

Re: Table of contents : different depth for different sections

Post by phi »

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

Re: Table of contents : different depth for different sections

Post by bluesmanu »

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

Table of contents : different depth for different sections

Post by phi »

For this you have to redefine the tocdepth counter inside the toc file:

Code: Select all

\documentclass[english]{article}
\usepackage{babel}
\usepackage{blindtext}

\begin{document}
\tableofcontents
\addtocontents{toc}{\setcounter{tocdepth}{3}}
\Blinddocument
\addtocontents{toc}{\setcounter{tocdepth}{2}}
\Blinddocument
\end{document}
daleif
Posts: 199
Joined: Wed Nov 19, 2008 12:46 am

Re: Table of contents : different depth for different sections

Post by daleif »

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
Post Reply