I have a BibTeX database with some big number of references which I use for work. When I need to send a document prepared using that database to somone I have two options: either send a full copy of the database (which I would not like to do), or copy all referenced entries from a large database to a smaller copy, and send that copy with a document. Are there any tools which would do this automatically?
-
4Is the recipient going to edit the bibliography? If not you can just send the .bbl file generated by BibTeX, which should contain only those citation entries actually used in the document. Open up the .bbl file in a text editor and you'll see what I mean.– Willie WongCommented Jul 27, 2010 at 20:48
-
1Yes, I would like to send an editable bibliography.– abbotCommented Jul 27, 2010 at 21:03
-
Since the \citation{} and \bibcite{} commands are in the .aux files, it should be quite easy to extract the relevant entries from a BibTeX database. Has no-one written such a tool?– András SalamonCommented Jul 27, 2010 at 21:39
-
1@stefan-pinnow, and other 'vote to close' voters, I'm very curious to know, how come that the question asked in 2010 can be a duplicate of a question asked in 2012. This is not how time works, really.– abbotCommented Nov 12, 2019 at 11:58
-
@abbot Strictly speaking you are right - the other post is a duplicate of this one and it should have been closed. Unfortunately that was not noticed in time and now the other post has many good answers, so I think this post was correctly closed as a duplicate. As the statement above says, This question already has an answer here: tex.stackexchange.com/questions/41821/…– user30471Commented Nov 12, 2019 at 13:08
9 Answers
BibTool is a command-line tool which allows you to perform various manipulations on .bib
files, including extracting all of the entries which are mentioned in a given .aux
file.
-
22I think you should mention how to use
bibtool
that is:bibtool -x file.aux -o refs.bib
for example. For biblatex users, this question is relevant– SeamusCommented Mar 31, 2011 at 20:37 -
Also note that by default
bibtool
searches for the bib files in the same way asbibtex
does. For instance, to have it pick up bib files only in the current directory one can useBIBINPUTS=:.: bibtool -x file.aux -o refs.bib
.– orbeckstCommented Apr 28, 2014 at 20:37
A reference manager such as JabRef will allow you to save selected entries from your entire .bib database to a new, smaller .bib file. JabRef also allows you to export to many other formats, such as XML, HTML, EndNote, and Harvard RTF.
-
9Jabref can extract the entries based on .aux file and write them to a new .bib file.– Pedro J. AphaloCommented Jul 28, 2010 at 10:22
-
3
You could also try M-x reftex-create-bibtex-file if you're using Emacs and RefTeX.
-
my reftex doesn't seem to have this feature. The only autocomplete options for
reftex-create-
arereftex-create-customize-menu
andreftex-create-tags-file
– SeamusCommented Mar 16, 2011 at 13:17 -
1@Seamus: seems to be a bug in reftex's autoloads; try loading the
reftex-site
library first?– SamBCommented Mar 17, 2011 at 23:01 -
That works! Thanks. Except this method seems to fail to find references with optional arguments:
\cite{foo}
gets put in the bib, but\cite[p.1]{foo}
doesn't...– SeamusCommented Mar 21, 2011 at 16:34 -
1@Seamus I also had this problem: was was able to use the menu item, but the tool seems quite broken (multiple citations also seem to fail.)– mforbesCommented Feb 23, 2013 at 0:45
I use a shell script called bibexport
bibexport: a tool to extract BibTeX entries out of .bib files.
usage: .../bibexport [-h|v] [-n] [-b bst] [-a [-e file]...] [-o file] file...
-a, --all export the entire .bib files
-b, --bst specifies the .bst style file [default: export.bst]
-e, --extra extra .bib files to be used (for crossrefs)
-c, --crossref include entries that are crossref'd [default: yes]
-n, --no-crossref don't include crossref'd entries [default: no]
-o file write output to file [default: bibexport.bib]
-h, --help print this message and exit
-v, --version print version number and exit
-
is it possible to use this in overleaf to extract cited bib entries from a larger bibfile? Commented Nov 7, 2022 at 9:09
The current download of JabRef will not run for me on OS 10.10.2 (OS X says it is 'damaged'.) But BibDesk also provides a way of doing this.
- Open your large .bib in BibDesk.
- Create a new, empty Bibliography.
- Click Database > 'Select Publications from .aux File'
- Navigate to the .aux file for your document.
- All entries cited in your document will now be selected. Drag them into the empty Bibliography. Save and rejoice.
I have had many journals request a separate .bib of this kind rather than a .bbl.
-
Nice. Just a clarification: you need to do Step 2 on your open large .bib file, not in the new empty bibliography.– epsiloneCommented Dec 4, 2022 at 12:25
latex2html
has a tool called aux2bib
which does the job.
-
+1 because in contrast to other tools,
latex2html
is included in / installable by the TeX distributions TeX Live and MiKTeX.– matthCommented Feb 25, 2012 at 13:48 -
@JosephWright Could it be that
aux2bib
is a part of 'btex2html` and not really oflatex2html
? Commented Jun 14, 2019 at 10:52
Or again Mendeley -- with it you could even have a shared collection which will stay in sync.
-
1could you elaborate how to do this, please? I use Mendeley synced with overleaf but my Mendeley bib is too big, so I want to only have cited bib-entries in it. Commented Nov 7, 2022 at 9:10
In Bookends, you create a folder for your specific references. After dragging the references to it you can easily export the folder to a bib
file. I use an Apple Script to speed things up.