about Grigoris Maravelias
Struggling with BibTeX ???

Struggling with BibTeX ???

Ok, it is time to try this promising thing called BibTeX [1,2,3], which allows you to use only one file with references* (suppose MyBibTeX.bib). Then, it easy to add references in any document just by simple adding the file and the citations. Although it seems rather straightforward hot to make the file its implementation is not.

So, first step is to add the file (or files separated with commas!) in you .tex document:
\bibliography{MyBibTeX}
[or even multiple files and in various locations, e.g. \bibliography{/path/to/bib,bib2,MyBibTeX} – by the way I did not notice any difference if extension .bib is kept or omitted!]

The second step is to add the style which will be used to represent the references. This is done by adding:
\usepackage{natbib} – at the preamble of the document and
\bibliographystyle{plainnat} – after/before \bibliography{}
to have the normal author-year style representation [3].

Now, to get proper representation of the references we have to compile the .bib file. This may seem a little complex (but you get used to this easily!):

  • pdflatex afile.tex
  • bibtex MyBibTeX.aux
  • pdflatex afile.tex
  • pdflatex afile.tex

[pdflatex or latex – depending on what you are using; see [3] for details]

In case on the error: “Bibliography not compatible with author-year citations
check that all your BibTeX entries include a year [4].
It is also important when making changes to the \bibliographystyle to remove the .aux and .bbl files completely [4].

Sources
[1] BibTeX.org: http://www.bibtex.org/ (retrieved 3/6/2014)
[2] Wikipedia: https://en.wikipedia.org/wiki/BibTeX (retrieved 3/6/2014)
[3] WikiBooks/LaTeX: https://en.wikibooks.org/wiki/LaTeX/Bibliography_Management (retrieved 3/6/2014)
[4] TeX-stackexchange.com: https://tex.stackexchange.com/questions/54480/package-natbib-error-bibliography-not-compatible-with-author-year-citations (retrieved 3/6/2014)

*EXAMPLE of references inside a MyBibTeX.bib:

@Book{testbook,
    author    = "M. Up and G. Down",
    title     = "Handbook of Testing TeX",
    publisher = "OpenBooks",
    year      =  2222,
    address   = "Caprica",
    edition   = "567th"
}

Leave a Reply

Your email address will not be published. Required fields are marked *