2

I am using makebst to create my own bib style. I would like the DOI to show up in the citation (as a hyperlink), whenever the DOI is present. I have successfully done that. When the DOI is present, I do NOT want the URL field to be used, since that is often redundant or pointless. I therefore disabled using the URL field in makebst. However, when there is no DOI field (some journals, etc. that I have do not have a DOI), I would like the URL field to appear instead. There is no option for this in makebst (as far as I can tell).

So, how can I use my makebst made bst file and use DOI preferentially, but URL when no DOI is present.

Packages I am using that might have an impact: hyperref, cite, url. [I am not using biblatex, which causes some other problems for me.]

1
  • You have to modify manually the resulting bst file. Unless, you have to submit the paper to publications still using bibtex, it would much easier to use biblatex (and to solve the other issue you might have).
    – Guido
    Apr 12, 2016 at 22:29

1 Answer 1

1

After playing around with the makebst output bst file, I found the following works. It amounts to changing the doi format. Make sure to first tell makebst to NOT include url (the default option).

  1. Open the .bst file (the makebst output)

  2. In the ENTRY section (the first section not commented out for me), you'll see a bunch of fields, including doi. Add 'url' (without the quotes) to this list.

  3. Go to the line that says FUNCTION {format.doi}. The next line should say { "" }. At least, that's what I had. Now, replace the { "" } with the following block of code:

        { url empty$
            { "" }
            {
              new.block
              "\url{" url * "}" *
            }
          if$
        }
    

After doing step 3, my format.doi block looks as follows (but yours might differ if you selected different makebst options):

FUNCTION {format.doi}
{ doi empty$
    { url empty$
        { "" }
        {
          new.block
          "\url{" url * "}" *
        }
      if$
    }
    {
      new.block
      "\doi{" doi * "}" *
    }
  if$
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .