TransWikia.com

Modifying apalike3 to print DOI with href

TeX - LaTeX Asked by Cynthia GS on August 5, 2021

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?

One Answer

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.

Correct answer by amyspark on August 5, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP