当编译包含.tex
本文末尾所示的前言的文件时,我收到以下错误:
! Package natbib Error: Bibliography not compatible with author-year citations.
(natbib) Press <return> to continue in numerical citation style.
See the natbib package documentation for explanation.
Type H <return> for immediate help.
...
l.96 ...mand\NAT@force@numbers{}\NAT@force@numbers
?
在.tex
文件中,我声明了要读入的参考书目library.bib
:
\bibliographystyle{ieeetr}
\bibliography{./library}
我对该文件进行了非常详细地分析library.bib
,逐一删除了每个引用,直到上述错误消失。
问题在于这个引文:
@Article{Thermal-expansion-coefficients-Calcite-old-paper,
author = "R. Srinivasan",
title = "The thermal expansion of calcite form room temperature up to 400",
journal = "Proceedings of the Indian Academy of Sciences - Section A",
volume = "42",
pages = "81 - 85",
year = "1955",
}
如果您尝试:
A)用我的序言,
b)将此引文复制到新.bib
文件中:library_clean.bib
,
C)并制作要调用此文件的文档:
This is a citation \cite{Thermal-expansion-coefficients-Calcite-old-paper}
和:
\bibliographystyle{ieeetr}
\bibliography{./library_clean}
您将收到上述错误。
因此,这表明错误与此引文有关。我修改了引文,错误消失时至少一个-
被改变_
,例如所有这些可能性 1-5 都不会产生上述错误:
1) @Article{Thermal_expansion-coefficients-Calcite-old-paper, ...
2) @Article{Thermal-expansion_coefficients-Calcite-old-paper, ...
3) @Article{Thermal-expansion-coefficients_Calcite-old-paper, ...
4) @Article{Thermal-expansion-coefficients-Calcite_old-paper, ...
5) @Article{Thermal-expansion-coefficients-Calcite-old_paper, ...
然而,正如我所说,@Article{Thermal-expansion-coefficients-Calcite-old-paper,
生产那个错误。
如果你能帮助我我将非常感激。
前言:
\documentclass[12pt]{article}
\usepackage[left=2.5cm,top=2.5cm,right=2.5cm,bottom=2.5cm]{geometry}
\usepackage{graphicx}
\usepackage[longnamesfirst]{natbib}
\usepackage{amsmath} % Required for some math elements
\setcitestyle{square}
\usepackage{caption,setspace}
\usepackage{enumerate}
\usepackage[british]{babel}
\usepackage[utf8]{inputenc}
\usepackage{amssymb}
\usepackage{datetime} % custom date
\newdateformat{mydate}{\monthname[\THEMONTH] \THEYEAR}
\usepackage{subcaption}
\usepackage{courier}
\usepackage{enumitem}
\usepackage{multirow}
\usepackage[version=3]{mhchem}
\usepackage{rotating}
\usepackage{subcaption}
\usepackage{mathtools}
\newcommand{\angstrom}{\mbox{\normalfont\AA}}
\usepackage{adjustbox}
\usepackage{textcomp}
\usepackage{url}
\usepackage{enumitem}
\usepackage{comment}
\setlength\parindent{0pt} % Removes all indentation from paragraphs
\captionsetup{font={footnotesize,sf,small,stretch=1},labelfont=bf}
\renewcommand{\labelenumi}{\alph{enumi}.} % Make numbering in the enumerate environment by letter rather than number (e.g. section 6)
\usepackage{fancyvrb}
\usepackage{color,soul}
\newcommand\hb{HB}
\newcommand\gb{GB}
\newcommand\dd{DD}
\DeclareMathOperator{\csch}{csch}
答案1
删除该选项longnamesfirst
并numbers
在加载natbib
包时添加该选项。该选项longnamesfirst
仅在您使用作者年份样式的引文标注时才有意义。但是,ieeetr
参考书目样式只能生成数字样式的引文标注。