[Tex/LaTex] Elsevier template compilation error when trying to show citation call-outs as numbers

citingelsarticlenatbib

I'm finishing a journal article using Elsevier's elsarticle document class.

My bibliography is yielding the following error (in output.aux):

Package natbib Error: Bibliography not compatible with author-year citations.
(natbib)                Press <return> to continue in numerical citation style.

A minimal code that reproduces the error is:

\documentclass[times,twocolumn,final,authoryear]{elsarticle}

\usepackage{prletters}
\usepackage{framed,multirow}
\usepackage{amssymb}
\usepackage{latexsym}
\usepackage{amsmath}
\usepackage{url}
\usepackage{xcolor}
\definecolor{newcolor}{rgb}{.8,.349,.1}

\journal{Pattern Recognition Letters}

\begin{document}

\cite{Brodatz1966}

\bibliographystyle{elsarticle-num}
\bibliography{refs}

\end{document}

Whenever I change the \bibliographystyle{elsarticle-num} line to \bibliographystyle{elsarticle-harv} or \bibliographystyle{elsarticle-num-names} the error goes away and it works normally, but then the format of the citation is not how I want it. I'm trying to get it in square brackets, like [23], but elsarticle-harv yields something like Brodatz (1966).

The refs.bib file contains the Brodatz1966 citation:

@BOOK{Brodatz1966,
  title = {Textures: a photographic album for artists and designers},
  publisher = {Dover Publications},
  year = {1966},
  author = {Brodatz, P.},
  series = {Dover pictorial archives},
  lccn = {66024124}
}

Any help would be appreciated. Thanks in advance.

Best Answer

Since you're looking to create numeric-style citation call-outs, you shouldn't be specifying the option authoryear at the \documentclass stage.

The authoryear option gets passed to the natbib citation management package. Because the elsarticle-num bibliography style (unsurprisingly...) is designed to create numeric-style rather than authoryear-style citation call-outs, an error message is generated.

A full MWE:

enter image description here

\RequirePackage{filecontents}
\begin{filecontents}{refs.bib}
@BOOK{Brodatz1966,
  title = {Textures: a photographic album for artists and designers},
  publisher = {Dover Publications},
  year = {1966},
  author = {Brodatz, P.},
  series = {Dover pictorial archives},
  lccn = {66024124}
}
\end{filecontents}

\documentclass[times,twocolumn]{elsarticle}
\bibliographystyle{elsarticle-num}
%%%\usepackage{prletters} % I don't seem to have this package
\usepackage{amssymb}
%%%\usepackage{latexsym}  % <-- don't load latexsym if you load amssymb
\journal{Pattern Recognition Letters}

\begin{document}
\cite{Brodatz1966}
\bibliography{refs}
\end{document}
Related Question