Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

up vote 7 down vote accepted

Here a small modification of your example. The example works only with backend=biber.

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


\DeclareBibliographyCategory{byname}
\newcommand*{\mknamesignature}[5]{\def#1{#2|||}}
\mknamesignature{\highlightname}{Knuth}{}{}{}

\DeclareIndexNameFormat{byname}%
 {%
  \mknamesignature{\currentsignature}{#1}{#3}{#5}{#7}%
  \ifdefequal{\highlightname}{\currentsignature}%
    {\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}
 \nocite{*}
 \printbibliography[notcategory=byname,heading=none]
\end{document}

enter image description here

share|improve this answer
    
This does not work for me: there is still no citation in the first category. –  Pascal Jul 29 '12 at 11:19
    
really? Did you run with biber? –  Marco Daniel Jul 29 '12 at 11:26
    
@Pascal: Which version of biblatex do you use? –  Marco Daniel Jul 29 '12 at 11:33
    
Ah sorry, I had not seen that it should be ran with biber. Biber doesn't work currently on my distro, I would prefer a solution without it, if you have one. –  Pascal Jul 29 '12 at 11:41
    
@Pascal: I don't know a way with bibtex? Which problems do you have with biber? –  Marco Daniel Jul 29 '12 at 11:56

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]
share|improve this answer
    
I must learn this kind of source. Awesome. –  Marco Daniel Jul 29 '12 at 17:25
    
This seems neat, but the \DeclareSourcemap command does not seem available on my tex distribution yet, I'll test it then. –  Pascal Jul 30 '12 at 14:40
    
You need to update to biblatex 2.0 and biber 1.0 –  PLK Jul 30 '12 at 14:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.