# \citep does not work using natbib package

The \citep command does not display the author and year, instead it displays a number.

\usepackage{times}
\usepackage{a4wide}

\usepackage{natbib} % various citation commands
\usepackage{siunitx}

\usepackage{epsfig}
\usepackage{pifont}
\usepackage{fancybox}
\usepackage{amssymb}


This is the end, references are stored in DM.bib

\bibliographystyle{apalike}
\bibliography{DM}


Can anyone tell me what is wrong with it? I want to cite author and year, but not just a number.

-

## migrated from stackoverflow.comOct 28 '11 at 13:57

This question came from our site for professional and enthusiast programmers.

Welcome to TeX.sx! Your question was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other, otherwise you won't be able to comment on or accept answers or edit your question. – doncherry Oct 28 '11 at 14:23

Your code fragments are not very helpful. I create a minimal example which produced the result seen in the picture below.

Some obsolete packages are collected in the Q&A: How to keep up with packages and know which ones are obsolete?

In your case the packages: times, a4wide, fancyheadings, epsfig

If you had an old LaTeX-installation you should install TeXLive 2011.

Now the example:

\documentclass{article}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{Mustermann,
author = {Mustermann, A. and Mostermann, B. and Mistermann, C},
year = {2011},
title = {Using articles in {\LaTeX} documents},
journal = {Journal}
}
\end{filecontents}
\usepackage{natbib}
\begin{document}

\bibliographystyle{apalike}
\bibliography{\jobname}
\end{document}


The result is:

-
The filecontents package is not necessary, if you put the filecontents environments before \documentclass. – egreg Oct 28 '11 at 16:16
@egreg: Without the package the generate file will no be overridden. (I hope it is correct ;-) ) – Marco Daniel Oct 28 '11 at 16:26
Yes, the standard filecontents doesn't overwrite existing files (which is usually what one wants, as in this case). If you use it for having the bibliography database in the main document, then use the package, but loading it normally and using the environment after \documentclass. I believe it's easier than using the non standard \RequirePackage command. – egreg Oct 28 '11 at 16:30
@egreg: I changed my code. Thanks for the information. – Marco Daniel Oct 28 '11 at 16:32
For a more simple MWE you could use \bibliography{biblatex-examples} – matth Nov 4 '11 at 10:49