[Tex/LaTex] How to format the extrayear field in biblatex

biblatex

In author-year citation/bibliography styles, multiple publications by the same author in the same year are formatted with a lowercase letter after the year: Smith 2011a … Smith 2011b etc.

In biblatex this works fine with numeric dates, but fails with non-numeric dates like "in progress". (The natbib style I use handles these cases correctly by putting parentheses around the letter if the year field is non-numeric.) How do I do the same thing in biblatex? So the expected output is:

Smith, 2011a
Smith, 2011b

Smith, in progress(a)
Smith, in progress(b)

Sample file and output:

\documentclass{article}
\usepackage[style=authoryear,labelyear=true]{biblatex}
\usepackage{filecontents}
\bibliography{test}
\begin{document}
\cite{test1,test2}
\printbibliography
\begin{filecontents}{test.bib}
@unpublished{test1,
    Author = {John Smith},
    Date-Added = {2011-02-21 13:41:09 -0500},
    Date-Modified = {2011-02-21 13:42:02 -0500},
    Note = {ms. MSU},
    Title = {A great paper in progress},
    Year = {in progress}}

@unpublished{test2,
    Author = {John Smith},
    Date-Added = {2011-02-21 13:42:09 -0500},
    Date-Modified = {2011-02-21 13:42:46 -0500},
    Note = {ms. MSU},
    Title = {Another great paper in progress},
    Year = {in progress}}
\end{filecontents}
\end{document}

Output image

Best Answer

This is a somewhat cruel hack, but here we go. Add the following to your preamble (EDIT: Should have scanned the manual more thoroughly -- \iffieldnums seems to be the correct test, see p. 148--149):

\DeclareFieldFormat{extrayear}{%
  \iffieldnums{labelyear}{%
    \mknumalph{#1}%
  }{%
    \mkbibparens{\mknumalph{#1}}%
  }%
}

UPDATE: I have submitted a feature request at SourceForge.net: biblatex.

UPDATE: The feature request is now pending. Philipp Lehman, author of biblatex, commented:

I'll add that even though I'm not entirely convinced that this is the way to deal with work in progress. I'd rather recommend putting "in progress" in the "pubstate" field and set a label in the "label" field.

UPDATE: This feature has been implemented in biblatex v1.3 (released March 14th, 2011).

Related Question