I want to use bibtex in a beamer presentation and format the citations with natbib. This code works:
\documentclass{beamer}
\usepackage{listings}
\usepackage{hyperref}
%\usepackage[super,sort,comma]{natbib}
\usepackage{filecontents}
\begin{filecontents}{mybib.bib}
@book{author_book,
title = {Book's title},
author = {Author, Some},
location = {The City},
publisher = {Publisher},
year = {2005},
}
\end{filecontents}
\begin{document}
\begin{frame}
\frametitle{Title}
Test \cite{author_book}
\end{frame}
\begin{frame}
\frametitle{References}
\bibliographystyle{plain}
\bibliography{mybib}{}
\end{frame}
\end{document}
But when I uncomment:
\usepackage[super,sort,comma]{natbib}
I get the citation format I want but the hyperlinks are lost.
How can I solve it?
Best Answer
Too long for a comment:
hyperref
is loaded by thebeamer
class. At that stagenatbib
is not loaded, sohyperref
does not activate itsnatbib
compatibility code. There is no easy way to turn that code on, a second loading ofhyperref
is simply ignored, andbeamer
messes with some of the same macros thatnatbib
does. (Incidentally usingnatbib
you should use matching\bibliographystyle
such asplainnat
.)If you want superscript citations with hyperlinks, then you can use
biblatex
with either its\supercite
command or with a superscript option its\autocite
command:The above code runs with
biber
; if you preferbibtex
then call thebiblatex
package as: