2

I am using biblatex with the following settings:

  • backend=biber
  • style=authoryear
  • citestyle=authoryear-comp
  • sorting=nyt

This works as expected, but I find the sorting=nyt to be suboptimal. I would rather sort by name, year, and then order of appearance in the text.

Why? The title of the paper has little relevance for the reader, but it still determines the order of disambiguation marks "a", "b", etc when there are multiple citations in a year. For example, imagine the two following publications by John Doe, both published in year 2017, with the titles

  • "Emerging evidence for x"
  • "Another piece of evidence for x"

Now, even if I cite the first paper (Emerging evidence) first and the second paper last (Another piece of evidence), the first will be cited as Doe (2017b) and the second will be Doe (2017a). Looks stupid to me.

What is the best way to have biblatex sort the citations in order name, year, order of appearance?

4

Look in the file biblatex.def to find definitions of the different sortings. Based on a combination of the sorting=none sorting and sorting=nyt I came up with the following which I call sorting=nyc (c for \citeorder).

\DeclareSortingScheme{nyc}{
  \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{\citeorder}
}

Just put this snippet after the \usepackage[sorting=nyc,...]{biblatex} command. Don't forget to specify sorting=nyc in the biblatex options.

Edit: presort and sortkey included in the beginning as suggested and explained by @moewe in two comments below.

Edit 2: Bugfixed code to really give order nyc. Thanks to @moewe for alerting me to the mistake.

  • +1) If you want your new scheme to be more in line with the standard schemes, you might want to add \sort{ \field{presort} } \sort[final]{ \field{sortkey} } (modulo line break) to the begin. – moewe Aug 31 '17 at 10:59
  • Thanks @moewe! Can you please clarify what improvement that would bring apart from being more in line with standard schemes? – rasmuse Aug 31 '17 at 11:43
  • 1
    This places presort and sortkey higher up in the sort order. sortkey is some kind of 'master sort key' as the documentation says, it can be set from the .bib file to override any automatic sorting. presort can be used to sort different entry types differently. In particular then, thesortkey field in the .bib as well as the \DeclarePresort command work as advertised instead of not at all with your current setting. – moewe Aug 31 '17 at 11:46
  • 1
    As pointed out in golatex.de/… the sorting scheme here is actually ync and not nyc. – moewe Sep 15 '17 at 17:32
  • Thanks @moewe for highlighting that! I noted the error and fixed it in my own document, but forgot to update here. – rasmuse Sep 17 '17 at 9:50

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.