19

Depending on the theme of a beamer-document, footnotes will either be placed inside or outside of a block-environment. It would like to do combine a style, which places the footnotes inside a block-environment e.g. Copenhagen, with footnotes outside of blocks. Strangely, no option I have tried for \setbeamertemplate{blocks}[option] seems to do that - whether I used default, circles, rectangles,nor inmargin. Is there any other way to tell beamer that footnotes should be placed at the bottom of the frame?

On the left you can see the desired result with theme Berlin, both footnotes are at the bottom of the frame. On the right you see the the outcome with theme Copenhagen that unfortunately places one footnote inside the block-environment, which I would like avoid.

enter image description here

UPDATE: So here is my new MWE with some code from here:

\documentclass{beamer}
\usepackage[english]{babel}
\usepackage{csquotes}
\usetheme{Copenhagen}
\usepackage[style=numeric-comp, backend=biber, citetracker=true,sorting=none]{biblatex}
\usepackage{hyperref}
\addbibresource{biblatex-examples.bib}
\setbeamertemplate{navigation symbols}{}

\makeatletter
\newtoggle{cbx@togcite}
% Citation number in brackets
\renewcommand\@makefntext[1]{%
  \iftoggle{cbx@togcite}
    {{\normalfont[\@thefnmark]}\enspace #1}
    {{\normalfont\@thefnmark}\enspace #1}%
  \global\togglefalse{cbx@togcite}}

\DeclareCiteCommand{\sfcite}[\cbx@superscript]%
  {\usebibmacro{cite:init}%
   \let\multicitedelim=\supercitedelim
   \iffieldundef{prenote}
     {}
     {\BibliographyWarning{Ignoring prenote argument}}%
   \iffieldundef{postnote}
     {}
     {\BibliographyWarning{Ignoring postnote argument}}}
  {\usebibmacro{citeindex}%
   \usebibmacro{sfcite}%
   \usebibmacro{cite:comp}}
  {}
  {\usebibmacro{cite:dump}}

\newbibmacro*{sfcite}{%
  \ifciteseen
  {}
  {\xappto\cbx@citehook{%
   \global\toggletrue{cbx@togcite}%
   \noexpand\footnotetext[\thefield{labelnumber}]{%
     \fullcite{\thefield{entrykey}}\addperiod}}}}

\newrobustcmd{\cbx@superscript}[1]{%
  \mkbibsuperscript{\mkbibbrackets{#1}}%
  \cbx@citehook%
  \global\let\cbx@citehook=\empty}

\let\cbx@citehook=\empty
\makeatother

\begin{document}
    \begin{frame}{A frame}
\begin{block}{Classic theory}
  As we already know from classic theory\sfcite{reese}, ...
  \begin{itemize}
    \item Fact 1
    \item Fact 2
  \end{itemize}
\end{block}
Now there are some new developments\sfcite{bertram} challenging the classic view.
\end{frame}
\end{document}

Update 24.02.

I found that in beamerbaseboxes.sty this minipage seems to be responsible for the footnote inside the block-environment.

\newcommand\beamerboxesrounded[2][]{%
  [...]
  % line 120
  \setbox\bmb@box=\hbox\bgroup\begin{minipage}[b]{\bmb@width}%
  \vskip2pt%
  \usebeamercolor[fg]{\bmb@lower}%
  \colorlet{beamerstructure}{upper.bg}%
  \colorlet{structure}{upper.bg}%
  %\color{.}%
}

\def\endbeamerboxesrounded{%
  \end{minipage}\egroup%

Removing the minipage is not a good solution though, since it messes up the layout. Also taking \end{minipage}\egroup% inside \newcommand\beamerboxesrounded takes the footnote to the bottom of the slide, but messes up the layout.

maetra
  • 4,540

1 Answers1

12

It's a very similar problem to this one

You need to use \footnotemark inside the block environment and \foocitetext{reese} immediately after it:

\begin{frame}{A frame}
  \begin{block}{Classic theory}
    As we already know from classic theory\footnotemark, ...
    \begin{itemize}
      \item Fact 1
      \item Fact 2
    \end{itemize}
  \end{block}\footcitetext{reese}
Now there are some new developments\footcite{bertram} challenging the classic view.
\end{frame}

For your particular style, this basic idea can be incorporated into \sfcite. Here footnotes outside blocks are set using the \AfterEndEnvironment hook from the etoolbox package.

\documentclass{beamer}
\usepackage[english]{babel}
\usepackage{csquotes}
\usepackage[style=numeric-comp,citetracker=true,sorting=none]{biblatex}
\usepackage{hyperref}

\usetheme{Copenhagen}
\setbeamertemplate{navigation symbols}{}

\DeclareCiteCommand{\footfullcitetext}
  [\let\thefootnote\relax\mkbibfootnotetext]
  {\usebibmacro{prenote}}
  {\mkbibbrackets{\thefield{labelnumber}}%
   \addnbspace%
   \usedriver
     {\DeclareNameAlias{sortname}{default}}
     {\thefield{entrytype}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\makeatletter
\let\cbx@citehook=\empty
\newtoggle{cbx@blockcite}

\renewcommand{\@makefntext}[1]{%
  \noindent\normalfont\@thefnmark#1}

\DeclareCiteCommand{\sfcite}[\cbx@superscript]%
  {\usebibmacro{cite:init}%
   \let\multicitedelim=\supercitedelim
   \iffieldundef{prenote}{}{\BibliographyWarning{Ignoring prenote argument}}%
   \iffieldundef{postnote}{}{\BibliographyWarning{Ignoring postnote argument}}}
  {\usebibmacro{citeindex}%
   \ifciteseen
     {\ifnumequal{\value{page}}{\csuse{cbx@page@\thefield{entrykey}}}
       {}
       {\ifnumequal{\value{framenumber}}{\csuse{cbx@frame@\thefield{entrykey}}}
          {\usebibmacro{sfcite}}
          {}}}
     {\usebibmacro{sfcite}}%
   \usebibmacro{cite:comp}}
  {}
  {\usebibmacro{cite:dump}}

\newbibmacro*{sfcite}{%
  \csnumgdef{cbx@page@\thefield{entrykey}}{\value{page}}%
  \csnumgdef{cbx@frame@\thefield{entrykey}}{\value{framenumber}}%
  \xappto\cbx@citehook{%
    \noexpand\footfullcitetext{\thefield{entrykey}}}}

\newrobustcmd*{\cbx@superscript}[1]{%
  \mkbibsuperscript{\mkbibbrackets{#1}}%
  \iftoggle{cbx@blockcite}
    {}
    {\cbx@citehook%
     \global\let\cbx@citehook=\empty}}

\BeforeBeginEnvironment{block}{\global\toggletrue{cbx@blockcite}}

\def\metabox#1{\edef\theprevdepth{\the\prevdepth}\nointerlineskip
  \vbox to0pt{#1\vss}\prevdepth=\theprevdepth}

\AfterEndEnvironment{block}
  {\metabox{%
     \global\togglefalse{cbx@blockcite}%
     \cbx@citehook%
     \global\let\cbx@citehook=\empty}}

\makeatother

\addbibresource{biblatex-examples.bib}
\begin{document}
\begin{frame}[b]{First Frame}
\begin{itemize}[<+->]
  \item First citation.\sfcite{reese} Recurrent citation.\sfcite{reese}
  \item Second citation.\sfcite{springer}
  \item Recurrent citation.\sfcite{springer}
\end{itemize}
\end{frame}
\begin{frame}[b]{Second Frame}
\begin{itemize}[<+->]
  \item Third citation.\sfcite{glashow}
  \item Recurrent citation.\sfcite{reese,springer,glashow}
\end{itemize}
\end{frame}
\begin{frame}{Third frame}
\begin{block}{Block title}
Recurrent citation.\sfcite{reese} New citation.\sfcite{companion}
\end{block}
New citation.\sfcite{bertram}
Recurrent citation.\sfcite{bertram,companion}
\end{frame}
\end{document}

enter image description here

If you are willing to track footnotes manually, a simpler approach is preferable. Add only the following in your preamble:

\makeatletter
\renewcommand\@makefnmark{\hbox{\@textsuperscript{\normalfont[\@thefnmark]}}}
\renewcommand\@makefntext[1]{{\normalfont[\@thefnmark]}\enspace #1}
\makeatother

\DeclareCiteCommand{\footfullcitetext}[\mkbibfootnotetext]
  {\usebibmacro{prenote}}
  {\usedriver
     {\DeclareNameAlias{sortname}{default}}
     {\thefield{entrytype}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

Then input your frame as

\begin{frame}{A frame}
  \begin{block}{Classic theory}
    As we already know from classic theory\footnotemark\ ...
    \begin{itemize}
      \item Fact 1
      \item Fact 2
    \end{itemize}
  \end{block}\footfullcitetext{reese}

Now there are some new developments\footfullcite{bertram} challenging the classic view. 
\end{frame}
egreg
  • 1,121,712
  • you're right this solves the problem for the provided MWE. I originally wanted to combine the bibstyle from here http://tex.stackexchange.com/questions/45406/footnotes-disappear-when-using-overlays-in-beamer with the footnotes. To keep the example simple, I didn't include the relevant bibliography code, which I probably should have done. With the bibliography code, it doesn't really work well, adding a 1 inside the block and [1] outside. – maetra Feb 24 '12 at 14:15
  • @maetra Please, make a full MWE – egreg Feb 24 '12 at 14:19
  • I hope the MWE makes it clearer now. – maetra Feb 24 '12 at 14:39
  • everything works fine for two citations. Although there is one drawback: If there is just \sfootnotemark \sfcitetext and no \sfcite afterwards no footnote is printed. – maetra Feb 24 '12 at 15:48
  • I'm afraid that some better surgery has to be done. – egreg Feb 24 '12 at 15:56
  • well I guess at the moment I just "really need more than one footnote in a frame" – maetra Feb 24 '12 at 16:13
  • 1
    @egreg \sfcitetext needs to expand \cbx@citehook and reset it to \empty. That can be done with the wrapper argument in \DeclareCiteCommand. – Audrey Feb 24 '12 at 16:21
  • @Audrey I'll tried adding \let\cbx@citehook=\empty as the wrapper argument in DeclareCiteCommand, but I didn't seem to have any effect. – maetra Feb 24 '12 at 17:27
  • @Audrey Feel free to add an answer. – egreg Feb 24 '12 at 17:30
  • @maetra It doesn't work because \cbx@citehook needs to be expanded first. – Audrey Feb 24 '12 at 17:50
  • @egreg Mind if I just edit your answer at some point? The approach would be identical. – Audrey Feb 24 '12 at 17:53
  • @Audrey Please do. There is another point: the \sfcitetext command enters horizontal mode and it shouldn't. – egreg Feb 24 '12 at 17:56
  • @egreg Done. I streamlined the citation commands. I'm no good with modes, so I just slapped the code in a vbox using code from one of you previous answers. Please edit further as you see fit. – Audrey Feb 24 '12 at 19:56
  • @Audrey great work, I would never have come up with this. I am not trying to be nitpicking, but there is just one more thing. Now there is some extra space between the footnotes and which I would rather get rid of. Additionally I think you left out backend=biber in your MWE, at least for me I didnt work without biber. – maetra Feb 25 '12 at 08:40
  • @maetra Spacing should be tighter now. I typically use the default backend for solutions that don't need biber to work. You can of course use biber as the backend if you like. – Audrey Feb 25 '12 at 14:26
  • @Audrey looks great now, I played around with a bit more and tried to combine it with your code \newrobustcmd*{\footlessfullcite}{\AtNextCite{\renewbibmacro{title}{}\renewbibmacro{in:}{}}\sfcite} from here http://tex.stackexchange.com/questions/29069/footnote-citation-in-beamer. For citations outside of boxes everything works fine, inside boxes the title is still printed. Getting the title ommission to work with citations inside boxes would just be the icing on the cake. – maetra Feb 25 '12 at 15:21
  • @maetra Hold the phone. I think I see what you mean now. Just add \AtEveryCite{\renewbibmacro*{in:}{}\renewbibmacro*{title}{}} to your preamble. – Audrey Feb 25 '12 at 15:52
  • @Audrey I am sorry for the confusion. Yes, with boxes I meant blocks and I want all the footnote citations outside blocks. What I was trying to say: If try to ommit the title of a reference in the footnote, footlessfullcite works as expected, if the citation was made outside of a block. If I use footlessfullcite inside a block, the footnote is printed at the bottom of the frame not the block, which is perfectly fine. Just in this case the reference contains the title of the citation, which I would like to omit. – maetra Feb 25 '12 at 15:53
  • @egreg: you're answer is great. But there is only one problem. Using that, when I want to use \footnote the numeric which should be as a superscript in footnote is simply stand beside the text (like this: 1Here). Would you help on that? – Amin Aug 18 '18 at 04:52
  • @Amin Difficult to say without seeing an example of code. – egreg Aug 18 '18 at 09:21
  • https://tex.stackexchange.com/questions/446521/footnote-cite-in-beamer-in-ieee-style-with-some-attributes – Amin Aug 18 '18 at 10:00
  • @egreg: I have a question. How we can make the superscript form to be a normal citation (just like inline with the text)? Please let me know. Thanks. – Amin Apr 26 '20 at 04:46