开发者

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

开发者 https://www.devze.com 2023-01-29 08:30 出处:网络
Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed. This question is off-topic. It is not currently accepting answers.

Want to improve this question? Update the question so it's on-topic for Stack Overflow.

Closed 10 years ago.

Improve this question

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} 
\usepa开发者_开发百科ckage[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.


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.


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

It will work after deleting \usepackage{cite}.

0

精彩评论

暂无评论...
验证码 换一张
取 消