4

For my publication list I want to generate several bibliographies that are automatically disciminated by the publication state. For the publication state I use the pubstate field and by the keywords= {own} field I have marked them in my bibliography database as my own publications (surprise, eh?). The bibliographies are restricted to my own publications by the keyword = own options.

As the filter functions of biblatex are only working on some specific fields where pubstate is not among them, I want to map the content of the pubstate field into the keywords field via the \DeclareSourcemap command. From there I could filter the bibliography according to that field. Unfortunately, no matter if I use the append option of \DeclareSourcemap or not, it seems as if there is nothing written into a field that is not empty. If I instead try to map into an empty field (comment the line starting with fieldset=keywords and uncomment the line below) then the field is containing the desired value afterwards.

\begin{filecontents}{\jobname.bib}
@article{inpress,
    author = {A. Uthor},
    title = {Yay, they accepted my article},
    keywords = {own},
    pubstate = {inpress},
    year = {2014},
    journal = {Journal of Universal Acceptance}
}

@article{submitted,
    author = {A. Uthor},
    title = {Look, I've written a nice manuscript, would you publish it? Pleeease?},
    keywords = {own},
    pubstate = {submitted},
    year = {2014},
    journal = {Journal of Doubtful Acceptance}
}
\end{filecontents}

\documentclass{article}
\usepackage[backend=biber]{biblatex}

\addbibresource{\jobname.bib}

\DeclareSourcemap{
    \maps[datatype=bibtex]{
        \map{
            \step[fieldsource=pubstate, match={inpress},
                fieldset=keywords, fieldvalue={inpress}, append]
%               fieldset=note, fieldvalue={inpress}, append]
        }
    }
}

\listfiles

\begin{document}
\nocite{*}
\printbibliography[keyword=inpress, title = {Articles in press}]
\printbibliography[keyword=own, title = {Submitted articles}]
\end{document}

Of course I could just do this manually in different ways but I'd like to understand, why it doesn't work as I expect it.

9

The problem is that you need to specify overwrite in the map. Try this:

\DeclareSourcemap{
    \maps[datatype=bibtex]{
        \map[overwrite]{
            \step[fieldsource=pubstate, match={inpress},
                fieldset=keywords, fieldvalue={inpress}, append]
%               fieldset=note, fieldvalue={inpress}, append]
        }
    }
}

BUT, Also you need to add the comma that separate the keywords, because the above code make owninpress.

It is possible that the below code is useful for you. It append the all pubstate in the keywords field.

\DeclareSourcemap{
    \maps[datatype=bibtex]{
        \map[overwrite]{
            \step[fieldsource=pubstate,final]
            \step[fieldset=keywords, fieldvalue={,}, append]
            \step[fieldset=keywords, origfieldval, append]
        }
    }
}

The above code make in the keywords: own, inpress and own, submitted.

  • I finally have transferred your solution from my MWE to my real world application and there I have a small flaw arising: If the an entry has neither a keywords nor a pubstate field, biber throws the following warning: "The field 'keywords' in entry 'XXX' cannot be null, deleting it". This is not a major issue as it does not prevent the function, but is quite annoying in a .bib file with some hundred entries. Can this somehow be prevented, maybe by restricting the action to entries where pubstate is defined? – Benedikt Bauer Oct 7 '14 at 12:20
  • @BenediktBauer,In the DeclareSourcemap Add final in the end of \step[fieldsource=pubstate]. This means, like this \step[fieldsource=pubstate, final] . I'm going to edit the answer for add this. – Carlos Lanziano Oct 7 '14 at 13:44
3

This is not a solution for the question, but to the problem. Instead of adding the inpress keyword to the keyword biblatex field, one can define a new bibcheck and use the check option of \printbibliography.

\defbibcheck{inpress}{
  \iffieldequalstr{pubstate}{inpress}{}{\skipentry}
}  

and then

\printbibliography[check=inpress]

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.