1

When an @online entry contains a note, but no title, I get a period after the year.
Even with \renewcommand{\labelnamepunct}{\addspace} enter image description here

How to tell biblatex to not print the period, when no title is present?

% arara: pdflatex
% arara: biber
% arara: pdflatex
\documentclass{article}

\usepackage[
    backend = biber,
    style = authoryear,
    sorting = nyt,
]{biblatex}


\begin{filecontents}{bib.bib}
    @online{
        a,
        author = {Aristotle},
        year = {2015},
        title = {Geometry},
        url = {http://athena.com}
    }
    @online{
        b,
        author = {Knuth},
        year = {2015},
        note = {Computer Scientist},
        url={http://latex.com}
    }
\end{filecontents}

\addbibresource{bib.bib}

% no dot after year
\renewcommand{\labelnamepunct}{\addspace}

\begin{document}

    \nocite{*}

    \printbibliography

\end{document}
2

The reason why \renewcommand{\labelnamepunct}{\addspace} does not work is because \labelnamepunct is the separator between the year (or "author-year") in the chosen style and the title. However, in the standard driver for online there are several \newunit before the note is printed. \nounit (or better \newunitpunct is the separator before note.

A "proper" solution would be to redefine the biblatex driver for online. Alternatively, one can use the following hack:

\AtEveryBibitem{
  \ifentrytype{online}
    {\iffieldundef{title}
      {\def\newunitpunct{\addspace}}
      {\def\newunitpunct{\addperiod\addspace}}
    {}
  }
  {}
}

This ensures that if there is not title, then \newunit produces a space. To restore the period (.) We can restore by including the definition in the formatting instruction for the note field in an online entry.

\DeclareFieldFormat[online]{note}{\gdef\newunitpunct{\addperiod\addspace}#1}  

Eventually, similar definitions should be given for the language list and the version field, and the bibmacros byauthor and byeditor+others.

On the OP the hack produces:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy