[Tex/LaTex] Wrong numbers when using \footnotemark

beamerfootnotesnumbering

When adding a footnote to a frame title in Beamer using the code from another question, I get wrong numbering. Here you can see 1 above and 0 below:

Wrong numbers

This is an imaginary example. In reality, I need footnotes to cite the source of the material.

Here is the code:

\documentclass{beamer}

\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{times}
\usepackage[T1]{fontenc}

% https://tex.stackexchange.com/questions/22323/footnote-in-block-statement
\addtobeamertemplate{footnote}{\vspace{-6pt}}{\vspace{6pt}} 
\makeatletter 
 \renewcommand*{\footnoterule}{\kern -3pt \hrule \@width 2in \kern 8.6pt} 
\makeatother 

\begin{document}
   \begin{frame}{SCLP example\footnotemark}
         \footnotetext{To be continued.}
         An example of a soft constraint logic program.
    \end{frame}
\end{document}

There is a related question "Enumeration of footnotes wrong", but if I add

\addtocounter{footnote}{+1}  

before the text of my footnote, I get wrong enumeration once again: 2 above and 1 below.

On the other hand, I tried to replace numbers with stars in the whole document as described here:

\def\thefootnote{\fnsymbol{ctr}} 

However, pdfLaTeX wouldn't compile this code.

What else can I try?

Best Answer

This might form part of how the frame title is set. In fact, looking at your analysis, it is clear that the frame title is set after the frame contents. As such, avoiding insertion of counter-related commands in the title might be a workable quick-fix.

Here I've forced the counter to be incremented (\stepcounter{footnote}) to allow for correct display when using \footnotetext, and only typeset the number in the frame title using \textsuperscript{\thefootnote}:

enter image description here

\documentclass{beamer}% http://ctan.org/pkg/beamer

%\usepackage[english]{babel}
%\usepackage[utf8]{inputenc}
%\usepackage{times}
%\usepackage[T1]{fontenc}

% http://tex.stackexchange.com/questions/22323/footnote-in-block-statement
\addtobeamertemplate{footnote}{\vspace{-6pt}}{\vspace{6pt}} 
\makeatletter 
\renewcommand*{\footnoterule}{\kern -3pt \hrule \@width 2in \kern 8.6pt} 
\makeatother 

\begin{document}
\begin{frame}{SCLP example\textsuperscript{\thefootnote}}
  \stepcounter{footnote}\footnotetext{To be continued.}
  An example of a soft constraint logic program.
\end{frame}
\end{document}