1

I want to make multiple subbibliographies using biblatex package and biber as backend. I know that the option sorting= of biblatex takes care of the sorting but it only knows name, year, volume and title. So right now my order with sorting=nty is name > title > year but is it possible to get keywords > name > title?

Here is my MWE:

\documentclass{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage{filecontents}
\begin{filecontents}{library.bib}
@book{book1,
    author  = {Einstein, Albert},
    title   = {The World as I See it},
    keywords= {book}
}
@book{book2,
    author  = {Hawiking, Stephen},
    title   = {A Brief History of Time},
    keywords= {book}
}
@book{intern1,
    author  = {Richards, John},
    title   = {Intern document},
    keywords= {intern}
}
@book{intern2,
    author  = {Bobby, Ricky},
    title   = {Intern document 2},
    keywords= {intern}
}
\end{filecontents}

\usepackage[%
    backend=biber,
    sorting=nty,
    style=ieee,
]{biblatex}
\addbibresource{library.bib}

\begin{document}
\cite{book1} \cite{book2} \cite{intern1} \cite{intern2}

\printbibheading
\printbibliography[%
        keyword=book,
        heading=subbibliography,
        title={Books}
    ]
\printbibliography[%
        keyword=intern,
        heading=subbibliography,
        title={Intern documents}
    ]
\end{document}

Wich results in this:

But I want more something like this:

Books
[1]
[2]
...
[7]

Intern documents
[8]
[9]
...
2

If you have disjoint split bibliographies at the same level, it is quite likely that you want to use the defernumbers option. In older versions of biblatex you would explicitly be warned to use defernumbers=true, but that was changed following biblatex advises defernumbers=true but details of references may be very hard to find and ultimately https://github.com/plk/biblatex/issues/493 (incidentally, I think the warning should have stayed since the cases where defernumbers is useful are much more abundant than those where it is not, you'll notice that the example that sparked this gave sub-par output with both settings, though the defernumbers=false was arguably nicer).

The biblatex manual explains the defernumbers option as (p. 56)

In contrast to standard LaTeX, the numeric labels generated by this package are normally assigned to the full list of references at the beginning of the document body. If this option is enabled, numeric labels [...] are assigned the first time an entry is printed in any bibliography. [...] This option requires two LaTeX runs after the data has been exported to the bbl file by the backend (in addition to any other runs required by page breaks changing etc.). An important thing to note is that if you are using this option, then changes to options, the bib file or certain commands like \printbibliography will usually require that you delete your current aux file and re-run LaTeX to obtain the correct numbering.

And later §3.14.5 Bibliography Filters and Citation Labels mentions (p. 136)

The citation labels generated by this package are assigned to the full list of references before it is split up by any bibliography filters. They are guaranteed to be unique across the entire document (or a refsection environment), no matter how many bibliography filters you are using. When using a numeric citation scheme, however, this will most likely lead to discontinuous numbering in split bibliographies. Use the defernumbers package option to avoid this problem. If this option is enabled, numeric labels are assigned the first time an entry is printed in any bibliography.

So if you set defernumbers=true you get continuous numbering in the bibliographies

\documentclass{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage{filecontents}
\begin{filecontents}{library.bib}
@book{book1,
    author  = {Einstein, Albert},
    title   = {The World as I See it},
    keywords= {book}
}
@book{book2,
    author  = {Hawiking, Stephen},
    title   = {A Brief History of Time},
    keywords= {book}
}
@book{intern1,
    author  = {Richards, John},
    title   = {Intern document},
    keywords= {intern}
}
@book{intern2,
    author  = {Bobby, Ricky},
    title   = {Intern document 2},
    keywords= {intern}
}
\end{filecontents}

\usepackage[%
    backend=biber,
    sorting=nty,
    style=ieee,
    defernumbers=true,
]{biblatex}
\addbibresource{library.bib}

\begin{document}
\cite{book1} \cite{book2} \cite{intern1} \cite{intern2}

\printbibheading
\printbibliography[%
        keyword=book,
        heading=subbibliography,
        title={Books}
    ]
\printbibliography[%
        keyword=intern,
        heading=subbibliography,
        title={Intern documents}
    ]
\end{document}

References//Books//1 A. Einstein, The World as I See it.//2 S. Hawiking, A Brief History of Time.//Intern documents//3 R. Bobby, Intern document 2.//4 J. Richards, Intern document.

Note that technically speaking this does not sort by keywords, but the result is what you need in this case. Sorting by keywords is not easy since the keyword field is a list that may hold several keywords in arbitrary order. If one wanted to sort by that and wanted to be able to enforce a non-alphabetic sort order, tricks would be needed.

  • That's exactly what I wanted thanks! This a great community – Jakeybolle Sep 13 '18 at 7:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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