Last active
August 3, 2023 06:46
-
-
Save dariusf/c539c364209b084eb19996596d55272d to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env bash | |
# This is safe to run in your paper directory, as it creates a copy of the files. | |
# to be uploaded in the $dest directory below. | |
# It assumes latexmk is used, and latexmk outputs go into a _build directory. | |
set -e | |
# build, as we need the bbl file | |
latexmk | |
dest=_build/arxiv | |
mkdir -p "$dest" | |
scrub() { | |
perl -p0e "s/\\\\begin\\{comment\\}.*\\\\end\\{comment\\}//se" < "$1" | perl -pe 's/(^|[^\\])%.*/\1%/' > "$2" | |
} | |
for file in *.tex; do | |
if [ -f "$file" ]; then | |
echo "$file scrubbed" | |
filename=$(basename "$file") | |
dest_file="$dest/$filename" | |
scrub "$file" "$dest_file" | |
fi | |
done | |
# don't include bib | |
cp {*.cls,latexmkrc,_build/main.bbl} "$dest" | |
(cd $dest && tar -czvf archive.tar.gz *) | |
mv $dest/archive.tar.gz . | |
echo "upload this:" | |
ls archive.tar.gz |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment