5

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.

  • 2
    If you don't want to/cannot edit the style file, you'll have to hijack another field the style file is happy with. Can you give me an example of what you currently have as well as your desired output? – Geodesic Sep 2 '15 at 8:19
  • You could add the doi in the url field if the style permits urls, otherwise you could use the note field. – nik gaffney Sep 2 '15 at 8:20
  • @Geodesic desired output is authors, year, title, journal, volume, issue, pgs. These appear to be the only ones not ignored by the style file. I'd like to place the DOI at the end. – WetlabStudent Sep 2 '15 at 8:22
  • 1
    Try adding the DOI to the pages field of this reference. Something like pages = {598--608. DOI:10.2514/1.52606} – Geodesic Sep 2 '15 at 8:26
  • 1
    You could switch over to biblatex which has a dedicated DOI field and even though suppressing doi is not a per-entry option, we can easily suppress the DOI for all but a particular lot of entries. – moewe Sep 2 '15 at 8:30
6

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}
  • The mbox and url fields are good suggestions. However, if MHH wants to use the pages field this still prepends 'pp.' after the journal title. – Geodesic Sep 3 '15 at 5:17
  • @Geodesic - I'm not sure I understand your point. I've posted an MWE (and associated screenshot) to flesh out my recommendation. The entry oclea2015-doi should contain a note field, but no volume, number, and pages fields. At least, that's what I think the OP wants. (However, I may be wrong...) – Mico Sep 3 '15 at 5:23
  • My interpretation was that the OP wants to include the pages field. If they don't then your answer is perfect. We shall see when they come back :) – Geodesic Sep 3 '15 at 5:31
  • @Geodesic And does it matter? The message here is: "Don't use doi or url field at all, and add this one particular DOI as a note. – yo' Sep 3 '15 at 6:03
  • @Mico I would personally prefer \href{http://dx.doi.org/12345}{\textsc{doi:} 12345}, but that's just a design decision (and a decision to include the "doi" label in the link). – yo' Sep 3 '15 at 6:05
1

This is a nasty hack, but overcoming the style files defaults isn't that straightforward unfortunately. The suggestion I proposed in my comment, appending the DOI to pages:

pages = {1--15. DOI:10.1899/15-9834.6}

appends the pp. in front of the page details as the style swaps to this mode after it sees the volume is blank. The solution to this is to put a negative space in the volume field, such that the style file is happy to treat this as a regular journal article:

volume = {\kern-0.3em}

This should work, although there's one caveat: the standard comma after the volume is still printed, and it'll print on the new line if the journal name happens to end flush with the right margin. I'm essentially hoping here your real titles don't have this problem and your fake ones are the exception.

For my own sanity, rather than using the pages field, you can also put the DOI in the note field like Steven has suggested, which makes this a little nicer on the eyes. The pp. addition still occurs if you just do this by itself and for some reason your style file doesn't like to capitalise the first letter (meaning you need to list it as 'doi' rather than 'DOI' if you choose to use the note field).

The oclea2015 entry I have working:

@article{oclea2015,
  title={The danger of fictitious invasive species},
  author={oclea, Mason},
  journal={Journal of Ecology},
  year={2015},
  volume={\kern-0.3em},
  number={},
  pages={1--15},
  note={doi:10.1899/15-9834.6}
}

Oclea2015

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.