Latex #
Makefile #
A generic Makefile for building Latex document:
$(TARGET): $(MAIN)
## PDFLatex
latexmk -pdf -pdflatex="pdflatex -interaction=nonstopmode" -jobname=$@ -use-make $<
## XeLatex
# latexmk -pvc -pdf -e '$$pdflatex=q/xelatex %O -interaction=nonstopmode %S/' $<
clean:
latexmk -CA
Compiling document remotely & viewing locally #
I mainly edit and compile a Latex document on a headless Linux server, while reading the compiled document on a local Windows laptop (with WSL).
Remote #
Watch for changes and compile on change:
echo *.tex | entr sh -c "make && cat *.pdf | nc -c localhost 8888 && echo updated"
Local #
Receive the updated document and render to PDF reader (mupdf):
mupdf test.pdf &
ssh -R 8888:127.0.0.1:8888 -N remotehost
while true; do \
nc -l -p 8888 > x && cat x > test.pdf && pkill -HUP mupdf && rm x; \
done