我正在写一个乳胶文件,我有一个很大的.bib文件和大量的引用.我想以[作者,年]格式的形式引用并使用natbib包,但无法获得citep或citet工作,虽然简单的引用工作正常.我得到的错误是:
! Undefined control sequence.
l.3 lets cite \citet{cayton05}
Run Code Online (Sandbox Code Playgroud)
我正在使用Ubuntu texlive包并使用\input{<file>}latex命令将章节输入到主.tex文件中.
令人惊讶的是,\input{<file>}如果我只在主.tex文件中包含文本,那么所有cite命令都可以正常工作.
任何帮助将受到高度赞赏.
工作版本是这样的:
\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}
Run Code Online (Sandbox Code Playgroud)
在现实.tex文件,我输入的章节文字从另一个.tex文件,citep并且citet将无法工作在给予上述误差,但纯cite将正常工作.
我之前忘了提到我使用的是简单编号的参考书目样式,一切正常,所以输入的.tex文件没有错误.
Dir*_*tel 18
如果\citep和\citet不工作,那么你可能没有加载natbib.
从我目前正在处理的文件:
\usepackage[authoryear,round,longnamesfirst]{natbib}
Run Code Online (Sandbox Code Playgroud)
您可能需要不同的选项 - 有关详细信息,请参阅natbib的方便参考表.