1

I would like to combine a method of customising footnote symbols which allows for commands like:

\footnote[*]{foo}

with a method of putting footnotes into section titles so that they don't show up in the Table of Contents.

If have tried simply putting the two methods together:

\makeatletter
\def\@xfootnote[#1]{\protected@xdef\@thefnmark{#1}\@footnotemark\@footnotetext}
\makeatother
\makeatletter
\def\titlefootnote{\ifx\protect\@typeset@protect\expandafter\footnote\else\expandafter\@gobble\fi}
\makeatother

and this allows me to do, for example:

\section{My new section\titlefootnote[*]{This section has footnotes}}

but the table of contents then reads:

1 My new section*]This section has footnotes

How can I adjust the code to allow for the \footnote[*]-type command and the \titlefootnote tweak?

Here's a MWE:

\documentclass{article}
% Allow footnotes to chapter (and other heading) titles without them
% appearing in the table of contents and running titles at the top of the page
\makeatletter
\def\@xfootnote[#1]{\protected@xdef\@thefnmark{#1}\@footnotemark\@footnotetext}
\makeatother
\makeatletter
\def\titlefootnote{\ifx\protect\@typeset@protect\expandafter\footnote\else\expandafter\@gobble\fi}
\makeatother

\begin{document}
\tableofcontents
\section{My new section\titlefootnote[*]{This section has footnotes}}
\end{document}

Title footnotes

(by the way, I know some people say you shouldn't use footnotes in a section title.)

LondonRob
  • 4,422

1 Answers1

2

As suggested in my comment, the use of the optional argument of \section can avoid the footnote in the toc.

\documentclass{article}
\makeatletter
\def\@xfootnote[#1]{\protected@xdef\@thefnmark{#1}\@footnotemark\@footnotetext}
\makeatother
\makeatletter
\def\titlefootnote{\ifx\protect\@typeset@protect\expandafter\footnote\else\expandafter\@gobble\fi}
\makeatother
\textheight 2in% FOR DEMONSTRATION PURPOSES ONLY
\begin{document}
\tableofcontents

\noindent\hrulefill

\section[Title]{Title\titlefootnote[*]{my footnote}}
\end{document}

enter image description here

  • This is a pretty good solution. There's obviously a risk of mismatches between chapter titles and table of contents due to lack of DRY but I'm happy to put up with this limitation. – LondonRob Apr 12 '16 at 13:31
  • 1
    @LondonRob DRY can be avoided with this: \def\DRY{Section Title} \section[\DRY]{\DRY\titlefootnote[*]{my footnote}} – Steven B. Segletes Jun 28 '17 at 11:15