I\'m writing a very long document in LaTeX. I have my work computer and my laptop, and I work on them both. I need to keep all the files synchronized between the two compute
I tried to implement this as a bash function, I've included it in my ~/.bashrc
to make it always available.
function git-latexdiff {
if [[ $# != 2 ]];
then
printf "\tusage: git-latexdiff \n";
elif [[ $2 -lt 0 ]];
then
printf "\t must be positive\n";
else
dire=$(dirname $PWD/$1);
based=$(git rev-parse --show-toplevel);
git show HEAD~$2:$(echo $dire| sed 's!'$(echo $based)'/!!')/$1 > $1_diff.tmp;
latexdiff $1 $1_diff.tmp > $1_diff.tex;
pdflatex $1_diff.tex;
okular $1_diff.pdf;
rm $1_diff*;
fi;
}
Note that this function needs latexdiff
to be installed (and be found on the path).
It is also important for it to to find pdflatex
and okular
.
The first is my prefered way to process LaTeX, so you can chage it to latex
as well.
The second is my PDF reader, I supose you'll want to use evince
under gnome, or some other solution.
This is a quick version, made with a single document in mind, and that is because with git, you will lose a lot of time and effort tracking a multi file LaTeX document. You may let git do this task as well, but if you want, you can also continue using \include