Skip to content

Instantly share code, notes, and snippets.

@rwcarlsen
Created February 12, 2016 16:52
Show Gist options
  • Select an option

  • Save rwcarlsen/d2d4326ccd9d771bdfc2 to your computer and use it in GitHub Desktop.

Select an option

Save rwcarlsen/d2d4326ccd9d771bdfc2 to your computer and use it in GitHub Desktop.
latex annotated diff generation from git revisions
#!/bin/bash
oldref=$1
olddir=/tmp/latexdiff1
newref=HEAD
newdir=/tmp/latexdiff2
if [[ $# -ge 2 ]]; then
newref=$2
fi
echo "Running 'latexdiff $oldref $newref'..."
rm -rf $olddir $newdir
mkdir -p $olddir
mkdir -p $newdir
bash -c "cd $olddir &>/dev/null && git clone $PWD &>/dev/null && cd fleetpaper &>/dev/null && git checkout $oldref &>/dev/null && make &>/dev/null"
bash -c "cd $newdir &>/dev/null && git clone $PWD &>/dev/null && cd fleetpaper &>/dev/null && git checkout $newref &>/dev/null && make &>/dev/null"
latexdiff --flatten --append-context2cmd="myabstract" $olddir/fleetpaper/paper.tex $newdir/fleetpaper/paper.tex > diff.tex
latexdiff $olddir/fleetpaper/paper.bbl $newdir/fleetpaper/paper.bbl > diff.bbl
pdflatex diff.tex &> /dev/null
bibtex diff.aux &>/dev/null
pdflatex diff.tex &> /dev/null
bibtex diff.aux &>/dev/null
pdflatex diff.tex &> /dev/null
rm -rf $olddir $newdir diff.tex diff.aux diff.blg diff.glo diff.ist diff.log diff.bbl diff.acn diff.out diff.xwm
@elliottbiondo
Copy link

Thanks!

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