The functions in the end are defined in my .bst
file. What they do is, when I add the field
webpage={http://xxx.xxx.xxx...../}
to a bibitem, it displays at the end of the reference in the bibliography the text:
... URL: http://xxx.xxx.xxx...../
(where the three first dots indicate the rest of the reference: authors, title, journal, etc..) What I would like is that instead of showing the actual url, it became a link of the text URL. This way the reference would only show the text URL at the end (and not the url itself) which I could click and go to that link.
Is this possible?
FUNCTIONS
ENTRY
{ address
...
webpage
year
...
}
FUNCTION {format.webpage}
{
webpage "webpage" bibinfo.check
duplicate$ empty$ 'skip$
{ new.block
bbl.availableat " \url{" * swap$ * "}" *
}
if$
}
FUNCTION {bbl.availableat}
{ "URL: " }
FUNCTION {new.block}
{ output.state before.all =
'skip$
{ after.block 'output.state := }
if$
}
FUNCTION {bibinfo.check}
{ swap$
duplicate$ missing$
{
pop$ pop$
""
}
{ duplicate$ empty$
{
swap$ pop$
}
{ swap$
pop$
}
if$
}
if$
}
Edit
I tried Mico's suggestion and changed the webpage
function like so:
FUNCTION {format.webpage}
{
webpage "webpage" bibinfo.check
duplicate$ empty$ 'skip$
{ new.block
" \href{" * swap$ * "}{URL}" *
}
if$
}
my bibfile contains only one item:
@ARTICLE{Dummy2012,
author = {{Vink}, J.~S. and {Gr{\"a}fener}, G.},
title = {{The Transition Mass-loss Rate: Calibrating the Role of Line-driven Winds in Massive Star Evolution}},
journal = {APJL},
year = {2012},
volume = {751},
pages = {L34},
month = jun,
eid = {L34},
adsnote = {Provided by the SAO/NASA Astrophysics Data System},
archiveprefix = {arXiv},
doi = {10.1088/2041-8205/751/2/L34},
eprint = {1205.0394},
keywords = {stars: early-type, stars: evolution, stars: mass-loss, stars: winds,outflows },
primaryclass = {astro-ph.SR},
webpage = {http://adsabs.harvard.edu/abs/2012ApJ...751L..34V}
}
And upon compiling I get the error:
You can't pop an empty literal stack for entry Dummy2012
and the .bbl
file looks like this:
\begin{thebibliography}{1}
\expandafter\ifx\csname natexlab\endcsname\relax\def\natexlab#1{#1}\fi
\bibitem[{{Vink} y {Gr{\"a}fener}(2012)}]{Dummy2012}
{\sc {Vink}, J.~S.} y {\sc {Gr{\"a}fener}, G.}
\newblock {The Transition Mass-loss Rate: Calibrating the Role of Line-driven
Winds in Massive Star Evolution}.
\newblock {\em APJL\/}, vol. 751, p\'agina L34,
\newblock http://adsabs.harvard.edu/abs/2012ApJ...751L..34V \href{2012}{URL}.
\end{thebibliography}