4

I'm working on an edited volume, for the major time so far compiling the different chapters separately, each of them having (one or) two bibliographies. I have a biber.conf file for each chapter, for generating two bibliographies (primary and secondary literature (of which the primary ones are also an ugly hack, but that would be another question, so I've reduced my example here to one bibliography per chapter.)). I associate the bib-files with keywords, and then generate the bibliographies for primary and secondary literature based on that. The commands for that follow the pattern biber -g 1.conf 1.

I am now putting the volume together, using docmute, and am realising my biblatex setup is seriously broken. It would have been desirable to have just one bibliographical database, from which each of the contributions would feed and build up their respective bibliographies by \cite etc., but that's not how things have naturally grown here. I hope for the next volume I can do it like that. For now I guess I have to find a way to either keep the bibliographies completely separate, or make duplicate entries appear in all the bibliographies in whose bib files they are present.

In the following example (should be named 1.tex. a.tex and b.tex represent chapters of the volume, of which I only display the bibliographies here.) the entry A2015 is a duplicate. How can I make it appear in both bibliographies?

\documentclass{memoir}
\usepackage{filecontents}
\usepackage[authordate]{biblatex-chicago}
\usepackage{docmute}
\addbibresource{a.bib}
\addbibresource{b.bib}


\begin{filecontents*}{1.conf}
<?xml version="1.0" encoding="UTF-8"?>
<config>
  <sourcemap>
    <maps datatype="bibtex" bmap_overwrite="1">
      <map>
        <per_datasource>a.bib</per_datasource>
        <map_step map_field_set="KEYWORDS" map_field_value="a"/>
      </map>
      <map>
        <per_datasource>b.bib</per_datasource>
        <map_step map_field_set="KEYWORDS" map_field_value="b"/>
      </map>
    </maps>
  </sourcemap>
</config>
\end{filecontents*}

\begin{filecontents*}{a.tex}
\documentclass{memoir}
\usepackage[authordate]{biblatex-chicago}
\addbibresource{a.bib}
\begin{document}
\nocite{*}
\printbibliography[keyword=a,heading=subbibliography]
\end{document}
\end{filecontents*}


\begin{filecontents*}{a.bib}
@book{A2015,
author = {Some Body},
year = {2015},
title = {A book},
}
\end{filecontents*}


\begin{filecontents*}{a.conf}
<?xml version="1.0" encoding="UTF-8"?>
<config>
  <sourcemap>
    <maps datatype="bibtex" bmap_overwrite="1">
      <map>
        <per_datasource>a.bib</per_datasource>
        <map_step map_field_set="KEYWORDS" map_field_value="a"/>
      </map>
    </maps>
  </sourcemap>
</config>
\end{filecontents*}


\begin{filecontents*}{b.tex}
\documentclass{memoir}
\usepackage[authordate]{biblatex-chicago}
\addbibresource{b.bib}
\begin{document}
\nocite{*}
\printbibliography[keyword=b,heading=subbibliography]
\end{document}
\end{filecontents*}


\begin{filecontents*}{b.bib}
@book{A2015,
author = {Some Body},
year = {2015},
title = {A Book},
}

@book{B2015,
author = {Somebody Else},
year = {2015},
title = {Another Book},
}
\end{filecontents*}

\begin{filecontents*}{b.conf}
<?xml version="1.0" encoding="UTF-8"?>
<config>
  <sourcemap>
    <maps datatype="bibtex" bmap_overwrite="1">
      <map>
        <per_datasource>b.bib</per_datasource>
        <map_step map_field_set="KEYWORDS" map_field_value="b"/>
      </map>
    </maps>
  </sourcemap>
</config>
\end{filecontents*}

\begin{document}
\input{a}
\input{b}
\end{document}
9
  • 1
    One possibility seems to be to use the keywords field, as in keywords = {a,b}, in the A2015 entry of the bibfile which is loaded first.
    – muk.li
    Sep 13, 2015 at 4:47
  • The problem really is that A2015 from b.bib is discarded because it is a duplicate key. We can't have to entries with the same identifier. Of course the information that it is in both files is lost. Your best bet is to add the keyword manually. There is for obvious reasons no "per_datasource" that only becomes active if a entry is in two files at the same time.
    – moewe
    Sep 13, 2015 at 5:21
  • @moewe the a.conf and b.conf would be needed only if I'd have more than one bibliography per chapter, which I do in the real project, but not here. I could have omitted them, to keep the example file shorter, indeed. They are needed when compiling the chapters separately.
    – muk.li
    Sep 13, 2015 at 5:22
  • That became very apparent, that's why I deleted my question. I think with the current state of the software adding keyword = {a,b} manually for the duplicates would be best.
    – moewe
    Sep 13, 2015 at 5:25
  • 1
    Good, let me see what I can come up with later. (I'm not sure if it will work though ...)
    – moewe
    Sep 14, 2015 at 10:13

1 Answer 1

4

If you want to keep the references in a.tex and b.tex completely separate (without a possibility for a proper common bibliography) you can use refsections.

You don't even have to touch the original .tex files it is enough to wrap the \input in a refsection environment where you have to specify the proper .bib file in the optional argument.

\begin{refsection}[a.bib]
\input{a}
\end{refsection}
\begin{refsection}[b.bib]
\input{b}
\end{refsection}

MWE

\documentclass{memoir}
\usepackage{filecontents}
\usepackage[authordate]{biblatex-chicago}
\usepackage{docmute}

\begin{filecontents*}{a.tex}
\documentclass{memoir}
\usepackage[authordate]{biblatex-chicago}
\addbibresource{a.bib}
\begin{document}
\nocite{*}
\printbibliography[heading=subbibliography]
\end{document}
\end{filecontents*}

\begin{filecontents*}{a.bib}
@book{A2015,
author = {Some Body},
year = {2015},
title = {A book},
}
\end{filecontents*}


\begin{filecontents*}{b.tex}
\documentclass{memoir}
\usepackage[authordate]{biblatex-chicago}
\addbibresource{b.bib}
\begin{document}
\nocite{*}
\printbibliography[heading=subbibliography]
\end{document}
\end{filecontents*}

\begin{filecontents*}{b.bib}
@book{A2015,
author = {Some Body},
year = {2015},
title = {A Book},
}

@book{B2015,
author = {Somebody Else},
year = {2015},
title = {Another Book},
}
\end{filecontents*}


\begin{document}
\begin{refsection}[a.bib]
\input{a}
\end{refsection}
\begin{refsection}[b.bib]
\input{b}
\end{refsection}
\end{document}

enter image description here

There are no Biber errors because the two refsections coexist independently.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .