9

In my Bibliography, I need two categories: Primary Sources and Secondary Sources. The first needs to be subdivided into Manuscripts and Published Works.

So, I thought I could use the following code:

\printbibheading
    \printbibliography[keyword={Manuscripts}, heading=subbibliography, title={Manuscripts}]
    \printbibliography[keyword={Primary Source}, heading=subbibliography, title={Primary Sources}]
    \printbibliography[keyword={Secondary Source}, heading=subbibliography, title={Secondary Sources}]

This, however, gives me three categories, but I would like to have only two with the first being subdivided. In other words I need something like this:

\printbibliography[keyword={Manuscripts},
    heading=subbibliography,
    title={Primary Sources},
    subtitle={Manuscripts}]  %% subtitle={...}
8

Well, you could do the following to put both sectioning commands in one \defbibheading:

\documentclass[12pt]{article}
\usepackage{biblatex}
\addbibresource{biblatex-examples.bib}
\defbibheading{multilevel}{% 
  \section*{Primary Sources}
  \subsection*{Manuscripts}}

\begin{document}                                                             
\nocite{knuth:ct}
\printbibliography[heading=multilevel]
\end{document}

A fuller example would be:

\documentclass[12pt]{article}

\usepackage[backend=biber,style=authortitle]{biblatex}
\addbibresource{biblatex-examples.bib}
\defbibheading{multilevel}{%
  \section*{Primary Sources}
  \subsection*{Manuscripts}}

\defbibheading{published}{%
  \subsection*{Published Works}}

\defbibheading{secondary}{%
  \section*{Secondary Sources}}

\DeclareBibliographyCategory{mss}
\DeclareBibliographyCategory{pri}
\DeclareBibliographyCategory{sec}

\addtocategory{mss}{knurth:ct}
\addtocategory{pri}{knuth:ct:a}
\addtocategory{sec}{knuth:ct:b}

\begin{document}

\nocite{knuth:ct,knuth:ct:a,knuth:ct:b}

\printbibliography[heading=multilevel, notcategory={pri}, notcategory={sec}]
% \printbibliography[heading=multilevel, category={mss}]
\printbibliography[heading=published,  category={pri}]
\printbibliography[heading=secondary,  category={sec}]

\end{document}

But for some reason it does not work correctly if you use three bibliography categories, though it will work if you use notcategory.... However, it does work fine with three different keywords (e.g., keyword={mss}, keyword={pri}, keyword={sec}) as long as your .bib file entries have the appropriate keywords field. (Unfortunately, the biblatex-examples.bib that ships with biblatex only has two categories of keywords: primary and secondary.)

enter image description here

3

Necro'ing after four years because I had a similar problem and found a better solution. Biblatex 3.5 allows to improve the solution a tad. From the manual:

\defbibheading{name}[title]{code}

This command defines bibliography headings. The name is an identifier to be passed to the heading option of \printbibliography or \printbibheading and \printbiblist when selecting the heading. The code should be LaTeX code generating a fully-fledged heading, including page headers and an entry in the table of contents, if desired. If \printbibliography or \printbiblist are invoked with a title option, the title will be passed to the heading definition as #1. If not, the default title specified by the optional title argument is passed as #1 instead. The title argument will typically be \bibname, \refname, or \biblistname (see § 4.9.2.1).

OK, that is not very clear, but what it means is that you can write a macro to produce the bibliographic heading. In the above case, one could do something like:

\defbibheading{firstlevel}[]{%
    \section*{#1}
    \addcontentsline{toc}{section}{#1}}

\defbibheading{secondlevel}[]{%
    \subsection*{#1}
    \addcontentsline{toc}{subsection}{#1}}
(...)
    \section*{Primary Sources}
    \addcontentsline{toc}{section}{Primary Sources}
    \printbibliography[keyword=published, heading=secondlevel, title={Published Works}]
    \printbibliography[keyword=manuscripts, heading=secondlevel, title={Manuscripts}]

    \printbibliography[keyword=secondary, heading=firstlevel, title = {Secondary Sources}]

You still need an explicit call to create the second section; maybe a LateX-guru could refine the code definitions to avoid this. But I would argue this solution is cleaner.

2

I know, I could use something like this:

\printbibheading
    \section*{Primary Sources}
        \subsection*{Manuscripts}
    \printbibliography[keyword={Manuscripts}, heading=none]
        \subsection*{Published Works}
    \printbibliography[keyword={Primary Source}, heading=none]
    \section*{Secondary Sources}
    \printbibliography[keyword={Secondary Source}, heading=none]

Maybe, however, there are other, i.e., more elegant, solutions possible.

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.