11

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.

3
  • 6
    The publishers are clearly sadists. My advice would be to just ignore that nonsense ... if the publishers care so much, they can have professional typesetters implement their weird reference fetishes. That should not be your responsibility as an author. Otherwise, they have made a .bst file available here: biometrics.tibs.org/biom.bst.txt. Not sure on the mechanics of how that could be included in biblatex specifically.
    – badroit
    Nov 22, 2012 at 1:24
  • I should add, the above file is linked for another journal from the same publishers: biometrics.tibs.org/latexdocumentclass.htm.
    – badroit
    Nov 22, 2012 at 1:27
  • Journal publishers are known to be sadistic, which would've been accepted if they wouldn't be making such profits on the backs of scientists... The journal doesn't provide any LaTeX template (did I mention already they profit from our work without doing much ...). I haven't looked into the .bst file since: 1. I'm using biblatex and not bibtex and 2. I'm almost done with my bbx style anyway.
    – Roey Angel
    Nov 22, 2012 at 9:44

2 Answers 2

14

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

11
  • Thanks a lot Audrey for the thorough reply! Your code works great. The only reason I was slow to reply is that I had trouble getting your method to work with my real document. Then I realized that the reason is that I had another \DeclareSourcemap{ command called from another file using \input a few lines later and it ran over yours. Is there a way to have two \DeclareSourcemap{ commands in one preamble? I tried naming them with \DeclareSourcemap{name}{ but that gave an error.
    – Roey Angel
    Nov 22, 2012 at 17:58
  • 1
    @RoeyAngel There actually is no need for multiple source map declarations. In \maps you can use multiple \map statements. They are executed in order of appearance. I can clarify with an edit, but I probably need an idea of what mapping other rules you need.
    – Audrey
    Nov 22, 2012 at 19:57
  • Thanks, I know how to use multiple \map statements in one \DeclareSourcemap call the only thing is that my other \map call is a file containing many reg exp patterns for turning journal names into abbreviations. The only trouble is that now the code looks a bit ugly. I mind about that because I want others to use the style I'm writing. On the other hand if I can 'shove' everything into the .bbx file that should be ok.
    – Roey Angel
    Nov 22, 2012 at 22:42
  • 1
    @RoeyAngel Yeah, I thought a little more and figured you might want an "author-level" source map separate from the user one in the preamble. I asked Philip about it at github. You can follow the issue here.
    – Audrey
    Nov 23, 2012 at 2:35
  • Brilliant! I think adding an option of a localized \DeclareStyleSourcemap would enhance a lot the flexibility of biblatex and will allow me and others to provide more 'intact' biblatex styles, which will require little to no further tweaking on the part of the users.
    – Roey Angel
    Nov 23, 2012 at 11:17
2

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.

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.