[Tex/LaTex] Removing subsection numbers in table of contents

table of contents

I'm using the report style.

I'm using \subsection* to suppress the numbers that would otherwise appear before my subsection text.

I'm generating a table of contents using setcounter{tocdepth}{2}

But the subsection numbers are appearing in the generated table of contents.

Is there a way to suppress the numbers for the subsections in the table of contents, like you can suppress them using \subsection* rather than \subsection?

(I want the chapter and section numbers to appear for new chapters and sections, as they currently are).

Best Answer

Don't use \subsection* everywhere, if you never want subsections to be numbered. Instead, add

\setcounter{secnumdepth}{1} % levels under \section are not numbered
\setcounter{tocdepth}{2}    % levels under \subsection are not listed in the TOC

Example with article, but with report or book (or most of the other classes)

\documentclass{article}

\setcounter{secnumdepth}{1} % levels under \section are not numbered
\setcounter{tocdepth}{2}    % levels under \subsection are not listed in the TOC

\begin{document}

\tableofcontents

\section{Introduction}

\subsection{Some title}
Here's the text.

\subsection{Again}
And again.

\section{Conclusion}
Enough.

\end{document}

enter image description here

Related Question