47

Trying to put a footnote in subsection title:

\subsection{Effect of Lateral Confinement on SW Band Structure\footnote{Parts of this sub--section are based on \citet{Venkat2013}}}

produces the following error:

Argument of \@sect has an extra } ...section are based on \citet{Venkat2013}}}

I am using:

 \documentclass[paper=A4, fontsize=12, toc=listof, toc=index, toc=bib]{scrreprt}

Please advise.

DKS
  • 1,309

2 Answers2

72

\footnote is a fragile command and section (or subsection) titles are moving arguments (meaning they get written to an auxiliary file to be used in the table of contents). Fragile commands break in moving arguments and the standard solution is to protect them with \protect:

\documentclass{scrartcl}
\begin{document}
\section{foo\protect\footnote{bar}}
\end{document}

This will however also produce a footnote in the table of contents:

\documentclass[paper=10cm:6cm]{scrartcl}% to get a small picture for tex.sx
\begin{document}

\tableofcontents

\section{foo\protect\footnote{bar}}

\end{document}

enter image description here

In order to avoid this use the optional argument of \section for the TOC or even better: don't use footnotes in headings.

\documentclass[paper=10cm:6cm]{scrartcl}
\begin{document}

\tableofcontents

\section[foo]{foo\footnote{bar}}

\end{document}

enter image description here

cgnieder
  • 66,645
  • Yesterday I found, the approach of your answer, which I made a note for, would go terribly wrong in AMS classes, see Barbara Beetons first paragraph here: http://tex.stackexchange.com/a/123763/9237. Lucky, we are using KOMA-Script, where we can control this behaviour, as we want it to do, with these 3 options “headings=optionto…” (or leave in the traditional way). – Speravir Jan 12 '14 at 01:17
  • 2
    @Speravir That's why the real answer is: don't use footnotes in headings. And that's why questions need an MWE... – cgnieder Jan 12 '14 at 08:07
  • 6
    I disagree. Sometimes I want to do what I shouldn't and LaTeX shouldn't punish typographical dissidence when I do! – cfr May 22 '17 at 02:10
  • @cfr but it doesn't: it gives you the tools to achieve them, anyway! :) – cgnieder May 22 '17 at 09:01
  • @clemens I was disagreeing with the comment - not the answer! – cfr May 22 '17 at 09:36
  • @cfr I got that. IMHO LaTeX doesn't punish you for “typographical dissidence” but most times gives you the tools to do so… (typographical) rules are there to be broken! In the case at hand one could of course argue that \footnote should be robust in the first place, but… – cgnieder May 22 '17 at 09:46
  • @clemens It was only a joke. But I do think \footnote should behave better, yes. – cfr May 22 '17 at 11:06
  • For the sake of completeness, I would like to add that the \protect solution also causes footnotes to appear in page headers (and not only in the TOC). Fortunately, using the optional argument of \section as a solution also solves this. – Arturo Moncada-Torres Aug 22 '17 at 15:33
21

I think "don't do that" is not a helpful answer. Section footnotes are often very useful!

According to: http://www.tex.ac.uk/FAQ-ftnsect.html

The correct thing to do is the following:

% in the document preamble
\usepackage[stable]{footmisc}
...
% in the body of the document
\section{title\footnote{title ftnt}}

Works great for me.

jsinglet
  • 476
  • 1
    footmisc works nicely ... but not when there is a \url{} in the footnote---which works in other footnotes. – schremmer Feb 25 '18 at 01:16
  • 1
    But it works fine with \section{title\footnotemark} and \footnotetext{\url{}}. Why didn't I think of it right away? :-(( – schremmer Feb 26 '18 at 03:36
  • Note: footmisc does also change the formatting of footnotes. So if you still want the formatting of the KOMA-Script class you have to repeat the \deffootnote command from the KOMA-Script manual after loading footmisc. – Schweinebacke Apr 03 '19 at 08:30