1

I wish to have a "Introduction" section that is not numbered, with subparts within it. I wish the subsections of that section not to be numbered, yet the whole thing to appear in the table of contents.

If I use

\section*{Introduction}
\addcontentsline{toc}{section}{Introduction}
\subsection{First part of intro}
...
\subsection{Second part of intro}

...then the \subsection commands will (in the numbering scheme I use) generate numbering such as "0.1 First part of intro" both in-text and in the TOC.

The following generates what I want:

\section*{Introduction}
\addcontentsline{toc}{section}{Introduction}
\subsection*{First part of intro}
\addcontentsline{toc}{subsection}{First part of intro}
...
\subsection*{Second part of intro}
\addcontentsline{toc}{subsection}{Second part of intro}

Is there a way to automagically do this? My problem is that I have to type the \addcontentsline everywhere, when I would like to have something where \section* triggers a switch to "non-numbered mode" where each \subsection command is expanded to the pair of \subsection*;\addcontentsline commands or something similar (and the next \section switches back to "numbered mode").

EDIT: disabling numbering of subsections for the whole document is not desired.

  • FWIW Christian Hupfer had posted a comment that made me found tex.stackexchange.com/questions/20538/… which (although inferior in my particular case) might be of use for future readers. – JM114516 Feb 7 '17 at 9:41
  • Note that \frontmatter usually turns of the numbers of \chapter only. With book the section numbers even still have the chapter prefix, e.g., 0.. Other classes may behave different, e.g., scrbook omits the chapter number prefix for section, subsection etc. and figure and table. – Schweinebacke Feb 7 '17 at 10:05
3

You can change secnumdepth for the introduction and afterward:

\documentclass{article}

\begin{document}
\tableofcontents
\setcounter{secnumdepth}{-1}% number only levels up to -1 (section is 1)
\section{Introduction}
\subsection{First part of intro}
\subsection{Second part of intro}
\setcounter{secnumdepth}{3}% back to default of article.cls
\section{First Section}
\subsection{First part of first section}
\subsection{Second part of first section}
\end{document}

enter image description here

  • That's neat. I had no idea the TOC would be generated correctly if the secnumdepth was changed inside the document. – JM114516 Feb 7 '17 at 9:42

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.