0

This question already has an answer here:

I'm trying to use natbib to get a bibliography, but it's not working. I tried compiling a sample tex-file, which worked fine, but in my document it's not happening. My document looks like this:

\listfiles
\documentclass[12pt]{ociamthesis}
\usepackage[square]{natbib}
\usepackage{amssymb}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{csquotes}
\usepackage{hyperref}
\usepackage{amsmath}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{tabulary}
\usepackage{listings}
\usepackage{color}
\usepackage{eurosym}
\usepackage[]{graphicx}
\usepackage{subfigure}
\usepackage{textcomp}
\begin{document}
---content with citations---
\bibliographystyle{plainnat}
\bibliography{refs}
\end{document}

My bib-file looks like this:

@book{goossens93,
  author = "Michel Goossens and Frank Mittlebach and Alexander Samarin",
  title = "The Latex Companion",
  year = "1993",
  publisher = "Addison-Wesley",
  address = "Reading, Massachusetts"
  }

It just completely ignores the bibliography, there's no headline or anything. Where I put the citations, it prints ?. I even tried stripping the document until only

\documentclass[12pt]{ociamthesis}
\usepackage{natbib}
\begin{document}
\cite{goossens93}
\bibliographystyle{plainnat}
\bibliography{refs}
\end{document}

remained, but it didn't help. When I created a new .tex-file in another directory with the same contents, it worked fine. Deleting everything but the *.tex-file also didn't help. Does anyone have an idea what I'm doing wrong?

marked as duplicate by user36296, Stefan Pinnow, Jesse, Kurt, moewe Aug 26 '16 at 12:04

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Are you using BibTeX? – Christian Jul 5 '16 at 6:18
  • I do not have your classfile, so I tried your MWE with \documentclass{article} and I did not encounter any problems. – Christian Jul 5 '16 at 7:25
  • 3
    Show the log-file and the blg-file of the compilation of the stripped down failing example. – Ulrike Fischer Jul 5 '16 at 7:33
  • Off-topic: The subfigure package is badly deprecated -- don't use it. In its stead, consider using either the subfig package or the subcaption package. – Mico Aug 5 '16 at 7:33
1

Simply loading the natbib citation management package does not generate a formatted bibliography. The natbib package provides various citation-related commands and provides several bibliography styles, such as plainnat.

To actually generate the bibliography and correctly-formatted citation call-outs (to entries in the bibliography), you need to run BibTeX (after having first run LaTeX, of course) and then rerun LaTeX twice more.

0

Found the solution in an answer to this question: BibTeX bibliography not printing

I don't know why it wouldn't work otherwise for my document, because it worked fine for a fresh document, but it worked.

  • The information content of an observation such as "it worked fine for a fresh document" is nearly impossible to evaluate. For sure, there's an unlimited number of potential "fresh" documents, and without access to a specific such document it's not meaningful to speculate as to what is going on. – Mico Aug 5 '16 at 7:31

Not the answer you're looking for? Browse other questions tagged or ask your own question.