Sorting Bibliography by Author Number of Authors and Date

I am trying to modify my citation style such that the bibliography sorts hierarchically as follows:

1) Author (i.e., first author last name) ascending alphabetically (A to Z);
2) Number of authors ascending 1 to X, i.e. - if I have 5 papers by the same first author, their single-authored papers will appear before co-authored papers with 1, then 2, then 3, then X additional authors;
3) By year descending (i.e., most recent pubs first).

It should look something like this:

Dodd, C.K., Jr. 1991. The status of the Red Hills Salamander Phaeognathus hubrichti, Alabama, USA, 1976–1988. Biological Conservation 55:57–75.

Dodd, C.K., Jr., and B.S. Cade. 1998. Movement patterns and the conservation of amphibians breeding in small, temporary wetlands. Conservation Biology 12:331–339.

Dodd, C.K., Jr., and R.A. Seigel. 1991. Relocation, repatriation, and translocation of amphibians and reptiles: are they conservation strategies that work? Herpetologica 47:336–350.

Dodd, C.K., Jr., W.J. Barichivich, and L.L. Smith. 2004. Effectiveness of a barrier wall and culverts in reducing wildlife mortality on a heavily traveled highway in Florida. Biological Conservation 118:619–631.

Dodd, C.K., Jr., K.M. Enge, and J.N. Stuart. 1989. Reptiles on highways in north-central Alabama, USA. Journal of Herpetology 23:197–200.

I found the following previous discussion that is somewhat similar, and set-up my style code following the suggestion:

https://forums.zotero.org/discussion/37506/cls-code-to-sort-biblio-by-first-author-and-number-of-authors/

Unfortunately it doesn't quite work as hoped where my bibliography actually looks something like this:

Dodd, C.K., J., W.J. Barichivich, and L.L. Smith. 2004. Effectiveness of a barrier wall and culverts in reducing wildlife mortality on a heavily traveled highway in Florida. Biological Conservation 118:619–631.

Dodd, C.K., J., and B.S. Cade. 2008. Movement Patterns and the Conservation of Amphibians Breeding in Small, Temporary Wetlands. Conservation Biology 12:331–339.

Dodd, C.K., J., K.M. Enge, and J.N. Stuart. 1989. Reptiles on highways in north-central Alabama, USA. Journal of Herpetology 23:197–200.

Dodd, C.K., J., and R.A. Seigel. 1991. Relocation, repatriation, and translocation of amphibians and reptiles: are they conservation strategies that work?. Herpetologica 47:336–349.

Dodd, C.K., J. 1991. The status of the Red Hills salamander Phaeognathus hubrichti, Alabama, USA, 1976–1988. Biological Conservation 55:57–75.

Notice that 3 author papers are sorted ahead of 1 and 2 author papers, and there is a 3 author, then a 2 author, then a 3 author, then a 2 author, then the 1 author. The date seems to be sorting correctly, but it seems to be sorting hierarchically ahead of number of authors which is not what I want.

Here is the relevant portions of my style code:

<macro name="author">
<names variable="author" suffix=".">
<name and="text" delimiter-precedes-last="always" et-al-min="11" et-al-use-first="10" initialize-with="." name-as-sort-order="first"/>
<label prefix=", "/>
<substitute>
<names variable="editor"/>
<text variable="title" form="short"/>
</substitute>
</names>
</macro>

<macro name="author-count">
<names variable="author">
<name form="count"/>
<substitute>
<names variable="editor"/>
</substitute>
</names>
</macro>

<macro name="year-date">
<choose>
<if variable="issued">
<date variable="issued">
<date-part name="year"/>
</date>
<text variable="year-suffix" font-style="italic"/>
</if>
<else>
<text term="no date" form="short"/>
</else>
</choose>
</macro>

<bibliography entry-spacing="0" hanging-indent="true">
<sort>
<key macro="author"/>
<key macro="author-count" sort="ascending"/>
<key macro="year-date" sort="descending"/>
</sort>

Can anyone help with this??

Thanks!

Matt
  • edited February 27, 2016
    Try
    <sort>
    <key macro="author" names-min="1" names-use-first="1"/>
    <key macro="author-count" names-min="3" names-use-first="3"/>
    <key macro="author" names-min="3" names-use-first="1"/>
    <key macro="year-date" sort="descending"/>
    </sort>


    Translation (in this sequence):
    1. Sort by the first authorm and the first author only
    2. Sort by author count, but only up to 3 authors
    3. For items with three of more authors, don't sort alphabetically by co-authors (but by implication, do so for 2 authors).
    4. Sort by date descending.
  • Hi Adam,

    This worked like a charm with the set of references I was testing (i.e., those that I pasted in above). But just to test further I added 6 new references for a different same author that all had different year and number of coauthor problems. Everything worked well for references with 1, 2, 4, and 6 authors, but for some reason the 3 author reference was sorted to the end. So, I tweaked your suggested code as follows:

    <key macro="author-count" names-min="1" names-use-first="3"/>

    And this seems to now work.

    Any chance you can explain to me why you think the names-use-first="3" would only sort by count for up to 3 authors? In my new test I had a 6 person paper that I altered the date to be newer than a 4 person paper just to make sure the sort by number of authors didn't break down after 3 and the manuscript did not change position (i.e., it stayed sorted as it should have).

    Thanks!!

    Matt
Sign In or Register to comment.