-
-
Save bryant1410/d5edfb770701680c2d4018937f02ef4f to your computer and use it in GitHub Desktop.
Script to prepare arXiv package of a document that depends on a recent texlive version of biblatex (using pdflatex)
This file contains hidden or 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 script is useful if: | |
# - you have a manuscript that you want to upload to the arXiv, | |
# - you are using biblatex, and | |
# - you are using a recent version of texlive while arXiv is still on texlive2011 | |
# | |
# Put this file in a directory containing the manuscript you want to | |
# upload to arXiv.org, and adapt the paths below. | |
### Main parameters ### | |
# The main latex file of your document (without .tex): | |
MAIN=main | |
# latexmkrc output path | |
OUTPUT=output | |
INITIAL_PATH=$(pwd) | |
FILES_TO_COPY="*.bbx *.bib *.cbx *.cls *.dbx *.sty *.tex .latexmkrc img" | |
# You must have both versions of texlive2011 installed | |
TEXLIVE2011=/usr/local/texlive_2011 | |
# Adapt these paths to your texlive2011 installation | |
# (especially $PATH in case you have a 32bit system) | |
PATH="$TEXLIVE2011/bin/x86_64-darwin:$PATH" | |
MANPATH="$TEXLIVE2011/texmf/doc/man:$MANPATH" | |
INFOPATH="$TEXLIVE2011/texmf/doc/info:$INFOPATH" | |
TEXMFHOME="$TEXLIVE2011/texmf" | |
TEXMFCNF="$TEXLIVE2011/texmf/web2c" | |
# This should point to the biber or bibtex executable of texlive2015: | |
MAKE_BIB=/usr/bin/biber | |
DEPLOY_FOLDER=arxiv-package | |
DEPLOY_FILE_NAME=$DEPLOY_FOLDER.tgz | |
if [ ! -d "$TEXLIVE2011" ] | |
then | |
echo "You must have texlive-2011 installed" | |
exit | |
fi | |
# make a temporary directory "arXiv-package" and | |
# copy texlive2015's biblatex there | |
rm $DEPLOY_FILE_NAME | |
rm -rf $DEPLOY_FOLDER | |
mkdir $DEPLOY_FOLDER | |
cp -R $FILES_TO_COPY $DEPLOY_FOLDER/ | |
cp /usr/share/texlive/texmf-dist/tex/generic/xstring/* $DEPLOY_FOLDER/ | |
cp /usr/share/texlive/texmf-dist/tex/latex/biblatex/* $DEPLOY_FOLDER/ | |
cp /usr/share/texlive/texmf-dist/tex/latex/biblatex/bbx/* $DEPLOY_FOLDER/ | |
cp /usr/share/texlive/texmf-dist/tex/latex/biblatex/cbx/* $DEPLOY_FOLDER/ | |
cp /usr/share/texlive/texmf-dist/tex/latex/biblatex/lbx/* $DEPLOY_FOLDER/ | |
cp /usr/share/texlive/texmf-dist/tex/latex/biblatex-ieee/* $DEPLOY_FOLDER/ | |
cp /usr/share/texlive/texmf-dist/tex/latex/caption/* $DEPLOY_FOLDER/ | |
cp /usr/share/texlive/texmf-dist/tex/latex/cleveref/* $DEPLOY_FOLDER/ | |
cp /usr/share/texlive/texmf-dist/tex/latex/hyperref/* $DEPLOY_FOLDER/ | |
cp /usr/share/texlive/texmf-dist/tex/latex/tools/* $DEPLOY_FOLDER/ | |
pushd $DEPLOY_FOLDER | |
# Run texlive2011's latexmk, but without bibtex/biber | |
latexmk -bibtex- $MAIN | |
# Run current bibtex/biber | |
$MAKE_BIB $MAIN | |
# Run texlive2011's latexmk again, without bibtex/biber | |
latexmk -bibtex- $MAIN | |
# Remove files that arxiv does not want | |
rm $OUTPUT/*.aux $OUTPUT/*.bcf $OUTPUT/*.log $OUTPUT/*.xml $OUTPUT/*.fdb_latexmk $OUTPUT/*.out $OUTPUT/*.fls $OUTPUT/$MAIN.pdf | |
# Remove output dir if empty | |
rmdir $OUTPUT 2> /dev/null | |
# Create .zip archive | |
shopt -s dotglob | |
tar -czvf $INITIAL_PATH/$DEPLOY_FILE_NAME * | |
shopt -u dotglob | |
popd | |
rm -rf $DEPLOY_FOLDER |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment