Created
May 29, 2019 15:55
-
-
Save willprice/8d261ae45cecd81d46aa156103cc7b72 to your computer and use it in GitHub Desktop.
LaTeX workflow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# You want latexmk to *always* run, because make does not have all the info. | |
# Also, include non-file targets in .PHONY so they are run regardless of any | |
# file of the given name existing. | |
NAME:=paper | |
DOC_SRC:=$(shell find . -maxdepth 1 -iregex './[^.].*\.tex') | |
MEDIA_SRC:=$(shell find images -type f) | |
SVG_SRC := $(shell find images -type f -iname '*.svg') | |
PDF_SVG := $(patsubst %.svg,%.pdf,$(SVG_SRC)) | |
DEPS := $(DOC_SRC) $(MEDIA_SRC) $(PDF_SVG) $(BIB_FILES) | |
BIB_FILES:= ~/references.bib | |
.PHONY: all clean | |
all: $(NAME).pdf | |
# -pdf tells latexmk to generate PDF directly (instead of DVI). | |
# -pdflatex="" tells latexmk to call a specific backend with specific options. | |
# -use-make tells latexmk to call make for generating missing files. | |
# -interaction=nonstopmode keeps the pdflatex backend from stopping at a | |
# missing file reference and interactively asking you for an alternative. | |
%.pdf: %.tex $(DEPS) | |
latexmk -f -pdf -pdflatex="pdflatex -interaction=nonstopmode --shell-escape" -use-make $< | |
%.pdf: %.svg | |
inkscape $< --export-area-drawing --without-gui --export-type=pdf --export-file=$@ | |
clean: | |
latexmk -C $(DOC_SRC) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
find . -regextype posix-extended \ | |
-iregex '.*.(tex|bib|svg|png|pdf)' \ | |
| entr -c make |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment