Bibtex 无法用新样式进行编译

Bibtex 无法用新样式进行编译

我正在尝试将我的书目样式从 unsrt 更改为 nar。但是,pdflatex、bibtex 和 2x pdflatex(使用 Texmaker)总是出现以下错误:

Package natbib Error: Bibliography not compatible with author-year citations. 我尝试删除 bib 和 aux 文件,但似乎不起作用。我有两个 *.bib 文件。一个由 Mendeley 创建,一个由我创建。这是我的一个条目的示例:

@book{saleh,
  Author = {Bahaa E. A. Saleh and Malvin C. Teich},
  Title = {Fundamentals of Photonics (Wiley Series in Pure and Applied Optics)},
  Publisher = {John Wiley \& Sons},
  Year = {1991},
  ISBN = {0471839655},
  URL = {http://www.amazon.com/Fundamentals-Photonics-Series-Applied-Optics/dp/0471839655%3FSubscriptionId%3D0JYN1NVW651KCA56C102%26tag%3Dtechkie-20%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0471839655}
}

我是这样引用的:

\cite{feyn}

似乎有很多这些问题,但所有提出的解决方案对我来说都不起作用。

答案1

看起来纳尔书目风格适用于数字样式(而不是作者年份样式)引文。因此,务必使用natbib选项加载包numbers。(该包的默认设置是创建作者年份样式的引文。)

在此处输入图片描述

\documentclass{article}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@book{saleh,
  Author = {Bahaa E. A. Saleh and Malvin C. Teich},
  Title = {Fundamentals of Photonics (Wiley Series in Pure and Applied Optics)},
  Publisher = {John Wiley \& Sons},
  Address  = {New York},
  Year = {1991},
  ISBN = {0471839655},
  URL = {http://www.amazon.com/Fundamentals-Photonics-Series-Applied-Optics/dp/0471839655%3FSubscriptionId%3D0JYN1NVW651KCA56C102%26tag%3Dtechkie-20%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0471839655}
}
\end{filecontents*}
\bibliographystyle{nar}
\usepackage[numbers]{natbib}
\usepackage{url}
\begin{document}
\cite{saleh}
\bibliography{\jobname}
\end{document}

相关内容