Numbering of citation in beamer with split frame

I have a problem with the numbering of \footfullcite{} command in split frames in beamer. I want to increase the citation counter for every cite-command, even if the commands are not on the same displayed page. If the title was already cited, it should get the same number as the first citation. On the last page, \printbibliography should sort the citations in their citation-order and set the corresponding number as the item. I know, that footline-citations are somehow different to normal citations, anyhow I want to have a similar behaviour for footnote citations than for standard citations in biblatex numeric style.

Here is an example code, where I commented the desired behaviour.

\documentclass[aspectratio=169]{beamer}
\usepackage[language=english, backend=biber, style=authoryear]{biblatex}
\usepackage{filecontents}

\begin{filecontents*}{exampleReferences.bib}
@book{foo1,
year = {2001},
title = {Example title 1},
author = {John One}
}

@book{foo2,
year = {2002},
title = {Example title 2},
author = {John Two}
}
\end{filecontents*}

\begin{document}
\begin{frame}{Example frame 1}
Text on frame that doesn't change.\\

%This citation should be marked with a 1
\only<1>{Special text foo1 to be cited \footfullcite{foo1}}

%This citation should be marked with a 2, as it is the second citation and different from the first citation
\only<2>{Another special text to be cited \footfullcite{foo2}}

%This should be marked once again with 1, as it was already cited before.
\only<3>{Another passage of special text foo1 to be citeted \footfullcite{foo1}}
\end{frame}

\begin{frame}{Example frame 2}
%The reference on a new frame should get the same marker if it was already cited (here it should get a 2)
New frame with reference to already referenced text \footfullcite{foo2}
\end{frame}

\begin{frame}{Bibliography}
%The bibliography of all cited texts.
%It should be sorted in citation-order and have a citation-number item instead of the image [e.g. [1]~\cite{foo1}].
\printbibliography
\end{frame}
\end{document}


Any suggestions?

It seems easiest to base the style on numeric and its supercite and modify it with a two-pass structure so we get a separate footnote for each citation.

\documentclass[aspectratio=169]{beamer}
\usepackage[backend=biber, style=numeric, sorting=none]{biblatex}

\setbeamertemplate{bibliography item}{\insertbiblabel}

