[Tex/LaTex] Multiple citations: citation order different to bibliography order

biblatex

I wish to cite several sources at once and sort my in-text citations in a different manner to how they appear in my bibliography. I want my citations to be sorted by year and my bibliography to be sorted by author. I am using BibLaTeX with Biber. I used this answer to achieve this with TeX Live 2015 but since upgrading to 2016 (as well as upgrading all my packages) this does not work.

Below is a minimal working example (with a second bibliography for illustrative purposes). I wish for the citations to be sorted ascending by year (2001, 2002, 2003) and the bibliographies to be sorted alphabetically (a, b, c) and descending by year (2003, 2002, 2001) respectively, but below is an image of the result; the bibliographies stay true to the desired sorting but the citations in-text are sorted descending by year.

If I remove the last \newrefcontext then everything (citations and bibliographies) is sorted alphabetically, and if I remove both \newrefcontexts then everything is sorted ascending by year (which was the option specified when originally calling BibLaTeX). It seems that the citations follow the last sorting referenced; ynt as per BibLaTeX options when both \newrefcontexts are removed or else whatever sorting is specified in the last \newrefcontext.

I am compiling in order pdflatex, biber, pdflatex, pdflatex and am on MacTeX.

It seems this would have worked as desired in TeX Live 2015 so is this a bug or has something changed which requires the citation sorting to be set in some other way?

\documentclass{article}

\usepackage[
           backend=biber,
           style=authoryear,
           sorting=ynt,
           sortcites,
           ]{biblatex}

\usepackage{filecontents}
\begin{filecontents}{lib.bib}
@article{test1,
  author = {b},
  title = {b},
  year=2003,
}
@article{test2,
  author = {c},
  title = {c},
  year=2001,
}
@article{test3,
  author = {a},
  title = {a},
  year=2002,
}
\end{filecontents}

\addbibresource{lib.bib}

\begin{document}

    Hello World! \parencite{test1,test2,test3}

    \newrefcontext[sorting=nyt]
    \printbibliography

    \newrefcontext[sorting=ydnt]
    \printbibliography

\end{document}

citation order incorrect

Edit

I have a workaround but it's super crap: Typeset the document with global sorting=ynt, copy the pdf to another file, then typeset the document with global sorting=nyt; using a PDF editing tool (Apple's Preview suffices) cut the pages containing the bibliography with the desired sorting from one PDF and paste into the other. As I said super crap. I'm not sure if I'd even do this as I'd feel dirty, but it's a workaround nonetheless.

If a solution does not exist or this is a bug without a patch, then what would be similar but much better would be some kind of package (which probably doesn't exist) which only changes certain pages at a time within the PDF (while still actually 'compiling' the whole document so that all the citations are done). It might look something like:

% document preamble
% ...

\usepackage{onlychange}
\onlychangerange{10,12}  % Bibliography found on pages 10--12
% On next compilation will typeset all pages except 10--12

% ...

It's a long shot but maybe someone knows of such a package or this rambling has inspired an actual solution.

Best Answer

edit The MWE works as intended with a recent version of biblatex and Biber

\documentclass{article}

\usepackage[
  backend=biber,
  style=authoryear,
  sorting=ynt,
  sortcites,
]{biblatex}

\begin{filecontents}{\jobname.bib}
@article{test1,
  author = {b},
  title  = {b},
  year   = 2003,
}
@article{test2,
  author = {c},
  title  = {c},
  year   = 2001,
}
@article{test3,
  author = {a},
  title  = {a},
  year   = 2002,
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
  Hello World! \parencite{test1,test2,test3}

  \newrefcontext[sorting=nyt]
  \printbibliography

  \newrefcontext[sorting=ydnt]
  \printbibliography
\end{document}

Hello World! (c 2001; a 2002; b 2003)