Of course, one can include individual elements into a table of contents by inclusion of addcontentsline at the element to be included. I'm seeking the opposite: I want to prevent selected individual elements from appearing in the table of contents when they otherwise would be.

Note that changing the depth of element to be included will not work for my case. I may want some subsections to appear in the table of contents and not others. Changing the depth will permit or prevent all subsections from appearing in the table of contents.

Is there a command (e.g., deletecontentsline) that will allow me to selectively prevent individual items from otherwise appearing in the TOC?

For my case, there will be no problems with numbering. In particular, I want subsections just in one section to not appear in the table of contents. So, even though there is section 1, subsection 1.1, 1.2, etc., and section 2, subsection 2.1, 2.2, etc. I want my table of contents to have only 1, 1.1., 1.2, and 2. (not 2.1, 2.2, etc.).

• The package tocvsec2 will allow you reset the toc depth locally. Nov 25 '15 at 18:16
• as an alternative, there's a technique used at the ams that lets you ignore an entry in the toc file. the command, \SkipTocEntry, must be defined in the job itself, and how it is defined depends on whether or not hyperref is being used. full instructions here. (ulrike's suggestion is probably better if it works for you; it's certainly "more conventional".) Nov 25 '15 at 18:48
• @barbarabeeton Your solution was simple and worked perfectly. Thanks so much. Nov 25 '15 at 19:32
• there are several answered questions that cite this technique, so probably this should be treated as a duplicate: Excluding chapters from ToC in amsbook. (the technique isn't limited to use with ams document classes.) Nov 25 '15 at 20:35

One way, with etoc. Works the same with or without hyperref.

\documentclass{article}
\usepackage{etoc}

\begin{document}

\tableofcontents

%\part{ONE}
\section{Section one}
\subsection{Subsection one one}
\subsection{Subsection one two}

\section{Section two}
\subsection{Subsection two one}
\subsection{Subsection two two}

\etocsettocdepth.toc {section}
\section{Section three DO NOT SHOW SUBSECTIONS}
\subsection{Subsection three one}
\subsection{Subsection three two}

\etocsettocdepth.toc {subsection}
\section{Section four}
\subsection{Subsection four one}
\subsection{Subsection four two}

\end{document}