Package: arxiv-collector
A small script to collect your LaTeX files for submission to the arXiv. Particularly useful if you use biblatex, and you canuse it directly on Overleaf.UsageInstall withpip install arxiv-collectororconda install -c conda-forge arxiv-collector– or just downloadarxiv_collector.py, it's a stand-alone script with no dependencies. Works with any reasonable version of Python 3, or 2.7 if you really must.Use witharxiv-collectorfrom your project's main directory, orarxiv-collector file.texif you have more than one.texfile and it can't guess correctly which one to use;arxiv-collector --helpfor more.Main features:By default, strips potentially-embarrassing comments from your uploaded.texfiles. (Use--no-strip-commentsto turn this off; it's based on a regular expression, and it's definitely possible for it to screw up, especially if you use%in averbatimblock or something.)Includes the necessary parts of any system package you tell it to upload. By default, this includes biblatex (if you use it) to avoid errors likePackage biblatex Warning: File '.bbl' is wrong format versionOnly uploads things you actually use: if you have an image you're not including anymore or whatever, doesn't upload it.Requirements:A working installation oflatexmk, on your PATH. (This is used to make the.bblfile and to track which files are used.)If you have working TeX and Perl installations, you likely already havelatexmkeven if you don't use it. If you don't, you can either install it the "normal" way (tmlgr install latexmk,apt-get install latexmk, ...), or just grab the script witharxiv-collector --get-latexmk path/to/output/latexmk.Iflatexmkisn't on your PATH for whatever reason, add--latexmk ./path/to/latexmkto yourarxiv-collectorcall.NOTE:latexmkversion 4.63b has broken dependency tracking, which meansarxiv-collectorwon't work with it. You can either update it with your package manager, or you can get a working version, e.g. 4.64a, witharxiv-collector --get-latexmk path/to/output/latexmk, and either put it in e.g.~/binor pass--latexmkto yourarxiv-collectorinvocations.CaveatsThe script may or may not work if you do something weird with your project layout / etc; always check that the arXiv output pdf looks right.Let me knowif you run into any problems, including a copy of the not-working project if possible.In particular, if you include figures or other files with absolute paths (\includegraphics{/home/me/wow.png}instead of\includegraphics{../wow.png}), the script will think it's a system file and not include it by default. You can hack it with--include-packagesto include any directory name in the path.Using directly on OverleafIt's easy to set up Overleaf to run the script on each compilation, so that you're always ready to upload to arXiv at a moment's notice! (You can of course comment out or remove the lines below after running it once, but it shouldn't add much overhead to just do it every time.)First, addarxiv_collector.pyto your project. You can do "New file", "From external url", then put inhttps://raw.githubusercontent.com/djsutherland/arxiv-collector/master/arxiv_collector.py.Now,add a file called.latexmkrcif you don't have one already. This is a control file that tellslatexmkhow to compile your project (which is what Overleaf uses behind the scenes). If you use something slightly complicated like an index or a glossary, you might need to add inOverleaf's default settings file, which this will override, but for 95% of projects you don't need to worry about this.Add to the.latexmkrcfile (whether you're starting from blank or from Overleaf's default, doesn't matter) the following contents:$dependents_list = 1;
$deps_file = ".deps";

END {
  system("python arxiv_collector.py --latexmk-deps $deps_file");
}Now, after you compile, you can downloadarxiv.tar.gzby clicking on the blue page icon to the right of the big green Recompile button ("Logs and output files"), clicking on "Other logs & files", then choosingarxiv.tar.gz. Upload that file to the arXiv, and you should be good!