1

I'm working on beamer and setting up a custom footnote-template. In this template I invoke a macro which contains the footnotes.

The problem is, that beamer prints the contents of the footnote-template every time the \footnote macro was used. Because of that, if no \footnote was used the template isn't printed.

How is it possible to print the template once (and only once) at the end (so after any \AddToFoot) of each frame? A two run solution utilizing footline is not an option (well technically it is, but where's the fun in that).

An option which doesn't move any contents of the slide would be appreciated (so unlike my \invisfootnote).

Another template, which gets evaluated/used at the end of each frame would be fine, too, so it doesn't has to be footnote.

MWE:

\documentclass[]{beamer}

\setbeamertemplate{footnote}{%
    \hfill\smash{\llap{\parbox[b]{5cm}{\footnotesize\myfootnotes}}}%
}
\newcommand*{\myfootnotes}{}
\newcommand*{\AddToFoot}[1]{\edef\myfootnotes{\myfootnotes#1\\}}
\newcommand*{\invisfootnote}{\smash{\llap{\phantom{\footnote{foo}}}}}% still takes up space
\let\footnoterule\relax

\makeatletter
%\def\@end@frame@hook{\invisfootnote}% doesn't work
%\edef\endframe{\noexpand\invisfootnote\unexpanded\expandafter{\endframe}}% doesn't work
\makeatother

\begin{document}
\begin{frame}
    \frametitle{with \texttt{\string\footnote}}
    \begin{itemize}
        \item Foo
        \item Bar
        \item Baz
    \end{itemize}
    \AddToFoot{foo}
    \AddToFoot{bar}
    \invisfootnote
\end{frame}
\begin{frame}
    \frametitle{without \texttt{\string\footnote}}
    \begin{itemize}
        \item Foo
        \item Bar
        \item Baz
    \end{itemize}
    \AddToFoot{foo}
    \AddToFoot{bar}
\end{frame}
\end{document}

Edit: Defining a new environment which calls the frame environment and something like \invisfootnote would work, but is definitely not the desired solution.

Edit2: What I'm actually trying to achieve is to rebuild the following template (the image is created using the code I already have with the two-pass solution to the footnote problem):

enter image description here

Skillmon
  • 60,462

1 Answers1

1

based on clarification of the question in https://chat.stackexchange.com/transcript/message/39697331#39697331

The footnote mechanism works well, so I suggest to not touch it. Instead place the content of the footnote in a minipage with suitable alignment and the footnotes will be top aligned at a constant height.

(with some xpatch foo the code can probably simplified a lot...)

\documentclass{beamer}

\makeatletter
\def\beamer@autobreakframebox{%
  \global\setbox\beamer@splitbox=\box\voidb@x%
  \ifbeamer@autobreak%
    % Ok, frame was overful -> split it!
    \setbox\@tempboxa=\vsplit\beamer@framebox to\beamer@autobreakfactor\textheight%
    \global\setbox\beamer@splitbox=\box\beamer@framebox%
    \@tempdima=\ht\beamer@splitbox%
    \ifdim\@tempdima<\beamer@autobreaklastheight%
      \global\beamer@autobreaklastheight=\@tempdima\relax%
    \else%
      \setbox\@tempboxa=\vbox{\unvbox\@tempboxa\unvbox\beamer@splitbox}%
      \global\setbox\beamer@splitbox=\box\voidb@x%
    \fi%
    \setbox\beamer@framebox=\vbox to\textheight{\unvbox\@tempboxa%
      \vskip\beamer@framebottomskipautobreak%
      \ifvoid\beamer@splitbox%
        \ifvoid\beamer@footins%
        \else%
          \begingroup
        \rule{\textwidth}{1pt}
            \begin{minipage}[b][0.5cm][t]{.45\textwidth}% 
                \usebeamerfont{title in head/foot}
                \insertshortauthor
                \insertshorttitle\newline
                \insertshortinstitute
            \end{minipage}% <----------------------
            \begin{minipage}[b][0.5cm][t]{.45\textwidth}% <----------------------
              \usebeamercolor*[fg]{footnote}%
%              \footnoterule%
                            \usebeamerfont{footnote}
              \unvbox \beamer@footins%
              \global\setbox\beamer@footins=\box\voidb@x%
            \end{minipage}% <----------------------

             \begin{minipage}[c]{\textwidth}% 
                \centering \insertframenumber
            \end{minipage}
          \endgroup  
        \fi%
      \fi%
      \beamer@exitcode%
    }%
  \else%
    \setbox\beamer@framebox=\vbox to\textheight{\unvbox\beamer@framebox%
      \vskip\beamer@framebottomskip%
      \ifvoid\beamer@footins%
      \else%
        \begingroup
        \rule{\textwidth}{1pt}
            \begin{minipage}[b][0.5cm][t]{.45\textwidth}% 
                \usebeamerfont{title in head/foot}
                \insertshortauthor
                \insertshorttitle\newline
                \insertshortinstitute
            \end{minipage}% <----------------------
            \begin{minipage}[b][0.5cm][t]{.45\textwidth}% <----------------------
              \usebeamercolor*[fg]{footnote}%
%              \footnoterule%
                            \usebeamerfont{footnote}
              \unvbox \beamer@footins%
              \global\setbox\beamer@footins=\box\voidb@x%
            \end{minipage}% <----------------------

             \begin{minipage}[c]{\textwidth}% 
                \centering \insertframenumber
            \end{minipage}
        \endgroup 
      \fi%
      \beamer@exitcode}%
    \global\setbox\beamer@footins=\box\voidb@x%
  \fi%
  }
\makeatother

\setbeamerfont{footnote}{size=\tiny}
\setbeamerfont{title in head/foot}{size=\tiny}

\title{title}
\author{author}
\institute{ins}

\begin{document}

\begin{frame}
    \footnote{Must not complain about beamer customisation}
    \footnote{Must not complain about too many duck images}
\end{frame} 

\begin{frame}
    \footnote{Must try the new \texttt{tikzducks} package}
\end{frame} 

\end{document}

enter image description here

  • For a (imho) small change to the layout, this is a hell of a lot of code and given the beamer documentation says something along the lines: "Use \setbeamertemplate{footnote}" this is overkill. I still think that applying small changes to the frame layout should be easier :) – Skillmon Aug 29 '17 at 14:38
  • @Skillmon I would not consider this a small change. It's like re-arranging the frame components to have the title on the bottom. Small changes (i.e. the alignment of the footnotenumbers) can be conveniently modified with \setbeamertemplate. – samcarter_is_at_topanswers.xyz Aug 29 '17 at 14:44
  • I was able to create my footnote layout based on your answer. Thank you very much! – Skillmon Aug 30 '17 at 08:43