4

I followed the solution of Undesired Placement of Footnotes in Blocks to do citations in my Beamer so that they are indeed footnotes and not foot-of-the-block notes. It works wonders however, when I do \sfcite{some_ref} inside a tabularx, it displays it as 0[1] Author's name, etc instead of simply [1] Author's name, etc. Any clue where this would come from?

% !TEX TS–program = pdflatexmk

\documentclass[mathserif,english]{beamer}
\usepackage[english]{babel}
\usepackage[backend=biber,style=numeric-comp,sorting=none]{biblatex}

\AtEveryCitekey{%
    \renewbibmacro*{in:}{}%
    \clearfield{pages}%
    \clearfield{volume}%
    \clearname{journal}%
    \clearfield{journal}%
    \clearlist{journal}%
    \clearfield{eprint}%
    \clearfield{archivePrefix}%
    \clearfield{primaryClass}%
    \clearfield{url}%
    \clearlist{address}%
    \clearfield{date}%
    \clearfield{eprint}%
    \clearfield{isbn}%
    \clearfield{issn}%
    \clearlist{location}%
    \clearfield{month}%
    \clearfield{series}%
    \clearfield{booktitle}%
    \clearname{booktitle}%
}

\setbeamertemplate{bibliography entry title}{}
\setbeamertemplate{bibliography entry location}{}
\setbeamertemplate{bibliography entry note}{}

\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

\usepackage{filecontents}
\begin{filecontents*}{bib2.bib}
@article{some_ref,
  title={Reference title},
  author={Author's name},
  year={2018}
}
}
\end{filecontents*}

\addbibresource{bib2.bib}

\usepackage{tabularx}
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}


\begin{document}

\begin{frame}
\frametitle{MWE frame}

The tabular here:

\begin{table}[h]
\begin{tabularx}{\textwidth}{P{0.45\linewidth}P{0.45\linewidth}}
Sample text & Other sample text\sfcite{some_ref}
\end{tabularx}
\end{table}

The same ref.\sfcite{some_ref}

\end{frame}
\begin{frame}[allowframebreaks]
        \frametitle{References}
    \printbibliography
\end{frame}


\end{document}

enter image description here

9
  • 1
    Can you please provide us with a minimal working example, i.e. a small document that starts with \documentclass, ends with \end{document} and illustrates the issue?
    – user121799
    Dec 12, 2018 at 18:33
  • 1
    Thanks. Unfortunately you seem to have inserted your code as a picture, so every [ became a \[ and every ] a \]. Could you please fix that?
    – user121799
    Dec 12, 2018 at 19:06
  • 1
    It's fixed, that was a clumsy blunder, sorry.
    – Cryme
    Dec 12, 2018 at 19:09
  • 3
    Why do you use tabularx? It doesn't make sense in your example. Dec 12, 2018 at 20:20
  • 1
    That is very true, because it is a MWE. I use the tabularx to hold images and an itemize. I could not get the itemize to work in a table else than using tabularx.
    – Cryme
    Dec 12, 2018 at 20:25

1 Answer 1

4

Using smacarter's answer to Unnumbered footnote in Beamer we can get unnumbered footnotes in beamer by redefining the beamer template.

\documentclass[mathserif,english]{beamer}
\usepackage[english]{babel}
\usepackage[backend=biber,style=numeric-comp,sorting=none]{biblatex}


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

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

\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}}
\makeatother

\setbeamertemplate{footnote}{%
  \parindent 1em\noindent%
  \raggedright
  \insertfootnotetext\par}

\addbibresource{biblatex-examples.bib}

\usepackage{tabularx}
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}


\begin{document}
\begin{frame}
\begin{table}[h]
\begin{tabularx}{\textwidth}{P{0.45\linewidth}P{0.45\linewidth}}
Sample text & Other sample text\sfcite{sigfridsson}\footnotetext{lorem}
\end{tabularx}
\end{table}

The same ref.\sfcite{sigfridsson}
\end{frame}
\end{document}

Footnotes without superfluous "0"s

3
  • +1 Nice answer! I knew adding the biblatex tag to the question would result in an answer by you :) Dec 13, 2018 at 16:34
  • @samcarter Well, you did all the work ;-) It took way too long because I have never really understood how footnotes work and throwing beamer into the equation definitely did not make things easier for me.
    – moewe
    Dec 13, 2018 at 16:37
  • Na, the really difficult parts were to combine that with biblatex :) (understanding footnotes is probably irrelevant for beamer, as beamer is reinventing them anyway :) Dec 13, 2018 at 16:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .