# Sort citations according to year, while being "grouped" by authors

I'm trying to make my bibliography list and in-text citations to mimic the style used by the institution where I study, and I've run into an issue regarding sorting of in-text citations. I am greatful for any help I can get.

The in-text citation should have chronological sorting, however with works by the same author(s) "grouped" by name/author. The bibliography list should be sorted as "nyt". I've put together an example below:

\documentclass{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[swedish,french,english]{babel}

\usepackage[]{xpatch}

\usepackage[style=authoryear-comp,backend=biber,dashed=false,dateabbrev=false,doi=true,firstinits=true,isbn=false,maxbibnames=8,minbibnames=8,maxcitenames=2,sortcites=true,sorting=ynt,url=false,urldate=comp,uniquename=false,uniquelist=false,useprefix=true]{biblatex}
\usepackage[]{csquotes}
\usepackage[]{doi}
\usepackage{hyperref}\urlstyle{same}
\hypersetup{
,pdfborder={0 0 0}
}

\begin{filecontents}{\jobname.bib}
@article{van_wagner_conditions_1977,
title = {Conditions for the start and spread of crown fire},
volume = {7},
journaltitle = {Canadian Journal of Forest Research},
author = {van Wagner, C. E.},
date = {1977},
pages = {23--34}
}
@report{albini_estimating_1976,
location = {{Ogden, UT, USA}},
title = {Estimating {{Wildfire Behavior}} and {{Effects}}},
number = {INT-30},
institution = {{USDA Forest Service, Intermountain Forest and Range Experiment Station}},
type = {General {{Technical Report}}},
author = {Albini, Frank A.},
date = {1976-01-01},
pages = {92}
}
@article{richards_mathematical_1999,
title = {The mathematical modelling and computer simulation of wildland fire perimeter growth over a 3-dimensional surface},
volume = {9},
number = {3},
journaltitle = {International Journal of Wildland Fire},
author = {Richards, Gwynfor D.},
date = {1999-01-01},
pages = {213--221}
}
@article{richards_elliptical_1990,
title = {An elliptical growth model of forest fire fronts and its numerical solution},
volume = {30},
number = {6},
journaltitle = {International Journal for Numerical Methods in Engineering},
author = {Richards, Gwynfor D.},
date = {1990-10-20}
}
@article{richards_properties_1993,
title = {The {{Properties}} of {{Elliptical Wildfire Growth}} for {{Time Dependent Fuel}} and {{Meteorological Conditions}}},
volume = {95},
number = {1-6},
author = {Richards, Gwynfor D.},
date = {1993-12-01},
pages = {357--383}
}
@article{richards_general_1995,
title = {A {{General Mathematical Framework}} for {{Modeling Two-Dimensional Wildland Fire Spread}}},
volume = {5},
number = {2},
journaltitle = {International Journal of Wildland Fire},
author = {Richards, Gwynfor D.},
date = {1995-01-01},
pages = {63--72}
}
@inproceedings{finney_modeling_1994,
location = {{Bethesda, MD, USA}},
title = {Modeling the spread and behavior of prescribed natural fires},
booktitle = {Proceedings of the 12th {{International Conference}} on {{Fire}} and {{Forest Meteorology}}},
publisher = {{Society of American Foresters}},
author = {Finney, M. A.},
date = {1994},
pages = {138--143}
}
\end{filecontents}

\begin{document}
\noindent\textcite{van_wagner_conditions_1977,richards_mathematical_1999,richards_elliptical_1990,finney_modeling_1994,richards_properties_1993,richards_general_1995,albini_estimating_1976}

\vspace{1cm}\noindent\parencite{van_wagner_conditions_1977,richards_mathematical_1999,richards_elliptical_1990,finney_modeling_1994,richards_properties_1993,richards_general_1995,albini_estimating_1976}

\printbibliography
\end{document}


I used soting=ynt above since that would give me chronological sorting but it doesn't group citations the way I want them to. I've been playing around with sorting schemes but I can't manage to get it working.

When using \textcite, the above code prints out:

Albini (1976), van Wagner (1977), Richards (1990, 1993), Finney (1994), Richards (1995, 1999)

and when using \parencite:

(Albini 1976; van Wagner 1977; Richards 1990, 1993; Finney 1994; Richards 1995, 1999)

Though, I wish to get the following when using \textcite:

Albini (1976), van Wagner (1977), Richards (1990, 1993, 1995, 1999), and Finney (1994)

and this when using \parencite:

(Albini 1976; van Wagner 1977; Richards 1990, 1993, 1995, 1999; Finney 1994)

I guess it is related to \DeclateSortingScheme{} which I don't understand yet.

(I aim to use refcontext as seen in the following snipped instead of \printbibliography, but for some reason it changes the sorting of the citations to nyt. I don't know why but it might relate to a bug that was around in biber v2.6 as stated here: Different ordering scheme for multiple citations and for bibliography in Biblatex. Maybe the bug is still around in biber v2.7?)

\begin{refcontext}[sorting=nyt]
\begingroup
\raggedleft
\sloppy
\printbibliography
\endgroup
\end{refcontext}


I am using biblatex v3.7 and biber v2.7. Thanks in advance!

• What do you want the bibliography to look like? Further, why on the in text citations (\textcite and \parencite) is it Albini, van Wagner, Richards, Finney. Wouldn't it be Albini, Finny, Richards, van Wagner? Jan 17 '17 at 20:58
• @StrongBad The bibliography should be sorted by first name sorting=nyt. I'll edit and add that to my post shortly. No, that's the sort order when using sorting=nyt. I want them sorted according to year/date, but with works by the same order grouped together. (Not logical at all but that's the way the Journal wants it sorted). I'll edit my post to print out an example of the sorting of the bibliography. Jan 17 '17 at 21:18
• Are you sure? The one article I looked at sorted in text citations chronologically with no grouping: McMichael 1999; Daszak et al. 2001; McMichael 2004; Daszak 2005; Castillo-Chavez et al. 2015 (notice the two McMichael entries). The instructions for authors says chronological order and nothing about grouping. Jan 17 '17 at 21:29
• @StrongBad Interesting. No I am not 100% sure but I've seen that sorting a few times. Fore example in this article. There you find the following: (Genko 1902–1903; Karcov 1903, Kocan 1957; Więcko 1963, 1984; Faliński 1966, 1986; Jędrzejewska et al. 1997). I wasn't sure myself and asked my resource at the Institution where I study and she told me this was the expected sorting. However, she might have miss-interpreted it also. I'll check back with her tomorrow. Chronological seem better. Jan 17 '17 at 21:48
• @StrongBad I've been talking to the resource at my institution and it turns out that you're correct - the Ambio style says chronologic sorting only. However, my institution wants the citations grouped also as I described it in the question. Any ideas of how to achieve such a sorting scheme? Jan 20 '17 at 11:10

With how sorting is implemented at the moment there can never be a sorting scheme that gives you what you want. At the moment you can't do context-dependent sorting. Whenever you compare two entries to determine who goes first you will always obtain the same answer.

You can either sort by author/editor/... first, or you can sort by year first. Both won't give you what you need.

For your citation scheme one would first have list all authors and then all the years for each author. Then sorting would commence by sorting the authors not by their names but by the first year associated with them. It is clear that this sorting scheme is context dependent.

You want

Richards (1990, 1993, 1995, 1999), and Finney (1994)

But

Finney (1994), and Richards (1995, 1999)

In the first case Finney1994 sorts after Richards1999, but in the second case before.