Script for Compiling Latex with Bibtex

Script for Compiling Latex with Bibtex


Below you can download a script to automatically compile a tex document with Bibtex references.


Bibtex provides an easy way to manage references in latex. A great tutorial can get one started with Bibtex quickly. The compilation of a tex document with the correct cross-referencing with bibtex includes several steps.

In order to compile a tex document with the cross-referencing, run the bash script as follows

./ <filename>

This requires the pdflatex and bibtex software, both included in the texlive package. An explanation of what this bash script does is below.

Explanation of Compilation

The tex document needs to be compiled a total of four times in the following manner

pdflatex <filename_base>.tex
bibtex <filename_base>
pdflatex <filename_base>.tex
pdflatex <filename_base>

The first pdflatex command tells bibtex what literature we cited in our paper. The bibtex command creates a .bib file which will be translated into the references section. The next two steps merge the reference section with the latex document and then assigns successive numbers in the last step.