[Tex/LaTex] BibTeX compilation is corrupting thefiles

bibtexcompilingcross-referencingtexmaker

I am using TexMaker 1.9.9 and managing my references with KbibTeX. I have all the LiveTex package up to date from Debian Stable release.

I always use the same template to write assignments:

\documentclass[10pt]{article}

% Some packages I always load, can be omitted:
\usepackage{url,graphicx,tabularx,array,geometry,amsmath,amssymb,apacite}

% Change english to the language you are writing in (for english this can   often be omitted):
\usepackage[english]{babel}

% Uncomment to use Sweave:
% \usepackage{Sweave}
% This is not a comment! Leave it in:
% need no \usepackage{Sweave.sty}

% Layout:
\setlength{\parskip}{1ex} %--skip lines between paragraphs
\setlength{\parindent}{0pt} %--don't indent paragraphs

% Commands for header:
\renewcommand{\title}[1]{\textbf{#1}\\}
\renewcommand{\line}{\begin{tabularx}{\textwidth}{X>{\raggedleft}X}   \hline    \\\end{tabularx}\\[-0.5cm]}
\newcommand{\leftright}[2]{\begin{tabularx}{\textwidth}{X>{\raggedleft}X}#1%
& #2\\\end{tabularx}\\[-0.5cm]}

%\linespread{2} %-- Uncomment for Double Space

%%% BEGIN DOCUMENT %%%

\begin{document}

\title{Title goes here}
\line
\leftright{\today}{Name (student number)} %-- left and right positions in the header

And my bibliography environment is:

\bibliographystyle{apa}
\bibliography{SIP_Project}



\end{document}

My problem is that for some reason none of the references are written down, and except I get question marks where the references should be. Now, I know this happens quite often and indeed it's not the first time. But before this would be fixed by compiling a few more times and then all would be good. But now, something is clearly wrong. I have managed to reproduce the error.

I start with only two files in my folder, the .tex file and the .bib file.
I do a Latex compile and the process starts and exits normally. Also, the files .dvi, .log and .aux have been created. Now, I run BibTex from TexMaker. Process starts but ends with errors. The files .bbl and .blg are created. Now, I do a quick build to see the pdf. The pdf file compiles with all references being shown as question marks, and with only 3 references listed at the bottom of the file (I used 7 references).

So, I close the pdf and try to make a Quick Build again. This time, the pdf doesn't compile and I get the following error (among others)

! Undefined control sequence.
\b@King1998 ->\astroncite
{King and Napa}{1998}
l.54 \item The study by \citeA{King1998}
is a study on social pshycology who...
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

This is another of the messages:

! Undefined control sequence.
\b@King1998 ->\astroncite
{King and Napa}{1998}
l.54 \item The study by \citeA{King1998}
is a study on social pshycology who...
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
! Use of \@year@ doesn't match its definition.
\Y@King1998 ->\@year@ \astroncite

And another:

{King and Napa}{1998}
l.54 \item The study by \citeA{King1998}
is a study on social pshycology who...
If you say, e.g., `\def\a1{...}', then you must always
put `1' after `\a', since control sequence names are
made up of letters only. The macro here has not been
followed by the required stuff, so I'm ignoring it.
! Undefined control sequence.

And so on. All the error messages have this format, but I don't see anything wrong with either my tex file or my bib file. By the way, my bib file was automatically generated by Mendeley, so I doubt there is something wrong with the entries. Just in case, the first entry I cite, which appears to be at least one of the problems, is the following on my .bib file:

@Article{ King1998,
    author = "L a King and C K Napa",
    issn = "0022-3514",
    journal = "Journal of personality and social psychology",
    keywords = "Adolescent, Adult, Aged, Aged, 80 and over, Female, Folklore, Happiness, Humans, Individuality, Job Satisfaction, Male, Middle Aged, Morals, Personal Satisfaction, Quality of Life, Social Values, Socioeconomic Factors, Students, Students: psychology",
month = jul,
number = "1",
pages = "156--65",
pmid = "9686456",
title = "{What makes a life good?}",
url = "http://www.ncbi.nlm.nih.gov/pubmed/9686456",
volume = "75",
year = "1998"
}

I have been using LaTex with TexMaker for quite some time now. I have used KBibTex and the same tex template over and over again. My bib files are always automatically generated from Mendeley, my bibliography manager. So I don't know what is wrong this time. Any comments or help are much appreciated.

Best Answer

The apa.bst style is a very old BibTeX style which is not compatible with the apacite package.

The documentation of apacite.sty says to use one of

\bibliographystyle{apacite}
\bibliographystyle{apacitex}
\bibliographystyle{apacann}
\bibliographystyle{apacannx}

Section 2, page 8:

enter image description here