1
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage[backend=biber,hyperref,style=chem-angew,subentry]{biblatex}
\usepackage{doi}

% https://tex.stackexchange.com/questions/464215/biblatex-hyperlink-entire-bib-entry-to-doi-url-or-isbn-if-available
\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

\begin{filecontents}{\jobname.bib}
@article{Salsi2020,
  author       = {Salsi, Federico and Neville, Michael and Drance, Myles and Hagenbach, Adelheid and Chan, Chinglin and Figueroa, Joshua S. and Abram, Ulrich},
  date         = {2020},
  doi          = {10.1039/D0CC03043K},
  journaltitle = {Chem. Commun.},
  volume       = {56},
  pages        = {7009-7012},
}
@article{Claude2020,
  author       = {Claude, Guilhem and Salsi, Federico and Hagenbach, Adelheid and Gembicky, Milan and Neville, Michael and Chan, Chinglin and Figueroa, Joshua S. and Abram, Ulrich},
  date         = {2020},
  doi          = {10.1021/acs.organomet.0c00238},
  journaltitle = {Organometallics},
  volume       = {12},
  pages        = {2287–2294},
}
@article{Figueroa2020,
  author       = {Figueroa, Joshua S. and Abram, Ulrich},
  date         = {2020},
  doi          = {10.1002/zaac.202000147},
  journaltitle = {Z. Anorg. Allg. Chem.},
  pages        = {1--7},
  volume       = {646},
}
@article{Hoffmann1990,
  author       = {Hoffmann, Roald},
  date         = {1991},
  doi          = {10.2307/431761},
  journaltitle = {Interdiscipl. Sci. Rev.},
  pages        = {301--312},
  volume       = {16},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}

\defbibentryset{set}{Salsi2020,Claude2020,Figueroa2020}

Cite it.\supercite{set} And do it again.\supercite{Hoffmann1990}

\printbibliography

\end{document}

compiles (up-to-date MiKTeX) to give: enter image description here

I took the code which adds doi hyperlinks to references from an answer provided by user moewe. Unfortunately, I'm not clever enough to figure out what he (or she) did there, but it is working great for me. There is one exception: If there is a set of references within the bibliography, there will somehow be additional spaces before all semicolons and periods, respectively (see ref. 1). This is not the case if a single reference is cited, see ref. 2. Could anybody please assist me in fixing this? The introduced spaces look disappealing and cause line-break trouble in some cases. Those spaces aren't present if the file is compiled with the lines from \newbibmacro{string+doiurl}[1]{% to \makeatother commented out.

1 Answer 1

2

The space is due to a missing % in chem-angew's @article driver. See https://github.com/josephwright/biblatex-chem/pull/19.

Until the pull request above is merged and a new version of biblatex-chem with the fix is released you can add the fixed version of the driver to your preamble.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage[backend=biber,style=chem-angew,subentry]{biblatex}
\usepackage{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

\DeclareBibliographyDriver{article}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/translator+others}%
  \setunit{\labelnamepunct}\newblock
  \iftoggle{bbx:articletitle}
    {%
      \usebibmacro{title}%
      \newunit
    }
    {}%
  \usebibmacro{byauthor}%
  \newunit\newblock
  \usebibmacro{bytranslator+others}%
  \newunit\newblock
  \printfield{version}%
  \newunit\newblock
  \usebibmacro{journal+issuetitle}%
  \newunit
  \usebibmacro{byeditor+others}%
  \newunit
  \usebibmacro{note+pages}%
  \newunit\newblock
  \iftoggle{bbx:isbn}
    {\printfield{issn}}
    {}%
  \newunit\newblock
  \usebibmacro{doi+eprint+url}%
  \newunit\newblock
  \usebibmacro{addendum+pubstate}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \newunit\newblock
  \iftoggle{bbx:related}
    {\usebibmacro{related:init}%
     \usebibmacro{related}}
    {}%
  \usebibmacro{finentry}%
}

\begin{filecontents}{\jobname.bib}
@article{Salsi2020,
  author       = {Salsi, Federico and Neville, Michael and Drance, Myles and Hagenbach, Adelheid and Chan, Chinglin and Figueroa, Joshua S. and Abram, Ulrich},
  date         = {2020},
  doi          = {10.1039/D0CC03043K},
  journaltitle = {Chem. Commun.},
  volume       = {56},
  pages        = {7009-7012},
}
@article{Claude2020,
  author       = {Claude, Guilhem and Salsi, Federico and Hagenbach, Adelheid and Gembicky, Milan and Neville, Michael and Chan, Chinglin and Figueroa, Joshua S. and Abram, Ulrich},
  date         = {2020},
  doi          = {10.1021/acs.organomet.0c00238},
  journaltitle = {Organometallics},
  volume       = {12},
  pages        = {2287–2294},
}
@article{Figueroa2020,
  author       = {Figueroa, Joshua S. and Abram, Ulrich},
  date         = {2020},
  doi          = {10.1002/zaac.202000147},
  journaltitle = {Z. Anorg. Allg. Chem.},
  pages        = {1--7},
  volume       = {646},
}
@article{Hoffmann1990,
  author       = {Hoffmann, Roald},
  date         = {1991},
  doi          = {10.2307/431761},
  journaltitle = {Interdiscipl. Sci. Rev.},
  pages        = {301--312},
  volume       = {16},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}

\defbibentryset{set}{Salsi2020,Claude2020,Figueroa2020}

Cite it.\supercite{set} And do it again.\supercite{Hoffmann1990}

\printbibliography

\end{document}

Bibliography entries without spurious spaces.

You must log in to answer this question.

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