Adding hyperlinks to our Latex articles
When they write papers, scientists take a lot of time in preparing their bibliography and correctly citing all their references. However, bibliographies and the corresponding bibtex styles were designed when everyone read scientific papers on paper. This is rarely the case today and most scientific papers are read online. Still, we insist on placing volume numbers, pages numbers and other information from the paper era in each paper but rarely URLs or DOIs. This is probably a mistake…
When developing the first edition of Computer Networking : Principles, Protocols and Practice I quickly found that students read references provided that these references were easily accessible through hyperlinks. Today’s students and I guess a growing number of researchers are used to browse the web but rarely go to their library to read articles on paper. For the recently published SIGCOMM ebook on Recent Advances in Networking, we did a small experiment in adding hyperlinks directly to each chapter in pdf format. Adding these hyperlinks was surprisingly easy and I hope useful for the readers.
Each chapter was written in standard latex with a bibliography encoded in bibtex files. Nowadays, each scientific article can be uniquely identified by either :
- its Uniform Resource Locator (URL)
- its Digital Object Identifier (DOI)
URLs are very common and can be used to point to articles stored in digital repositories for example. Some scientific publishers provide stable URLs, but others don’t. DOIs are more useful. By design, they are short and stable. Major scientific publisher associate one DOI to each published article and the http://dx.doi.org/ server could be used to be redirected automatically to the corresponding article. I sent a few days adding the DOIs and if none was found the URL for most cited reference. For ACM papers, the easiest solution is to simply reuse the bibtex file provided by ACM, such as
@inproceedings{Paasch_Mobile:2012,
author = {Paasch, C. and Detal, G. and Duchene, F. and Raiciu, C. and Bonaventure, O.},
title = {{Exploring mobile/WiFi handover with Multipath TCP}},
booktitle = {Proceedings of the 2012 ACM SIGCOMM workshop on Cellular networks: operations, challenges, and future design},
series = {CellNet '12},
year = {2012},
isbn = {978-1-4503-1475-6},
location = {Helsinki, Finland},
pages = {31--36},
numpages = {6},
url = {http://doi.acm.org/10.1145/2342468.2342476},
doi = {10.1145/2342468.2342476},
acmid = {2342476},
publisher = {ACM},
address = {New York, NY, USA},
keywords = {energy consumption, mptcp, vertical handover, wifi/3g},
}
It already contains the relevant information. The bibtex file provided by IEEExplore also contains the DOI. For RFCs, Roland Bless’s rfc.bib provides all the required information. For books, I found some URLs on books.google.com but not for all of them. With these rich bibtex files, I could then apply the bibtex modifications described by Andrew Comech on http://www.math.tamu.edu/~comech/tools/bibtex-doi-eprint/. First, make sure that you use the latex hyperref package. Then, you need to modify your preferred bibtex style file. For the SIGCOMM ebook, we reused the acm.bst file which is part of the standard ACM latex package. This file indicates how references must be pretty printed in the bibliography. It first defines under the ENTRY label the different types of information that can be placed inside bibtex files
ENTRY
{ address
author
booktitle
chapter
edition
editor
howpublished
institution
journal
key
month
note
number
organization
pages
publisher
school
series
title
type
volume
year
url
doi
}
You simply simply need to add to this entry the url and doi records. Then, you need to modify the functions that process titles to include the required information. For example, the function format.title processes the title of an article. It is defined in acm.bst as
FUNCTION {format.title}
{ title empty$
{ "" }
{ title "t" change.case$ }
if$
}
To support URLs and DOIs, it can be rewritten as follows
FUNCTION {format.title}
{ title empty$
{ "" }
{ title "t" change.case$ }
if$
url empty$
{
doi empty$
{ }
{ "\href{http://dx.doi.org/" doi * "}{" * swap$ * "}" * }
if$
}
{ "\href{" url * "}{" * swap$ * "}" * }
if$
}
The same modification can be applied for format.btitle and format.in.ed.booktitle. With this modified bibtex style sheet and the DOI/URL records in the bibtex files, all references become hyperlinks in the pdf file. You can see this in the individual chapters of the SIGCOMM ebook http://www.sigcomm.org/content/ebook. Unfortunately, the entire ebook had to be build by assembling the pdf files of all chapters together by using the pdfpages latex package that does not yet correctly support the inclusion of pdf files containing hyperlinks.