Skip to content

Instantly share code, notes, and snippets.

@emichael
Created January 24, 2016 01:09
Show Gist options
  • Save emichael/c4a471c45d420e19cc86 to your computer and use it in GitHub Desktop.
Save emichael/c4a471c45d420e19cc86 to your computer and use it in GitHub Desktop.
LaTeX Makefile
LATEX=latexmk -synctex=1 -bibtex -f- -pdf -interaction=nonstopmode -halt-on-error
PAPER=paper
.PHONY: all clean viewpdf continuous-update
all: $(PAPER).pdf
$(PAPER).pdf: clean
# Only compile with verbose if the quiet build fails
$(LATEX) $(PAPER).tex -quiet || $(LATEX) $(PAPER).tex
# Comment because latexmk annoyingly doesn't end output with a newline
continuous-update:
watchy -w `find -name "*.tex" -or -name "*.cls" -or -name "*.bib" | paste -s -d ,` make
viewpdf: $(PAPER).pdf
gnome-open $(PAPER).pdf
clean:
latexmk -c && rm -fv $(PAPER).dvi $(PAPER).ps $(PAPER).gz $(PAPER).log $(PAPER).bbl $(PAPER).blg $(PAPER).image.tex $(PAPER).brf $(PAPER).haux $(PAPER).htoc $(PAPER).hbbl $(PAPER).out $(PAPER).tdo $(PAPER).pdf $(PAPER).synctex.gz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment