TeXShopBeamer and citations

Information and discussion about TeXShop, an integrated LaTeX environment for Mac OS X
Post Reply
beamme
Posts: 9
Joined: Thu May 26, 2011 1:03 pm

Beamer and citations

Post by beamme »

Hi all,

I am writing a slide show with beamer, and I have to cite quite a few times different books and articles from my (huge) bibliography. So, I have a .bib file which I have dragged into the folder where my .tex file is. Now normally, like in a latex-article, I would put \usepackage{natbib} in the preamble, \bibliographystyle{plainnat} right after /begin{document} and \bibliography{BIB} right before \end{document}.
And when I want to cite something somewhere in the text flow, I would use, say, \cite{hemingway52} and I'd get a nice output. Now, in Beamer, I just get a question mark in my output.

Is there a way to fix this?
At one point the console says: No file Presentation.bbl
(The folder which holds all the tex-files is called Presentation)

I've actually seen a post here in the forum which said that it won't work at all, but on the other hand I found so many posts on the internet where people said that it worked for them-- so I'm confused :P

I'm very grateful for any advice!

Thank you very much!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
kaiserkarl13
Posts: 707
Joined: Tue Mar 25, 2008 5:02 pm

Beamer and citations

Post by kaiserkarl13 »

Without seeing exactly what you're doing I can't say what's going wrong, but the example I tried myself works fine:

Code: Select all

\begin{frame}{Bibliography}
\bibliographystyle{plainnat}
\bibliography{my-bibliography-databases}
\end{frame}
Make sure you spelled your citation correctly, and that you ran BibTeX on the aux file before running LaTeX (twice).

By the way, I always recommend to people NOT to do their citations with BibTeX when using the beamer class. It's not a BibTeX thing, per se---I also recommend not putting citations at the end in a PowerPoint slideshow. If you put the citations at the end, your audience has no idea what you are citing until your talk is over (in which case they no longer care). If you want to cite something, put it in a footnote---that way the can quickly jot down the information if something excites them.

I've thought about writing a package that would put citations at the bottom of the beamer slide, but there's simply too much variability in how people design slides to make such a thing practical. The footbib package is probably the closest thing that could exist anyway.
beamme
Posts: 9
Joined: Thu May 26, 2011 1:03 pm

Beamer and citations

Post by beamme »

Thank you very much for your fast reply!
I don't know what you mean by running BibTeX on the aux file-- how exactly do I do that? This is probably (hopefully) what's causing trouble...

I tried what you did, but I still get [?] in my output. This is my code:

Code: Select all

\begin{frame}{Bibliography}
\bibliographystyle{plainnat}
\bibliography{BIB}
\frametitle{1.5}
\begin{itemize}
\item[] First point...
\item[] Second point which is mentioned in \cite{hemingway}.
\end{itemize}
\end{frame}
And now I didn't put any commands in the preamble or at the end.
Last edited by Stefan Kottwitz on Fri May 27, 2011 9:52 pm, edited 1 time in total.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

Beamer and citations

Post by Stefan Kottwitz »

Hi,

you could open a terminal window, change to the documents directory and type

Code: Select all

bibtex documentname
at the command prompt.

Or check your editor (I don't use TeXshop) if there's a BibTeX option, button or menu entry for running it from within the editor.

Stefan
LaTeX.org admin
kaiserkarl13
Posts: 707
Joined: Tue Mar 25, 2008 5:02 pm

Beamer and citations

Post by kaiserkarl13 »

If you ever see [?] for a citation, it's because LaTeX didn't find the number or other text that it needed to refer to the citation. In your case, it's because you never generated the .bbl file (which contains the bibliography) by running BibTeX. As Stefan_K said, the usual way to generate a document containing a bibliography is the following sequence of commands:

Code: Select all

  latex myfile
  bibtex myfile
  latex myfile
  latex myfile
Since TeX assumes the extensions are the standard ones if you don't provide them explicitly, the above sequence is equivalent to the following set of commands:

Code: Select all

  latex myfile.tex
  bibtex myfile.aux
  latex myfile.tex
  latex myfile.tex
This is what I meant by running BibTeX on the .aux file.

If you're using some kind of front-end for LaTeX (i.e., you generate the document by a menu option instead of at the command line), then you should use the same options you use for a regular document with a bibliography. If you use the command line, try the commands above (or the same ones with latex replaced by pdflatex if you use PDFLaTeX).
beamme
Posts: 9
Joined: Thu May 26, 2011 1:03 pm

Re: Beamer and citations

Post by beamme »

Thank you two for the help! It was indeed very easy, I just had to find "BibTeX" in a drop-down menu and execute, and then executed Latex twice, just like you said: And it works. Thank you so much!

One more question: I have a nice bibliography end the end of the slide show of all the works cited in the presentation, but it's in a very light gray. How can I change its color to black?
kaiserkarl13
Posts: 707
Joined: Tue Mar 25, 2008 5:02 pm

Re: Beamer and citations

Post by kaiserkarl13 »

It depends on the Beamer style you're using. The brute force way is with \color or \textcolor, but I'd recommend against that if possible. If you could provide a short document that reproduces the grayness without too many additional files or personal information, I'll see what I can do to help.
beamme
Posts: 9
Joined: Thu May 26, 2011 1:03 pm

Re: Beamer and citations

Post by beamme »

well.. I use BibTeX, so I have a .bib file in my folder with all the latex-files. In my .tex file I have the following preamble (I don't know which of these commands are actually relevant for my problem, so I'll post them all, sorry that it's so annoyingly long):

\documentclass[xcolor=svgnames]{beamer}
\usecolortheme[named=MidnightBlue]{structure}
\usetheme{Goettingen}
\usepackage{array}
\usepackage{wrapfig}
\usepackage{graphics}
\usepackage{graphicx}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
\setbeamertemplate{navigation symbols}{}
\mode<presentation>
{
\usetheme{Goettingen}
\setbeamercovered{transparent}
%
}
\title{..}\subtitle{..}
\beamerdefaultoverlayspecification{<+->}
\begin{document}
\bibliographystyle{plainnat}
\maketitle

and then in a frame environment I would, e.g., \cite{poe} and then right before \end{document} I have a few \nocite{someauthor} and a \bibliography{BIB}.

All this produces a bibliography at the end of the slideshow which looks good, except for the color.
I hope that helps a little... Any ideas?
kaiserkarl13
Posts: 707
Joined: Tue Mar 25, 2008 5:02 pm

Beamer and citations

Post by kaiserkarl13 »

I had to tweak your example to get it to do anything at all (next time, please post a working example), but I think the problem is your default overlay specification line. If I comment that out, I get a "normal" looking bibliography.

Incidentally, the example you posted is actually broken---if run as written, I get BibTeX errors. These errors stem from the fact that the default overlay specification you chose (which expands each bullet on a separate slide) cause multiple \bibstyle commands to get written to the .aux file, which isn't allowed.

Check the beamer manual for how to change the default overlay specification mid-slideshow back to the default and you should be all set. Just make sure you don't get any more errors when compiling.
Post Reply