7

I've spend hours already trying to get natbib running. Im using Texmaker on Windows XP and just cannot find the problem:

  • I made sure the link to the .bib file is correct
  • I changed the bibliography style to a "natbib" compatible one
  • I'm compiling document, bibtex, document, document

So is there maybe any problem with my code?

\documentclass[12pt,oneside,a4paper]{article}
\setlength{\parindent}{0pt}
\setlength{\parskip}{1.15ex plus 0.4ex minus 0.2ex}
\usepackage{graphicx}
\graphicspath{{./figures/}}
\usepackage{hyperref}
\usepackage{float}
\usepackage{microtype}
\usepackage[doublespacing]{setspace}
\usepackage{amsmath}
\usepackage[utf8]{inputenc}
\usepackage[left=4cm, right=2cm, top=1cm, bottom=1cm, includeheadfoot]{geometry}
\usepackage{natbib}
\usepackage{fancyhdr}

\pagestyle{fancy}
\fancyhead{}
\fancyfoot{}
\renewcommand{\headrulewidth}{0pt}
\rfoot{\thepage}

\begin{document}
\section{Introduction}
For 2011, OECD reports...  \citet{oecd11}

\bibliographystyle{plainnat}
\bibliography{ba-thesis.bib}
\end{document}
3
  • 1
    Welcome to TeX.SX. You shouldn't use the .bib extension in the argument to \bibliography. Write \bibliography{ba-thesis}
    – egreg
    Mar 24, 2012 at 0:01
  • Checked, the problem remains. Nevertheless, thanks @egreg Mar 24, 2012 at 0:04
  • Welcome to TeX.SE! A quick comment: I've removed the "thanks" line from your question; in this group, we tend not to thank people with words for comments and answer they may provide. Upvoting their answers and accepting the best answer you get is the best way of expressing your gratitude. Two quick observations on your code: First, there's no need to include ".bib" in the argument of the \bibliography command. Second, did you remember to run bibtex following a latex run, followed by two more latex runs?
    – Mico
    Mar 24, 2012 at 0:04

2 Answers 2

5

Your file runs pproperly with me if:

remove .bib extension from the bibliography file

and RUN:

pdflatex

bibtex

pdflatex

pdflatex

in this sequence.

enter image description here

If it is not working for you, you may check the log file generated by bibtex. (Have you defined the bibtex key oecd11 in your bibtex entry?) You may also post your bibtex entry along with MWE.

PS. Since you did not provide the .bib file, I used another one.

5
  • 1
    Im 110% sure I had tried that before (removing the .bib extension). But anyway, it is working now! Mar 24, 2012 at 1:57
  • @Skywalker187, I do not quite understand. Any way I happy that it is working now for you.
    – user11232
    Mar 24, 2012 at 1:59
  • 1
    By the way, this forum seems like a great place to be. Mar 24, 2012 at 1:59
  • 2
    @Skywalker187, True. People here are friendly and helpful.
    – user11232
    Mar 24, 2012 at 2:00
  • Sometimes there is a little bit of magic in any kind of programming. Experience has taught me that most of the time, when I do something ten times and then it changes on the 11th time, it was usually my mistake. But there are times that it's just magic. :-) For *TeX especially, if you use one compiler (e.g. latex) and then switch to another (e.g. pdflatex), sometimes things behave ever-so-slightly differently. It might have something to do with the auto-generated files.
    – jvriesem
    Mar 11, 2015 at 23:05
0

The answer I found while working on Sublime Text was to have both, the apacite.bst and the apacite.sty in my project's folder.

1
  • This is generally not advisable.
    – Werner
    Jun 4, 2021 at 6:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .