You have a typo in your code: You need to use aysep={}
instead of aysep{}
:
\begin{filecontents*}{\jobname.bib}
@article{badie2010,
author={Badie, John},
title={Title},
journal={Journal},
year={2010},
}
\end{filecontents*}
\documentclass{article}
\usepackage{natbib}
\setcitestyle{notesep={: }}
\setcitestyle{aysep={}}
\begin{document}
\citep[1--2]{badie2010}
\bibliographystyle{plainnat}
\bibliography{\jobname}
\end{document}
The following basic citation commands are defined in natbib
:
\citet{jon90,jam91} ⇒ Jones et al. (1990); James et al. (1991)
\citep{jon90,jam91} ⇒ (Jones et al., 1990; James et al. 1991)
\citep{jon90,jon91} ⇒ (Jones et al., 1990, 1991)
\citep{jon90a,jon90b} ⇒ (Jones et al., 1990a,b)
Additionally there are some extended commands too:
\citealt{jon90} ⇒ Jones et al. 1990
\citealt*{jon90} ⇒ Jones, Baker, and Williams 1990
\citealp{jon90} ⇒ Jones et al., 1990
\citealp*{jon90} ⇒ Jones, Baker, and Williams, 1990
\citealp{jon90,jam91} ⇒ Jones et al., 1990; James et al., 1991
\citealp[pg.~32]{jon90} ⇒ Jones et al., 1990, pg. 32
\citenum{jon90} ⇒ 11
\citetext{priv.\ comm.} ⇒ (priv. comm.)
To extract just part of a citation, e.g. the author name or year, you can also use:
\citeauthor{jon90} ⇒ Jones et al.
\citeauthor*{jon90} ⇒ Jones, Baker, and Williams
\citeyear{jon90} ⇒ 1990
\citeyearpar{jon90} ⇒ (1990)
There are also uppercase versions of the citation commands for sentence initial citations of names that have a name prefix such as "de" or "von".
The \citeasnoun
command is from a different package. The natbib
documentation is a bit confusing in this respect, since the last section describes a bunch of other packages, all of which natbib
is intended to replace.
Best Answer
Well, I finally figured this out. Thanks egreg for telling me you didn't get any error. This pointed me in the right direction.
The problem was that a few years ago I had installed the Copernicus package, and it includes a natbib.sty file dating from 2006. Since I installed it in my ~/Library/texmf path, which comes before the directory for the systemwide files in the LaTeX search path, LaTeX was finding this file instead of the up-to-date one that comes with MacTeX-2011.
Once egreg told me it works, I looked more closely at the log file and noticed that a 2006 version of natbib was being loaded, instead of the 2010 version that comes with MacTeX. I'd infer that \setcitestyle was not implemented in 2006.
Lots of lessons here.
Thanks again.