# Sort bibliography with same author and same year (biblatex)

When I cite two works by an author published in the same year, biblatex will sort them in the bibliography according to their title. In some cases, however, I know that the work sorted in the second place in fact was published first. How can I reorder them?

\documentclass{article}
\usepackage{filecontents}
\usepackage[style=authoryear,sorting=nyt]{biblatex}
\begin{filecontents}{\jobname.bib}
@BOOK{lennon1972a,
AUTHOR = "John Lennon",
TITLE = "My music",
YEAR = "1972"}
@BOOK{lennon1972b,
AUTHOR = "John Lennon",
TITLE = "More of my music",
YEAR = "1972"}
\end{filecontents}
\begin{document}
\cites{lennon1972a}{lennon1972b}
\printbibliography
\end{document}


Inspired by henrique's answer, the best way seems to use the sorttitle option, as explained in §3.5 of the biblatex documentation. According to that description, biblatex sorts in this order:

1. presort 2. sortkey 3. author 4. year 5. sorttitle, if defined, otherwise title.

No. 1 and 2 are normally left undefined. To override the sorting by title in 5, define sorttitle:

\documentclass{article}
\usepackage{filecontents}
\usepackage[style=authoryear,sorting=nyt]{biblatex}
\begin{filecontents}{\jobname.bib}
@BOOK{lennon1972a,
AUTHOR = "John Lennon",
TITLE = "My music",
YEAR = "1972",
SORTTITLE = "a"}
@BOOK{lennon1972b,
AUTHOR = "John Lennon",
TITLE = "More of my music",
YEAR = "1972",
SORTTITLE = "b"}
\end{filecontents}
\begin{document}
\cites{lennon1972a}{lennon1972b}
\printbibliography
\end{document}


See the sorting option in the biblatex manual. The default is, as you say "nty" (Name, then Title, then Year) but this can be changed or you can define your own custom sorting scheme (See \DeclareSortingScheme). It looks like you probably want sorting=nyt.

Alternatively, you probably want to make your .bib know which one came first (there's not much point in just you knowing ...). Put in a MONTH field in your .bib to distinguish the entries within the same YEAR and then use a custom sorting spec:

\DeclareSortingScheme{nymt}{
\sort{
\field{presort}
}
\sort[final]{
\field{sortkey}
}
\sort{
\field{sortname}
\field{author}
\field{editor}
\field{translator}
\field{sorttitle}
\field{title}
}
\sort{
\field{sortyear}
\field{year}
}
\sort{
\field{month}
}
\sort{
\field{sorttitle}
\field{title}
}
\sort{
\literal{0000}
}
}


Then use the option sorting=nymt

If you don't want to see the months in the bibliography, put this in your preamble too:

\AtEveryBibitem{\clearfield{month}\clearfield{labelmonth}}

• Setting sorting=nyt won't change anything, since the name (n John Lennon) and the year (y 1972) are identical in this case, so they're sorted by title (t). – Sverre Aug 15 '13 at 17:29
• I've updated my MWE accordingly. – Sverre Aug 15 '13 at 17:41
• Updated answer to make your knowledge of which came first explicit by using MONTH field and custom sorting scheme. – PLK Aug 15 '13 at 20:35

What you're looking for is something like the sortkey field (or perhapspresort). Check §3.5 (or §4.5.5 for more complicated sorting schemes — check this answer for a good example) of biblatex documentation

IMHO, you should consider a bibliography as an index for citations; it's meant to "decode" the citation labels, and to offer the reader a good compilation of literature on the subject. However bizarre it may seem, changing the sorting scheme halfway could make your bibliography confuse.

Here's a MWE:

\documentclass{article}
\usepackage{filecontents}
\usepackage[style=authoryear,sorting=nyt]{biblatex}
\begin{filecontents}{\jobname.bib}
@BOOK{lennon1972a,
AUTHOR = "John Lennon",
TITLE = "My music",
YEAR = "1972",
SORTKEY = {a}
}
@BOOK{lennon1972b,
AUTHOR = "John Lennon",
TITLE = "More of my music",
YEAR = "1972",
SORTKEY = {b}
}
\end{filecontents}
\begin{document}
\cites{lennon1972a}{lennon1972b}
\printbibliography
\end{document}


• That won't work either, because sortkey apparently takes precedence over everything else, and puts the Lennon 1972a item as the first item in the bibliography, ahead of authors like 'Anderson'. But your suggestion led me to the right conclusion: to use sorttitle. This comes into play only after name and year have been taken into account for sorting purposes. So I'm using sorttitle = "a" for lennon1972a and sorttitle = "b" for lennon1972b. – Sverre Aug 15 '13 at 18:52
• To address your opinion, I don't think anyone looks for items in someone's bibliography based on the alphabetical order of the titles. People look for names, then years, then an index like a, b if the years are the same too (this index convention is to me a good indication that no one actually considers the alphabetical order of the titles). So I'm totally ok with overriding the "sort by title" procedure. – Sverre Aug 15 '13 at 19:00
• @Sverre, that's what I meant with "something like sortkey", sorry for not making it clearer. – henrique Aug 15 '13 at 19:11
• In this case, I guess, to use the sortyear field would be more "semantically correct". – Oleg Domanov Aug 16 '13 at 6:37

The easiest way, is to set up the month in your bibliography file as it is the default fallback for ordering, like:

month = jan


(In case of a prolific author you can also aim for the day of the publication)

If you don't know it, and don't want to put an artificial one, or if you want another solution, you can also edit your .bbl file after the compilation, to manually reorder the two articles (And change their name) and compile again. From:

 \bibitem[Lennon 1972a]{lennon1972b}
John Lennon.
\newblock More of my music. 1972

\bibitem[Lennon 1972b]{lennon1972a}
John Lennon.
\newblock My music. 1972


to

 \bibitem[Lennon 1972a]{lennon1972a}
John Lennon.
\newblock My music. 1972

\bibitem[Lennon 1972b]{lennon1972b}
John Lennon.
\newblock More of my music. 1972


(As long as the number of conflicting paper in this case is small, this solution can be effective)

• Although the second part of your answer is valid for bibtex, biblatex produces a different bbl file without \bibitems – henrique Aug 15 '13 at 18:30