Important! Beware that the layout of a Makefile follows certain very precise rules. Cutting and pasting by mouse almost certainly will destroy that precise layout. Don't cut and paste. Download it as instructed in the the previous paragraph.
# 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!
Remark 1: The command "make" takes your file through the following sequence:
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.
No hay comentarios:
Publicar un comentario