36

It's cool to add a hyperlink in references like this: enter image description here

I want to know how to add the blue box in bibtex. For example, the following article's link is "ee".

@inproceedings{DBLP:conf/osdi/DeanG04,
author    = {Jeffrey Dean and
           Sanjay Ghemawat},
title     = {MapReduce: Simplified Data Processing on Large Clusters},
booktitle = {OSDI},
year      = {2004},
ee        = {http://www.usenix.org/events/osdi04/tech/dean.html},
crossref  = {DBLP:conf/osdi/2004},
bibsource = {DBLP, http://dblp.uni-trier.de}
}
Lijie Xu
  • 1,427

2 Answers2

35

Loading the hyperref package and using

url        = {http://www.usenix.org/events/osdi04/tech/dean.html},

gives a clickable url in your bibliography.

screenshot

alternatively you can use

             note        = {\href{http://www.usenix.org/events/osdi04/tech/dean.html}{my text for the link which can break across lines}},

which gives a link which has different text from the link. I agree with @Mico- this is probably a bad idea in general for a variety of different reasons.

screensh

Complete MWE

% arara: pdflatex
% arara: bibtex
% arara: pdflatex
% arara: pdflatex
\begin{filecontents}{mybib.bib}
  @inproceedings{dblp,
             author = {Jeffrey Dean and
             Sanjay Ghemawat},
             title     = {MapReduce: Simplified Data Processing on Large Clusters},
             booktitle = {OSDI},
             year      = {2004},
             note        = {\href{http://www.usenix.org/events/osdi04/tech/dean.html}{my text for the link which can break across lines}},
             bibsource = {DBLP, http://dblp.uni-trier.de}
             }
\end{filecontents}

\documentclass{article}
\usepackage[backend=bibtex]{biblatex}   % bibliography
\usepackage{hyperref}

% bibliography
\bibliography{mybib}
\begin{document}

hello world \cite{dblp}

\printbibliography
\end{document}
cmhughes
  • 100,947
  • 4
    ,this is a solution, but I'm wondering if this url can be hidden in paper's title. Paper's title is clickable. – Lijie Xu Mar 04 '13 at 02:48
  • 7
    @LijieXu - Unless you can be absolutely certain that your paper will always be read on-screen, and never from a paper copy, it's probably not a good idea to hide the actual URL from your readers' eyes. – Mico Mar 04 '13 at 03:26
  • @LijieXu see the update :) – cmhughes Mar 04 '13 at 03:31
  • 2
    Note that if you have tilde ~ in \href it won't work. To fix it, you can replace ~ with %7E. BTW: interesting point of view why the %7e solution really good?. – patryk.beza Jun 25 '16 at 11:21
  • Note for future readers: Using hyperref with \url{....} can also solve issues related to underscores and tildes in urls. – starbeamrainbowlabs Apr 24 '18 at 12:28
  • 1
    @cmhughes the command \href{}{} does not work in the bibtex file. How can I activate it? – QGravity Jan 13 '19 at 07:55
  • 1
    @Mico Most documents come in an electronic format now and hidden clickable links seem to be fine to me. If you read a hard-copy without a computer around, then having the explicit link is not really helpful. If you read a hard-copy with a computer around, get the electronic version and click on the link. Bottom-line: explicit human-unreadable links are not useful. Am I missing something? – pluton Nov 20 '20 at 03:42
  • @pluton - It depends on what's shown and on what's hidden. My interpretation of the OP's request was that the information that would be shown might not to be sufficient to let a reader of a hardcopy version of the publication find the bibliographic reference without considerable sleuthing. – Mico Nov 20 '20 at 05:53
  • 1
    I find href better as I just show the DOI, not the doi.org URL, while linking. Same for PMID. Nobody wants to type the entire doi URL if reading the hard copy, I agree with @pluton . You will instead type it in a search engine, namely doi.org's. – Andrestand Jun 20 '22 at 19:10
18

Thanks for the code of @cmhughe. I rewrite it as follows:

@inproceedings{DBLP:conf/osdi/DeanG04,
author    = {Jeffrey Dean and
           Sanjay Ghemawat},
title     = {\href{http://www.usenix.org/events/osdi04/tech/dean.html}{MapReduce: Simplified Data Processing on Large Clusters}},
booktitle = {OSDI},
year      = {2004},
ee        = {http://www.usenix.org/events/osdi04/tech/dean.html},
crossref  = {DBLP:conf/osdi/2004},
bibsource = {DBLP, http://dblp.uni-trier.de}

In this way, the hyperlink effect can be achieved.

enter image description here

Lijie Xu
  • 1,427
  • 4
    Nice solution. You can add the entry automatically using BibTool and bibtool -- 'add.field{title2="\href{%s(url)}{%s(title)}"}' test.bib -o test1.bib. See this post for details. – DJJ Sep 20 '16 at 11:45
  • how to get the link in "In OSDI, 2004"? – Ka Wa Yip Feb 27 '17 at 01:11
  • @Lijie Xu the command \href{}{} does not work in the bibtex file. How can I activate it? – QGravity Jan 13 '19 at 08:13
  • According to the official bibtex documentation ( https://ctan.org/pkg/bibtex ), ee is not an accepted field for inproceedings . The fact that ee appeared in your example, confused me and might confuse other people. Please consider removing it. – evaristegd May 13 '19 at 00:52
  • I was looking for hours on how to add a website to the bibliography, and this is the unique solution that worked for me. Thanks. – Gaston Burrull Mar 14 '22 at 08:07