Is it possible to omit a single specific subsection from the table of contents, while keeping it numbered as usual within the main body, and keeping other subsections listed?

(I am using the amsart class.)

  • 3
    Why would you want to do that? Just curious...
    – vonbrand
    Mar 2 '13 at 1:17

The following code provides the an \addsubsection macro that works similar to \subsection (starred version, optional argument) that uses the \qrr@gobblenexttocentry macro to suppress the content that gets written to the .toc file.

When the hyperref package is used this line consists of five parameters, hence the \ifcsname check.

This won’t work if between the to-be-hidden subsection and its predecessor is not a single character. (But why would one do this?)




%\usepackage{hyperref}% works with or without hyperref

\ifcsname phantomsection\endcsname

\section{section name}
\subsection{I'm here.}
\addsubsection{I'm gone.}
\subsection{I'm there.}


enter image description here


In the following code, whatever is put between \ignorethis...\endignorethis is ignored, and \TOCstop with \TOCstart simply write these two commands into the .toc file.







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.