2

This is kind of a combination of two questions and then I have a bibliography style problem on top of that.

I would like to make each bib entry into a hyperlink with the priority: 1. DOI, 2. URL, 3. ISBN/ISNN. It has earlier been shown how this is done for the title of the entries in biblatex: make title hyperlink to DOIs, URL or ISBN. However, I am using a bibliography style which does not show titles (chem-angew). I would like the entire entry to become a hyperlink. This has been done only with DOI in Hyperlink each bib entry to its DOI page.

My first problem is, when I use the chem-angew style and I include an entry with a DOI, the DOI shows, even though I include DOI=false in the usepackage (and the DOI is not supposed to show up in the chem-angew style):

\documentclass{article}
\usepackage[style=chem-angew,doi=false,url=false,isbn=false,]{biblatex}
\usepackage[colorlinks]{hyperref}

\begin{filecontents}{\jobname.bib}
@article{A01,
author = {Author, A.},
year = {2001},
title = {Alpha},
doi = {doi},
url = {url},
issn = {isbn-issn},
}
\end{filecontents}

\addbibresource{\jobname.bib}
\nocite{*}

\begin{document}
\printbibliography
\end{document}

enter image description here

My second problem is, when I add:

\AtEveryBibitem{%
  \iffieldundef{url}
    {}
    {\href{\thefield{url}}{\usedriver{\thefield{article}}}
    \csdef{blx@bbx@\thefield{entrytype}}{}}%
}

to my local biblatex.cfg file, the bib entry will have the biblatex style and not the chem-angew style as asked for in the same way as my earlier MWE.

enter image description here

The final problem is the priority of the hyperlink which I would like to add to the entries.

1 Answer 1

7

Here is one solution that tries to link the entire entry (minus the label). string+doiurl is a simplified version of lockstep's string+doiurlisbn from biblatex: make title hyperlink to DOIs, URL or ISBN

\documentclass{article}
\usepackage[style=chem-angew,doi=false,url=false,isbn=false,]{biblatex}
\usepackage[colorlinks]{hyperref}

\newbibmacro{string+doiurl}[1]{%
  \iffieldundef{doi}
    {\iffieldundef{url}
       {#1}
       {\href{\thefield{url}}{#1}}}
    {\href{https://doi.org/\thefield{doi}}{#1}}}

\makeatletter
\def\blx@driver#1{%
  \ifcsdef{blx@bbx@#1}
    {\usebibmacro{string+doiurl}{\csuse{blx@bbx@#1}}}
    {\ifcsdef{blx@bbx@*}
       {\blx@warning{%
          No driver for entry type '#1'.\MessageBreak
          Using fallback driver}%
        \usebibmacro{string+doiurl}{\csuse{blx@bbx@*}}}
       {\blx@error
          {No driver found}
          {I can't find a driver for the entry type
           '\abx@field@entrytype'\MessageBreak
           and there is no fallback driver either}}}}
\makeatother

\addbibresource{biblatex-examples.bib}
\nocite{sigfridsson,ctan,nussbaum}

\begin{document}
\printbibliography
\end{document}

Screenshot of the bibliography in the MWE: The first two entries are linked to DOI and URL, respectively. The last entry is not linked as it misses both a <code>doi</code> and <code>url</code> field.

2
  • Highly helpful, thanks! I've created a follow-up question to this example. Maybe there might be some adjustments required in cases where biblatex is used with the subentry option.
    – tstone-1
    Sep 9, 2020 at 5:15
  • 1
    This is awesome! Some journals indeed link an entire bibliography entry to a DOI or URL (e.g., Econometrica), and this code makes it possible to mimic that style. Other journals (e.g., the American Economic Review) include an icon in front of the entry instead and link this icon to the DOI/URL—probably to avoid long stretches of colored text. I have posted some code in a different thread that does exactly that: tex.stackexchange.com/a/588287/156280. Mar 21, 2021 at 10:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .