[Tex/LaTex] How to include the doi in only one single bibtex reference and exclude it from all others

bibtexdoi

There are many questions on here about the doi field in bibtex, however they are all (at least the ones I have found) about adding a doi for all references. What should you do if you only want it in a single reference in the bibliography (assuming you are using a style file that excludes doi's).

desired output is authors, year, title, journal, volume, issue, pgs. These appear to be the only fields not ignored by the style file. I'd like to place the DOI at the end, for one paper that is in press. I know I can place 'in press' in the year field, but the year is actually given, since the paper appears online on the journal's website. Ideally I'd like to replace the pages, volume or issue filed with the DOI for this one reference.

Below is two references and the corresponding style file used as a minimal reproducible example.

@article{berec2015,
  title={Designing efficient surveys: spatial arrangement of sample points for detection of invasive species},
  author={Berec, Lud{\v{e}}k and Kean, John M and Epanchin-Niell, Rebecca and Liebhold, Andrew M and Haight, Robert G},
  journal={Biological Invasions},
  volume={17},
  number={1},
  pages={445--459},
  year={2015},
  publisher={Springer}
}

@article{oclea2015,
  title={The danger of fictitious invasive species},
  author={oclea, Mason},
  journal={Fake Journal of Ecology},
  year={2015},
  volume={},
  number={},
  pages={1--15. DOI:10.1899/15-9834.6}
}

\documentclass[12pt,reqno]{article}
\setlength\parindent{0pt} %no auto indentation for new paragraphs
\usepackage{geometry} 
\geometry{a4paper} 
\usepackage{natbib}
\begin{document}
\citep{berec2015}
\citep{oclea2015}
\bibliographystyle{BESJournalsStyleFile}
\bibliography{BibTexFileGoesHere}
\end{document}

using Bibstyle BESJournalsStyleFile which can be found here https://www.ctan.org/tex-archive/biblio/bibtex/contrib/besjournals?lang=en. I have tried adding the DOI all of the fields. The above option for author oclea2015 produces a strange pp. before the DOI in the PDF.

Best Answer

The bibliography style besjournals doesn't appear to do anything with fields named doi. Thus, for any entry for which you do want to show doi-related information, you need to place that information in the note field which, as your luck would have, will be placed at the end of the formatted entry.

For the second entry you're listing, you should create the following near-duplicate entry (note the extra -doi string in the entry's key):

@article{oclea2015-doi,
  title={The danger of fictitious invasive species},
  author={Oclea, Mason},
  journal={Fake Journal of Ecology},
  year={2015},
  note={\mbox{doi}:\url{10.1899/15-9834.6}}
}

Of course, you should keep the original entry -- with the correct volume, number, and pages fields, but without the note field -- around as well. That way, you can choose which entry -- the one with or without the doi information -- to include in the bibliography.

enter image description here

\RequirePackage{filecontents} % make this a self-contained example
\begin{filecontents}{BibTexFileGoesHere.bib}
@article{berec2015,
  title={Designing efficient surveys: spatial arrangement of sample points for detection of invasive species},
  author={Berec, Lud{\v{e}}k and Kean, John M and Epanchin-Niell, Rebecca and Liebhold, Andrew M and Haight, Robert G},
  journal={Biological Invasions},
  volume={17},
  number={1},
  pages={445--459},
  year={2015},
  publisher={Springer},
}
@article{oclea2015,
  title={The danger of fictitious invasive species},
  author={Oclea, Mason},
  journal={Fake Journal of Ecology},
  year={2015},
  volume={},
  number={},
  pages={1--15},
  doi={10.1899/15-9834.6},
}
@article{oclea2015-doi,
  title={The danger of fictitious invasive species},
  author={Oclea, Mason},
  journal={Fake Journal of Ecology},
  year={2015},
  doi={10.1899/15-9834.6},
  note={\mbox{doi}:\url{10.1899/15-9834.6}}
}
\end{filecontents}

\documentclass[12pt,a4paper]{article}
\setlength\parindent{0pt} %no indentation for first lines of paragraphs
\usepackage{geometry,natbib,url}

\begin{document}
\nocite{*}  % include all entries in the bib file
\bibliographystyle{besjournals}
\bibliography{BibTexFileGoesHere}
\end{document}
Related Question