Skip to content

Instantly share code, notes, and snippets.

@rriley
Created August 28, 2015 15:10
Show Gist options
  • Save rriley/9ebfad31840cde7ac79e to your computer and use it in GitHub Desktop.
Save rriley/9ebfad31840cde7ac79e to your computer and use it in GitHub Desktop.
Quick script to generate a latexdiff of two revisions of a latex document in a repo.
#!/bin/bash
# This script generates a diff of two different git revisions of a
# tex file. Note that a few things should be true:
# -The two revisions should share the same latex style. (article,llncs,etc.)
# -The main file of each should be called main.tex
# -Everything must be in a git repository
if [ "$#" -ne 2 ]
then
echo "Usage: $0 <git-revision1> <git-revision2>"
exit -1
fi
git stash
git checkout $1
latexpand main.tex > old.tex
git checkout $2
latexpand main.tex > new.tex
git checkout master
latexdiff old.tex new.tex > diff.tex
pdflatex diff
bibtex diff
pdflatex diff
pdflatex diff
git stash pop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment