![backref 和 natbib 生成错误](https://linux22.com/image/386182/backref%20%E5%92%8C%20natbib%20%E7%94%9F%E6%88%90%E9%94%99%E8%AF%AF.png)
由于某些原因,自几周前以来,当我同时使用natbib
和时backref
,我收到一条错误消息并且编译停止。
Runaway argument? ! File ended while scanning use of \BR@@lbibitem.
backref
我在下面提供了一个 MWE。如果注释掉包含该软件包的行,则该文档确实可以在 Windows 7 或 Windows 10 中使用 MiKTeX 进行编译。在调查时,我注意到该bbl
文件在参考列表中的项目之间有注释行。我理解,要backref
正常工作,文件中两个连续的引用之间必须有一个空行bbl
。
我该如何解决这个问题?谢谢。
梅威瑟:
\documentclass{article}
\usepackage{natbib} %citep and citet
\usepackage[english,hyperpageref]{backref}
\usepackage{hyperref}
\RequirePackage{filecontents}
\begin{filecontents}{mybib.bib}
@Article{boiral_2006,
author = {Olivier Boiral},
title = {Global Warming: Should Companies Adopt a Proactive Strategy?},
journal = {Long Range Planning},
year = {2006},
volume = {39},
number = {3},
month = {jun},
pages = {315--330},
doi = {10.1016/j.lrp.2006.07.002},
publisher = {Elsevier {BV}},
}
@Article{koe1,
author = {G. {K\oe nig}},
title = {Production de la connaissance et pratiques organisationnelles},
journal = {Revue de Gestion des Ressources Humaines},
year = {1993},
volume = {9},
pages = {4-17},
}
\end{filecontents}
\begin{document}
Minimum working example where the reference list is unable to correctly backreference the citations.
K\oe ning
\cite{koe1}
\cite{boiral_2006}
\section{References}
\bibliographystyle{elsarticle-harv}
\bibliography{mybib}
\end{document}
答案1
嗯,对我而言,你使用的东西\bibliographystyle{elsarticle-harv}
就是罪魁祸首。
如果我将其更改为\bibliographystyle{plainnat}
我可以无错误地编译您的代码。您被迫使用这种风格elsarticle-harv
吗?
MWE(请注意,我使用了[backref=page]
包选项hyperref
而不是调用包backref
;语言english
是默认的):
\RequirePackage{filecontents}
\begin{filecontents}{\jobname.bib}
@Article{boiral_2006,
author = {Olivier Boiral},
title = {Global Warming: Should Companies Adopt a Proactive Strategy?},
journal = {Long Range Planning},
year = {2006},
volume = {39},
number = {3},
month = {jun},
pages = {315--330},
doi = {10.1016/j.lrp.2006.07.002},
publisher = {Elsevier {BV}},
}
@Article{koe1,
author = {G. {K\oe nig}},
title = {Production de la connaissance et pratiques organisationnelles},
journal = {Revue de Gestion des Ressources Humaines},
year = {1993},
volume = {9},
pages = {4-17},
}
\end{filecontents}
\documentclass{article}
%\usepackage[english,hyperpageref]{backref}
\usepackage{natbib} %citep and citet
\usepackage[backref=page]{hyperref}
\begin{document}
Minimum working example where the reference list is unable to correctly
backreference the citations.
K\oe ning
\cite{koe1}
\cite{boiral_2006}
\section{References}
\bibliographystyle{plainnat} % elsarticle-harv <========================
\bibliography{\jobname}
\end{document}
得到以下结果 PDF,没有错误或警告: