ArXiv – How to Clean Article Source Code Before Submitting

arxiv

ArXiv requires uploading TeX sources. The justifications they give for this are rather weak IMHO, but that is beside the point.

What is the easiest way to clean up an article for submission? ArXiv suggests to automatically delete all lines starting with %, but of course this vastly understates the possibilities of LaTex: Many of my files contain complex \if statements, \iffalse-\fi blocks, not all % symbols mark comments, etc.

Is there a good automatic way to prepare a file for submission?

During the compilation, clearly at some point LaTeX must decide which parts to ignore and which to compile, what to do with the conditionals etc. Is there a way to send the result of this into a file?

Or are there any other good ideas of how to approach this problem?

Best Answer

Google provides a neat tool to clean up the source code for arxiv submission - https://github.com/google-research/arxiv-latex-cleaner.

It removes auxiliary files, comments from your code and has some other nifty features.