7

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).

  • 2
    What happens with \setcounter{tocdepth}{1}? Or do you want the subsection's name on toc but not numbered there but numbered on the text? – Sigur Jan 9 '14 at 14:30
  • The TOC doesn't display the subsection title either. – Bathsheba Jan 9 '14 at 14:32
  • 1
    You shouldn't use \subsection* everywhere; just say \setcounter{secnumdepth}{1} before \begin{document} and use \subsection normally. If you want the subsections in the TOC, add also \setcounter{tocdepth}{2} – egreg Jan 9 '14 at 14:50
  • Welcome to TeX.SX! – karlkoeller Jan 9 '14 at 15:04
10

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

0

This is one way:

\subsection*{text here}
\addcontentsline{toc}{subsection}{text here}

And set the depth of the table of contents to be above the subsection level, using \setcounter{tocdepth}{appropriate value here}

Unfortunately though, you need to write "text here" in two places.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.