# Problem inserting bibliography in TexStudio

\documentclass[preprint,12pt,authoryear]{elsarticle}
\usepackage{amssymb}
\usepackage{lineno}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{natbib}

\bibliographystyle{elsarticle-harv}

\begin{document}

\begin{frontmatter}
\title{Wave Forces}
\end{frontmatter}

%% main text
\linenumbers
\section{Introduction}
\label{}
With tremendous population \cite{kee1997flexible}
\bibliography{bibby}
\end{document}

bibby.bib contains

@article{kee1997flexible,
title={Flexible membrane wave barrier. {II}:~{Floating}\slash
submerged buoy-membrane system},
author={Kee, S. T. and Kim, M. H.},
journal={Journal of Waterway, Port, Coastal, and Ocean Engineering},
volume={123},
number={2},
pages={82--90},
year={1997},
publisher={American Society of Civil Engineers}
}

the errors shown are

Process started: bibtex.exe "texstudio_hN6136"

This is BibTeX, Version 0.99d (MiKTeX 2.9.6350 64-bit)
The top-level auxiliary file: texstudio_hN6136.aux
The style file: elsarticle-harv.bst
I couldn't open database file bibby.bib
---line 4 of file texstudio_hN6136.aux
: \bibdata{bibby
:               }
I'm skipping whatever remains of this command
I found no database files---while reading file texstudio_hN6136.aux
Warning--I didn't find a database entry for "kee1997flexible"
(There were 2 error messages)

Process exited with error(s)

Process started: pdflatex.exe -synctex=1 -interaction=nonstopmode "texstudio_hN6136".tex

Process exited normally

Could someone help me where I am making mistake and Any help on properly inserting bibliography is highly appreciated.

• Welcome to TeX.SE. Thanks for posting a very clear MWE (minimum working example). I am unable to replicate the issue you've described if the file bibby.bib is placed in the same directory as the main tex file (texstudio_hN6136.tex in the case of your example). Have you double-checkd the spelling of the bib file name, and have you checked that the file doesn't have an additional extension, say bibby.bib.txt or bibby.bib.tex? – Mico Oct 23 '17 at 5:48
• Off-topic: The elsarticle document class loads the natbib package automatically -- no need to load natbib separately. Also, don't load packages (amssymb) more than once. – Mico Oct 23 '17 at 5:51
• @Mico: For clarity sake I gave MWE. Thank you for the reply. It helped me. – KGV Oct 23 '17 at 5:59
• Did you save your .tex file prior to compiling? Filenames like texstudio_hN6136 usually occur if an new file is not saved prior to compiling and texstudio will automatically save it with such a name in a temporary folder (which then of course does not have your .bib file). – user36296 Oct 23 '17 at 9:44
• @samcarter: thank you for the suggestions. it is helpful. – KGV Oct 25 '17 at 10:19