2

A bibliography having entries from a specific author only should be created using biber's sourcemap feature. Answer https://tex.stackexchange.com/a/65145/99345 shows how to do it with adding a certain keyword to each matching entry. This works for me as well, as long as no keywords were still present in matching bib entries. Thus, the following example produces a references list with only one entry instead of both entries.

References list with only one entry References list with both entries

Removing the existing keyword foo in the second entry makes both entries appear in the list, as expected.

\begin{filecontents}{\jobname.bib}
@book{first, author = {Doe, John}, title = {First}}
@book{second, author = {Doe, John}, title = {Second}, keywords = {foo}}
\end{filecontents}

\documentclass{article}
\usepackage[backend=biber]{biblatex}
\addbibresource{\jobname.bib}

\DeclareSourcemap{
    \maps[datatype=bibtex, overwrite]{
        \map{
            \step[fieldsource=author, match=Doe, final]
            \step[fieldset=keywords, fieldvalue=doe, append]
        }
    }
}

\begin{document}
\nocite{*}
\printbibliography[keyword=doe]
\end{document}

With overwrite and append attributes set, I assumed that also existing keywords can be modified that way. How can the intended behavior be achieved?

2

The keyword field is a comma separated list. If you just append doe to a list like keya,keyb you get keya,keybdoe, but of course you want keya,keyb,doe, so you need to append ,doe (that may leave you with an empty entry if the keyword field was empty, you might even get a warning, but you can ignore it). You would then use

\DeclareSourcemap{
    \maps[datatype=bibtex, overwrite]{
        \map{
            \step[fieldsource=author, match=Doe, final]
            \step[fieldset=keywords, fieldvalue={,doe}, append]
        }
    }
}
  • 1
    Don't forget that instead of just appending a fixed string, you can use regexp match/replace. This could deal with the case where there is nothing to append to. Or write two maps with a regexp check first to see if there is anything in the target field. – PLK Jun 17 '16 at 7:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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