4

I'm using biblatex authoryear and have multiple entries of the same author that do not have a year. When I cite them there are letters shown to distinguish them: mwe

But in the bibliography those letters are not shown and you can only distinguish them by the title. Is it possible to show the letters in the bibliography, too?

\documentclass[a4paper,12pt]{article}%
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{filecontents}
\begin{filecontents}{bib.bib}
@BOOK{bar1,
  title = {Text One},
  year = {},
  author = {Firstname Lastname},
}
@BOOK{bar2,
  title = {Text Two},
  year = {},
  author = {Firstname Lastname},
}
\end{filecontents}

\usepackage[backend=biber, style=authoryear-icomp, dashed=true]{biblatex}
\addbibresource{bib.bib}

\begin{document}

\cite{bar1} and \cite{bar2}

\printbibliography
\end{document}
  • Welcome to TeX.SX!. – karlkoeller Feb 26 '14 at 9:31
  • @karlkoeller I'm not sure that is really the problem. The problem seems to lie with biblatex not printing any date information (if it is not available) in the bibliography. (Also these books don't have a urldate) – moewe Feb 26 '14 at 10:14
  • @karlkoeller Mhhh weird, it does not work here. Even with \DeclareLabeldate{\field{date}\field{eventdate} \field{origdate}\literal{nodate}} I do not get the "n.d." in the bibliography. – moewe Feb 26 '14 at 10:52
  • 1
    @karlkoeller Trying the proposed duplicate answer does not work for me. – Andrew Swann Feb 26 '14 at 10:55
  • 1
    @moewe I don't know what I did before and it worked, but now it doesn't work for me, either. Retracting closing vote. If the question will be closed, I'll vote for reopening. – karlkoeller Feb 26 '14 at 10:57
4

By default biblatex does not print anything in the bibliography if the date is not set

\renewbibmacro*{date+extrayear}{%
  \iffieldundef{\thefield{datelabelsource}year}
    {}
    {\printtext[parens]{%
       \iffieldsequal{year}{\thefield{datelabelsource}year}
         {\printdateextralabel}%
         {\printfield{labelyear}%
          \printfield{extrayear}}}}}%

You can force biblatex to always print the year

\renewbibmacro*{date+extrayear}{%
  \printtext[parens]{%
    \iffieldsequal{year}{\thefield{datelabelsource}year}
      {\printdateextralabel}%
      {\printfield{labelyear}%
       \printfield{extrayear}}}}%

Or to only print the letter if no year is available

\renewbibmacro*{date+extrayear}{%
  \iffieldundef{\thefield{datelabelsource}year}
    {\printfield{extrayear}}
    {\printtext[parens]{%
       \iffieldsequal{year}{\thefield{datelabelsource}year}
         {\printdateextralabel}%
         {\printfield{labelyear}%
          \printfield{extrayear}}}}}%

This applies to the standard mergedate=true/mergdetae=compact setting, if you have any other mergdate option in place, you might have to modify the redefinitions above.

\documentclass[a4paper,12pt]{article}%
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@BOOK{bar1,
  title = {Text One},
  year = {},
  author = {Firstname Lastname},
}
@BOOK{bar2,
  title = {Text Two},
  year = {},
  author = {Firstname Lastname},
}
\end{filecontents}

\usepackage[backend=biber, style=authoryear, dashed=true]{biblatex}
\addbibresource{\jobname.bib}

\renewbibmacro*{date+extrayear}{%
  \printtext[parens]{%
    \iffieldsequal{year}{\thefield{datelabelsource}year}
      {\printdateextralabel}%
      {\printfield{labelyear}%
       \printfield{extrayear}}}}%

\begin{document}

\cite{bar1} and \cite{bar2}

\printbibliography
\end{document}

enter image description here

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.