# Adding references in beamer slides

I am adding references in slides created using beamer.Following the post in this link I made a few modifications. The line that appears in the footnote stops in the middle of the frame. How do we extend it until the end of the frame/ how to remove the line?

\documentclass[xcolor={table,dvipsnames,usenames}]{beamer}
\begin{filecontents}{\jobname.bib}
@book{Saussure1995,
Author = {Ferdinand de Saussure},
Origyear = {1916},
Publisher = {Payot},
Title = {Cours de Linguistique G{\'e}n{\'e}rale},
Year = {1995}}

@book{Labov1972,
Author = {William Labov},
Publisher = {University of Pennsylvania Press},
Title = {Sociolinguistic Patterns},
Year = {1972}}

\end{filecontents}
\usepackage{natbib}
\usepackage{bibentry}
\bibliographystyle{apalike}
\usepackage{chngcntr}
\usepackage{subcaption}
\counterwithin*{footnote}{page}
\newcommand\footcite[1]{\footnote{\bibentry{#1}}\label{\thepage:#1}}
\newcommand\secondcite[1]{\textsuperscript{\ref{\thepage:#1}}}
\usepackage{graphicx}
\graphicspath{ {image/} }
\begin{document}
\nobibliography{\jobname}
\subsection{frame 6}
\begin{frame}{}
\begin{figure}[ht]
\centering
\begin{subfigure}{\linewidth}
\centering\includegraphics[width=4cm]{rabbit.png}
\end{subfigure}%
\begin{subfigure}{\linewidth}
\centering\includegraphics[width=4cm]{rabbit.png}\footcite{Saussure1995}
\end{subfigure}
\end{figure}
\begin{figure}
\includegraphics[scale=0.6]{image/image.png}
\caption{Steps }
\end{figure}
\end{frame}
\end{document}


Edit1: Also, for images how do we directly include the reference at the footnote without displaying the reference number next to the image. Edit2: The size of the font in the footnote appears big. I tried reducing the size using \tiny \footcite{Saussure1995}. But this isn't reducing the font size. Any suggestions?

Edit3:Here is the code without \subcaption and without figure

\documentclass[xcolor={table,dvipsnames,usenames}]{beamer}
\begin{filecontents}{\jobname.bib}
@book{Saussure1995,
Author = {Ferdinand de Saussure},
Origyear = {1916},
Publisher = {Payot},
Title = {Cours de Linguistique G{\'e}n{\'e}rale},
Year = {1995}}

@book{Labov1972,
Author = {William Labov},
Publisher = {University of Pennsylvania Press},
Title = {Sociolinguistic Patterns},
Year = {1972}}

\end{filecontents}
\usepackage{natbib}
\usepackage{bibentry}
\bibliographystyle{apalike}
\usepackage{chngcntr}

\counterwithin*{footnote}{page}
\newcommand\footcite[1]{\footnote{\bibentry{#1}}\label{\thepage:#1}}
\newcommand\secondcite[1]{\textsuperscript{\ref{\thepage:#1}}}
\usepackage{graphicx}
\graphicspath{ {image/} }
\begin{document}
\nobibliography{\jobname}
\subsection{frame 6}
\begin{frame}{}
\includegraphics[width=.47\textwidth]{rabbit.png}\hfill
\includegraphics[width=.47\textwidth]{rabbit.png}\footcite{Saussure1995}
\vfill
\includegraphics[width=\textwidth,height=50pt]{image.png}
\includegraphics[scale=0.6]{image/image.png}
\caption{Steps }
\end{frame}
\end{document}


Edit5:

\documentclass[xcolor={table,dvipsnames,usenames}]{beamer}
\begin{filecontents}{\jobname.bib}

@article{aguiree2013idf,
title={IDF diabetes atlas},
author={Aguiree, Florencia and Brown, Alex and Cho, Nam Ho and Dahlquist, Gisela and Dodd, Sheree and Dunning, Trisha and Hirst, Michael and Hwang, Christopher and Magliano, Dianna and Patterson, Chris and others},
year={2013},
publisher={International Diabetes Federation}
}

\end{filecontents}
\usepackage{natbib}
\usepackage{bibentry}
\bibliographystyle{apalike}

\begin{document}
\nobibliography{\jobname}
\subsection{frame 6}
\begin{frame}{}
\begin{figure}
\includegraphics[width=.47\textwidth]{image/rabbit.png}\hfill
\includegraphics[width=.47\textwidth]{image/rabbit.png}
\vfill
\includegraphics[width=\textwidth,height=50pt]{example-image}
\caption{Steps}
\end{figure}
\vfill
\footnotesize Image credit: \bibentry{aguiree2013idf}
\end{frame}
\end{document}


• Adding \usepackage{subcaption} changes the orientation of the images – Natasha May 6 '18 at 5:38
• I can't compile your document if I load the subcaption package, are you sure about your ECM? Which compilation engine do you use? – AndréC May 6 '18 at 8:26
• Apologies, I should have asked, and not just edited. Your original example doesn't work at all, because the subfigure environment isn't defined by any of the packages you had (you get ! LaTeX Error: Environment subfigure undefined.). subcaption does define an environment like that, used in the way you did, so I assumed that package was just missing. Edit: I see you do by accident get some reasonable output if you skip through that error, but the code is still wrong without subcaption. – Torbjørn T. May 6 '18 at 12:23
• (By the way, as far as I know it's possible to ping users who have edited a post as well, not just other commenters, so I think if you'd used @TorbjørnT. in your first comment, I would have been notified of it.) – Torbjørn T. May 6 '18 at 12:47
• I think ShareLaTeX by default runs in nonstopmode, meaning latex will skip past any errors and try to generate some output. But ShareLaTeX tells you that there are errors with the small red box with the number in it, next to the compile button (i.stack.imgur.com/TWddi.png). Whenever you get a red box like that there, you should click it to find out what the error is, and then try to find and fix it. – Torbjørn T. May 6 '18 at 12:57

Instead of trying to remove the footnoterule and the footnotemark, why not manually placing the reference at the bottom of the frame?

Off-topic: but you cannot use \caption outside of a figure or table environment.

\documentclass[xcolor={table,dvipsnames,usenames}]{beamer}
\begin{filecontents*}{\jobname.bib}

@article{aguiree2013idf,
title={IDF diabetes atlas},
author={Aguiree, Florencia and Brown, Alex and Cho, Nam Ho and Dahlquist, Gisela and Dodd, Sheree and Dunning, Trisha and Hirst, Michael and Hwang, Christopher and Magliano, Dianna and Patterson, Chris and others},
year={2013},
publisher={International Diabetes Federation}
}

\end{filecontents*}
\usepackage{natbib}
\usepackage{bibentry}
\bibliographystyle{apalike}

\begin{document}
\nobibliography{\jobname}
\subsection{frame 6}
\begin{frame}{}
\begin{figure}
\includegraphics[width=.47\textwidth]{rabbit.png}\hfill
\includegraphics[width=.47\textwidth]{rabbit.png}
\vfill
\includegraphics[width=\textwidth,height=50pt]{example-image}
\caption{Steps}
\end{figure}
\vfill
\footnotesize Image credit: \bibentry{aguiree2013idf}
\end{frame}
\end{document}


• Thank you very much. Will this work for only specific bibliography style? For instance, I am using BibTeX format. An error is displayed while compiling, citation not found. – Natasha May 6 '18 at 12:48
• @Natasha Can you make a minimal working example with bibliography (MWEB) that demonstrates the error you get? – samcarter_is_at_topanswers.xyz May 6 '18 at 12:51
• Please check the edit 5 in my original post – Natasha May 6 '18 at 13:00
• @Natasha Does not completely fit on the page, because the reference is too long, but otherwise it works fine for me. – samcarter_is_at_topanswers.xyz May 6 '18 at 13:09
• But, my earlier version of the code displayed the output. I compiled the code that you updated in sharelatex.It doesn't display the same output. – Natasha May 6 '18 at 13:46