Aux2bib

From Docswiki
Jump to navigation Jump to search

aux2bib is part of the bibtools package, which you can obtain here. As you might be able to guess from the name, it takes a .aux file from a latex compilation and creates a new bib file called references.bib which contains only the entries required by the corresponding .tex file. In this case, I'm going to consider a tex files called FILE.tex located at ~/test/FILE.tex

Once you extract the perl scripts you need to make them executable using

chmod +x aux2bib

You also need to copy the style files the script uses to the directory containing your tex file. While in the bibtools directory,

cp subset* ~/test

There is one possible issue that you could run into when your document uses multiple bib files. If you have the same reference in more than one of those bib files, bibtex will throw a warning. This isn't a problem for the latex compilation as it just continues, but the aux2bib script requires bibtex to exit flawlessly. A good way to check this is just to run bibtex yourself before aux2bib, i.e. for FILE.tex

bibtex FILE.tex

should exit without ANY problems. If you do have multiple references, you can just delete one of the duplicates and all will be well.

After you've made references.bib, make sure you change its name to something more suitable and also change the bibliography environment in your .tex file to point at it!

NOTE: You may have problems running the script because of a 'bad interpreter'. This just means it can't find perl so just use

perl aux2bib FILE.aux