# Structuring the bibliography by headings and subheadings

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={...}

-
–  Marco Daniel Apr 1 '13 at 11:22

## 2 Answers

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.)

-

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.

-