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. – Steven B. Segletes Aug 15 '17 at 9:53
  • The hyperref package provides the \href macro... and the \url macro... – Paul Gaborit Aug 15 '17 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 '17 at 10:15
  • 3
    Why exactly? As others mention, when hyperref is loaded, that is how \url work. – daleif Aug 15 '17 at 10:17

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$ * "}" * 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.