6

This question is very related to the following example.

Remove period ONLY after doi and url in bibliography in model5-names.bst (elsarticle.cls)

I would like to remove the period after the DOI, but not after the year, in case the bibliographic item is missing the DOI number, using biblatex.

For example (taken from the above link),

Kanizsa, G. (1976). Subjective contours. Scientific American, 234(4), 48–52.

and

Kanizsa, G. (1976). Subjective contours. Scientific American, 234(4), 48–52. doi:123456789

but not

Kanizsa, G. (1976). Subjective contours. Scientific American, 234(4), 48–52. doi:123456789.

MWE:

\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},
}

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

\addbibresource{\jobname.bib}

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

enter image description here

1 Answer 1

6

I will think of a cleverer way, but in the meantime try

\renewcommand*{\finentrypunct}{\ifboolexpr{togl {bbx:doi} and not test {\iffieldundef{doi}}}{}{\addperiod}}
5
  • Isn't the boolean toggle?
    – Bernard
    Jul 23, 2017 at 17:30
  • 2
    Isn't this clever enough? :)
    – Alan Munn
    Jul 23, 2017 at 19:59
  • This worked beautifully.
    – aviness
    Jul 24, 2017 at 2:31
  • @Bernard Within an \ifboolexpr the keywords are togl, bool and test. So togl is the correct keyword for a toggle defined via \newtoggle{bbx:doi}.
    – moewe
    Jul 24, 2017 at 6:00
  • @moewe: Thanks for the information! I had not seen it inn the documentation – I must say I didn't look very long through it.
    – Bernard
    Jul 24, 2017 at 9:01

You must log in to answer this question.

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