TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to add to all my bibliography items a DOI (Digital Object Identifier) link or a link to a download location.

How can I do this with the natbib / BibTeX / hyperref combination? Currently I am using the plainnat style, but I'm willing to change that.

share|improve this question
@Joseph I updated my question – Peter Smit Oct 6 '10 at 7:07
Duplicate of tex.stackexchange.com/questions/3039/… (which comes up as the second hit when you search this site for DOI) – Seamus Oct 6 '10 at 9:28
@Seamus No, that question is about solving a problem with doi's, while I could not figure out how to it completely. Related: yes, dupliate: no. – Peter Smit Oct 6 '10 at 9:31
@Seamus Check for example google.com/… It is not clear for me what the solution is. And no, on this website there was no clear answer for my question. – Peter Smit Oct 6 '10 at 9:51
I'd agree with Peter: the question is not a duplicate (the previous one is about a very specific issue), although the relation between the two is clear. – Joseph Wright Oct 6 '10 at 10:23
up vote 49 down vote accepted

Include your DOIs in the BibTeX database under the doi field and include the URLs under the url field; for example:

  author = "Foo Bar",
  journal = "J.P.B.",
  year = 2010,
  title = "Where the wild things are.",
  doi = {10.1.1/jpb001},
  url = {http://dx.doi.org/10.1.1/jpb001}

test \citet{foo2010}

If you wish to hyperlink the DOI, I believe that loading the doi package will perform this automatically.

share|improve this answer
Worked great for me, I just had to download doi.sty from: ctan.org/tex-archive/macros/latex/contrib/doi – Quinn Taylor Jan 5 '12 at 6:50

A minimal change would be to use the plainurl style instead of plainnat.

You could also continue to use plainnat and give a suitable definition of \doi (to override the non-hyperlinked version \provided by plainnat), eg:

\newcommand*{\doi}[1]{\href{http://dx.doi.org/#1}{doi: #1}}

In both cases, just use a doi field in your .bib file.

share|improve this answer
What does plainurl add? Oh, I see, hyperlinks in the DOI. Sorry, was confused for a minute. – Will Robertson Oct 6 '10 at 7:34
I changed the bibtex style from plainnat to plainurl, but now each reference contains both the DOI and a URL to the same DOI, e.g: "URL: dx.doi.org/10.1016/0925-7721(93)90007-s, doi:10.1016/0925-7721(93)90007-s.". This is redundant. Is there a way to tell BibTeX to show only the DOI, without the URL? – Erel Segal-Halevi Aug 11 '15 at 9:53

Will Robertson showed how to do it with natbib and hyperref (as requested by the original poster). The most important point is of course to have a doi field in your bib file.
Another solution would be to use biblatex instead of natbib. My experience is that biblatexis at the same time very flexible and very stable, especially when some fileds (e.g name or doi) contain strange/special characters. Here is a MWE that should compile fine as it is:




Lorem ipsum dolor sit amet~\citep{kastenholz}.
At vero eos et accusam et justo~\citet{sigfridsson}.
share|improve this answer

I came across this thread recently while solving a variant of Peter's question.

Instead of adding a hyperlink DOI to each of the bibliography items, you may want not to write the DOI explicitly but to make another field of the bibliographic item clickable with an hyperlink to the download location. In some journals, the hyperlink is associated to the group "Journal Name, volume, page number" for instance. You may find some existing bibliography style files doing that, but sometimes you need to add this feature to a personal bibliography style. In this case, none of the above solutions work. The hack I came up with is to define the following function in the .bst file:

FUNCTION {doilink}
{ duplicate$ empty$
{ pop$ "" }
{ doi empty$
    { skip$ }
    { "\href{http://dx.doi.org/" doi * "}{" * swap$ * "}" * }

Here is an example of how to call the function:

FUNCTION {format.vol.num.pages}
{ volume field.or.null
  pages empty$
    { duplicate$ empty$
    { pop$ format.pages }
    {  ", " * pages first.page.number * }

In this case the volume and pages will be hyperlinks. In general the hyperlink will be associated to the item on the top of the stack when the function doilink is called. You also need to make sure that the doi is declared as a possible field for bibliographic entries. As a minimal example:

{ author

This may not be the most robust solution but it solved my problem. I thought it might be useful to some people here.


Following @laclaro 's follow-up question, I add an example of a .tex file calling the modified .bst file:






    Author = {Brune, M  and Hagley, E and Dreyer, J and Maître, X and  Maali, A and Wunderlich, C and Raimond,J.M. and Haroche,S },
    Title = {Observing the Progressive Decoherence of the “Meter” in a Quantum Measurement},
    Year = {1996},
    Journal = {Phys. Rev. Lett.},
    volume = {77},
    pages = {4887},
    doi = {10.1103/PhysRevLett.77.4887}}





and a screenshot of what it looks like:

enter image description here

Here, clicking on the volume or page number opens the doi link. To adapt this so that the hyperlink is on the journal, you would need to modify the function FUNCTION {format.journal} in the .bst style file rather than the FUNCTION {format.vol.num.pages} as was done here.

share|improve this answer
with biblatex and the eprint field, you can also add arxiv or oai links as offered by the Hal open archive hal.archives-ouvertes.fr. See tex.stackexchange.com/questions/4972/… – pluton Jul 25 '12 at 22:38

@Lev: that worked, although DOIs can contain special latex characters like underscores, such as:


So I modified your hack to:

\newcommand*{\doi}[1]{\href{http://dx.doi.org/\detokenize{#1}}{doi: \detokenize{#1}}}
share|improve this answer
Some of the strangest DOIs I have in my .bib file are: dx.doi.org/10.1002/… and dx.doi.org/10.1002/… – matth Feb 16 '12 at 12:06
See tex.stackexchange.com/q/3039/627 for more discussion of weird characters in doi strings. – Lev Bishop May 1 '12 at 18:08

Just adding my piece, I have myself revised the .bst style I wanted (apalike) to include ISBN, ISSN, DOI, and URL. I did not find any "apalikeurl" version so far, so I did it myself. It builds links for DOIs and ISBNs, and for ISBNs it is even capable of managing several IDs in the same field (i.e. one link for each).


Now I wonder if there is a way to use options for the style to say which IDs to accept for the display. I made all that just yesterday and did not have the time to investigate further. Comments and fixes are also welcome.

share|improve this answer

My reference section requires to output doi's also in the bibliography. Inspired from Corentin's solution, I come up with the following hack in the .bst file:

I add a doi field in the ENTRY section, if it does not contain:


Next, I define a function output.doi

FUNCTION {output.doi}
    doi empty$
        { skip$ }
        { "\href{http://dx.doi.org/" doi * "}{doi:" * doi * "}" * output }

Then, in the entries that I want to report doi field, I call this function, after a new block. In my case, it is required at the end, before the notes:

FUNCTION {article}
    note output

I added the doi field to article, inproceedings and incollection types.

For a bib entry with doi = {10.1007/978-3-642-20946-8\_2}, this solution displays a doi:10.1007/978-3-642-20946-8_2 reference at the bibliography, and when clicked it links to http://dx.doi.org/10.1007/978-3-642-20946-8_2 address.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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