4

I have used LaTeX for reports in physics, but now I'm in a new field where I need citations. I'm not very savvy with LaTex in the first place, so please describe the possible solutions as simple as possible.

Here is a MWE:

\documentclass[danish,a4paper,oneside, twocolumn,article,9pt]{memoir}
\usepackage[danish]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{graphicx}
\usepackage{mathtools}
\usepackage{siunitx}
\usepackage{natbib} **%this is what't new for me.**
\bibliographystyle{agsm} **%this is also new.** 
\sisetup{separate-uncertainty=true}
\usepackage[colorlinks=true]{hyperref}
\usepackage{microtype}
\setlrmarginsandblock{1.6cm}{1.6cm}{*} 
\setlength{\oddsidemargin}{-1cm} 
\pagestyle{plain}

\begin{document}
blah blah \citep{Deary200713}.
\bibliography{/Brugere/Julle/Skrivebord/LaTeX(artikel)/science.bib}
\end{document}

Additional information: As you can see, I write in Danish. I got the cited articles information from science direct, exported as a BibTeX format, and put the file in the same folder at my LaTeX document.

I get the messages:

citation 'Deary200713' undefined

and

there were undefined citations.

edit: This was solved when i compiled differently, as suggested in the comments AND changing the path of bibliography to just 'science' since the files are in the same folder.

2
  • Have you run latex, bibtex, latex, latex on your file? The \bibliography path looks unusable; if your .bib file is in the same folder as your .tex file, just write \bibliography{science}. Also, don't write science.bib, just write science. I also recommend putting your \bibliographystyle{agsm} just before your \bibliography{science}.
    – jon
    Commented Oct 25, 2013 at 14:41
  • 1
    Your code works as long as you have the bib. file in the same place as your main TeX file. Recall what @jon said, you need to latex --> bibtex --> latex --> latex when you build/compile your document. You can fix that on your TeXeditor options (i.e., in the quick build). Commented Oct 25, 2013 at 14:43

1 Answer 1

2

The bibliography style agsm is part of the harvard citation package. If you want to use it with the natbib citation management package, you can certainly do so; just be sure to load the har2nat package as well. The har2nat package "translates" some of the harvard-based commands encountered in agsm.bst into natbib-equivalent commands.

Of course, be sure to run LaTeX, BibTeX, and LaTeX twice more on your document to get all references in the bibliography and all citations (which are, for all practical purposes, cross-references to items in the bibliography) sorted out.

As an added bonus of loading both natbib and har2nat, the hyperref package works perfectly with this combination.

You must log in to answer this question.

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