Resources‎ > ‎LaTeX‎ > ‎

Makefile for LaTeX

When you write a scientific/engineering article including a thesis, you probably have to do:

  1. latex document.tex
  2. bibtex document
  3. latex document.tex
  4. latex document.tex

In order to make your life easier, you can run this sequence using make command.  The following is a sample Makefile:

SRC=thesis
REPORT=$(SRC).pdf

all: $(REPORT)

$(REPORT): $(SRC).tex
    pdflatex $(SRC).tex && bibtex $(SRC) && pdflatex $(SRC).tex && pdflatex $(SRC).tex && wc -w *.tex */*.tex

clean:
    rm -f *~ *.dvi $(SRC).ps $(SRC).pdf

Comments