2

For each article, I get a .bib file, then I have to copy it to the main bib file I'm using with bibtex. Is there tool, even outside of latex programming, to merge all .bib files to a single one and avoid duplication of references in the main bib file?

It may require to use another programming language to do it. I'm asking if there something already done. Otherwise I will code it in Python.

My code is like that:

\documentclass[12pt]{report}
\usepackage[backend=bibtex]{biblatex}
\addbibresource{main.bib}
\begin{document}
\cite{Dick2009}
\end{document}
Vitor Abella
  • 1,158
  • It's clear that you're after updating the bib key. How are the articles and their bibliographies linked in your final .tex? For this to be done solely in (La)TeX, you'll have to show the setup... – Werner Jun 21 '16 at 18:25
  • Instead of \cite{Dick2009}, you probably use \input{article1} or \include{article1}, right? – Werner Jun 21 '16 at 18:32
  • No. I have, for example, Dick2009.bib and many other .bib files. Whenever I want to add a new reference, I download its .bib file, and paste it in the main.bib. But I spend too much time copying and pasting them and I know it's possible to code it. Imagine that I have a folder with many .bib files and I want to merge them and paste on the main.bib, but don't delete toher references that already were on the main.bib and aren't in the folder with many .bib files. – Vitor Abella Jun 21 '16 at 18:35
  • So if you have \bibitem{key}{..} in filea.bib and \bibitem{key}{..} in fileb.bib, how would you manage this duplicate key? Discard it in fileb.bib? Rename it to fileb:key in fileb.bib? – Werner Jun 21 '16 at 18:38
  • Another way to formulate the question is: use \addbibresource{} to a folder, is it possible? – Vitor Abella Jun 21 '16 at 18:40
  • Sure, use \addbibresource{/foldera/filea} \addbibresource{/folderb/fileb}. But that doesn't answer the question about how to handle duplicates. – Werner Jun 21 '16 at 18:42
  • No, use \addbibresource to ALL .bib files in a folder – Vitor Abella Jun 21 '16 at 18:43
  • I agree that it doesn't solve duplicates problem. I think I will program it in python. Then it will merge all, avoid duplicates, put in alphabetical order and everything I want. Then I share it here. – Vitor Abella Jun 21 '16 at 18:45
  • You can follow these guidelines: How to iterate through the name of files in a folder and use \addbibresource. Additionally, one could update \bibitem to modify duplicates... – Werner Jun 21 '16 at 18:46
  • 1
    Note: \addbibresource, by design, must be used for each file that is being loaded. This is because biblatex can handle other types of bibliography files besides the traditional .bib file of BibTeX. In order to deal with duplicate entries, look at bibtool or the tool mode of the Biber engine (which was developed for use with biblatex). ‎ – jon Jun 21 '16 at 18:51
  • 1
  • 2
    JabRef has functions Append to database, Import into current database and Import into new database. – Bernard Jun 21 '16 at 19:18
  • 2
    tool mode of biber will do this. It will skip duplicates and you can sort the output however you want. – PLK Jun 22 '16 at 07:58
  • Would you consider your question to be a duplicate of Merge two BibTeX files? If not, can you explain what you need in more detail? – moewe Jul 22 '16 at 07:46
  • @moewe: Ah, one must appreciate the irony of a question about merging duplicate entries being marked as a duplicate :-) – einpoklum Feb 03 '17 at 13:38

0 Answers0