[Tex/LaTex] Add external bibtex to beamer presentation

beamerbibtexpresentations

I would like to separate my bibliography from my slides. However, currently the onliest version that is working is to add the the citations directly to my main file.

Here is my example code:

\documentclass{beamer}

\mode<presentation> {


\usetheme{Madrid}

}
\usepackage{natbib}
\usepackage{bibentry}
\usepackage{graphicx} % Allows including images
\usepackage{booktabs} % Allows the use of \toprule, 


\title[Test]{Test } 

\author{} 
\institute[] 
{

}
\date{\today} 
\begin{document}

\begin{frame}
\titlepage % Print the title page as the first slide
\end{frame}

\begin{frame}
\frametitle{Overview} % Table of contents slide, comment this block out to remove it
\tableofcontents 
\end{frame}

%----------------------------------------------------------------------------------------
%   PRESENTATION SLIDES
%----------------------------------------------------------------------------------------

%------------------------------------------------
\section{First Section} % Sections can be created in order to organize your presentation into discrete blocks, all sections and subsections are automatically printed in the table of contents as an overview of the talk
%------------------------------------------------

\subsection{Subsection Example} % A subsection can be created just before a set of slides with a common theme to further break down your presentation into chunks


\begin{frame}[fragile] % Need to use the fragile option when verbatim is used in the slide
\frametitle{Citation}
An example of the \verb|\cite| command to cite within the presentation:\\~

This statement requires citation \cite{p1}.~\cite{test1}
\end{frame}

%------------------------------------------------

\begin{frame}
\frametitle{References}
\footnotesize{
\begin{thebibliography}{99} % Beamer does not support BibTeX so references must be inserted manually as below
\bibitem[Smith, 2012]{p1} John Smith (2012)
\newblock Title of the publication
\newblock \emph{Journal Name} 12(3), 45 -- 678.
\end{thebibliography}
}
\end{frame}

\begin{frame}[t,allowframebreaks]
\frametitle{References}
\bibliography{bibfile.bib}
\end{frame}

\end{document}

My external bibtex file is called bibfile.bib and is in the same directory.

@article{test1,
title = {Commercial Banks as Creators of 'Money'},
author = {Tobin, James},
year = {1963},
institution = {Cowles Foundation for Research in Economics, Yale University},
type = {Cowles Foundation Discussion Papers},
number = {159},
url = {http://EconPapers.repec.org/RePEc:cwl:cwldpp:159}
}

However, nothing gets shown on the last slide.

Any suggestions what I am doing wrong?

I appreciate your replies!

Best Answer

The following code worked for me. I removed the natbib package since it was causing problems. I also gave a bibliographystyle.

\documentclass{beamer}

\mode<presentation> {


\usetheme{Madrid}

}
%\usepackage{natbib}
\usepackage{bibentry}
\usepackage{graphicx} % Allows including images
\usepackage{booktabs} % Allows the use of \toprule, 


\title[Test]{Test } 

\author{} 
\institute[] 
{

}
\date{\today} 
\begin{document}

\begin{frame}
\titlepage % Print the title page as the first slide
\end{frame}

\begin{frame}
\frametitle{Overview} % Table of contents slide, comment this block out to remove it
\tableofcontents 
\end{frame}

%----------------------------------------------------------------------------------------
%   PRESENTATION SLIDES
%----------------------------------------------------------------------------------------

%------------------------------------------------
\section{First Section} % Sections can be created in order to organize your presentation into discrete blocks, all sections and subsections are automatically printed in the table of contents as an overview of the talk
%------------------------------------------------

\subsection{Subsection Example} % A subsection can be created just before a set of slides with a common theme to further break down your presentation into chunks


\begin{frame}[fragile] % Need to use the fragile option when verbatim is used in the slide
\frametitle{Citation}
An example of the \verb|\cite| command to cite within the presentation:\\~

This statement requires citation \cite{p1}.~\cite{test1} 
\end{frame}

%------------------------------------------------

\begin{frame}
\frametitle{References}
\footnotesize{
\begin{thebibliography}{99} % Beamer does not support BibTeX so references must be nserted manually as below
\bibitem[Smith, 2012]{p1} John Smith (2012)
\newblock Title of the publication
\newblock \emph{Journal Name} 12(3), 45 -- 678.
\end{thebibliography}
}
\end{frame}

\begin{frame}[t, allowframebreaks]
\frametitle{References}
\bibliographystyle{amsalpha}
\bibliography{bibfile}
\end{frame}

\end{document}

Citation is done right. enter image description here

The resulting references frame looks like this

enter image description here