[Tex/LaTex] Sorting of references in Bibliography (books/articles) with correct labels

biblatexsorting

I've got a problem with my bibliography. I have to split it up into different parts (books / articles). The problem is, I`ve got articles AND books of the same author, published in the same year. Using biblatex and "authoryear", they are sorted alphabetically by title.

 \documentclass{article}
\usepackage[style=authoryear]{biblatex}
\usepackage{filecontents}

\begin{filecontents}{references.bib}

@article{Anonymous:2012b,
Author = {Anonymous, Arthur},
Journal = {Somewhere},
Pages = {46-54},
Title = {Arthur's article},
Volume = {25 (2012)},
Year = {2012}}

@article{Anonymous:2012c,

Author = {Anonymous, Arthur},
Journal = {Somewhere else},
Pages = {6-12},
Title = {Last words},
Volume = {43 (2012)},
Year = {2012}}

@book{Anonymous:2012a,
Address = {Someplace},
Author = {Anonymous, Arthur},
Publisher = {Nobody},
Title = {Book by Arthur},
Year = {2012}}

\end{filecontents}

\bibliography{references.bib}


\begin{document}
\nocite{*}

\printbibliography[title={Books}, type=book]

\printbibliography[title={Articles},type=article]

\end{document}

I am not allowed to post a picture of the results, but the main result is: "Book by Arthur" gets the label "2012b". The problem is: I need to have an automatical sorting that labels the book 2012a – as it is the first reference given in the bibliography – and the first article 2012b.

I cannot find a solution. Maybe someone's got an idea?

Thank you very much!


O.k., I'm trying to specify what I have to achieve and I will provide a simple example without code (as I am not at home right now; I´ll try to add an example based on code later).

My PhD thesis contains a bibliography of ALL publications of two authors in a specific period of time. Therefore, the problem is not just a local one, but more ore less all over the place. The bibliography will probably contain at least 500 , much more likely nearly 1000 publications over the space of 30 years, of all kinds of types. Aside from splitting these bibliographies in different sections (that would be easy if the main problem is solved), the general sorting I need is as follows:

Name,
Year,
and (!) within every single year: "books" first, then "incollection", then "articles"

This would read as follows:

Anonymous 2001a: article (title: "a")

Anonymous 2001b: article (title: "x")

Anonymous 2002a: book (title: "e")

Anonymous 2002b: book (title: "m")

Anonymous 2002c: book (title: "z")

Anonymous 2002d: article (title: "b")

Anonymous 2003a: book (title: "g")

Anonymous 2003b: article (title: "d")

Anonymous 2003c: article (title: "h")

Anonymous 2004a: book (title: "n")

Anonymous 2004b: incollection (title: "j")

Anonymous 2005a: incollection (title: "y")

Anonymous 2005b: article (title: "k")

Anonymous 2012a: book (title: "n")

Anonymous 2012b: article (title: "l")

Anonymous 2012c: article (title: "s")

Best Answer

Using biblatex 2.0 and biber 1.0. You have to redefine the nyt sorting scheme and add a custom field, example below. In general, this is easy, just add a custom field with an ordering value based on the entrytype of the entry, then sort on this after the year:

\DeclareSourcemap{
  \maps[datatype=bibtex]{
    \map{
      \pertype{book}
      \step[fieldset=usera, fieldvalue=1]
    }
    \map{
      \pertype{article}
      \step[fieldset=usera, fieldvalue=2]
    }
  }
}

\DeclareSortingScheme{nyt}{
  \sort{
    \field{presort}
  }
  \sort[final]{
    \field{sortkey}
  }
  \sort{
    \name{sortname}
    \name{author}
    \name{editor}
    \name{translator}
    \field{sorttitle}
    \field{title}
  }
  \sort{
    \field{usera}
  }
  \sort{
    \field{sorttitle}
    \field{title}
  }
  \sort{
    \field{sortyear}
    \field{year}
  }
  \sort{
    \field[padside=left,padwidth=4,padchar=0]{volume}
    \literal{0000}
  }
}