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.

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?

share|improve this question
3  
Is 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 Wong Jul 27 '10 at 20:48
    
Yes, I would like to send an editable bibliography. –  abbot Jul 27 '10 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 Salamon Jul 27 '10 at 21:39

6 Answers 6

up vote 24 down vote accepted

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.

share|improve this answer
13  
I 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 –  Seamus Mar 31 '11 at 20:37
    
Also note that by default bibtool searches for the bib files in the same way as bibtex does. For instance, to have it pick up bib files only in the current directory one can use BIBINPUTS=:.: bibtool -x file.aux -o refs.bib. –  orbeckst Apr 28 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.

share|improve this answer
6  
Jabref can extract the entries based on .aux file and write them to a new .bib file. –  Pedro J. Aphalo Jul 28 '10 at 10:22
    
Jabref > Tools > New subdatabase based on AUX file. –  dips Jul 5 at 11:35

You could also try M-x reftex-create-bibtex-file if you're using Emacs and RefTeX.

share|improve this answer
    
my reftex doesn't seem to have this feature. The only autocomplete options for reftex-create- are reftex-create-customize-menu and reftex-create-tags-file –  Seamus Mar 16 '11 at 13:17
1  
@Seamus: seems to be a bug in reftex's autoloads; try loading the reftex-site library first? –  SamB Mar 17 '11 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... –  Seamus Mar 21 '11 at 16:34
    
wow.. this is damn simple. –  kindahero Sep 8 '11 at 18:47
    
@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.) –  mforbes Feb 23 '13 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
share|improve this answer

Or again Mendeley -- with it you could even have a shared collection which will stay in sync.

share|improve this answer

latex2html has a tool called aux2bib which does the job.

share|improve this answer
    
+1 because in contrast to other tools, latex2html is included in / installable by the TeX distributions TeX Live and MiKTeX. –  matth Feb 25 '12 at 13:48

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.