6

I use the authoryear style for Biblatex. For articles that have a DOI, biblatex+biber automatically produce the following in the bibliography:

DOI : 10.1162/qjec.2008.123.1.49

which contains a hyperref link to : https://doi.org/10.1162/qjec.2008.123.1.49

I would like to know how to change the style so that the DOI would also display the full link, that is, that it would display:

DOI : https://doi.org/10.1162/qjec.2008.123.1.49

and still link to the same URL https://doi.org/10.1162/qjec.2008.123.1.49

Thank you!

MWE:

\documentclass{article}
\usepackage{hyperref}

\usepackage[%url=false,eprint=false,
 style=authoryear,  backend=biber]{biblatex}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@article{GabaixLandier_2008,
    author               = {Gabaix, Xavier and Landier, Augustin},
    doi                  = {10.1162/qjec.2008.123.1.49},
    journal              = {The Quarterly Journal of Economics},
    number               = {1},
    pages                = {49-100},
    title                = {Why has CEO Pay Increased So Much?},
    volume               = {123},
    year                 = {2008},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}

\section{Introduction}
Dummytext~\autocite{GabaixLandier_2008}.

\printbibliography
\end{document}
7

Add the following to your preamble after loading biblatex:

\DeclareFieldFormat{doi}{%
  \mkbibacro{DOI}\addcolon\space
  \ifhyperref
    {\href{https://doi.org/#1}{\nolinkurl{https://doi.org/#1}}}
    {\nolinkurl{https://doi.org/#1}}}
7

Use

\DeclareFieldFormat{doi}{\mkbibacro{DOI}\addcolon\space\url{https://doi.org/#1}}
  • Is there a reason to prefer this over mine? Just curious. – Alan Munn Apr 12 '17 at 15:58
  • @AlanMunn It looks nicer, I think. (Plus, it actually works ;-)) – moewe Apr 12 '17 at 15:58
  • Yeah, I fixed the working part. But I don't see the aesthetic difference. – Alan Munn Apr 12 '17 at 16:00
  • 1
    @AlanMunn I prefer my solution because I don't have to go into an \if... branch that essentially does the same for both cases. – moewe Apr 12 '17 at 16:01

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.