15

biblatex prints the string n.d. (no date) in the bibliography for entries that have no date information in the .bib file (as a result of this question).

It didn't use to print n.d. for @online entries, but in the current version (3.6) it does. My question is, how can I remove all such n.d./nodate strings from all @online entries, while leaving others alone (as in @book in the example below, which should still print n.d.)?

\documentclass{article}
\usepackage[style=authoryear-comp]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{lennon,
    AUTHOR = "John Lennon",
    TITLE = "Who did what in the Beatles"}
@online{google,
    TITLE = "Google",
    URL = "https://www.google.com"}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
\textcites{lennon}{google}
\printbibliography
\end{document}

enter image description here

1 Answer 1

14

The answer was updated with a much better solution. See the edit history for the earlier, less elegant approach.

The "nodate" marker is inserted by the labeldate format as fall-back with \literal{nodate} at the very end of \DeclareLabeldate. We can suppress this for @online entries by providing a type-sepcific definition for \DeclareLabeldate. With the code below the labeldate field will simply come out undefined instead of "nodate" if no suitable date fields are defined for @online entries.

\documentclass{article}
\usepackage[style=authoryear-comp]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{lennon,
    AUTHOR = "John Lennon",
    TITLE = "Who did what in the Beatles"}
@online{google,
    TITLE = "Google",
    URL = "https://www.google.com"}
\end{filecontents}
\addbibresource{\jobname.bib}

\DeclareLabeldate[online]{%
  \field{date}
  \field{year}
  \field{eventdate}
  \field{origdate}
  \field{urldate}
}

\begin{document}
\textcites{lennon}{google}
\printbibliography
\end{document}

gives The citations now read "Lennon (n.d.) and Google", similarly in the bibliography: the "(n.d.)" after "*Google*" is gone

0

You must log in to answer this question.

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