Skip to content

Instantly share code, notes, and snippets.

@bogdan-kulynych
Last active August 30, 2018 16:24
Show Gist options
  • Save bogdan-kulynych/48e7bf1bc80f6b8a98c9a3711bbaf8e1 to your computer and use it in GitHub Desktop.
Save bogdan-kulynych/48e7bf1bc80f6b8a98c9a3711bbaf8e1 to your computer and use it in GitHub Desktop.
Preprocess papers for submission to arxiv

What is this?

A Makefile recipe which allows to run make arxiv to get a tarball (__arxiv.tar.gz) that is ready to be uploaded to arXiv.

Prerequisites

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment