[Tex/LaTex] Bibliography and elsarticle

bibliographies

I am trying to complile an elsarticle tex document. Although I dont get errors, the bibliographt doesn's seem to work. All I get is "elsarticle-harv" written.

Here is my MWE:

\documentclass[preprint,12pt,authoryear]{elsarticle}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage[brazilian]{babel}
\usepackage[utf8]{inputenc}
\usepackage{natbib}
\begin{document}
\cite{BHL}
\begin{thebibliography}
%\bibliographystyle{plainnat}   
\bibliographystyle{elsarticle-harv}
\bibliography{bib}
\end{thebibliography}
\end{document}

Any help is appreciated.

EDIT: Here is the bib file:

@Article{BHL,
author={Bjørnland, Hilde C. and Leitemo, Kai},
title={Identifying the interdependence between US monetary policy and the stock      market},
journal={Journal of Monetary Economics},
year=2009,
volume={56},
number={2},
pages={275-282},
month={March},
keywords={ VAR Monetary policy Asset prices Identification},
abstract={We estimate the interdependence between US monetary policy and the S\&P 500 using structural vector autoregressive (VAR) methodology. A solution is proposed to the simultaneity problem of identifying monetary and stock price shocks by using a combination of short-run and long-run restrictions that maintains the qualitative properties of a monetary policy shock found in the established literature [Christiano, L.J., Eichenbaum, M., Evans, C.L., 1999. Monetary policy shocks: what have we learned and to what end? In: Taylor, J.B., Woodford, M. (Eds.), Handbook of Macroeconomics, vol. 1A. Elsevier, New York, pp. 65-148]. We find great interdependence between the interest rate setting and real stock prices. Real stock prices immediately fall by seven to nine percent due to a monetary policy shock that raises the federal funds rate by 100 basis points. A stock price shock increasing real stock prices by one percent leads to an increase in the interest rate of close to 4 basis points.},
url={http://ideas.repec.org/a/eee/moneco/v56y2009i2p275-282.html}
}

Thanks.

Best Answer

You must delete (or comment out) the statements \begin{bibliography} and \end{bibliography}. Do add the instruction \section*{References} (or \section*{Bibliography} immediately before the \bibliography{bib} instruction.

Do also remember that all \usepackage statements must occur in the preamble.

Since some of your bib entries have long URL strings, I suggest you also load the url package. And, don't forget to encase words in the title field that shouldn't get lowercased in curly braces. (For the entry at hand, the word "US" qualifies for this treatment -- it definitely shouldn't get typeset as "us"...)

The results from the full MWE:

enter image description here

\documentclass[preprint,12pt,authoryear]{elsarticle}
\usepackage{filecontents}
\begin{filecontents}{bib.bib}
@Article{BHL,
author={Bjørnland, Hilde C. and Leitemo, Kai},
title={Identifying the interdependence between {US} monetary policy and the stock market},
journal={Journal of Monetary Economics},
year=2009,
volume={56},
number={2},
pages={275-282},
keywords={ VAR Monetary policy Asset prices Identification},
url={http://ideas.repec.org/a/eee/moneco/v56y2009i2p275-282.html}
}
\end{filecontents}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage[brazilian]{babel}
\usepackage[utf8]{inputenc}
\usepackage{natbib}
\usepackage{url} %% new
\begin{document}
\cite{BHL}
%%%\begin{thebibliography}
%\bibliographystyle{plainnat}  
\section*{References} %% new
\bibliographystyle{elsarticle-harv}
\bibliography{bib}
%%%\end{thebibliography}
\end{document}