0

I am trying to modify apalike3.bst (see here) so that instead of printing the DOI number as a URL with hyperlink, it prints the actual DOI number but retains the hyperlink. The original DOI function is:

FUNCTION {format.doi} % doi
{
  doi empty$
    { "" }
    { "\url{https://doi.org/" doi * "}" * }
  if$
}

I'm trying to use \href instead: I've tried some variations and I can make it print some words hyperlinked to the right webpage, but not a DOI number that changes with the article. I thought the following would work:

FUNCTION {format.doi} % doi
{
  doi empty$
    { "" }
    { "\href{https://doi.org/" doi * "}{DOI:" doi * "}" * }
  if$
}

but I get a the literal stack is empty error when compiling the .bib file. Any clue of what should be written instead?

1 Answer 1

1

The issue may be that the string bits aren't properly concatenated. The line

    { "\href{https://doi.org/" doi * "}{DOI:" doi * "}" * }

should read

    { "\href{https://doi.org/" doi * "}{DOI:" * doi * "}" * }

The table in page 33 of the TameTheBeast manual has more details on this.

1
  • That works perfectly!! Thanks a lot and thanks for the reference!
    – Cynthia GS
    Commented Aug 25, 2020 at 20:47

You must log in to answer this question.

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