# 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}]


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

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}

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

\begin{document}
\cite{geer,loh}
\newrefcontext[labelprefix=P]
\newrefcontext[labelprefix=M]
\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}
\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}
\end{document}


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

\newrefcontext[labelprefix=P]
\newrefcontext[labelprefix=M]