2

Whenever a DOI is available, I provide it instead of a URL in my bibliography. In both cases, I need to provide the access date (urldate field) as well. My problem: biblatex puts a period after the DOI, so that the ensuing visited on is capitalized, but no period after the URL (so no capitalization). This does not look homogenous.

How can I remove the period after the DOI?

MWE:

output

\documentclass{article}

\usepackage[
    backend = biber,
    style = authortitle,
    ]{biblatex}

\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@article{a,
author = {Lily},
title = {Trees},
journaltitle = {Journal of Trees},
year = {2015},
url = {www.trees.com},
urldate = {2016-11-21},
}

@article{b,
author = {John},
title = {Flowers},
journaltitle = {Journal of Flowers},
year = {2015},
doi = {17.7-31893.23},
urldate = {2016-11-21},
}
\end{filecontents*}

\addbibresource{\jobname.bib}

\begin{document}
\nocite{*}
\printbibliography
\end{document}
2

Here you are. Just redefine the bibmacro doi+eprint+url:

\documentclass{article}

\usepackage[
    backend = biber,
    style = authortitle,
    ]{biblatex}

\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@article{a,
author = {Lily},
title = {Trees},
journaltitle = {Journal of Trees},
year = {2015},
url = {www.trees.com},
urldate = {2016-11-21},
}

@article{b,
author = {John},
title = {Flowers},
journaltitle = {Journal of Flowers},
year = {2015},
doi = {17.7-31893.23},
urldate = {2016-11-21},
}
\end{filecontents*}

\addbibresource{\jobname.bib}

\renewbibmacro*{doi+eprint+url}{%
  \iftoggle{bbx:doi}
    {\printfield{doi}}
    {}%
  \newunit\newblock
  \iftoggle{bbx:eprint}
    {\usebibmacro{eprint}}
    {}%
  \setunit{\addspace}\newblock
  \iftoggle{bbx:url}
    {\usebibmacro{url+urldate}}
    {}}

\begin{document}
\nocite{*}
\printbibliography

\end{document} 

enter image description here

  • Thanks, perfect! I had gotten to the doi+eprint+url bibmacro, but didn’t know how to modify it. (I guess I could have put that in the question as well.) So you changed \newunit\newblock to \setunit{\addspace}\newblock. Looks like I’ll have to read up on units and blocks in biblatex, or is there a simple explanation of these concepts? – doncherry Nov 21 '16 at 21:29
  • 1
    It's fairly simple: units are groups in the bibliography, and they're separated by a default punctuation ( \adddot\addspace). It's explained in §4.7 of the documentation, pp. 209–213. – Bernard Nov 21 '16 at 21:36

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.