[Tex/LaTex] biblatex: separating publications of a specific author in the bibliography

biblatexsubdividing

The question I want to ask is related to the answer of this question: biblatex: filter out publications from a specific author in the references dynamically .

My aim is to separate my bibliography into two parts : one part for a personnal bibliography, and a second one for the regular bibliography.

To do that, I use the technique of the post I cited :

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\usepackage[style=alphabetic,maxnames=6,natbib=true]{biblatex}
\bibliography{biblatex-examples}

% Variants of each could be added
\newcommand{\firstname}{Donald~E.}
\newcommand{\lastname}{Knuth}

\DeclareBibliographyCategory{byname}

\DeclareIndexNameFormat{byname}{% Test could be refined
  \ifboolexpr{ test {\ifdefstring{\lastname}{#1}}
           and test {\ifdefstring{\firstname}{#3}}
              }
{\addtocategory{byname}{\thefield{entrykey}}}
{}}

\AtDataInput{%
  \indexnames[byname]{author}}

\begin{document}
 \section{Knuth's books}
 \begin{refsection}
 \nocite{*}
 \printbibliography[category=byname,heading=none]
 \end{refsection}
 \section{Not Knuth's books}
 \printbibliography[notcategory=byname,heading=none]
\end{document}

The problem is that only the second bibliography appears, and when I remove the refsection, then all the bibtex entries of my input files are printed, separated as they should.

EDIT: the aim is to have all publications (even the ones not cited) by author knuth in the first section and all the other cited publications in the second one.

Best Answer

If you want to do this using biber, I'd recommend using the sourcemap feature, it's cleaner than adding a category via an index format. This alters the input stream (without altering the .bib file) so that the keyword "knuth" is added to all works with matching "Knuth" as the author, which you can then filter on:

\DeclareSourcemap{
  \maps[datatype=bibtex]{
    \map{
      \step[fieldsource=author,
            match=Knuth,
            final]
      \step[fieldset=keywords, fieldvalue=knuth]
    }
  }
}

\printbibliography[keyword=knuth]
\printbibliography[notkeyword=knuth]