[Tex/LaTex] Multibib reverse label or sort order

biblatexbibliographiesmultibibsortingsubdividing

I'm using multibib. I manually set the order of the bibliography. I would like the order of the numbered items to be reversed. For example, my document has:

\nociteX{Foo}
\nociteX{Bar}

And the document then shows:

[1] Foo
[2] Bar

I would like the document to show:

[2] Foo
[1] Bar

Can anyone explain what to change in my .bst file, or a flag to multibib that I am missing that will achieve this?

Best Answer

The biblatex package offers features comparable to those of multibib. References from a single bib file can be subdivided using various options of \printbibliography. Examples include type, keyword and category. Refer to the biblatex manual for details. Prefixes to the labelnumber are specified with the prefixnumbers option.

Assuming each sub-bibliography has a unique prefix, descending label numbers can be obtained by altering the labelnumber field format so that it prints the value given by the total prefix-specific entry count, minus the actual labelnumber, plus one.

\documentclass{article}
\usepackage[style=numeric-comp,sorting=ydnt,defernumbers]{biblatex}

\AtDataInput{%
  \csnumgdef{entrycount:\strfield{prefixnumber}}{%
    \csuse{entrycount:\strfield{prefixnumber}}+1}}

\DeclareFieldFormat{labelnumber}{\mkbibdesc{#1}}    
\newrobustcmd*{\mkbibdesc}[1]{%
  \number\numexpr\csuse{entrycount:\strfield{prefixnumber}}+1-#1\relax}

\addbibresource{biblatex-examples.bib}

\begin{document}
Filler text \cite{aksin,bertram,angenendt}.
Filler text \cite{chiu,padhye,moraux}.
\printbibheading
\printbibliography[prefixnumbers={A},type=article,title={Articles},heading=subbibliography]
\printbibliography[prefixnumbers={R},type=report,title={Reports},heading=subbibliography]
\printbibliography[prefixnumbers={P},type=inproceedings,title={Presentations},
                   heading=subbibliography]
\end{document}

enter image description here

This solution works with either backend, though with biber the "rerun LaTeX" messages in the log may not stabilize. In any case heed the warning; the first time the message disappears after recompiling should give the correct document.