Saturday, May 15, 2010

Compiling a LaTeX document with Bibtex references

To successfully compile a LaTeX document with Bibtex references, you need to execute 4 steps.

In this case, I'm assuming my document is called MyTexDoc.tex and I want to compile to the pdf file format; for the dvi file format, change the below commands to latex instead of pdflatex.

1. pdflatex MyTexDoc Creates .aux files which include the keywords of your citations
2. bibtex MyTexDoc Extracts cited publications from the .bib file file, using the .aux file and formats them according to your indicated bibliography style. Finally the results are put into a .bbl file
3. pdflatex MyTexDoc Inserts the appropriate reference indications at each citation according to your indicated bibliography style
4. pdflatex MyTexDoc Refines citation and cross references, page formatting and page numbers

Ideally, the above are stored in a shell script (Linux) or batch file (Windows) and execute that file whenever you need to compile the document.