21

I'm making a beamer presentation and I'd like to use natbib because of its \citet and that it recognizes URLs. However, when I try to compile it, while doing the third PDFLaTeX pass, there appear this error (among others):

[28] (./presentacion.toc) [29] (./presentacion.bbl  

(./presentacion.toc  

! Missing } inserted.  

<inserted text>   

                }  

l.3 ...r@sectionintoc {1}{Introducci\'on}{4}{0}{1}  

When I take out the natbib package, everything works well, including the \bibliography

Is there a way to solve this, or I shouldn't use natbib with beamer?

Joseph Wright
  • 259,911
  • 34
  • 706
  • 1,036
fabikw
  • 6,203

2 Answers2

14

The beamer class is not working with natbib. The initial author of the class Till Tantau said:

Currently, beamer does not work with natbib since beamer meddles with the same things as natbib and beamer's meddling is not done in such a way that natbib can tolerate this. Also, it is not possible to "switch off beamer's meddling"

However, you may use it in article mode.

You can read it here in the tex.latex.beamer.general mailing list.

Stefan Kottwitz
  • 231,401
14

Here is a working example. I compiled this on MacTex-2009, using pdflatex. No errors, no warnings (except a message about pgfbaseimage.sty being obsolete, which is unrelated).

\documentclass[hyperref={pdfpagelabels=false}]{beamer}
\usepackage[scaled]{helvet}
\usepackage[round]{natbib}
\newcommand{\newblock}{}

\begin{document}

\begin{frame}
    See \citet{foo}.

    \begin{thebibliography}{22}
        \bibitem[Foo(1988)]{foo} Foo (1998). Bar. \emph{CONF 1988}.
    \end{thebibliography}
\end{frame}

\end{document}

The result is a PDF document that looks like this:

See Foo (1988).

Foo (1998). Bar. CONF 1988.

And another example using Bibtex; test.tex:

\documentclass[hyperref={pdfpagelabels=false}]{beamer}
\usepackage[scaled]{helvet}
\usepackage[round]{natbib}
\newcommand{\newblock}{}

\begin{document}

\begin{frame}
    See \citet{foo}.

    \bibliographystyle{abbrvnat}
    \bibliography{test}
\end{frame}

\end{document}

and test.bib:

@INPROCEEDINGS{foo,
    author={Bar Foo},
    year={1988},
    title={Foo},
    booktitle={CONF 1988}
}

Again, works fine.

Jukka Suomela
  • 20,795
  • 13
  • 74
  • 91
  • 5
    Your post was very helpful for me. I want to say, though, that this second example is NOT straightforward at all. In particular \newcommand{\newblock}{} is a hack to get natbib and beamer working together. The beamer user guide suggests that only the manual bibliography entry approach is supported. – lowndrul Mar 02 '11 at 00:59
  • It worked for me with \renewcommand{\newblock}{}, great! – yannis May 22 '15 at 21:35
  • 2
    This second example does not work for me. Although I hoped it would! – B Furtado Jun 07 '18 at 20:08