3

I try to use bib file to do my reference in latex, it was fine for a test document I did, the test document is shown as following

\documentclass[12pt]{article}

\usepackage{apacite}

\usepackage{natbib}

\begin{document}

\title{Investigations of parametric similar waves}

\date{\today}

\maketitle

Blah blah blah blah \citet{Turner2009}

\bibliography{MyCollection}

\bibliographystyle{apacite}


\end{document}

However, when I tried to implement it in another report, it does not work. The following are all the packages I used in my report. I suspect the problem is caused by one of package i used to do plots, but i am not sure how to fix it, anyone has any suggestions?

\documentclass[12pt]{article}
\usepackage{apacite}
\usepackage{natbib}

\usepackage[margin=0.85in, paperwidth=8.5in, paperheight=11in ]{geometry}
\usepackage{amsfonts}
\usepackage{graphicx}
\usepackage{subcaption}
\newsavebox{\largestimage}
\usepackage{tocloft}
\newlength{\mylen}

\renewcommand{\cftfigpresnum}{\figurename\enspace}
\renewcommand{\cftfigaftersnum}{:}
\settowidth{\mylen}{\cftfigpresnum\cftfigaftersnum}
\addtolength{\cftfignumwidth}{\mylen}

\renewcommand{\cfttabpresnum}{\tablename\enspace}
\renewcommand{\cfttabaftersnum}{:}
\settowidth{\mylen}{\cfttabpresnum\cfttabaftersnum}
\addtolength{\cfttabnumwidth}{\mylen}

\usepackage{verbatim}
\usepackage{latexsym}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{pdflscape}
\usepackage{soul}
\usepackage{color}
\usepackage{url}

\renewcommand{\baselinestretch}{1.5}
\numberwithin{equation}{section}
\numberwithin{figure}{section}
\numberwithin{table}{section}
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
\usepackage[backref=true,backend=biber,natbib=true,hyperref=true]{biblatex}
\bibliography{refs}
\usepackage{float}
\usepackage{hyperref}
\hypersetup{
     colorlinks   = true,
     citecolor    = gray
}
\begin{document}

\title{Investigations of parametric similar waves}

\date{\today}

\maketitle

Blah blah blah blah \citet{Turner2009}




 \bibliography{MyCollection.bib}
 \bibliographystyle{apacite}
 \end{document}
6
  • 2
    The second file also loads biblatex, which is fundamentally incompatible with natbib. You must choose to use one or the other.
    – jon
    Nov 14, 2016 at 1:48
  • Please do not quote code. It should be formatted as code. Highlight it and click {} or use ctrl+k. If you have problems, leave it unformatted. It is easier to correct than it is if you quote it. (Much easier.)
    – cfr
    Nov 14, 2016 at 1:51
  • @jon thanks for the reply, but say if i want to use biblatex, how should i do the reference..
    – Zhifang Hu
    Nov 14, 2016 at 2:24
  • 2
    As for biblatex in the APA style, see this answer (note that the answer is also trying to use the 'canadian' variant of English, which you can probably skip). If you use biblatex, you cannot load any of these: apacite or natbib; and you cannot use the \bibliographystyle. Please try the answer I suggested, however, and see if that helps.
    – jon
    Nov 14, 2016 at 3:05
  • 2
    See bibtex vs. biber and biblatex vs. natbib for an explanation of the differences. For apa citations see What is the relationship between natbib, apacite package, and apa document class? and the question @jon linked to.
    – Alan Munn
    Nov 14, 2016 at 3:36

1 Answer 1

1

Some comments about the first document: You may claim that "it was fine for a test document I did". However, this can't be the case except maybe for an extremely limited test document. Specifically, you should never load both the apacite package and the natbib package. In fact, since you're specifying apacite as the bibliography style, you should definitely not load the natbib package. If you prefer using natbib's citation commands \citet and \citep, you should load the apacite package as follows:

\usepackage[natbibapa]{apacite}

The second document suffers from an even bigger problem: Not only do you again load both apacite and natbib, you then load biblatex as well. The three packages are mutually incompatible. Another major problem is that the document features not one but two [!] \bibliography statements. No wonder things went haywire. Your conjecture, "I suspect the problem is caused by one of package i used to do plots", does not appear to be supported by the facts on the ground.

If you've had otherwise good experiences with the apacite citation management package and the apacite bibliography style, you should definitely not be loading either the biblatex or the natbib package.

Your second document suffers from some additional problems. For instance, I can think of no valid reason whatsoever for loading the latexsym package in a LaTeX2e document, the more so since you're also loading the amssymb package. There can also be no justification for loading the color package if you're going to override all of its capabilities by subsequently loading the xcolor package.

You must log in to answer this question.

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