Generalsubsection not in toc but keeping numbering

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
loicus
Posts: 2
Joined: Thu Mar 04, 2010 7:37 pm

subsection not in toc but keeping numbering

Post by loicus »

Hello all,

this is my first post on this forum, so I hope I am posting in the right category.
I would like to suppress some (but not all) subsection of by table of content but keeping the correct Title format in my document. So with the numbering of the title section and the right font and so on.

How can I do this?

generally I use

Code: Select all

\section*{Dummy}
\addcontentsline{toc}{section}{Dummy}
but this do the exact opposite of what I want...

thanks for help
Loic,

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

kaiserkarl13
Posts: 707
Joined: Tue Mar 25, 2008 5:02 pm

subsection not in toc but keeping numbering

Post by kaiserkarl13 »

I had to solve the same problem to satisfy my graduate school's requirements for my Ph.D. dissertation (which specified that section headings should not appear in the table of contents for appendices, though they had to appear for all headings BEFORE the appendices).

The following command should work for you:

Code: Select all

\addtocontents{toc}{\protect\setcounter{tocdepth}{0}}
You can change the zero to another number if you want to change the numbering depth, of course.

NOTE: If you include this command as part of the re-definition of \appendix and then \include the first chapter immediately after the \appendix command, as I did, you will find that the command takes effect AFTER the first appendix. This is built into the LaTeX kernel. The way around it is to ALSO put the line above as the first line of the \include'd file. All subsequent \include's will honor your new tocdepth.

If you want ALL sections of a certain level to appear (or not), of course, you can set the counter in the preamble instead.

Welcome to the forum!
loicus
Posts: 2
Joined: Thu Mar 04, 2010 7:37 pm

subsection not in toc but keeping numbering

Post by loicus »

Thank you very much,
Actually I just found something event better

The package tocvsec2 allows you to change the depth level of the ToC in different parts of the document. You can set the level up to sections by

Code: Select all

\settocdepth{section}
in one part and then change it again later to subsection by

Code: Select all

\settocdepth{subsection}
in another part.

thanks again,
loic
prosper
Posts: 4
Joined: Wed Mar 24, 2010 7:42 pm

Re: subsection not in toc but keeping numbering

Post by prosper »

Many a thankyous, Loicus for this most useful post.
I'm only just beginning with Latex and it's fascinating.
Post Reply