Take the 2-minute tour ×
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.

Possible Duplicate:
How to get DOI links in bibliography

I'm struggling with a bibliography style problem. I would like to have the doi link set on the journal name, and then hide the doi key from the bibliography list.

I've tried to write some bst-bibtex function, which produces many errors, warning me that the stack was empty. I can't remember all the errors. If you know something about bibtex code, help me please.

FUNCTION {journal_doi}
{ doi duplicate$ empty$
  { }
  { "\href{http://doi.org/" doi * "}" *
    journal empty$
      { }
      { "{" * journal * "}" * }
    if$ 
  if$
  }
}
share|improve this question

marked as duplicate by zeroth, Thorsten, Paul Gaborit, percusse, Harish Kumar Oct 10 '12 at 22:53

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
You can adapt the answer given here. Which bibliography style are you using? –  Corentin Oct 10 '12 at 15:16

1 Answer 1

Building on this post, I would define a new function in the .bst file:

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

Then you need to find how the journal information is printed in your .bst file (this depends on which particular .bst you are using). Just add a call to doilink before outputting the journal information. If you also want to remove the doi from the output, you also need to find the place in the .bst where this is printed and delete those lines. It is difficult to be more specific without knowing more about your particular bibliography configuration.

Note that a very good guide to BibTeX may be found here (or texdoc tamethebeast in a shell). There would also be biblatex solutions.

EDIT: Here is an example based on the plain.bst style file:

FUNCTION {article}
{ output.bibitem
  format.authors "author" output.check
  new.block
  format.title "title" output.check
  new.block
  crossref missing$
    { journal emphasize doilink "journal" output.check
      format.vol.num.pages output
      format.date "year" output.check
    }
    { format.article.crossref output.nonnull
      format.pages output
    }
  if$
  new.block
  note output
  fin.entry
}

I have just added the call to the doilink function at the proper place (and you also need to add doi in the ENTRY {...} fields description at the beginning of the .bst file.

share|improve this answer

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