0

I have looked for a solution in this forum and elsewhere, but none of the solutions work for me.

Here is my code:

\documentclass[preprint,12pt]{elsarticle}
\usepackage{natbib} 
%\bibliographystyle{abbrvnat}
%\bibliographystyle{plainnat}
\bibliographystyle{unsrtnat}
\biboptions{comma,round}
\usepackage{lineno}
\linenumbers

\begin{document}

test test test \citep{blazek_explainable_2021,woese2004}. \bibliography{testref} \end{document}

My testref.bib file contains these two references:

@article{woese2004,
author = {Carl R. Woese },
title = {A New Biology for a New Century},
journal = {Microbiology and Molecular Biology Reviews},
volume = {68},
number = {2},
pages = {173-186},
year = {2004},
doi = {10.1128/MMBR.68.2.173-186.2004},
URL = {https://journals.asm.org/doi/abs/10.1128/MMBR.68.2.173-186.2004}

}

@article{blazek_explainable_2021, title = {Explainable neural networks that simulate reasoning}, volume = {1}, issn = {2662-8457}, url = {https://www.nature.com/articles/s43588-021-00132-w}, doi = {10.1038/s43588-021-00132-w}, language = {en}, number = {9}, urldate = {2021-10-15}, journal = {Nature Computational Science}, author = {Blazek, Paul J. and Lin, Milo M.}, month = sep, year = {2021}, pages = {607--618}, }

I tried the bibliography styles abbrvnat, unsrtnat and plainnat. But in all cases, I get only a numerical reference test test test (1, 2). I would like the citations to be in the author year format. e.g. (Woese C.R, 2004). Not sure what I'm missing here. Do I need to download the .bst files?

I would appreciate any help. Thanks in advance!

Kaumz
  • 11

1 Answers1

0

enter image description here

When loading elsarticle document class, pass the option nonatbib which unloads natbib package. You may then reload it and pass options as you wish. Also, elsarticle-harv does pretty much the style you want in the bibliography entries, but not in citation labels.

MWE

% !TeX document-id = {21024933-f6de-4c80-bd58-6d645072d057}
% !BIB TS-program = bibtex

\begin{filecontents*}{testref.bib} @article{woese2004, author = {Carl R. Woese}, title = {A New Biology for a New Century}, journal = {Microbiology and Molecular Biology Reviews}, volume = {68}, number = {2}, pages = {173-186}, year = {2004}, doi = {10.1128/MMBR.68.2.173-186.2004}, URL = {https://journals.asm.org/doi/abs/10.1128/MMBR.68.2.173-186.2004}

}

@article{blazek_explainable_2021, title = {Explainable neural networks that simulate reasoning}, volume = {1}, issn = {2662-8457}, url = {https://www.nature.com/articles/s43588-021-00132-w}, doi = {10.1038/s43588-021-00132-w}, language = {en}, number = {9}, urldate = {2021-10-15}, journal = {Nature Computational Science}, author = {Blazek, Paul J. and Lin, Milo M.}, month = sep, year = {2021}, pages = {607--618}, } \end{filecontents*}

\documentclass[preprint,12pt,nonatbib]{elsarticle}

\usepackage{natbib} \setcitestyle{semicolon}

\usepackage{lineno} \linenumbers

\begin{document}

\citep{woese2004,blazek_explainable_2021}.

\bibliographystyle{elsarticle-harv}
\bibliography{testref.bib}

\end{document}

  • 2
    Thanks! Unfortunately that did not work for me - even after copy pasting your code, only numerical references were generated. However, I took the idea that the elsarticle comes loaded with natbib, and this worked for me: \documentclass[preprint,12pt,authoryear]{elsarticle} – Kaumz Dec 02 '21 at 22:01