3

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}

1 Answer 1

3

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

3
  • 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
    Commented Nov 21, 2016 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
    Commented Nov 21, 2016 at 21:36
  • I implemented this solution, but for some reason, it removes the period after the urldate in my MWE. Also, for some strange reason it removed the period after the year as well: overleaf.com/6514453265gbtcvtrmpjnw
    – Steven
    Commented Sep 18, 2022 at 5:30

You must log in to answer this question.

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