Theses, Books, Title pagesHow to hyperlink all Bibliography URLs?

Classicthesis, Bachelor and Master thesis, PhD, Doctoral degree
Post Reply
templateuser
Posts: 679
Joined: Tue Mar 03, 2015 4:01 pm

How to hyperlink all Bibliography URLs?

Post by templateuser »

First, many thanks to the ones taking care of this website. Really excellent stuff!

I changed the default style to abbrvnat from the template as it fits the requirement better

\bibliographystyle{abbrvnat} % Use the "unsrtnat" BibTeX style for formatting the Bibliography

I want to have all urls in my references list to be hyperlinked say under the word "URL".

I've 100+ urls and some are very long, its not looking very nice. Ideally, a quick solution which results in having all URLs hyperlinked under the word URL..

Please note below example is not really helpful, it will take me ages to do this manually for each entry!

note = {\href{http}{text}}

latexdrivingmecrazy

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
Vel
Site Moderator
Posts: 463
Joined: Fri Jun 29, 2012 1:20 am

How to hyperlink all Bibliography URLs?

Post by Vel »

Hey,

Nice username :) Thanks for the kind words about the website!

This looks like it will solve your problem - though it is not really advisable - you can use the redefinition

Code: Select all

\DeclareFieldFormat{url}{\href{#1}{\underline{Link}}}
this definition will print the full URL if hyperref is not enabled

Code: Select all

\DeclareFieldFormat{url}{%
  \ifhyperref
    {\href{#1}{\underline{Link}}}
    {\url{#1}}}
Or maybe even - making use of the localisation capabilities biblatex offers

Code: Select all

\DefineBibliographyStrings{english}{%
  url = {link},
}

\DeclareFieldFormat{url}{%
  \ifhyperref
    {\href{#1}{\bibstring{url}}}
    {\url{#1}}}
This was written by moewe at http://tex.stackexchange.com/questions/165656/ but as said it may not be advisable as readers of the physical copy won't be able to follow the URL.

Cheers,
Vel
Founder and administrator of LaTeXTemplates.com and LaTeXTypesetting.com
Post Reply