Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

In the LaTeX wikibook I found a workaround for having multiple references to the same footnote:

First reference.\footnote{This is the footnote}\addtocounter{footnote}{-1}\addtocounter{Hfootnote}{-1}
Second reference.\footnotemark

However, when using the beamer package and placing a footnote in the following context

\usetheme{CambridgeUS}
% ...

\begin{block}{testblock}
    one program\footnote{open-source software}\addtocounter{footnote}{-1},
    other program\footnotemark
\end{block}

this trick doesn't work (as the second reference is '0' instead of 'a'). What's the best way to achieve this with beamer (it seems that the problem is that beamer uses another counter for the 'footnotes' inside the block environment and \footnotemark returns the regular counter)?

share|improve this question
    
PS: I hope that $^a$ isn't the best workaround for this. –  Gerald Senarclens de Grancy Sep 7 '11 at 11:54
    
The only way that I can get the second reference to be 0 instead of anything is if I have \addcounter{footnote}{-1} twice. Did you really put Hfootnote in the second \addcounter? –  Loop Space Sep 7 '11 at 12:35
    
PS I added the links to make it easier for others to find the original source of the advice. –  Loop Space Sep 7 '11 at 12:36
    
Thanks for the links. I actually use \addcounter{footnote}{-1} once which sets the counter to 0 since it was never incremented b/c it appears that beamer uses another counter for the footnotes inside blocks. –  Gerald Senarclens de Grancy Sep 7 '11 at 12:45
1  
Given your remark to Marco below, can you please include a full working example, preamble and all. –  Loop Space Sep 7 '11 at 12:48

2 Answers 2

up vote 7 down vote accepted

The Hfootnote counter is needed for articles because hyperref plays fast and loose with the internals and has its own counters for many things, including footnotes. So when changing a counter in a non-normal fashion, you also have to change the hyperref version, which is usually H<original counter name>.

However, this is only needed when hyperref is making links between things in the document. In this case, it isn't. Beamer turns off much of hyperref's stuff as it loads the package with implicit=false. If you look carefully at the resulting PDF of a beamer presentation with footnotes, you'll see that there are no hyperlinks on footnotes.

So the internal footnote stuff isn't installed, and this is why Marco gets the error that he does: Hfootnote isn't defined.

Thus, in fact, the original solution from the LaTeX WikiBook works absolutely fine in this context:

\documentclass{beamer}
\begin{document}
\begin{frame}
\begin{block}{testblock}
    one program\footnote{open-source software},
    other program\footnotemark[\value{footnote}],
    third program\footnote{proprietry}
\end{block}
\end{frame}
\end{document}

Indeed, this is a far more robust version since if you want more references to the same footnote, you can easily just copy that line:

\documentclass{beamer}
\begin{document}
\begin{frame}
\begin{block}{testblock}
    one program\footnote{open-source software},
    other program\footnotemark[\value{footnote}],
    other program\footnotemark[\value{footnote}],
    third program\footnote{proprietry}
\end{block}
\end{frame}
\end{document}

This would not work with the \addtocounter hack, you'd need to \addtocounter{footnote}{-1} after each use of the footnotemark. However, this still doesn't work with out-of-order footnotes, to do that you'd need to save the footnote marker. Here's a simple hack for that, though I wouldn't be surprised to learn that there's a package to do it more cleanly (and that can cope with saving more than one footnote at a time).

\documentclass{beamer}
\renewcommand{\thefootnote}{\alph{footnote}}
\newcommand{\savefootnote}{\edef\tmpfn{\the\value{footnote}}}
\newcommand{\savedfootnote}{\footnotemark[\tmpfn]}
\begin{document}

\begin{frame}
\begin{block}{testblock}
    one program\footnote{open-source software}\savefootnote,
    other program\savedfootnote,
    fourth program\savedfootnote,
    third program\footnote{proprietry}
    other program\savedfootnote
\end{block}
\end{frame}
\end{document}

