Last active
November 12, 2023 14:09
-
-
Save plmi/d2cd5c96b8ae07361f5a77e2fd448d02 to your computer and use it in GitHub Desktop.
Makefile to compile latex document with latexmk
This file contains hidden or 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
PAPER=solution-1.tex | |
SHELL=/bin/zsh | |
# remove extension .tex from PAPER | |
# https://unix.stackexchange.com/a/460224 | |
FILENAME := $(shell x='$(PAPER)'; echo "$${x%%.*}") | |
.PHONY: all clean watch | |
# use -shell-escape to use minted package | |
# use -bibtex for biblatex support | |
all: | |
latexmk -pdf -pdflatex="pdflatex -interaction=nonstopmode" -use-make $(PAPER) -shell-escape -bibtex | |
clean: | |
find . -type f -regex "./$(FILENAME)\.\(aux\|fls\|log\|out\|dvi\|fdb_latexmk\|bcf\|run.xml\|bbl\|blg\)" -delete | |
watch: | |
@while [ 1 ]; do; inotifywait $(PAPER); sleep 0.01; make all; done | |
# for bash: | |
# @while true; do; inotifywait $(PAPER); sleep 0.01; make all; done |
This file contains hidden or 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
#!/bin/bash | |
# fixes '*** missing separator' error | |
perl -pi -e 's/^ */\t/' Makefile |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment