# Separate bibliographies for phdthesis and mastersthesis in biblatex

I want separate bibliograhies for phdtheses and masterstheses in biblatex 3.0.

The bib-keys @phdthesis and @masterthesis will be treated just like @thesis by biblatex (with an additional bib-field "type").

Thus

\printbibliography[type=thesis, heading=subbibliography, title={Theses}]


collects all kind of theses. And

\printbibliography[type=phdthesis, heading=subbibliography, prefixnumbers=P, title={Doctoral Theses}]
\printbibliography[type=mastersthesis, heading=subbibliography, prefixnumbers=M, title={Master's Theses}]


throws a warning

Package biblatex Warning: Type 'phdthesis' not found ...


What can I do to separate phdtheses and masterstheses automatically? Is it possible to filter by the bib-field "type" (not the bib-key)?

## 2 Answers

Instead of keywords you can use the type field directly in a bibcheck. The type field is automatically populated with the correct string when Biber converts @phdthesis and @mathesis to @thesis. (The conversion happens in such a way that aside from the type field, there is no difference between @phdthesis and @mathesis for either Biber or biblatex.)

\documentclass{article}
\usepackage[defernumbers,backend=biber]{biblatex}
\addbibresource{biblatex-examples.bib}

\defbibcheck{phdthesis}{%
\iffieldequalstr{type}{phdthesis}
{}
{\skipentry}}
\defbibcheck{mathesis}{%
\iffieldequalstr{type}{mathesis}
{}
{\skipentry}}

\begin{document}
\cite{geer,loh}
\newrefcontext[labelprefix=P]
\printbibliography[check=phdthesis, heading=subbibliography, title={Doctoral Theses}]
\newrefcontext[labelprefix=M]
\printbibliography[check=mathesis, heading=subbibliography, title={Master's Theses}]
\end{document}


• Thanks! This solves my problem. For I am using biblatex 3.0 I just had to replace the newrefcontent-command by the prefixnumbers-parameter as @DavidPurton already explained. – uvularer_frikativ May 13 '17 at 11:37

I guess you could do it with a source map. Copy the thesis type field to the keywords field and then filter based on that. Note that this code is for biblatex 3.0 as you have specified. For more recent versions of biblatex you can't use the prefixnumbers option. But the source map idea is the same.

\documentclass{article}
\usepackage[defernumbers,backend=biber]{biblatex}
\addbibresource{biblatex-examples.bib}
\pagestyle{empty}
% copy the thesis type field to the keywords field
\DeclareSourcemap{
\maps{
\map[overwrite]{
\pertype{thesis}
\step[fieldsource=type, final]
\step[fieldset=keywords, origfieldval]
}
}
}
\begin{document}
\cite{geer,loh}
\printbibliography[keyword=phdthesis, heading=subbibliography, prefixnumbers=P, title={Doctoral Theses}]
\printbibliography[keyword=mathesis, heading=subbibliography, prefixnumbers=M, title={Master's Theses}]
\end{document}


For more recent versions of biblatex you would print your bibliographies like this (I think):

\newrefcontext[labelprefix=P]
\printbibliography[keyword=phdthesis, heading=subbibliography, title={Doctoral Theses}]
\newrefcontext[labelprefix=M]
\printbibliography[keyword=mathesis, heading=subbibliography, title={Master's Theses}]

• Thanks for your nice answer that solves my problem, too. However, I prefer using the "check" attribute (in the other solution), because setting the keywords here seems to be more work-around-ish. – uvularer_frikativ May 13 '17 at 11:44