latex - natbib 出现的bug -authoryear

在latex中使用natbib,引用authoryear,出现了一种 bug,改了好久,找出一个适合自己的方法:

1. 环境:我的软件为mac下texstudio, 保证reference的bib文件中,每条参考文献都有author 和 year

2. 

\usepackage[comma]{natbib}

\bibliographystyle{plain}

LaTeX编译

报错:

! Package natbib Error: Bibliography not compatible with author-year citations. 

3. 按照网上的建议,加上usepackage 环节 numbers

\usepackage[comma, numbers]{natbib}

不再报错,但文章中的author和year无法显示

latex - natbib 出现的bug -authoryear

4. 更改bib 的style

\bibliographystyle{plainnat} 

latex编译仍无反应

5. 

按照Fuximi的建议,先删除.aux和.bbl文件,

同时保证:

\usepackage[comma, numbers]{natbib}

\bibliographystyle{plainnat} 

重新编译即可成功

步骤:

  1. \usepackage[comma, numbers]{natbib}
  2. \bibliographystyle{plainnat} 
  3. Delete the .aux and the .bbl files
  4. Do your changes (in the \bibliographystyle or in any option of natbib)
  5. Run LaTeX
  6. Run BibTeX

latex - natbib 出现的bug -authoryear

搞定!

参考链接:

https://blog.****.net/sweet_dew/article/details/43451475