Skip to content

Instantly share code, notes, and snippets.

@holgerdell
Last active February 16, 2016 20:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save holgerdell/9252163 to your computer and use it in GitHub Desktop.
Save holgerdell/9252163 to your computer and use it in GitHub Desktop.
Script to prepare arXiv package of a document that depends on texlive2014's version of biblatex (http://biblatex-biber.sourceforge.net/).
#!/bin/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 texlive2014 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.
# The main latex file of your document (without .tex):
MAIN=main
# You must have both texlive2011 and texlive2014 installed:
TEXLIVE2011=/usr/local/texlive/2011
TEXLIVE2014=/usr/local/texlive/2014
# Adapt these paths to your texlive2011 installation
# (especially $PATH in case you have a 32bit system)
PATH="$TEXLIVE2011/bin/x86_64-linux:$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 texlive2014:
MAKE_BIB=$TEXLIVE2014/bin/x86_64-linux/biber
if [ ! -d "$TEXLIVE2011" ] || [ ! -d "$TEXLIVE2014" ]
then
echo "You must have texlive-2011 AND texlive-2014 installed"
exit
fi
# make a temporary directory "arXiv-package" and
# copy texlive2014's biblatex there
rm arXiv-package.zip
rm -rf arXiv-package
mkdir arXiv-package
cp *.sty *.tex *.bib arXiv-package/
cp $TEXLIVE2014/texmf-dist/tex/latex/biblatex/*.* arXiv-package/
cp $TEXLIVE2014/texmf-dist/tex/latex/biblatex/bbx/*.* arXiv-package/
cp $TEXLIVE2014/texmf-dist/tex/latex/biblatex/cbx/*.* arXiv-package/
cp $TEXLIVE2014/texmf-dist/tex/latex/biblatex/lbx/*.* arXiv-package/
cp $TEXLIVE2014/texmf-dist/tex/latex/biblatex-ieee/*.* arXiv-package/
./git.tex.sh > arXiv-package/git.tex
cd arXiv-package
# Run texlive2011's latexmk, but without bibtex/biber
latexmk -bibtex- $MAIN
# Run texlive2014's bibtex/biber
$MAKE_BIB $MAIN
# Run texlive2011's latexmk again, but without bibtex/biber
latexmk -bibtex- $MAIN
# Remove files that arxiv does not want
rm *.aux *.bib *.blg *.log *.pdf
cd ..
# Create .zip archive
zip -r arXiv-package.zip arXiv-package
rm -rf arXiv-package
@robince
Copy link

robince commented Feb 16, 2016

Thanks very much for putting this up. It really saved me a lot of time!
I made a fork with minor changes for a document using pdflatex (some extra files to remove and don't want to remove pdf figures)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment