Created
May 10, 2023 01:52
-
-
Save chi-feng/eaafa9db9984de07ac45b61af47af8fe to your computer and use it in GitHub Desktop.
prepare latex project for arxiv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# use \listfiles in preamble to get a list of included files | |
rm -rf arxiv_tmp | |
mkdir -p arxiv_tmp | |
# copy files to temp folder | |
rsync -av --files-from=list-of-files.txt . arxiv_tmp/ | |
for f in `find arxiv_tmp/ -name "*.tex"` | |
do | |
echo "Processing $f" | |
# remove comments | |
latexpand --empty-comments $f > "${f}_stripped" | |
# strip lines that start with % | |
sed -i '/^\s*%/d' "${f}_stripped" | |
# squeeze multiple blank lines into single blank lines | |
# cat -s "${f}_stripped" | sponge "${f}_stripped" | |
mv "${f}_stripped" $f | |
done | |
# create tarball for upload to arxiv | |
tar -cvf arxiv.tar -C arxiv_tmp . | |
rm -rf arxiv_tmp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment