[Tex/LaTex] BibTeX can’t open style file

bibtexnatbib

I have a problem making my bibliography run. I had the same code some time ago and it did run then, I can't figure out what the problem is.

\documentclass[12pt]{scrartcl}
\usepackage[comma,authoryear]{natbib}
\begin{document}
Blablabla \cite{xy}
\bibliographystyle{natbib}
\bibliography{rp_bib.bib}
\end{document}

When I run LaTeX and afterwards BibTeX, it says I couldn't open style file natbib.bst
I'm skipping whatever remains of this command
I couldn't open database file...

Does anyone know what the problem might be?

Best Answer

There are several errors in your MWE. I have corrected them and included a short example bib file with package filecontents (for the manual type texdoc filecontents in your command line).

Please have a look for the bibliography style: natbib is the name of the package, you ment natdin I guess. Macro \bibname needs only the name (here: \jobname) of your bib file. Leave out .bib (Explanation: If you store the MWE with the file name mwe.tex your created bib file will be named mwe.bib).

Corrected and pretty printed MWE:

%http://tex.stackexchange.com/questions/85424/bibtex-cant-open-style-file
\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}  % writes bib file.
@book{adams,
  title     = {The Restaurant at the End of the Universe},
  author    = {Douglas Adams},
  series    = {The Hitchhiker's Guide to the Galaxy},
  publisher = {Pan Macmillan},
  year      = {1980},
}
\end{filecontents*}

\documentclass[12pt]{scrartcl}
\usepackage[comma,authoryear]{natbib}
%\usepackage{natbib}
\begin{document}
Blablabla \cite{adams}
\bibliographystyle{natdin} % natdin alphadin
\bibliography{\jobname}    % use file \jobname.bib for bibliography
\end{document}