Theses, Books, Title pagesHow do I hide subsections from the table of contents?

Classicthesis, Bachelor and Master thesis, PhD, Doctoral degree
Post Reply
templateuser
Posts: 679
Joined: Tue Mar 03, 2015 4:01 pm

How do I hide subsections from the table of contents?

Post by templateuser »

Hello ! Thank you for the template, it is very well done ! I am writing my Master thesis on it ! How can I hide a subsection from the table of contents ??

I have tried \subsection*{…} but with this command all the subsections become hidden and that subsection specifically becomes non-numbered !

I would appreciate any help.

Greetings, Bruno

Recommended reading 2024:

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

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

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Vel
Site Moderator
Posts: 463
Joined: Fri Jun 29, 2012 1:20 am

How do I hide subsections from the table of contents?

Post by Vel »

Hi Bruno,

To hide a single subsection from the table of contents but still keep its numbering, use the following:

Code: Select all

Code, edit and compile here:
\addtocontents{toc}{\protect\setcounter{tocdepth}{1}}
\subsection{A (not so short) Introduction to \LaTeX{}}
\addtocontents{toc}{\protect\setcounter{tocdepth}{2}}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
To hide all subsections, add \setcounter{tocdepth}{1} to the preamble.

Cheers,
Vel
Founder and administrator of LaTeXTemplates.com and LaTeXTypesetting.com
Post Reply