5

I was wondering whether there is a way to have a 'Link'-button in a bibtex-bibliography which links to the underlying URL, instead of having to show the whole URL for every entry? I find it helpful to be able to directly link to the source online, but the URLs take up a lot of space in my bibliography.

Edit: Add Example:

\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc} 
\usepackage{geometry} 
\usepackage{array} 
\usepackage{graphicx} 
\usepackage{setspace} 
\usepackage[authoryear]{natbib} 
\makeatletter 
\providecommand{\tabularnewline}{\\} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands. 
\usepackage[colorlinks=true, allcolors=black]{hyperref} 
\usepackage{graphicx} 
\usepackage{epstopdf} 
\makeatother 
\usepackage{babel} 

\begin{document} 
    \newpage{}
    \bibliographystyle{elsarticle-harv}

\bibliography{MA_bib,electronic_references}

\end{document}

Edit: Add bib-entry. This is what my reference manager generates:

@article{Giuliano:2009ib,
  author = {Giuliano, Paola and Ruiz-Arranz, Marta},
  title = {{Remittances, financial development, and growth}},
  journal = {Journal of Development Economics},
  year = {2009},
  volume = {90},
  number = {1},
  pages = {144--152},
  month = sep,
  publisher = {Elsevier B.V.},
  doi = {10.1016/j.jdeveco.2008.10.005},
  url = {http://dx.doi.org/10.1016/j.jdeveco.2008.10.005},
  uri = {\url{papers3://publication/doi/10.1016/j.jdeveco.2008.10.005}}
}
4
  • Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. Mar 31 '17 at 11:29
  • I updated your question with your code. You example should be extended by an example of your bib-file. How do you set an url? Mar 31 '17 at 12:17
  • I find that including DOIs achieves this -- there's enough information on a hardcopy to find the reference, but they're compact. This question and the links underneath it might be of interest.
    – Chris H
    Mar 31 '17 at 12:27
  • I updated my answer Mar 31 '17 at 13:01
8

If you use biblatex you can change the output of url by \DeclareFieldFormat.

In the example below a symbol of the package fontawesome is linked.

\documentclass{article}
\usepackage{fontawesome}
\usepackage{biblatex}
\usepackage{hyperref}
\DeclareFieldFormat{url}{\mkbibacro{URL}\addcolon\space\href{#1}{\faExternalLink}}
\addbibresource{biblatex-examples.bib}

\begin{document}
\cite{ctan}

\printbibliography
\end{document}  

enter image description here

Update with the MWE of the op:

\RequirePackage{filecontents}
\begin{filecontents}{mwe.bib}
@article{Giuliano:2009ib,
  author = {Giuliano, Paola and Ruiz-Arranz, Marta},
  title = {{Remittances, financial development, and growth}},
  journal = {Journal of Development Economics},
  year = {2009},
  volume = {90},
  number = {1},
  pages = {144--152},
  month = sep,
  publisher = {Elsevier B.V.},
  doi = {10.1016/j.jdeveco.2008.10.005},
  url = {http://dx.doi.org/10.1016/j.jdeveco.2008.10.005},
  uri = {\url{papers3://publication/doi/10.1016/j.jdeveco.2008.10.005}}
}
\end{filecontents}


\documentclass[english]{article}
\usepackage{etoolbox,fontawesome}
\usepackage[colorlinks=true, allcolors=black]{hyperref} 
\AtBeginEnvironment{thebibliography}{\def\url#1{\href{#1}{\faExternalLink}}}

\begin{document} 
    \nocite{*}
    \bibliography{mwe}
    \bibliographystyle{elsarticle-harv}
\end{document}
0

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.