# Footnote in section header causes unwanted new line

I am using MiKTeX 2.9 on Windows 7.

When I use the following to add a footnote to a section header

\section{Section Name}\footnote{Footnote text.}
\label{sec:SectionLabel}


I get the superscript for the footnote as a separate paragraph in the section. When I try

\section{Section Name\protect\footnote{Footnote text.}}
\label{sec:SectionLabel}


I get a compile error

! TeX capacity exceeded, sorry [input stack size=5000].


which I don't get otherwise since it is a fairly small document (33 pages).

Edit: The compilable latex code is as follows.

\documentclass[twocolumn]{article}

\usepackage{MnSymbol}
\usepackage{amsmath} % Required to use \text
\usepackage[normalem]{ulem} % Use ulem with normal (as opposed to underlined) emphasis option

\usepackage[T1]{fontenc} % Use 8-bit encoding that has 256 glyphs
\usepackage{datetime}

\usepackage[hmarginratio=1:1,top=32mm,columnsep=20pt]{geometry} % Document margins
\usepackage[hang, small,labelfont=bf,up,textfont=it,up]{caption} % Custom captions under/above floats in tables or figures
\usepackage{booktabs} % Horizontal rules in tables
\usepackage{float} % Required for tables and figures in the multi-column environment - they need to be placed in specific locations with the [H] (e.g. \begin{table}[H])
\usepackage{hyperref} % For hyperlinks in the PDF
\usepackage{mathtools}
\DeclarePairedDelimiter{\ceil}{\lceil}{\rceil}
\DeclarePairedDelimiter{\floor}{\lfloor}{\rfloor}

\usepackage{lettrine} % The lettrine is the first enlarged letter at the beginning of the text
\usepackage{paralist} % Used for the compactitem environment which makes bullet points with less space between them

\usepackage{abstract} % Allows abstract customization

\renewcommand{\abstractnamefont}{\normalfont\bfseries} % Set the "Abstract" text to bold
\renewcommand{\abstracttextfont}{\normalfont\small\itshape} % Set the abstract itself to small italic text

\usepackage{titlesec} % Allows customization of titles
\titleformat{\section}[block]{\large\scshape\centering}{\thesection.}{1em}{} % Change the look of the section titles
\titleformat{\subsection}[block]{\large}{\thesubsection.}{1em}{} % Change the look of the section titles

\usepackage{fancyhdr} % Headers and footers
\pagestyle{fancy} % All pages have headers and footers
\fancyhead{} % Blank out the default header
\fancyfoot{} % Blank out the default footer
\fancyhead[C]{ Title $\bullet$ \date{\today}} % Custom header text
\fancyfoot[RO,LE]{\thepage} % Custom footer text

\usepackage{graphicx}
\usepackage{rotating}
\usepackage{amsfonts} % For number set symbols
\usepackage{appendix}
\usepackage{color}

\usepackage{amsmath}
\usepackage{algorithm}
\usepackage[noend]{algpseudocode}
\makeatletter
\def\BState{\State\hskip-\ALG@thistlm}
\makeatother

%----------------------------------------------------------------------------------------
%   TITLE SECTION
%----------------------------------------------------------------------------------------

\title{\vspace{-15mm}\fontsize{24pt}    {10pt}\selectfont\textbf{Title}} % Article title

\author{
\large
\textsc{Name}\thanks{Thankee}\\[2mm]
\vspace{-5mm}
}
\date{}

%----------------------------------------------------------------------------------------

\begin{document}

\maketitle % Insert title

\thispagestyle{fancy} % All pages have headers and footers

\section{Section Name}\footnote{Footnote text.}
\label{sec:SectionLabel}

\end{document}


Further edited to add version number

• what document class are you using? (a compilable example would help us a lot.) Feb 23 '15 at 16:11
• Thanks, Barbara. I have edited my question to include the compilable code. The document class is "article". Thanks, Feb 23 '15 at 16:34
• I have version 2.9. This is the latest version I could find. miktex.org/download Was your footnote supertext on the same line as the title header? Thanks, Feb 23 '15 at 16:55
• \section[Section Name]{Section Name\footnote{Whatever}} Feb 23 '15 at 17:10

Protecting \footnote is completely useless; it would work if you didn't load titlesec, but you'd get the footnote also in several places (the table of contents, for example, and page headings).

There are two solutions to the issue:

1. (best) never footnote a section title
2. use

\section[Section Name]{Section Name\footnote{Whatever}}

• Why should we never footnote a section title? Also, why does adding the "[Section Name]" part work? (without it the document fails to compile but I don't understand why) Apr 28 '16 at 0:16

I created a short command to do as @egreg suggests, avoiding this problem with the TOC and keeping a normal font size:

\newcommand{\headingwithfootnote}[2]{
#1[#2]{#2{\textsuperscript{\normalsize\footnotemark}}}}

...