hide an entry from Toc in latex

I think you are looking for

\section*{hide}
\addtocounter{section}{1}

or make it into a command:

\newcommand{\toclesssection}[1]{\section*{#1}\addtocounter{section}{1}}

EDIT:

Okay, I think I understand what is wanted now (and it makes more sense then the answer I gave). Here is a command that you can use to suppress adding a section, subsection, etc. to the TOC. The idea is to temporarily disable \addcontentsline.

\newcommand{\nocontentsline}[3]{}
\newcommand{\tocless}[2]{\bgroup\let\addcontentsline=\nocontentsline#1{#2}\egroup}
...
\tocless\section{hide}
\tocless\subsection{subhide}

Leave a Comment