The sequence of commands for processing a LaTeX file into a PDF file were described in the section Compiling slides into PDF. Although these commands can be typed and executed manually, their repeated use during a write/test/debug cycle can be tiresome and error-prone.
In my writing and programming projects I use Makefiles to organize and automate the flow of work. A Makefile contains a sequence of instructions to be performed. The UNIX utility, make, reads and executes instructions specified in a Makefile.
The description of the make utility is outside of the scope of this tutorial so I will not get into that. However, you don't need to be a make expert in order to use it.
I suggest that you download the Makefile pointed to by this link and modify it for your own use. (Note that on some browsers you will have to right-click on a link to download it.) The contents of that file are shown below.
# Generic make file for LaTeX: requires GNU make
TEXFILE = slides.tex
.PHONY: dvi ps pdf clean
pdf: $(TEXFILE:.tex=.pdf)
ps: $(TEXFILE:.tex=.ps)
dvi: $(TEXFILE:.tex=.dvi)
%.dvi: %.tex
( \
latex $<; \
while grep -q "Rerun to get cross-references right." $(<:.tex=.log); \
do \
latex $<; \
done \
)
%.ps: %.dvi
dvips -q -t a4 $< -o $(<:.dvi=.ps)
%.pdf: %.ps
ps2pdf -dPDFSETTINGS=/prepress $<
clean:
@rm -f \
$(TEXFILE:.tex=.aux) \
$(TEXFILE:.tex=.log) \
$(TEXFILE:.tex=.out) \
$(TEXFILE:.tex=.dvi) \
$(TEXFILE:.tex=.pdf) \
$(TEXFILE:.tex=.ps)
In normal use, you will edit the Makefile's "TEXFILE = slides.tex" line and replace "slides.tex" by the name of your LaTeX file. No other changes should be necessary.
Then the single command "make" will process your LaTeX file and produce a PDF file. That's all!
file.tex --> file.dvi --> file.ps --> file.pdf
The command "make dvi" will run only the first step, i.e.,
file.tex --> file.dvi
This is useful for debugging your LaTeX source file.
The command "make ps" will run only the first and second steps, i.e.,
file.tex --> file.dvi --> file.ps
This is useful for creating files for viewing with ghostview, as in:
gv -landscape file.ps
The command "make clean" will delete all the files created by make. This is useful for removing clutter from your directory.
dvips -q $< -o $(<:.dvi=.ps)