A Makefile recipe which allows to run make arxiv
to get a tarball (__arxiv.tar.gz
) that is ready to be uploaded to arXiv.
The main LaTeX file has to be called main.tex
, and the bibliography file has to be main.bib
.
FILENAME=main | |
.PHONY: arxiv | |
arxiv: clean | |
pdflatex -interaction nonstopmode ${FILENAME}.tex | |
bibtex ${FILENAME} | |
pdflatex -interaction nonstopmode ${FILENAME}.tex | |
pdflatex -interaction nonstopmode ${FILENAME}.tex | |
rm -f ${FILENAME}.blg | |
rm -f ${FILENAME}.aux | |
rm -f ${FILENAME}.pdf | |
rm -f ${FILENAME}.log | |
cp ${FILENAME}.tex ${FILENAME}.tex.backup | |
sed -i '2s;^;\\pdfoutput=1\n;' ${FILENAME}.tex | |
cd .. && tar -czf __arxiv.tar.gz --exclude "Makefile" --exclude ".git" --exclude "${FILENAME}.tex.backup" $(shell basename ${PWD}) | |
mv ../__arxiv.tar.gz . | |
mv ${FILENAME}.tex.backup ${FILENAME}.tex | |
.PHONY: clean | |
clean: | |
rm -f ${FILENAME}.bbl | |
rm -f ${FILENAME}.blg | |
rm -f ${FILENAME}.aux | |
rm -f ${FILENAME}.pdf | |
rm -f ${FILENAME}.log | |
rm -f __arxiv.tar.gz |