1

I'd like to cite two sources on the same line. They're supposed to appear in superscript. There is no separator between them, just a whitespace, which makes it look like '12' instead of the desired '1, 2'. Here's an MWE:

\documentclass{beamer}
\usepackage[style=verbose-ibid,backend=bibtex]{biblatex}

\usepackage{filecontents}
\begin{filecontents}{refs.bib}
@article{ref_a,
    author = {A},
    title = {a},
    year = {1970},
}
@book{ref_b,
    author = {B},
    title = {b},
    year = {1970},
} 
\end{filecontents}

\bibliography{refs}
\begin{document}

\begin{frame}\frametitle{frametitle}
text.

\begin{itemize}
    \item item \autocite{ref_a} \autocite{ref_b}    
\end{itemize}
\end{frame}
\end{document}

So if I'm using \autocite{ref_a} \autocite{ref_b}, I get '12' instead of '1, 2'. And if I'm using \autocite{ref_a, ref_b}, I get '1' and the footnote lists the two references in the same entry, separated by a semicolon. And if I'm using \autocite{ref_a}, \autocite{ref_b}, then this doesn't work either, of course. What I'd like is two separate entries and '1, 2'. Is there a way to set the separator for such references in Beamer with BibTeX?

  • You could try \autocites{ref_a}{ref_b} ... – BambOo Jun 08 '20 at 17:38
  • @BambOo thanks, I just did, it results in the same '1' with semicolon-separate citations in one entry in the footnote, and I need two separate entries with '1, 2'. Unless this requires some sort of package that would provide the intended behavior? – wouldnotliketo Jun 08 '20 at 17:59

1 Answers1

2

Since biblatex just typesets its \footcite (which is what \autocite comes down to with your settings) using the normal \footnote command, this question could be reformulated independently of biblatex as: "How do I place a comma between directly consecutive footnote markers?" (This is purely a beamer question in this case and has nothing to do with biblatex.)

I will, however, try to answer a different question, which I feel is the question you wanted to ask. Namely: "How do I get numeric citations with consistent numbering and full footnote references with biblatex in beamer?"

This question has been addressed with devilishly clever tricks by Audrey in Footnotes disappear when using overlays in beamer, so here is just a slight variation of that answer

\documentclass{beamer}
\usepackage[backend=bibtex, style=numeric-comp, citetracker=true]{biblatex}

\makeatletter
\newtoggle{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}%
   \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{%
    \global\toggletrue{cbx@togcite}%
    \noexpand\cbx@beamersfcite@footnote{\thefield{entrykey}}}}

% vary bad hack to get the footnote format as desired
\newcommand\cbx@footnotewithmark[2]{%
  \def\@makefntext##1{%
    \parindent 1em\noindent%
    \raggedright
    \hbox to 1.8em{\mkbibbrackets{#1}\hfil}\bibfootnotewrapper{#2}\par}%
  \footnotetext{we don't need this}}

\DeclareCiteCommand{\cbx@beamersfcite@footnote}
  {}
  {\cbx@footnotewithmark{%
     \usebibmacro{cite:init}%
      \usebibmacro{cite:comp}%
      \usebibmacro{cite:dump}}
    {\usedriver
      {\DeclareNameAlias{sortname}{default}}
      {\thefield{entrytype}}}}
  {}
  {}

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

\let\cbx@citehook=\@empty

\DeclareMultiCiteCommand{\sfcites}[\cbx@superscript]{\sfcite}{\supercitedelim}
\DeclareAutoCiteCommand{sfcite}[f]{\sfcite}{\sfcites}
\makeatother

\ExecuteBibliographyOptions{autocite=sfcite}


\addbibresource{biblatex-examples.bib}
\begin{document}
\begin{frame}
\frametitle{frametitle}
text.

\begin{itemize}
  \item item \autocite{sigfridsson,worman}
  \item ipsum \autocite{sigfridsson}
\end{itemize}
\end{frame}
\end{document}

Numeric citations with full footnote refs.

moewe
  • 175,683
  • Thank you! This answers the question, so I accepted it, but now I have a question regarding formatting... when used with punctuation, like so: item \autocite{ref_a};, the reference appears after the semicolon (item;1); is there a way to avoid this (item1;, imagine 1 being in superscript)? item \autocite{ref_a} ;, of course, adds an unnecessary space before the semicolon. IIRC the default autocite command handles it automatically? – wouldnotliketo Jun 09 '20 at 09:10
  • 1
    @wouldnotliketo Remove the [f] in \DeclareAutoCiteCommand{sfcite}[f]{\sfcite}{\sfcites} so it becomes \DeclareAutoCiteCommand{sfcite}{\sfcite}{\sfcites}. – moewe Jun 09 '20 at 10:28
  • Thank you! One more thing I discovered: this doesn't quite work with citations used in captions. The superscript reference appears as expected, but there is no footnote generated at the bottom. Can't quite provide an MWE in the comments, but with just a simple empty table and its caption it's visible. Is there any way to fix this? Sorry, I have zero experience with such features of LaTeX. – wouldnotliketo Jun 09 '20 at 11:27
  • @wouldnotliketo Basically, footnotes don't work in within floats. You may want to try avoiding the table environment and using \usepackage{capt-of} \captionof{table}{...} instead of \caption{...}. – moewe Jun 09 '20 at 14:24
  • Sorry, I appear to have misinformed you: I actually used captionof, not caption. However, the result is the same, even with the inclusion of \usepackage{capt-of}: the footnote is not generated, while the superscript reference is present. I can 'hack' this by simply using centered plain text instead of a caption, but that might not be applicable in more complicated situations. – wouldnotliketo Jun 09 '20 at 15:32
  • @wouldnotliketo Then please ask a new question with an MWE. I probably won't be able to figure out the issue, since the implementation of footnotes in beamer goes a bit over my head, but maybe someone else has an idea. – moewe Jun 09 '20 at 15:39