I'm using LaTeX with BibTeX to write my paper. The .bst file is written by someone else.

In the .bst file, he wrote a function to deal with the \url as follows:

FUNCTION {format.url} { 
  "\url{" swap$ * "}" * 

Now I want to change "\url" to "\href". For example,

\url{http://www.aaa.com} --> \href{http://www.aaa.com}{http://www.aaa.com}

The minimum working example can be downloaded from here

Thank you.

  • 1
    You can edit and create a modified .bst file (making the correction), or you could, in your document, reassign \url to behave as \href, assuming the argument lists were compatible. However, it would help if you edit your question to provide a minimum working example to show the actual problem. Aug 15, 2017 at 9:53
  • The hyperref package provides the \href macro... and the \url macro... Aug 15, 2017 at 9:54
  • Thank you for your help. The minimum working example can be downloaded from raw.githubusercontent.com/jinglou/p2017-hcn-co-sod/master/…
    – loujing
    Aug 15, 2017 at 10:15
  • 3
    Why exactly? As others mention, when hyperref is loaded, that is how \url work.
    – daleif
    Aug 15, 2017 at 10:17

1 Answer 1


I referenced this question set DOI link on Journal Name with bibtex/.bst and have solved this problem.

The code is

FUNCTION {format.url} {    
  "\href{" url * "}{" * swap$ * "}" * 

You must log in to answer this question.

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