-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlatex-makefile
More file actions
119 lines (88 loc) · 2.78 KB
/
latex-makefile
File metadata and controls
119 lines (88 loc) · 2.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# Source file names
TEX = file.tex
PLOTS = plot1.eps plot2.eps
# Can set bib if not using ADS
ADS = file.ads
BIB = $(ADS:.ads=.bib)
# Program file names
BIBTEX = bibtex
PDFLATEX = pdflatex
LATEX = latex
PP4 = pp4
ADS_MAKE_KEYS = ads-make-keys
# To get aux files... may be pdflatex if you only want pdf output
AUXLATEX = pdflatex
LATEX_OPTS = -interaction=nonstopmode
# Derived file names
PDF = $(TEX:.tex=.pdf)
PS = $(TEX:.tex=.ps)
DVI = $(TEX:.tex=.dvi)
AUX = $(TEX:.tex=.aux)
PRESENTATION = $(PDF:.pdf=.presentation.pdf)
PDFPLOTS = $(PLOTS:.eps=.pdf)
NONADS = $(ADS:.ads=.nonads)
BBL = $(ADS:.bib=.bbl)
RERUN = "(There were undefined references|Rerun to get (cross-references|the bars) right)"
RERUNBIB = "No file.*\.bbl|Citation.*undefined"
COPY = if test -r $*.toc; then cp $*.toc $*.toc.bak; fi
# Main rule: what do you want?
all: $(PS) $(PDF) $(PRESENTATION)
# Basic rules
clean:
rm -f $(DVI) $(PS) $(PDF) $(PRESENTATION) $(PDFPLOTS)
rm -f *.aux *.log *.bbl *.blg *.brf *.cb *.ind *.idx *.ilg *.inx *.toc *.out
ps: $(PS)
pdf: $(PDF)
presentation: $(PRESENTATION)
viewpdf: $(PDF)
acroread $(PDF)
viewpresentation: $(PRESENTATION)
acroread $(PRESENTATION)
viewps: $(PS)
gs $(PS)
$(BIB) : $(NONADS) $(ADS)
$(BBL) : $(BIB) $(AUX)
$(DVI) : $(TEX) $(BBL)
$(PS) : $(DVI) $(PLOTS)
$(PDF): $(TEX) $(PDFPLOTS) $(BBL)
$(PRESENTATION) : $(PDF)
# For pdflatex, aux files depend on plots, too.
# Comment/uncomment as necessary
# $(AUX): $(PDFPLOTS)
# Instructions about how to make what
%.bib: %.ads
$(ADS_MAKE_KEYS) $<
%.bib: %.nonads
$(ADS_MAKE_KEYS) $<
%.bbl: %.bib
$(BIBTEX) $*
%.aux: %.tex
$(AUXLATEX) $(LATEX_OPTS) $*
%.ps: %.dvi
dvips $< -o
%.pdf: %.eps
epstopdf $<
%.presentation.pdf: %.pdf
pp4 $< $@
%.pdf: %.tex
$(COPY) ; $(PDFLATEX) $(LATEX_OPTS) $<
egrep -c $(RERUNBIB) $*.log && ($(BIBTEX) $*;$(COPY); $(PDFLATEX) $(LATEX_OPTS) $<) ; true
egrep $(RERUN) $*.log && ($(COPY) ; $(PDFLATEX) $(LATEX_OPTS) $<) ; true
egrep $(RERUN) $*.log && ($(COPY) ; $(PDFLATEX) $(LATEX_OPTS) $<) ; true
if cmp -s $*.toc $*.toc.bak ; then true ; else $(PDFLATEX) $(LATEX_OPTS) $< ; fi
rm -f $*.toc.bak
# Display relevant warnings
echo ERRORS AND WARNINGS
egrep -i "(Reference|Citation).*undefined" $*.log ; true
%.dvi: %.tex
$(COPY) ; $(LATEX) $(LATEX_OPTS) $<
egrep -c $(RERUNBIB) $*.log && ($(BIBTEX) $*;$(COPY); $(LATEX) $(LATEX_OPTS) $<) ; true
egrep $(RERUN) $*.log && ($(COPY) ; $(LATEX) $(LATEX_OPTS) $<) ; true
egrep $(RERUN) $*.log && ($(COPY) ; $(LATEX) $(LATEX_OPTS) $<) ; true
if cmp -s $*.toc $*.toc.bak ; then true ; else $(LATEX) $(LATEX_OPTS) $< ; fi
rm -f $*.toc.bak
# Display relevant warnings
echo ERRORS AND WARNINGS
egrep -i "(Reference|Citation).*undefined" $*.log ; true
# Possibly not needed anymore....
# pdfthumb $(NTFILES) $(TFILES)