How to establish a complex sorting scheme of references in biblatex?

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


I think much of this can be achieved without a sourcemapping by using the new-ish (min|max)sortnames (https://github.com/plk/biblatex/issues/755).

With

minsortnames=1, maxsortnames=2,

you essentially tell biblatex to consider at most the first two names for sorting. More precisely,

  1. works by <name_1> are sorted under <name_1>,
  2. works by <name_1> and <name_2> are sorted after works by only <name_1> in the order induced by <name_2>,
  3. works by more than two authors are sorted under <name_1> et al., which sorts after <name_1> and <name_1> and <name_2>.

For backwards compatibility reasons setting (min|max)bibnames will also set (min|max)sortnames, so (min|max)sortnames must be set after (min|max)bibnames.

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


\DeclareSortingTemplate{emi}{
  \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}
  \sort{
    \field{sorttitle}
    \field{title}
  }
  \sort{
    \field{volume}
    \literal{0}
  }
}

\begin{filecontents}{\jobname.bib}
@article{ref1,
  author  = {First, Joe and Second, Jane and Third, Bob},
  title   = {Article title},
  journal = {Journal},
  date    = {2001-01},
}
@article{ref2,
  author  = {First, Joe and Second, Jane and Third, Bob},
  title   = {Article title},
  journal = {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 \autocite{ref1,ref2,ref3,ref4,ref5,ref6}.
Filler \autocite{knuth:ct:a,knuth:ct:c}.
Filler \autocite{knuth:ct:b}
\printbibliography
\end{document}

Sorted output.