[Tex/LaTex] How to establish a complex sorting scheme of references in biblatex

biblatexsorting

The journal in which I intend to publish has some weird sorting requirements for the reference list. The basic sorting is alphabetical but then (quoting from here):

  1. "Papers with two authors should follow those of the first-named author, arranged in alphabetical order according to the name of the second author."
  2. "Articles with more than two authors should follow those of the first named author in chronological order"
  3. "with multiple references from the same first author in a given year, please list the references in cited order."

Number 1 is of course automatically achieved using sorting = nyt but how do I include requirements 2 and 3?
I'm guessing the solution should involve \DeclareSortingScheme{} but I haven't got a clue how to code this.

Best Answer

It isn't really clear how these rules should be combined. Based on reference lists recently published in this journal it appears that any two-author paper should precede a three-or-more-author work having the same first author, regardless of chronology. A similar precedent holds for one-author and two-author works. You can achieve all this by copying the first author and some "large" value into the sortname field for every entry with more than two authors.

For one- or two-author entries sortname can be left missing by adding the whole author list to the same sorting element, as done in the new sorting scheme emi below. Further requirements related to citation sorting and name list truncation can easily be achieved with some global option settings. The document also demonstrates a few of these.

\documentclass{article}
\usepackage{csquotes}
\usepackage[american]{babel}
\usepackage[backend=biber,style=authoryear,sortcites,sorting=noneyear,
            maxcitenames=1,minbibnames=6,maxbibnames=7]{biblatex}

\DeclareSourcemap{
  \maps[datatype=bibtex]{
    \map[overwrite]{
      \step[fieldsource=author,match=\regexp{\s+and\s.+\s+and\s},final]
      \step[fieldset=sortname,origfieldval]
      \step[fieldsource=sortname,match=\regexp{\s+and\s.+},replace={\ and\ Zzz}]
    }
  }
}

\DeclareSortingScheme{noneyear}{
  \sort{\citeorder}
  \sort{\field{year}}
}

\DeclareSortingScheme{emi}{
  \sort{
    \field{sortname}
    \field{author}
  }
  \sort{\field{year}}
  \sort{\citeorder}
}

\begin{filecontents}{\jobname.bib}
@article{ref1,
  author = {First, Joe and Second, Jane and Third, Bob},
  title = {Article title},
  journaltitle = {Journal},
  date = {2001-01}}
@article{ref2,
  author = {First, Joe and Second, Jane and Third, Bob},
  title = {Article title},
  journaltitle = {Journal},
  date = {2000-01}}
@book{ref3,
  author = {First, Joe and Third, Bob},
  title = {Book title},
  year = {2002}}
@book{ref4,
  author = {Doe, Joe and Smith, Sam},
  title = {Book title},
  date = {2001}}
@book{ref5,
  author = {Doe, Joe and Brown, Bob},
  title = {Book title},
  date = {2002}}
@book{ref6,
  author = {First, Joe},
  title = {Book title},
  date = {2003}}
\end{filecontents}

\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}

\begin{document}
Filler \parencite{ref1,ref2,ref3,ref4,ref5,ref6}.
Filler \parencite{knuth:ct:c,knuth:ct:b,knuth:ct:a}.
\printbibliography[sorting=emi]
\end{document}

enter image description here

Related Question