Skip to content

Instantly share code, notes, and snippets.

@drewsberry
Last active August 29, 2015 14:17
Show Gist options
  • Save drewsberry/6ec8906891ba7125c47c to your computer and use it in GitHub Desktop.
Save drewsberry/6ec8906891ba7125c47c to your computer and use it in GitHub Desktop.
Template LaTeX Makefile
# You only need to change these top two lines
BASE=your-main-file
DEP=your-dependencies.tex
SRC=$(BASE).tex
PDF=$(BASE).pdf
LATEXMK=latexmk -pdf -pdflatex="pdflatex --shell-escape %O %S"
LATEXMKCONT=latexmk -pvc -pdf -pdflatex="pdflatex --shell-escape --interaction=nonstopmode %O %S"
TMP=$(BASE).pdfsync *~ *.tmp *.bbl *.blg *.aux *.end *.fls *.log *.out *.fdb_latexmk
all: $(PDF)
$(PDF): $(SRC) $(DEP)
$(LATEXMK) $(SRC)
cont:
$(LATEXMKCONT) $(SRC)
force:
latexmk -C $(BASE)
rm -rf $(TMP)
$(LATEXMK) $(SRC)
clean:
latexmk -C $(BASE)
rm -rf $(TMP)
count:
@texcount -inc -sum -0 '$(SRC)' | tr -d '\n'
@echo
.PHONY: all cont force clean count
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment