TransWikia.com

Package natbib Error: Bibliography not compatible with author-year citations (Elsevier template)

TeX - LaTeX Asked on July 21, 2021

I am getting an error "Package natbib Error: Bibliography not compatible with author-year citations.
(natbib) Press to continue in numerical citation style."

I am to generate the reference number at the text which works great and gives me good results on the PDF but still getting error!

%%%%%%%%%%%%%Elsevier template %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
documentclass[5p,preprint,authoryear]{elsarticle}

journal{Energy}
setcitestyle{square}
usepackage{times}
usepackage{hyperref}
usepackage{graphicx}
usepackage{subfig}
usepackage{amsmath}
usepackage{circuitikz}
usetikzlibrary{patterns}
usepackage{array,booktabs}
usepackage{natbib}
usepackage{tikz}
usepackage{float}


begin{document}

begin{frontmatter}

begin{abstract}
 Latex Latex Latex Latex Latex Latex Latex Latex Latex Latex Latex Latex Latex Latex Latex Latex Latex Latex Latex Latex Latex Latex Latex Latex    
end{abstract}

end{frontmatter}

section{Introduction}
Latex Latex Latex  Latex Latex Latex Latex Latex Latex Latex Latex Latex Latex Latex Latex Latex Latex Latex Latex Latex Latex Latex Latex Latex Latex Latex Latex Latex Latex Latex Latex Latex Latex Latex Latex Latex Latex Latex Latex Latex cite{nazari2019optimal}. 




biboptions{sort&compress}
bibliographystyle{elsarticle-num}
bibliography{citation.bib}

end{document}

endinput
%%
%% End of file `elsarticle-template-harv.tex'.

my citation

@article{nazari2019optimal,
  title={Optimal energy management for a mild hybrid vehicle with electric and hybrid engine boosting systems},
  author={Nazari, Shima and Siegel, Jason and Stefanopoulou, Anna},
  journal={IEEE Transactions on Vehicular Technology},
  volume={68},
  number={4},
  pages={3386--3399},
  year={2019},
  publisher={IEEE}
}

One Answer

Since it looks like you want authoryear-style citation call-outs, you should change

bibliographystyle{elsarticle-num}

to

bibliographystyle{elsarticle-harv}

While you're at it, you should probably also change

setcitestyle{square}

to

setcitestyle{round}

Then, delete all auxiliary files and perform a full recompile cycle -- LaTeX, BibTeX, and LaTeX twice more.

Answered by Mico on July 21, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP