threads / discuss / 29624

git-latexdiff: Git and Latexdiff working together

Subject: git-latexdiff: Git and Latexdiff working together

## tl;dr

5 messages between Feb 14, 2012 and Feb 14, 2012.

replies: 4people: 3as markdown or json

Matthieu Moy· Feb 14, 2012, 13:22 UTC · lore
Hi,

You may know latexdiff, a neat tool to visualize differences between LaTeX files (it annotates your .tex file with colors for removed/added parts, producing another compilable .tex file).

I wrote a little shell-script that allows one to use latexdiff on files versionned by Git, with e.g.

  git latexdiff HEAD^ --main foo.tex --output foo.pdf

Essentially, it does a checkout of the old and new revisions, and calls latexdiff + pdflatex for you.

The result is attached in case anyone is interested.

It may be relevant to add this to contrib/ in git.git. If anyone's interested, let me know, and I'll resend the code in the form of a patch doing that.

Regards,
-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Tim Haga· Feb 14, 2012, 20:19 UTC · re: Matthieu Moy · lore

Re: git-latexdiff: Git and Latexdiff working together

Hi,

your tool seems very useful for LaTeX users, especially in scientific work. I could not test it in detail until now, but i had two or three runs with an article draft and it seems to work.

Long story short, i would appreciate it if your tool would be integrated in git.

T.

Am Tue, 14 Feb 2012 14:22:45 +0100 schrieb Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>:

Show 22 quoted lines
> Hi,
> 
> You may know latexdiff, a neat tool to visualize differences between
> LaTeX files (it annotates your .tex file with colors for removed/added
> parts, producing another compilable .tex file).
> 
> I wrote a little shell-script that allows one to use latexdiff on files
> versionned by Git, with e.g.
> 
>   git latexdiff HEAD^ --main foo.tex --output foo.pdf
> 
> Essentially, it does a checkout of the old and new revisions, and calls
> latexdiff + pdflatex for you.
> 
> The result is attached in case anyone is interested.
> 
> It may be relevant to add this to contrib/ in git.git. If anyone's
> interested, let me know, and I'll resend the code in the form of a
> patch doing that.
> 
> Regards,
> 
Jeff King· Feb 14, 2012, 21:16 UTC · re: Matthieu Moy · lore

Re: git-latexdiff: Git and Latexdiff working together

On Tue, Feb 14, 2012 at 02:22:45PM +0100, Matthieu Moy wrote:
> I wrote a little shell-script that allows one to use latexdiff on files
> versionned by Git, with e.g.
> 
>   git latexdiff HEAD^ --main foo.tex --output foo.pdf

My latex usage is all from a past life, so I didn't even try out your tool. But I did wonder what your rationale was in making a separate command as opposed to providing a script that could be plugged in as an external diff.

-Peff
Matthieu Moy· Feb 14, 2012, 23:13 UTC · re: Jeff King · lore

Re: git-latexdiff: Git and Latexdiff working together

Jeff King <peff@peff.net> writes:
> My latex usage is all from a past life, so I didn't even try out your
> tool.  But I did wonder what your rationale was in making a separate
> command as opposed to providing a script that could be plugged in as an
> external diff.

My LaTeX documents are usually sets of .tex files including each other, plus figures and possibly Makefiles. So, git-latexdiff does a full checkout of the old and new tree, then runs latexdiff on the main file, and then compiles the result.

A diff driver would work well for a standalone file, but I don't think you can plug it in this kind of situation.

Also, git-latexdiff has a few hacks like detecting the main latex file automatically by grepping all .tex files for "documentclass", detecting the presence of a Makefile to compile the document, ... that would hardly fit in a diff driver.

That said, that may be just me not knowing diff drivers or difftools well enough.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Jeff King· Feb 14, 2012, 23:31 UTC · re: Matthieu Moy · lore

Re: git-latexdiff: Git and Latexdiff working together

On Wed, Feb 15, 2012 at 12:13:40AM +0100, Matthieu Moy wrote:
Show 12 quoted lines
> Jeff King <peff@peff.net> writes:
> 
> > My latex usage is all from a past life, so I didn't even try out your
> > tool.  But I did wonder what your rationale was in making a separate
> > command as opposed to providing a script that could be plugged in as an
> > external diff.
> 
> My LaTeX documents are usually sets of .tex files including each other,
> plus figures and possibly Makefiles. So, git-latexdiff does a full
> checkout of the old and new tree, then runs latexdiff on the main file,
> and then compiles the result.
> [...]

Ah, yeah. I didn't think about the fact that there's a whole ecosystem of files that go into producing the output.

> That said, that may be just me not knowing diff drivers or difftools
> well enough.
No, your analysis is right. A diff driver wouldn't work well at all.
Thanks for satisfying my curiosity.
-Peff

← back to recent threads