I am writing a document using the memoir class, pdflatex and biber. Now both my Bibliography at the end of the document and the citations in the text sort alphabetically, but I would like the citations to sort by year. How can i achieve this?

In my preamble I have this:

\usepackage[style=authoryear,backend=biber]{biblatex}%
\renewcommand*{\nameyeardelim}{\addcomma\space}

and I have made a config file that looks like this:

\ExecuteBibliographyOptions{dashed=false, block=space, firstinits, maxcitenames=2,maxbibnames=99, sortcites, sorting=nyt, uniquelist=false}
\DeclareFieldFormat[article]{title}{#1\isdot}
\DeclareFieldFormat[incollection]{title}{#1\isdot}
\DeclareFieldFormat{pages}{#1}
\DeclareFieldFormat{postnote}{#1}
\DeclareNameAlias{sortname}{last-first}
\renewbibmacro{in:}{}

\renewbibmacro*{volume+number+eid}{
\printfield{volume}
\setunit*{\addnbthinspace}
\printfield{number}
\setunit{\addcomma\space}
\printfield{eid}}
\DeclareFieldFormat[article]{number}{\mkbibparens{#1}}

As far as I understand the sorting option does half the trick as it changes both bib and cite order. Suggestions?

  • 1
    What exactly is your question? sorting=nyt, sortcites are exactly the right options if you want your bibliography sorted by name and then year, and have the citations sorted accordingly. You can use sorting=ynt to sort by year, name and title (in that order). Do you want only the citations to be sorted by year and not the bibliography? In that case specify the citation sorting in \ExecuteBibliographyOptions (e.g. sorting=nyt) and use the optional argument to \printbibliography to declare sorting in the bibliography: \printbibliography[sorting=nty]. – moewe Feb 26 '14 at 12:21
  • I was asking for, as you guessed, how to sort the printed bibliography by name, and the in-text citations by year. By '\ExecuteBibliographyOptions' and add 'sorting=ynt' (in the config file), and write '\printbibliography[soring=nyt]' this was solved. Thank you very much! – havfal Feb 26 '14 at 13:13
  • @moewe Didn't work for me :( – Daniel Valencia C. Jul 3 '17 at 1:34
up vote 3 down vote accepted

This is an answer for a now very outdated version of biblatex. For more recent versions please refer to Biblatex: how to automatically sort citation by year (sortcites=ynt) when references are sorted by name (sorting=nyt).

biblatex's sorting option can be applied globally (that is in the package loading options, or via \ExecuteBibliographyOptions). The global sorting scheme is then used to sort citations - if sortcites is used - , it is furthermore employed to sort all bibliographies and lists of shorthands printed via \printbibliography or \printshorthands.

If you want to sort a bibliography using a different sorting scheme than the global one, you can specify that sorting scheme in the optional argument to \printbibliography: \printbibliography[sorting=nty].

In your case, you would probably want the global sorting scheme sorting=ynt, so load biblatex with \usepackage[sorting=ynt]{biblatex}, or \ExecuteBibliographyOptions{sorting=ynt}. Your bibliography sorting scheme would be sorting=nty, so you print your bibliography via \printbibliography[sorting=nty].

  • I didn't works for me. Do you know why? – Daniel Valencia C. Jul 3 '17 at 1:34
  • @DanielValencia In newer versions of biblatex you cannot pass the sorting option to \printbibliography any more, you will have to use refcontexts. See tex.stackexchange.com/q/244971/35864. This can mess up the disambiguation labels, so I cannot recommend doing it (see also the warning in the manual about that). – moewe Jul 3 '17 at 4:43
  • @moewe: Do you refer to section 3.7.10 "Reference Contexts"? – gerw Jul 21 '17 at 14:24
  • 1
    @gerw I do indeed. – moewe Jul 21 '17 at 14:35

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.