[Tex/LaTex] Compile error when using \bibliography: “can only use in preamble”

bibliographiesbibtexerrors

I have a main file and a references.bib file I want to use.

The relevant code in my main file to my file is this:

\documentclass[12pt]{article}
\usepackage{biblatex}
...
\section{References}    

\cite{Heine-Borel}
\cite{L'Hospital}

\bibliography{myBibRefsFile}
\bibliographystyle{plain}

When I try compiling this, I get an error with the \bibliography line, telling me it can only be used in preamble. Based on the resources I've read, I don't think I'm using it wrong, so why am I getting this error?

Best Answer

You use commands for bibtex and .bst files. The syntax for biblatex should be:

\documentclass[12pt]{article}
\usepackage{biblatex}
\addbibresource{myBibRefsFile.bib} % with extension
...
\section{References}    

\cite{Heine-Borel}
\cite{L'Hospital}

\printbibliography

The default backend with biblatex is biber. If you want to stick to bibtex, specify it as an option to biblatex:

\usepackage[backend=bibtex]{biblatex}

You also can choose backend=bibtex8 or backend=bibtexu.

Related Question