# APA style citation with apacite package

I am trying to put APA referencing using apacite but failing miserably. Here is my minimal trial example.

\documentclass[12pt]{article}
\usepackage[BCAY]{apacite}
\title{Brief Article}
\author{The Author}

\begin{document}
\maketitle
stuff \cite{anderson2012}

\bibliographystyle{apacite}
\bibliography{reference}

\end{document}


Inside my 'reference.bib' is following :

@techreport{anderson2012,
title = {Alcohol in the European Union : WHO Regional Office Europe},
author = {P. Anderson and L. M{\o}ller, G. Galea},
url  = {http://www.euro.who.int/__data/assets/pdf_file/0003/160680/e96457.pdf},
year = {2012}
}


And it is gives following warnings :

LaTeX Warning: Citation anderson2012' undefined on input line 17.

No file text.bbl.
[1] (./text.aux)

LaTeX Warning: There were undefined references.

)
Output written on text.pdf (1 page).
SyncTeX written on text.synctex.gz.
Transcript written on text.log


and following document

I am using Texshop and by changing typeset to bibtex i get following message

This is BibTeX, Version 0.99d (TeX Live 2015)
The top-level auxiliary file: text.aux
The style file: apacite.bst
Database file #1: reference.bib
apacite.bst [2013/07/21 v6.03 APA bibliography style]


Then back to Latex,

• hey i added the content of reference.bib – hadi k Jun 30 '16 at 14:29
• have you compiled using bibtex like described here, you need to proceed the compilation in this order > pdflatex -> biber -> pdflatex -> pdflatex in order to have your refrences defined and up to date. – SAM Jun 30 '16 at 14:31
• i am very confused. i am quite novice in this term and i do not know how to make that compilation order. i am using texshop and changed the typeset setting to LaTeX compiled and then to BibTex and again back to LaTex, but nothing has changed. I got some different information from console I have added it up – hadi k Jun 30 '16 at 14:39

The problem is that your url field contains underscores, which is a mathmode character. So solve this you need to tell apacite to deal with URLs properly. To do this, add load the url package:

But there is a second problem: the [BCAY] option should not be used unless you are working with an old document. It was included for backwards compatibility purposes, and should not be used any more.

I also made some corrections to your bib entry. Author names should be separated by and not commas. Things that need to preserve their capitalization need to be enclosed in {}. See:

% !BIB TS-program = bibtex

\documentclass[12pt]{article}
% This next bit is just a way to make a self-contained document containing
% a bib file. It will create a file with your-tex-file-name.bib based on the
% .bib file (edited to match the corrections made here)
\begin{filecontents}{\jobname.bib}
@techreport{anderson2012,
title = {Alcohol in the {European Union}: {WHO} Regional Office {Europe}},
author = {P. Anderson and L. M{\o}ller and G. Galea},
url  = {http://www.euro.who.int/__data/assets/pdf_file/0003/160680/e96457.pdf},
year = {2012}
}
\end{filecontents}
% self-contained stuff ends here
\usepackage[]{apacite}
\usepackage{url}
\title{Brief Article}
\author{The Author}

\begin{document}
\maketitle
stuff \cite{anderson2012}

\bibliographystyle{apacite}
\bibliography{\jobname}

\end{document}


As others have noted, you need to compile using latex, bibtex, latex, latex to get references to resolve correctly. See:

If you want to automate this using TeXShop, you can use one of the latexmk engines included with it. For instructions on getting it to work see:

• Incidentally, I have some doubts whether @techreport is the most appropriate type for the entry at hand. @misc and @unpublished` may be more suitable entry types. – Mico Jun 30 '16 at 16:33
• @mico Yes, I agree that either of those categories may be more appropriate. – Alan Munn Jun 30 '16 at 16:42
• hey, thanks got it. and also thank you for the links. learned so much with this :) – hadi k Jun 30 '16 at 23:04