# Biblatex/biber non-consecutive numbering references by type when using multiple bibliographies

I'm trying to have two bibliographies in one document. The first on is the normal references. And the later is intended to be a publication list and should be separated by type.

I managed to split the bibliographies and include the references. However, the numbers of the second bibliography are in chronological order instead of sequential numbering.

For example, in the image below, you can see that the numbering jumps 1, 2, 5, and I would like to have, 1, 2, 3, and then continue with 4 in the next group.

I tried running the compilation again and it just get worst as it starts the numbers from 9, instead. But after another compilation it returns to the previous configuration.

After playing with the code, I noticed that the problem lies in the \newrefsection to produce the second bibliography. When I remove it and run the grouped by type bibliography the order is fine. What may be the problem? and how can I solve it? Is it something with my custom sorting?

The code I'm using is below:

\documentclass{article}

\usepackage{filecontents}
\begin{filecontents}{ref2.bib}
@ARTICLE{R2013,
author = {A. R},
title = {B paper},
year = {2013},
journal = C,
keywords = {publication}
}

@ARTICLE{R2012,
author = {A. R},
title = {L paper},
year = {2012},
journal = I,
keywords = {publication}
}

@INPROCEEDINGS{R2012a,
author = {A. R},
title = {L paper},
booktitle = {I},
year = {2012},
month = nov,
keywords = {publication}
}

@INPROCEEDINGS{R2012b,
author = {A. R},
title = {R paper},
booktitle = {I},
year = {2012},
month = oct,
keywords = {publication}
}

@ARTICLE{R2012c,
author = {A. R},
title = {C paper},
year = {2012},
month = sep,
journal = I,
keywords = {publication}
}

@INPROCEEDINGS{R2011,
author = {A. R},
title = {O paper},
booktitle = {A},
year = {2011},
month = aug,
keywords = {publication}
}

@MISC{R2009,
author = {A. R},
title = {M thesis},
year = {2009},
howpublished = {B.Sc. Thesis},
month = feb,
keywords = {publication}
}

@ARTICLE{S2009,
author = {C. S},
title = {F paper},
year = {2009},
journal = {I}
}
\end{filecontents}

\usepackage[style=ieee,sorting=ymdtn,sortcites,defernumbers=true]{biblatex}

\DeclareSortingScheme{ymdtn}{
\sort{
\field{presort}
}
\sort[final]{
\field{sortkey}
}
\sort[direction=descending]{
\field{sortyear}
\field{year}
\literal{9999}
}
\sort[direction=descending]{
\literal{99}
}
\sort[direction=descending]{
\literal{99}
}
\sort{
\field{sorttitle}
}
\sort[direction=descending]{
\literal{9999}
}
\sort{
\name{sortname}
\name{author}
\name{editor}
\name{translator}
\field{sorttitle}
\field{title}
}
}

\bibliography{ref2}

\pagestyle{empty}

\begin{document}
\cite{S2009}
\printbibliography
\newrefsection
\nocite{*}

\end{document}

-

I think all you need to do is add resetnumbers to the first \printbibliography after the \newrefsection:
\printbibliography[resetnumbers=true,keyword=publication,type=article,heading=subbibliography,title={Journals}]