I store LaTeX document in local GIT repository.
Once I accomplish appropriate part of document I compile it to PDF and send it to my supervisor who is not familiar with LaTeX nor GIT.
However, he ask me to mark all changes which I made since previous PDF by red color.
Currently, I do that manually, so I also need to remove it from my document, once changes are accepted. It is time consuming and source of mistakes.
Is there any automated way to:
- select GIT commit or specific date which will be used to compare against current document version,
- copy current document to temporary file and mark all differences by red font in that temporary file,
- compile temporary file to PDF?
Best Answer
I've done this with a combination of
git show
andlatexdiff
. One caveat: this is for single-file documents, might be more complicated if you have split the document into several files and used\input
/\include
.Start by getting the version of a file from a previous commit, with
Run
latexdiff
to generate a new.tex
file with the differences highlighted:Compile
tmpdiff.tex
as usual.For
git show
you need to specify the complete path in the repository I think, so if it is placed in a subfolder you needpath/to/filename.tex
.I wrote a script to automate this somewhat, and also clean up leftovers. Admittedly, I haven't used this much yet, but it may be a starting point.