General ⇒ hide subsection from table of contents
hide subsection from table of contents
i was wondering if there is any way the subsection be hidden in toc but still appear in the report with the numerical number i.e 1.2.1
i have tried inserting \subsection*{test}
the heading hides from the toc but appears with no numbers in the report.
DO you if there is a way?
thanks
ma501th
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
- Stefan Kottwitz
- Site Admin
- Posts: 10360
- Joined: Mon Mar 10, 2008 9:44 pm
hide subsection from table of contents
you can hide all subsections inside the toc if you set the counter tocdepth to 1:
Code: Select all
\setcounter{tocdepth}{1}
Code: Select all
\documentclass[a4paper,10pt]{book}
\begin{document}
\tableofcontents
\chapter{One}
\section{One}
\subsection{One}
\addtocontents{toc}{\protect\setcounter{tocdepth}{1}}
\subsection{Two}
\addtocontents{toc}{\protect\setcounter{tocdepth}{2}}
\subsection{Three}
\end{document}
Stefan
Re: hide subsection from table of contents
if i just want to hide ONE particular subsection of the toc but the number to appear in the report of that particlaur subsection, which code of line should i apply and where
thanks
- Stefan Kottwitz
- Site Admin
- Posts: 10360
- Joined: Mon Mar 10, 2008 9:44 pm
hide subsection from table of contents
then try to use my second example.
Code: Select all
% hide subsections in the toc:
\addtocontents{toc}{\protect\setcounter{tocdepth}{1}}
\subsection{This subsection is numbered but not shown in the toc}
\addtocontents{toc}{\protect\setcounter{tocdepth}{2}}
%from now on subsections are shown like usual
Re: hide subsection from table of contents
- Stefan Kottwitz
- Site Admin
- Posts: 10360
- Joined: Mon Mar 10, 2008 9:44 pm
hide subsection from table of contents
You will find further explanation here.
Stefan