\makeatletter
\newcommand*{\mkblankfootnote}[1]{%
\begingroup
\renewcommand\thefootnote{}%
\footnotetext{\bibfootnotewrapper{#1}}%
\endgroup
}

\newcommand*{\mkbibsupercite}[1]{%
\def\cbx@savedcites{\cbx@footfullcite}%
\mkbibsuperscript{\mkbibbrackets{#1}}%
\cbx@savedcites}

\DeclareCiteCommand{\supercite}[\mkbibsupercite]
{\gdef\cbx@savedkeys{}}
{\usebibmacro{citeindex}%
\usebibmacro{cite}%
{}%
\xappto\cbx@savedkeys{\thefield{entrykey},}}
{\supercitedelim}
{\protected@xappto\cbx@savedcites{%
[\thefield{prenote}][\thefield{postnote}]{\cbx@savedkeys}}}

\DeclareCiteCommand{\cbx@footfullcite}
{}
{\mkblankfootnote{%
\printtext[labelnumberwidth]{%
\usebibmacro{cite}%
}%
\usedriver
{\DeclareNameAlias{sortname}{default}}
{\thefield{entrytype}}}}
{}
{}
\makeatother

\usepackage{filecontents}
\begin{filecontents*}{exampleReferences.bib}
@book{foo1,
year = {2001},
title = {Example title 1},
author = {John One}
}

@book{foo2,
year = {2002},
title = {Example title 2},
author = {John Two}
}
\end{filecontents*}

\begin{document}
\begin{frame}{Example frame 1}
Text on frame that doesn't change.

%This citation should be marked with a 1
\only<1>{Special text foo1 to be cited \supercite{foo1}}

%This citation should be marked with a 2, as it is the second citation and different from the first citation
\only<2>{Another special text to be cited \supercite{foo2}}

%This should be marked once again with 1, as it was already cited before.
\only<3>{Another passage of special text foo1 to be citeted \supercite{foo1}}
\end{frame}

\begin{frame}{Example frame 2}
%The reference on a new frame should get the same marker if it was already cited (here it should get a 2)
New frame with reference to already referenced text \supercite{foo2}
\end{frame}

\begin{frame}{Bibliography}
%The bibliography of all cited texts.
%It should be sorted in citation-order and have a citation-number item instead of the image [e.g. [1]~\cite{foo1}].
\printbibliography
\end{frame}
\end{document}


• Would it be possible to sort the footnote citations also in their (global) citation order if you have multiple citations (that were already cited) on the same page? For example if you add \only<3>{\supercite{foo1}} at the end of example frame 1. – Nico Aug 14 '18 at 11:56
• @Nico That would be infinitely harder (I'm not saying it can't be done). You would have to collect and sort the footnotes instead of just issuing them right away. That will need a lot of machinery. I think we had something remotely similar before, I'll see if I can find it, but I can't promise anything. beamer's overlay mechanism could be a serious problem here. I think it should be possible to collect footnotes per page, but I'm not sure about beamer frame/overlay... – moewe Aug 14 '18 at 12:03
• Finally I could use your solution for my problem. Thank you and sorry for accepting your answer that late. – Nico Oct 9 '18 at 9:27

Just a quick hack, for the disadvantages see moewes comment.

\documentclass[aspectratio=169]{beamer}
\usepackage[language=english, backend=biber, style=numeric]{biblatex}
\usepackage{filecontents}

\begin{filecontents*}{exampleReferences.bib}
@book{foo1,
year = {2001},
title = {Example title 1},
author = {John One}
}

@book{foo2,
year = {2002},
title = {Example title 2},
author = {John Two}
}
\end{filecontents*}

\setbeamertemplate{bibliography item}[text]

\makeatletter
\DeclareCiteCommand{\cite}[\mkbibsuperscript]
{\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\usebibmacro{cite}}
{\multicitedelim}
{\usebibmacro{postnote}}

\renewbibmacro*{cite}{%
\printtext[bibhyperref]{%
\printfield{labelprefix}%
\printfield{labelnumber}%
\ifbool{bbx:subentry}{%
\printfield{entrysetcount}
}{}%
}%
\footnotetext[\thefield{labelnumber}]{%
\usedriver{\DeclareNameAlias{sortname}{default}}{\thefield{entrytype}}
}%
}
\makeatother
\begin{document}
\begin{frame}{Example frame 1}
Text on frame that doesn't change.\\

%This citation should be marked with a 1
\only<1>{Special text foo1 to be cited \cite{foo1}}

%This citation should be marked with a 2, as it is the second citation and different from the first citation
\only<2>{Another special text to be cited \cite{foo2}}

%This should be marked once again with 1, as it was already cited before.
\only<3>{Another passage of special text foo1 to be citeted \cite{foo1}}
\end{frame}

\begin{frame}{Example frame 2}
%The reference on a new frame should get the same marker if it was already cited (here it should get a 2)
New frame with reference to already referenced text \cite{foo2}
\end{frame}

\begin{frame}{Bibliography}
%The bibliography of all cited texts.
%It should be sorted in citation-order and have a citation-number item instead of the image [e.g. [1]~\cite{foo1}].
\printbibliography
\end{frame}
\end{document}

• \thefield{labelnumber} should work instead of 42, but that can't deal with labelprefix, so I normally avoid the optional argument to \footnotetext and try to work with a combination of \mkbibsuperscript and footnotes without marker. That destroys the link, but it allows for multiple citations at once. – moewe Aug 14 '18 at 11:01
• @moewe Thanks a lot for your comments and help! – user36296 Aug 14 '18 at 11:16
• @samcarter I chose the answer from moewe because it came a little faster and I had already changed my presentation based on it. But I tested your code and it works just as well. Since it works with a little less lines of code it is a bit more elegant, so +1 for this. – Nico Oct 9 '18 at 9:29
• @Nico Selecting moews answer is a very good choice! Mine is just a hack, moewe actually solves the problem! – user36296 Oct 9 '18 at 9:34