[Tex/LaTex] How to hide a footnote in a section title from the table of contents

amsbookfootnotessectioningtable of contents

This is a question that arose in the comments here: Change Section titles to Small Caps only in ToC

I normally hide footnotes from the TOC by doing this:

\section[title]{title\footnote{This is a footnote.}}.

This works in a lot of document classes (memoir, article, …), but not in all of them. amsbook, for example, uses the optional argument only for the running heads so the footnote mark still ends up in the TOC. So what is the 'universal solution'?

Best Answer

there is no "universal" solution. the ams document classes, based on the conclusion that the "basic" situation of headings and toc ("short" form used for both running heads and toc) is unsatisfactory, follow a a different approach: full title used for both body and toc, short (bracketed) version used only for running heads, and \mark... and other adjustments provided to handle exceptions.

the approach originally tried was to insert a command, \SkipTocEntry, to suppress the "next" entry in the .toc file, and use \addcontentsline to insert the replacement. (examples in Excluding chapters from ToC in amsbook and Is there a way to show the short title of a chapter in the TOC instead of the long?) this suffered from timing problems, and has been superseded by a different approach.

two commands, \exclude{toc}{...} and \for{toc}{...}, are now provided to include the instructions for "variants" directly in the text of the title or heading. this is not yet well documented in user manuals, but is described in an entry in the ams author faq.

the possibilities are best understood through an (exhaustive/exhausting) example.

\documentclass{amsbook}
\usepackage{verbatim}

\begin{document}

\tableofcontents

\chapter[Title with two footnotes]%
  {Title\except{toc}{\protect\footnote{The first footnote}}
  with two footnotes\except{toc}{\protect\footnote{The second footnote}}}

There is some text in this chapter.\footnote{With a footnote}

Footnotes should be avoided on chapter titles whenever possible.
However, if a footnote---or other material that should not go
into the table of contents, such as a line break---is present, the
command \verb+\except{toc}{...}+ should be wrapped around that element
to suppress it from the contents.

If the header with such a modification may be used in a running head,
either the \verb+[...]+ option or a suitable \verb+\mark...+ command
must be given to omit the modification from the running head.

\newpage

There is a second page in this chapter.

\chapter*{A starred title\except{toc}{\protect\footnotemark}\ with two
  footnotes\except{toc}{\protect\footnotemark}}
\markboth{TITLE WITHOUT EITHER FOOTNOTE}{TITLE WITHOUT EITHER FOOTNOTE}

\addtocounter{footnote}{-1}
\footnotetext{This is the first footnote}
\addtocounter{footnote}{1}
\footnotetext{This is the second footnote}

Notice that footnote numbering isn't reset for ``starred'' chapters.
Also, the bracketed \verb+[...]+ option doesn't work to provide alternate
titles for such chapters so a \verb+\mark...+ must be used
(this may be changed in the future).
Furthermore, a \verb+\footnotemark+, although enclosed in braces as an
argument of \verb+\except+, will gobble the next space, so an explicit
space must be provided.

Section headings can also have footnotes\footnote{An irrelevant footnote}
excluded from the TOC.

\section[A section heading with a footnote]%
  {A section heading, with a
  footnote,\except{toc}{\protect\footnote{And yet another.}}
  that is very long\except{toc}{\protect\\}
  so that it has\for{toc}{\protect\\} to be broken under input control}

There is also a command \verb+\for+ that can be used to \emph{include}
selected material in the TOC, such as an explicit linebreak different
from one used in the body.

\newpage

There is a second page in this chapter.

\chapter[Another chapter title]{Another chapter title with a
  footnote\except{toc}{\protect\footnote{This is another footnote}}}

Footnote numbering \emph{is} reset for numbered chapters.

\newpage

There is also a second page in this chapter too.

\vspace{3\baselineskip}
\small
\verbatiminput{\jobname.tex}
\end{document}

owing to the length of the example the output isn't shown here. however, after processing, the input is shown, verbatim, at the end of the processed output, to make it easier to cope with.

Related Question