natbib:引用相似作者和同一年份的论文时出错

natbib:引用相似作者和同一年份的论文时出错

natbib当我使用该软件包(启用选项)尝试在同一文档中引用两篇特定论文时,出现了一个奇怪的错误numbers。如果我修剪作者列表或更改其中一篇论文的年份,那么它就可以正常工作。

错误是:

...
Document Class: article 2005/09/16 v1.4f Standard LaTeX document class
(/usr/share/texmf/tex/latex/base/size10.clo))
(/usr/share/texmf/tex/latex/natbib/natbib.sty) (./test.aux)
! Missing = inserted for \ifnum.
<to be read again> 
                   \def 
l.5 ...p{mieghem10assortativity,mieghem10rewiring}
                                                   says

我已确认其他人的安装也会出现这种情况。所以这不是我的机器独有的。

我做错了什么,或者这是一个 bug natbib?如果是 bug,有解决方法吗?

这是一个简单的测试用例:

测试.bib:

@article{mieghem10assortativity,
        Month = {{Nov}},
        Numpages = {{11}},
        Publisher = {{American Physical Society}},
        author = {Van Mieghem, P. and Ge, X. and Schumm, P. and Trajanovski, S. and Wang, H.},
        title = {{Spectral graph analysis of modularity and assortativity}},
        journal = {{Physical Review E}},
        volume = {{82}},
        number = {{5}},
        pages = {056-113},
        year = {{2010}},
        doi = {{10.1103/PhysRevE.82.056113}},
}

@article{mieghem10rewiring,
        author = {Van Mieghem, P. and Wang, H. and Ge, X. and Tang, S. and Kuipers, F. A.},
        title = {{Influence of assortativity and degree-preserving rewiring on the spectra of networks}},
        journal = {{European Physical Journal B}},
        volume = {{76}},
        number = {{4}},
        pages = {643-652},
        year = {{2010}},
        doi = {{10.1140/epjb/e2010-00219-x}},
}

测试.tex:

\documentclass[a4paper]{article}
\usepackage[numbers]{natbib}

\begin{document}
blah. \citep{mieghem10assortativity,mieghem10rewiring} says
blah blah

\bibliographystyle{plainnat}
\bibliography{test}

\end{document}

答案1

错误是由于 bib 文件中的双括号引起的(尤其是在只需要数字的情况下)。为什么 bib 文件中的几乎每个字段都有双括号?如果我将它们更改为单括号,则一切正常。

\documentclass[a4paper]{article}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{mieghem10assortativity,
        Month = {Nov},
        Numpages = {11},
        Publisher = {American Physical Society},
        author = {Van Mieghem, P. and Ge, X. and Schumm, P. and Trajanovski, S. and Wang, H.},
        title = {Spectral graph analysis of modularity and assortativity},
        journal = {Physical Review E},
        volume = {82},
        number = {5},
        pages = {056-113},
        year = {2010},
        doi = {10.1103/PhysRevE.82.056113},
}

@article{mieghem10rewiring,
        author = {Van Mieghem, P. and Wang, H. and Ge, X. and Tang, S. and Kuipers, F. A.},
        title = {Influence of assortativity and degree-preserving rewiring on the spectra of networks},
        journal = {European Physical Journal B},
        volume = {76},
        number = {4},
        pages = {643-652},
        year = {2010},
        doi = {10.1140/epjb/e2010-00219-x},
}
\end{filecontents}
\usepackage[numbers]{natbib}

\begin{document}
blah. \citep{mieghem10assortativity,mieghem10rewiring} says
blah blah

\bibliographystyle{plainnat}
\bibliography{\jobname}

\end{document}

(注意:filecontents 包和环境仅用于生成 bib 文件,它们不是解决方案的一部分。)

答案2

我在使用网页的 inbook 模板时也遇到了类似的问题。为了使参考文献的格式正确显示,我输入了{[Accessed 22 January 2016]}年份字段。我引用了同一网站的两个网页,因此整体参考文献非常相似,只是标题和 URL 不同。当我添加其中一个参考文献时,它会编译,但当我添加第二个时,会出现此错误。我发现通过更改日期(即{[Accessed 21 January 2016]}它会编译。它似乎不喜欢非常相似的参考文献。

相关内容