Here is a screenshot of my table of content (amsart documentclass) : TOC

I do not want these Section *.2, Section *.3, Section *.4 in between the actual lines. How do I get rid of these inexplicable phrases? Thank you.

Apparently the problem is occurring due to the use of my self-defined command \addsubsection* instead of \subsection* (because I do not want the subsections to be shown in the table of contents).

A minimal code:








 \newcommand\normsymb{\ell}  % was \|\,\|
 \newcommand\norm[1]{\ell({#1})}   % was \|{#1}\|
 \newcommand\normn[1]{\ell_n({#1})}   % was \|{#1}\|

 %\vast \Vast - Bigger than \Bigg

 %\addsubsection - not shown in toc
 \ifcsname phantomsection\endcsname





 \tableofcontents %\need to fix it


 bla bla bla...

 We consider this and that, that and that..

 \section{New section}

 \addsubsection*{here we are}

 \addsubsection*{also here}

 \section{The main theorem}


Your current definition of \addsubsection inserts \qrr@gobblenexttocentry into the ToC in an attempt to gobble a subsequent entry of \contentsline. This may seem appropriate, but two \addsubsections immediately following one another causes a problem, since the gobbling becomes out-of-sync. Moreover, if you wish to define \qrr@gobblenexttocentry to be conditional on the existence of \phantomsection (when hyperref is loaded), it's obvious that which branch will be chosen since you're loading hyperref after this.

There's a far better way of doing what you're after: Use \subsection (starred or not) as-is and add to your preamble


The above will only print ToC entries up to \section.

enter image description here





\tableofcontents %\need to fix it



\section{New section}

\addsubsection*{here we are}

\addsubsection*{also here}

\section{The main theorem}


Technically this allows you to get rid of \addsubsection altogether. I've left it in the above code, making it similar to \subsection.

|improve this answer|||||
  • Excellent. That's what I wanted. Thank you sir. – firestorm Jan 13 '18 at 5:26
  • And thanks for the detailed clarification for why the previous definition did not work. I really appreciate it. – firestorm Jan 13 '18 at 5:27

Okay so I found a solution. It's a bit of cheating really but produces the same result.

I replaced




I guess it's a situation when we were looking for an flamethrower where a simple lighter would have worked. However, it is still an interesting problem to find code for self-defined subsection that does not show up in the toc.

|improve this answer|||||
  • why not simple \subsection*{subsection title}? read @Werner answer carefully again. – Zarko Jan 13 '18 at 5:36
  • @Zarko the name of the subsection along with the page number still shows in the table of contents (just without the subsection number). – firestorm Jan 13 '18 at 5:38
  • 1
    apparently you not understand @Werner. with\setcounter{tocdepth}{1} in toc will appear only sections. remove your \addsubsection definition. it is superfluous. – Zarko Jan 13 '18 at 5:40
  • You're right! So all I needed is \setcounter{tocdepth}{1} Thank you so much! – firestorm Jan 13 '18 at 5:45
  • 2
    and use standard subsection{...} (if you like to be numbered) or \subsection*{...} (for unnumbered) :-) – Zarko Jan 13 '18 at 5:48

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.