[Tex/LaTex] Unsorted bibliography but locally sorted using biblatex

biblatexsorting

I'm trying to solve a rather odd sorting of the bibliography. I want to have the numeric citations appear in order of citation. However, I want to sort the group of references by another style.

I thought it will be similar to other problems: The same bibliography with different sorting, but that solution is not working.

For instance, if I have

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[backend=biber,style=ieee, citestyle=numeric-comp, sortcites, sorting=nyt]{biblatex}
\usepackage{filecontents}

\begin{filecontents*}{biblatex-ieee.bib}
    @book{candy1992,
      editor        = "J. C. Candy and G. C. Temes",
      title         = "Oversampling Delta-Sigma Data Converters Theory,
                       Design and Simulation",
      publisher     = "{IEEE} Press.",
      location      = "New York",
      year          = "1992"
    }
    @inbook{anderson2000,
      author        = "J. B. Anderson and K. Tepe",
      title         = "Properties of the Tailbiting {BCJR} Decoder",
      booktitle     = "Codes, Systems and Graphical Models",
      series        = "{IMA} Volumes in Mathematics and Its Applications",
      publisher     = "Springer-Verlag",
      location      = "New York",
      year          = "2000"  
    }   
    @book{bul1964,
      author        = "B. K. Bul",
      title         = "Theory Principles and Design of Magnetic Circuits",
      publisher     = "Energia Press",
      loction       = "Moscow",
      year          = "1964",
      pages         = "464",
      note          = "(in Russian)"
    }
\end{filecontents*}

\addbibresource{biblatex-ieee.bib}

\begin{document}
\cite{candy1992, anderson2000} \cite{bul1964}

\newrefcontext[sorting=none]
\printbibliography[title=Unsorted]

\end{document}

I obtain

enter image description here

while I was expecting

enter image description here

That is, to get the consecutive citations to be cited in order of appearance. But the contents of the each citation to be sorted (by a particular scheme).

Is there a way to achieve that using biblatex?

Best Answer

As far as Biber is concerned two entries that were both first cited in the same \cite have the same precedence when sorting with sorting=none (i.e. \sort{\citeorder}), a tie is broken by taking the order in which the entries were cited within that \cite into account. But you can also break the tie differently by adding other sort features, for example a copy of what nyt does. This was implemented following BibLaTeX: how to sort references by year within the citation and https://github.com/plk/biblatex/issues/5 in https://github.com/plk/biber/commit/f74af1c946675b829e19743dd77ad62aec901f3d. Just define the sorting scheme nonenyt as follows

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[backend=biber,style=ieee, citestyle=numeric-comp, sortcites]{biblatex}

\DeclareSortingTemplate{nonenyt}{
  \sort{\citeorder}
  \sort{
    \field{presort}
  }
  \sort[final]{
    \field{sortkey}
  }
  \sort{
    \field{sortname}
    \field{author}
    \field{editor}
    \field{translator}
    \field{sorttitle}
    \field{title}
  }
  \sort{
    \field{sortyear}
    \field{year}
  }
  \sort{
    \field{sorttitle}
    \field{title}
  }
  \sort{
    \field{volume}
    \literal{0}
  }
}
\ExecuteBibliographyOptions{sorting=nonenyt}

\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@book{candy1992,
  editor        = {J. C. Candy and G. C. Temes},
  title         = {Oversampling Delta-Sigma Data Converters Theory,
                   Design and Simulation},
  publisher     = {{IEEE} Press.},
  location      = {New York},
  year          = {1992},
}
@inbook{anderson2000,
  author        = {J. B. Anderson and K. Tepe},
  title         = {Properties of the Tailbiting {BCJR} Decoder},
  booktitle     = {Codes, Systems and Graphical Models},
  series        = {{IMA} Volumes in Mathematics and Its Applications},
  publisher     = {Springer-Verlag},
  location      = {New York},
  year          = {2000},
}
@book{bul1964,
  author        = {B. K. Bul},
  title         = {Theory Principles and Design of Magnetic Circuits},
  publisher     = {Energia Press},
  loction       = {Moscow},
  year          = {1964},
  pages         = {464},
  note          = {(in Russian)},
}
\end{filecontents*}

\addbibresource{\jobname.bib}

\begin{document}
\cite{candy1992, anderson2000} \cite{bul1964}

\printbibliography
\end{document}

"[1, 2] [3]" and in the bibliography 1: J. B. Anderson and K. Tepe, 2: J. C. Candy and G. C. Temes, Eds., 3: B. K. Bul