[Tex/LaTex] Add text around footnote mark in beamer

beamerfootnotes

I've been trying to change the behavior of the footnotes in beamer. I can change the "footnote" template fine, but I'm having trouble changing the marker in both places. Ideally, I'd like to have flexible control, but here's a simple example.

If I want to use [1] instead of ^1. After seeing how-do-i-change-footnote-font-size-in-beamer-presentation, this is what I tried:

\documentclass{beamer}
\usepackage{etoolbox}
\makeatletter
\patchcmd{\@makefnmark}{\insertfootnotemark{#1}}{\insertfootnotemark{[#1]}}{}{}
\makeatother
\setbeamertemplate{footnote}{%
    [\insertfootnotemark] \insertfootnotetext
}

\begin{document}

\begin{frame}{Footnote test}
    Hello World.\footnote{Hello Back}
\end{frame}

\end{document}

but the output from pdflatex didn't seem to change. I've seen lots of folks messing with the color (see adding-color-to-the-footnote-mark-in-beamer), but not too much with the style from what I've looked at.

Best Answer

You were not far off, but beamer is not very flexible about some things (mainly ones which are discouraged in the manual). Here, there are a couple of patches needed

\documentclass{beamer}
\usepackage{etoolbox}
\makeatletter
\patchcmd{\@makefnmark}{\@textsuperscript}{\@makefnmark@aux}{}{}
\newcommand*{\@makefnmark@aux}[1]{[#1]}
\makeatother
\setbeamertemplate{footnote}{%
    \leavevmode \insertfootnotemark~\insertfootnotetext
}

\begin{document}

\begin{frame}{Footnote test}
    Hello World.\footnote{Hello Back}
\end{frame}

\end{document}

The idea is first to remove the \@textsuperscript from \@makefnmark, then to also deal with the fact that we then need a space where the footnote is actually printed. That needs a \leavevmode, which really should be in the underlying code I guess, but clearly is not!