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.

Normally, LaTeX will only create references for the BibTeX entries cited in the text. Is there a way of extracting these entries into a different .bib file automatically? For example if I have a .bib file with two entries, and only one is cited in a particular text, I need a way of creating a new .bib file with just that reference.

share|improve this question

migrated from stackoverflow.com Jan 21 '12 at 14:42

This question came from our site for professional and enthusiast programmers.

For Mac users of BibDesk, there is BBL to BIB with BibDesk. –  Adam Liter Sep 19 '13 at 3:08
For Windows, JabRef provides this capacity: see [here][1] [1]: tex.stackexchange.com/questions/98370/… –  Johannes Pfeifer Jul 18 at 14:10

3 Answers 3

With a TeX Live distribution (possibly also with MiKTeX) there is a bibexport program. Assuming your document is myarticle.tex, you have to compile it normally and then you call

bibexport -o extracted.bib myarticle.aux

where extracted.bib is the name that you want to give to your new .bib file. Notice that you have to give the extension .aux (or no extension at all).

Then you have to change the name of the .bib file in your document, in order to use extracted.bib.

share|improve this answer
+1 Nice tool. I didn't know it. –  Marco Daniel Jan 21 '12 at 15:38
In MiKTeX 2.9 this tool is missing :-( –  Kurt Feb 15 '13 at 16:24
Although this falls outside of the scope of the question, perhaps a brief word about how this tool does not work with biber-driven bibliographies (or with .bib files that use biblatex fields such as date instead of year) is in order. –  jon Feb 15 '13 at 16:29
@jon bibexport uses BibTeX for doing its job. The manual tells how to add new fields (section 1.4). For biblatex/Biber compatibility the script should look not only for \citation commands in the aux file but also for \abx@aux@cite. –  egreg Feb 15 '13 at 16:42
@egreg -- Right. I was thinking more for people who look at your answer, but don't realize why bibexport isn't working for them; most of them are not going to be modifying bibexport.sh. Another problem that might arise is if you use non-standard entry types (from BibTeX's perspective). I use @Collectio{<key>,..., e.g., for essay collections; that comes through as @{<key>,.... –  jon Feb 15 '13 at 20:02

In addition to egreg's answer, I'd like to point out an alternative solution. Nelson Beebe has developed utilities called bibextract, citetags and citefind to handle sub-bibliography databases. You can obtain them here.

In this case, you would compile the document normally and then type in a shell

citetags myarticle.aux > myarticle-tags
citefind myarticle-tags mybib.bib > mysubbib.bib

The first command prints all the citation keys used in your .tex, while the second selects all the entries from my bib.bib with keys from myarticle-tags. Of course, one can easily write a script to merge the two commands if needed.

Although it works in a similar fashion as bibexport, this solution has the advantage that it does not delete the biblatex fields such as date, while bibexport does by default as mentioned in the comments. It also works with biblatex if you use bibtex as a backend, but as far as I know, it does not if you use biber.

share|improve this answer

With biblatex/biber you can use

biber document-base-name.bcf --output_format=bibtex
share|improve this answer
The above command doesn't work with entries using the crossref field. –  asr Apr 18 at 14:32

Your Answer


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