18

I have a bibliographic entry with no date. I would like this to be printed both in the citation (i.e. in the text) and in the references with "n.d.", otherwise it shouldn't be different from a regular entry.

In the example below, I would like the citations to be

Lennon (n.d.); Lennon (1972)

and the references to be

Lennon, John (n.d.). Peace on earth.

Lennon, John (1972). More peace on earth.

\documentclass{article}
\usepackage{csquotes,filecontents}
\usepackage[style=authoryear,dashed=false]{biblatex}
\begin{filecontents}{\jobname.bib}
@BOOK{lennon,
    AUTHOR = "John Lennon",
    TITLE = "Peace on earth"}
@BOOK{lennon1972,
    AUTHOR = "John Lennon",
    TITLE = "More peace on earth",
    YEAR = "1972"}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\textcites{lennon}{lennon1972}.
\printbibliography
\end{document}

enter image description here

3 Answers 3

11

You can add the following hooks to your preamble:

\newcommand{\mkbibnodate}{n\adddot d\adddot}
\AtEveryCitekey{\iffieldundef{labelyear}{\restorefield{labelyear}{\mkbibnodate}}{}}
\AtEveryBibitem{\iffieldundef{labelyear}{\restorefield{year}{\mkbibnodate}}{}}

With biber, you can achieve the same result with the source map:

\DeclareSourcemap{
  \maps[datatype=bibtex]{
    \map[overwrite=false]{
      \step[fieldset=date,origfieldval,final]
      \step[fieldset=eventdate,origfieldval,final]
      \step[fieldset=origdate,origfieldval,final]
      \step[fieldset=urldate,origfieldval,final]
      \step[fieldset=eventyear,origfieldval,final]
      \step[fieldset=origyear,origfieldval,final]
      \step[fieldset=urlyear,origfieldval,final]
      \step[fieldset=year,fieldvalue={n.d.},final]
      \step[fieldset=sortyear,fieldvalue={0000}]
    }
  }
}

Both of these approaches are style-independent so they should work for authoryear and any of its variants.

The above sourcemap is based on the default labelyear specification:

\DeclareLabelyear{
  \field{year}
  \field{eventyear}
  \field{origyear}
  \field{urlyear}
}

Currently \DeclareLabelyear does not support literal strings, but something like the following would be useful:

\DeclareLabelyear{
  \field{year}
  \field{eventyear}
  \field{origyear}
  \field{urlyear}
  \literal{n.d.}
}

I've added a feature request for this at the biblatex github repository.

4
  • 1
    A follow-up note: Using the former alternative, biblatex now also adds n.d. to the entry type @ONLINE, which is not suitable, since the @ONLINE entry has a field URLDATE for this purpose. I assume there's an easy fix for this (one that skips @ONLINE entries or one that doesn't add n.d. if the entry has a field for URLDATE), but I wouldn't know how to do it.
    – Sverre
    Commented Mar 7, 2013 at 18:43
  • 1
    @Sverre labelyear has a few fallback values if year isn't defined. For the first approach you can just base the test always on labelyear. Accounting for fallbacks in second approach gets messy.
    – Audrey
    Commented Mar 7, 2013 at 23:40
  • The '\DeclareSourcemap' -method works for me since I am using biber. How do you change the 'n.d.' to 's.a.'?
    – Niko Fohr
    Commented Aug 18, 2016 at 9:34
  • Nevermind. The answer was the most obvious; just edit the \step[fieldset=year,fieldvalue={n.d.},final] -line. I forgot to run PdfLatex-Biber-PdfLatex and hence the values did not update.
    – Niko Fohr
    Commented Aug 18, 2016 at 9:38
10

Please try biblatex 2.6/biber 1.6 development versions from SourceForge. This set up is now the default and there is a new localisation string "nodate" which defaults to "n.d." in all languages currently. \DeclareLabelyear is now the more general:

\DeclareLabeldate{%
  \field{date}
  \field{event}
  \field{orig}
  \field{url}
  \literal{nodate}
}

but you shouldn't need to worry about that unless you are a style author using this macro. With these versions, your example gives the following without any extra coding:

enter image description here

Changing the "nodate" localisation string for your language will change the "n.d." in both the references and citation.

4
  • Good to hear that the next(?) version of biblatex and biber will do this by default. I also hope the appropriate language specific variants will be added in the near future (that is not a pressing need for me). I will myself wait until the next version is released, since I update my packages through TexLive.
    – Sverre
    Commented Mar 14, 2013 at 11:40
  • 1
    Most language variants for "nodate" have now been incorporated into the biblatex 2.6 dev version.
    – PLK
    Commented Mar 15, 2013 at 12:50
  • It appears as if this still outputs 'n.d.' even though my paper's language is set to 'ngerman'. Any idea why that is so?
    – user290966
    Commented Jul 30, 2023 at 17:06
  • @nerdyllama - check your package options, see especially the autolang option which is set to none by default. You probably want autolang=other
    – PLK
    Commented Jul 31, 2023 at 15:43
2
\renewbibmacro*{date+extrayear}{%
    \iffieldundef{year}
      {\printtext[parens]{n.d.}}
      {\printtext[parens]{\printdateextra}}}%

\renewbibmacro*{cite:label}{%
  \iffieldundef{label}
    {\printtext[bibhyperref]{\printtext{n.d.}}}
    {\printtext[bibhyperref]{\printfield{label}}}}
1
  • While this works for \textcite, it doesn't work with \cite or \parencite. In the latter two cases, it only prints n.d., and not the author's name.
    – Sverre
    Commented Mar 6, 2013 at 16:40

You must log in to answer this question.

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