1

The guidelines of my papers have specific requirements of how to sort the reference list, which depends on the alphabetical order of the authors, the year of publication and additionally the number of authers. I struggle with the ordering by numbers of authors.

These are the rules:

  1. Authors have to be presented in alphabetical order (ascending)
  2. If one author has several publications, they have to be ordered by the year of publication (ascending).
  3. If an author has written papers with varying numbers of co-authors, the references have to appear in ascending order of the number of co-authors: All papers with two co-authors, all papers with three co-authors, ...

So for example, this would be the appropriate order:

Author, A (2010) ...

Author, A, Cuthor, C (2005) ...

Author, A, Duthor, D (1990) ...

Author, A, Duthor, D (2000) ...

Author, A, Buthor, B, Cuther, C (2000) ...

and so on. I struggle with the ordering based on the numbers of authors. I am using latest version of Biblatex with author/year citation style - Is there a way to achieve the appropriate reference list?

  • 4
    Somewhere there must be a ministry of silly rules for reference lists. With a numeric citation style it would be at least usable, but with an author/year style it only makes for the reader more difficult to find an entry. So where is the sense? – Ulrike Fischer Nov 2 '16 at 11:47
  • Making sense or not - I have to comply with the given rules for structuring the reference list. Therefore I would appreciate any tips on how to achieve the correct order :) – DrA Nov 2 '16 at 14:51
  • 3
    Well you could bribe me: Ask someone who made this rule (or inforce it now) to explain publicly why he/she thinks it is of any use to put "Adam and Zenon" before "Adam, Adam and Aurelius" and that he/she really wants you to comply to this rule. I would like to know who to blame ... – Ulrike Fischer Nov 2 '16 at 18:10
6

Satisfying this (silly) sorting scheme requires using some advanced features. You should use a custom field to sort by and use a source map to populate the field with a construction functionally determined by the number of authors. What we are doing here is effectively calculating the number of ands in the author name list which, due to the BibTeX name format, is a count of the names. So, a concatenation of the ands is a string which can be used to sort the entries. Then, a custom sorting scheme sorts on this field before alphabetical name sort:

\documentclass{article}
\usepackage{csquotes}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{AuthorA2010,
  title={Titlea},
  author={Author, Alan},
  journal={Journala},
  volume={10},
  pages={1--3},
  year={2010},
  publisher={Publishera}
}
@article{AuthorAC2005,
  title={Titleac},
  author={Author, Alan and Cuthor, Carla},
  journal={Journalac},
  volume={10},
  pages={1--3},
  year={2005},
  publisher={Publisherac}
}
@article{AuthorAD1990,
  title={Titlead},
  author={Author, Alan and Duthor, David},
  journal={Journalad},
  volume={10},
  pages={1--3},
  year={1990},
  publisher={Publisherad}
}
@article{AuthorAD2000,
  title={Titlead two},
  author={Author, Alan and Duthor, David},
  journal={Journalad two},
  volume={10},
  pages={1--3},
  year={2000},
  publisher={Publisherad two}
}
@article{AuthorABD2000,
  title={Titleabd},
  author={Author, Alan and Bill Buthor and Cuthor, Carla},
  journal={Journalabd},
  volume={10},
  pages={1--3},
  year={2000},
  publisher={Publisherabd}
}
\end{filecontents}
\usepackage[style=authoryear,firstinits=true, dashed=false,sorting=custsort]{biblatex}
\addbibresource{\jobname.bib}
\DeclareSortingScheme{custsort}{
  \sort{
    \field{presort}
  }
  \sort[final]{
    \field{sortkey}
  }
  \sort{
    \field{usera}
  }
  \sort{
    \field{sortname}
    \field{author}
    \field{editor}
    \field{translator}
    \field{sorttitle}
    \field{title}
  }
  \sort{
    \field{sortyear}
    \field{year}
  }
}
\DeclareSourcemap{
  \maps[datatype=bibtex]{
    \map{
      \step[fieldsource=author]
      \step[fieldset=usera, origfieldval]
      \step[fieldsource=usera, match=\regexp{.+?\sand\s}, replace=\regexp{and}]
      \step[fieldsource=usera, match=\regexp{((?:and)*).+}, replace=\regexp{$1}]
    }
  }
}

\begin{document}

\nocite{*}
\printbibliography
\end{document}
| improve this answer | |
  • Gorgeous! Am I asking too much if I suggest to you to answer also this? – CarLaTeX Nov 3 '16 at 7:31
  • I would have used e.g. usera as target for the regex, imho expanding the datamodel isn't really needed for such an one time requirement. And now I won't be able to get my bribe and never know who is responsable for such rules ;-(. – Ulrike Fischer Nov 3 '16 at 8:34
  • You are right about using usera - I was looking into making numauthors into a real integer field which would have needed datamodel extensions but it's not worth the messy effort with regexps. – PLK Nov 3 '16 at 15:08
  • Thank you for your help - this is great! Sorry @UlrikeFischer, you have to live with the knowledge, that out there, somewhere in your country, people have to comply to this rule ;). – DrA Nov 3 '16 at 15:42
  • @DrA I doubt that you really have to comply. But you don't care enough to take a risk and do something about it -- one of the reason why silly rules stay sometimes for ever. – Ulrike Fischer Nov 3 '16 at 17:08
1

I think the easiest way to reach that crazy way of sorting is to add an appropriate sortname in the bib items whose order you want to change:

\begin{filecontents}{crazybib.bib}
    @article{AuthorA2010,
            title={Titlea},
            author={Author, Alan},
            journal={Journala},
            volume={10},
            pages={1--3},
            year={2010},
            publisher={Publishera}
        }%
    @article{AuthorAC2005,
        title={Titleac},
        author={Author, Alan and Cuthor, Carla},
        journal={Journalac},
        volume={10},
        pages={1--3},
        year={2005},
        publisher={Publisherac}
    }%
    @article{AuthorAD1990,
        title={Titlead},
        author={Author, Alan and Duthor, David},
        journal={Journalad},
        volume={10},
        pages={1--3},
        year={1990},
        publisher={Publisherad}
    }%
    @article{AuthorAD2000,
        title={Titlead two},
        author={Author, Alan and Duthor, David},
        journal={Journalad two},
        volume={10},
        pages={1--3},
        year={2000},
        publisher={Publisherad two}
    }%
    @article{AuthorABD2000,
        title={Titleabd},
        author={Author, Alan and Bill Buthor and Cuthor, Carla},
        sortname={Author, Alan and Zzzz},% or everything makes the sort correct
        journal={Journalabd},
        volume={10},
        pages={1--3},
        year={2000},
        publisher={Publisherabd}
    }%
\end{filecontents}

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}

\usepackage[english]{babel}

\usepackage[style=authoryear, natbib=true, backend=biber,firstinits=true, dashed=false]{biblatex}
\usepackage{csquotes}

\addbibresource{crazybib.bib}

\begin{document}

    \nocite{*}

    \printbibliography

\end{document}

enter image description here

| improve this answer | |

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.