0

I have downloaded a .bib file, but I don't know how to reference this file in beamer, and it only appears on the current page, not the last page. This is a minimal case, how can I add?

\documentclass{beamer}
\usepackage[utf8]{inputenc}

\usepackage[backend = biber, style = numeric, urldate = long, maxcitenames = 2, defernumbers=true ]{biblatex} \addbibresource{my.bib}

\begin{document}

\begin{frame} \newrefsection \begin{refsegment} Here is an example a reference\cite{2014IB}. \end{refsegment}

\printbibliography[segment=1] \end{frame}

\end{document}

This is my.bib file:

@misc{2014IB,
author = {Hu, Zhonghan},
title = {Infinite Boundary Terms of Ewald Sums and Pairwise Interactions for Electrostatics in Bulk and at Interfaces},
journal = {Journal of Chemical Theory and Computation},
volume = {10},
number = {12},
pages = {5254-5264},
year = {2014},
doi = {10.1021/ct500704m},
    note ={PMID: 26583209},

URL = { https://doi.org/10.1021/ct500704m

}, eprint = { https://doi.org/10.1021/ct500704m

} }

f6

  • I don't understand how your example makes references appear on the current page. – Teepeemm Nov 05 '22 at 14:30
  • You need to compile your document with Biber (a full cycle would be XeLaTeX, Biber, XeLaTeX, XeLaTeX). See https://tex.stackexchange.com/q/63852/35864 for an explanation why. See https://tex.stackexchange.com/q/154751/35864 for help with getting your editor to run Biber for you. – moewe Nov 06 '22 at 16:13

1 Answers1

1

References on each slide

If you want to print a reference list for each slide, Biblatex has functionality for this. In the code below, we use \newrefsection so that we do not have to change the segment number for each slide. Documentation is here.

\documentclass{beamer}
\usepackage[utf8]{inputenc}

\usepackage[backend = biber, style = numeric, urldate = long, maxcitenames = 2, defernumbers=true ]{biblatex} \addbibresource{references.bib}

\begin{document}

\begin{frame} \newrefsection \begin{refsegment} Here is an example a reference\cite{areference}. \end{refsegment}

\printbibliography[segment=1] \end{frame}

\begin{frame} \newrefsection \begin{refsegment} Here is an example of another reference\cite{anotherreference}. \end{refsegment}

\printbibliography[segment=1] \end{frame}

\end{document}

The file references.bib looks like this:

@misc{areference,
  author = {Me},
  title = {My first reference},
  year = 2022,
}

@misc{anotherreference, author = {Me}, title = {My second reference}, year = 2022, }

The result is this: enter image description here

References on last slide

If you rather want the default behavior of having references on the last slide, use \printbibliography:

\documentclass{beamer}
\usepackage[utf8]{inputenc}

\usepackage[backend = biber, style = numeric, urldate = long, maxcitenames = 2, ]{biblatex} \addbibresource{references.bib}

\begin{document}

\begin{frame} Here is an example reference\cite{areference}. \end{frame}

\begin{frame} \frametitle{References} Here is an example of another reference\cite{anotherreference}.

\printbibliography \end{frame}

\end{document}

The result looks like this: enter image description here

  • Thanks for your answer. When I applied my bib file I found it didn't work, I have updated the question, why is this? – Zhao Dazhuang Nov 06 '22 at 02:59
  • I ran your code and it works fine for me. You should show the error message and what output you get. – Nicholas Dalhaug Nov 06 '22 at 09:30
  • Thank you, I updated the title. When I compiled, the citation did not appear, but I wrote \cite{2014IB}, and the result of the compilation showed 2014IB, no corner mark, no citation information – Zhao Dazhuang Nov 06 '22 at 10:23
  • I cannot see an error message. Could you show the output of the compiler? Also, it seems not to be related to Beamer at all. Are you able to build references in article documents? See this link. – Nicholas Dalhaug Nov 06 '22 at 13:26