0

I have a document:

\documentclass[12pt]{amsart}

That's how I produce the title and ToC:

\maketitle
\tableofcontents

I have a section

\section*{Acknowledgement}

for which I do not want a listing in the ToC and no numbering. The star disables the numbering but still it appears in the ToC:

enter image description here

I googled at lot and read many threads in this forum but didn't find the solution. Other answers suggest that the star would already do the trick but as you can see in my screenshot it doesn't.

4
  • Did you find this answer to a similar question?
    – alchemist
    Mar 30, 2023 at 23:03
  • One possibility is, immediately before the instruction \section*{Acknowledgment} to issue the instruction \addtocontents{toc}{\makeatletter \def\@toclevel{0} \makeatother}, and after the section is set, restore the previous \@toclevel value. Mar 31, 2023 at 0:14
  • @barbarabeeton So what is the command after \section*{Acknowledgment}? Mar 31, 2023 at 6:31
  • Following \section* insert the line \addtocontents{toc}{\setcounter{secnumdepth}{3}}. But I should add that the answer by @Οὖτις was developed at AMS and should work unless hyperref is used. If hyperref is used, a modification is necessary; see tex.stackexchange.com/a/131719 from which that answer was "stolen". (That answer may render this question a duplicate.) Mar 31, 2023 at 13:35

1 Answer 1

0

The idea was shamelessly stolen from this answer.

\documentclass[12pt]{amsart}
\usepackage{lipsum} % just to have some blindtext

\DeclareRobustCommand{\SkipTocEntry}[4]{} % stolen from https://tex.stackexchange.com/a/131719/237192
\newcommand{\hiddensection}[1]{\addtocontents{toc}{\SkipTocEntry}\section*{#1}} % easier version

\begin{document}
    \tableofcontents
    
    \section{Introduction} % not hidden from toc
    \lipsum[1][1-5]
    
    \addtocontents{toc}{\SkipTocEntry} % hidden from toc using original command combination
    \section*{Acknowledgement}
    \lipsum[2][1-5]

    \hiddensection{Another hidden section} % hidden from toc using shorthand
    \lipsum[3][1-5]

    \section{Next visible section}
    \lipsum[4][1-5]
\end{document}

Result

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .