2

Currently, I use below code (from StackExchange) to 'linkify' parts of BibTeX entries:

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

Appending this command to, e.g., the code for format.title formats the title as a hyperlink:

FUNCTION {format.title}
{ title
  duplicate$ empty$ 'skip$
    { "t" change.case$ }
  if$
  "title" bibinfo.check
  duplicate$ empty$ 'skip$
    {
      emphasize
    }
  if$
  doilink
}

Question: How can I change the doilink code to use the url field when there is no doi field, and to do nothing if both are not present?

The solution should work with BibTeX (in particular, it should not require biblatex).

mrupp
  • 155

0 Answers0