Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

citep and citet not working even when using natbib package [closed]

Tags:

latex

biblatex

I am writing a document in latex and I have a big .bib file and a large number of citations. I want to have citations in the form [Author, year] format and am using the package natbib, but can't get citep or citet working, though plain cite is working fine. The error I get is:

! Undefined control sequence.
l.3 lets cite \citet{cayton05}

I am using Ubuntu texlive package and use \input{<file>} latex command to input the chapters to the main .tex file.

What's surprising is that instead of using \input{<file>} if I just have text in the main .tex file then all the cite commands are working.

Any help would be highly appreciated.

The working version is like this:

\usepackage{cite} 
\usepackage[square,sort]{natbib}
%% lot of other packages and formatting %%

\begin{document}

\chapter{Testing citations}

\begin{enumerate}
  \item this is the first citation \cite{belkin02}.
  \item this is the second citation \citep{belkin02}.
  \item this is the third citation \cite{shlens03}.
\end{enumerate}



\phantomsection\addcontentsline{toc}{chapter}{Bibliography}
\begin{spacing}{1.5}
\nocite{*}
\bibliographystyle{apalike}
\bibliography{testnb.bib}
\end{spacing}

\end{document}

In the real .tex file, I input the chapter text from another .tex file, and citep and citet won't work in that giving the aforesaid error, though plain cite will work fine.

I forgot to mention earlier I was using plain numbered bibliography style and everything was working, so there is no error in the input .tex files.

like image 664
Dronacharya Avatar asked Dec 09 '10 01:12

Dronacharya


2 Answers

If \citep and \citet do not work, then you probably did not load natbib.

From a document I currently work on:

 \usepackage[authoryear,round,longnamesfirst]{natbib}

You may want different options -- see the handy reference sheet for natbib for details.

like image 133
Dirk Eddelbuettel Avatar answered Oct 31 '22 05:10

Dirk Eddelbuettel


You should only include \usepackage[square,sort]{natbib}.

It will work after deleting \usepackage{cite}.

like image 44
jjjjjj Avatar answered Oct 31 '22 04:10

jjjjjj