(Note: As this answer has been accepted, and as nothing in the above is actually wrong, I'm adding this rather than deleting the above and replacing it. However, the below is a more accurate analysis and more suitable fix. I still don't claim any elegance, though.)

After a bit of digging, I've discovered that this is nothing to do with beamer whatsoever and everything to do with minipages. The reason that you are seeing this is because when beamer does fancy boxes then the contents get put inside a minipage. Minipages have their own setup for footnotes and so within a minipage we have to hook in to the minipage system instead of the usual one. In particular, minipage footnotes have their own counter, mpfootnote, and this is the one that should be saved. At the start of the minipage environment, the old footnote stuff is replaced by the minipage-specific stuff. This should mean that everything just works. Except that it doesn't, because whoever designed the minipage environment didn't think that someone would want to use the \footnotemark command with an optional argument so the particular bit that that calls isn't swapped.

Fortunately, it's not hard to swap that bit if we need it. Unfortunately, I can't see a way to test if we're in a minipage so we need to define a different command to save the footnote inside a minipage (or a block) to outside. Maybe some passerby will be able to correct this.

Here's a sample code:

\documentclass{article}

\makeatletter
\newcommand{\savefootnote}{%
\edef\tmpfn{\the\value{footnote}}}
\newcommand{\savempfootnote}{%
    \let\@xfootnotemark=\@mpxfootnotemark
\edef\tmpfn{\the\value{footnote}}}
\newcommand{\savedfootnote}{\footnotemark[\tmpfn]}
\def\@mpxfootnotemark[#1]{%
  \begingroup
  \c@footnote #1\relax
  \unrestored@protected@xdef\@thefnmark{\thempfootnote}%
  \endgroup
  \@footnotemark}
\makeatother
\begin{document}

    one program\footnote{open-source software}\savefootnote,
    one program\savedfootnote,
    one program\savedfootnote,
    other program\footnote{proprietry},
    one program\savedfootnote,
\begin{minipage}{\textwidth}
    one program\footnote{open-source software}\savempfootnote,
    one program\savedfootnote,
    one program\savedfootnote,
    other program\footnote{proprietry},
    one program\savedfootnote,
\end{minipage}
\end{document}
share|improve this answer
    
Apparently it's the style I use that uses alphabetical counters inside blocks. The problem occurs, for example, with \usetheme{CambridgeUS}. –  Gerald Senarclens de Grancy Sep 7 '11 at 12:53
    
grand, this works :) (I had forgotten to copy the part you added to the preamble) –  Gerald Senarclens de Grancy Sep 7 '11 at 12:58
    
@Gerald: I've done some more investigating and found the source of the problem. It's actually nothing to do with beamer and everything to do with minipage. I've updated my answer. –  Loop Space Sep 7 '11 at 18:19

If you had made a minimal working example, you would have seen that the counter Hfootnote isn't defined.

\listfiles
\documentclass{beamer}
\begin{document}
\begin{frame}
\begin{block}{testblock}
    one program\footnote{open-source software}\addtocounter{footnote}{-1},
    other program\footnotemark
\end{block}
\begin{block}{testblock}
    one program\footnote{open-source software},
    other program\footnotemark[\value{footnote}]
\end{block}
\end{frame}
\end{document}

The result:

enter image description here

share|improve this answer
    
I have actually made a 'working' example (hence I know that the solution doesn't work (though I should have removed the Hfootnote above). So the solution you propose still leaves the first footnote as "a" and the second (the mark) as "0". –  Gerald Senarclens de Grancy Sep 7 '11 at 12:37
    
@Gerald: I edited my post. I get the correct result. ?? –  Marco Daniel Sep 7 '11 at 12:41
    
I see. I guess it's my style that uses alphabetic counters instead of numeric ones and hence causes the problem. –  Gerald Senarclens de Grancy Sep 7 '11 at 12:46
    
@Gerald: Use the commands of Andrew. \value should work. –  Marco Daniel Sep 7 '11 at 12:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.