[Tex/LaTex] adding doi-hyperlinks to journal, volume, issue, year, pages in the bibliography

biblatexdoihyperref

I am trying to make a hyperlink in my bibliography referring the doi-url. The url begins with journal name and ends with the pages. Do to this I am using the code provided by Mateus Araújo in hyperlinks in biblatex. Unfortunately this also changes the style. For example, a normal reference looks likes this

enter image description here

But after adding the code do make the doi-hyperlink, it adds a dot after year and starts with a an uppercase letter.

enter image description here

I would like to remove the dot and start with a lowercase letter, but don't know how do that.

Here is a the code:

\documentclass{article}
\usepackage[backref=true]{biblatex}
\usepackage[colorlinks]{hyperref}
\bibliography{biblatex-examples}

\ExecuteBibliographyOptions{doi=false}
\DeclareFieldFormat{doilink}{
\iffieldundef{doi}{#1}
{\href{http://dx.doi.org/\thefield{doi}}{#1}}}

\DeclareBibliographyDriver{article}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/translator+others}%
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{title}%
  \newunit
  \printlist{language}%
  \newunit\newblock
  \usebibmacro{byauthor}%
  \newunit\newblock
  \usebibmacro{bytranslator+others}%
  \newunit\newblock
  \printfield{version}%
  \newunit\newblock
  \usebibmacro{in:}%
  \href{http://dx.doi.org/\thefield{doi}}{%
  \usebibmacro{journal+issuetitle}%
  \newunit\newblock
  \usebibmacro{byeditor+others}%
  \newunit\newblock
  \usebibmacro{note+pages}}%
  \newunit\newblock
  \iftoggle{bbx:isbn}
   {\printfield{issn}}
   {}%
  \newunit\newblock
  \usebibmacro{doi+eprint+url}%
  \newunit\newblock
  \usebibmacro{addendum+pubstate}%
  \newunit\newblock
  \usebibmacro{pageref}%
  \usebibmacro{finentry}
  }

\begin{document}
\cite{kastenholz}
\printbibliography
\end{document}

Best Answer

In the linked question is used another bibliography driver.

EDIT 2: Comment by maetra:

I recognized that using this together with any of the author-year styles results in an extra space after the link if no pages are defined. Maybe you know a solution?

Solution:

In the version 1.6 of biblatex is a small bug in the file authoryear.bbx. The style redefine the macro issue+date. The redefinition of the macro depends on the option mergedate. If the option is set to true or compact the redefinition is as follows:

\renewbibmacro*{issue+date}{%
  \iffieldundef{issue}
    {}
    {\printtext[parens]{\printfield{issue}}}
  \newunit}%

Before the last \newunit work there is a none escaped space which results in the extra space. So you have to do this:

\renewbibmacro*{issue+date}{%
  \iffieldundef{issue}
    {}
    {\printtext[parens]{\printfield{issue}}}%
  \newunit}%

This fixes the problem.

EDIT 1: Changed Code.

\documentclass{article}
\usepackage[backend=biber,backref=true]{biblatex}
\addbibresource{biblatex-examples.bib}

\usepackage[colorlinks]{hyperref}

\ExecuteBibliographyOptions{doi=false}
\ExecuteBibliographyOptions{doi=false}
\DeclareFieldFormat{doilink}{%
\iffieldundef{doi}{#1}%
{\href{http://dx.doi.org/\thefield{doi}}{#1}}}

\DeclareBibliographyDriver{article}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/translator+others}%
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{title}%
  \newunit
  \printlist{language}%
  \newunit\newblock
  \usebibmacro{byauthor}%
  \newunit\newblock
  \usebibmacro{bytranslator+others}%
  \newunit\newblock
  \printfield{version}%
  \newunit\newblock
  \usebibmacro{in:}%
  \printtext[doilink]{%
  \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}%
  \usebibmacro{finentry}}


\begin{document}
\cite{kastenholz}\qquad\cite{herrmann}\qquad\cite{sigfridsson}
\printbibliography
\end{document}

enter image description here

Related Question