# git-latexdiff: Git and Latexdiff working together

5 messages from 2012-02-14 to 2012-02-14. Participants: Matthieu Moy, Tim Haga, Jeff King.
Thread: https://gitlist.dev/t/29624

## Matthieu Moy, 2012-02-14 13:22

Subject: git-latexdiff: Git and Latexdiff working together
Message-ID: <vpq7gzph7mi.fsf@bauges.imag.fr>
URL: https://gitlist.dev/e/vpq7gzph7mi.fsf%40bauges.imag.fr

```
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, 2012-02-14 20:19

Subject: Re: git-latexdiff: Git and Latexdiff working together
Message-ID: <20120214211917.53ef9df6@sirion>
URL: https://gitlist.dev/e/20120214211917.53ef9df6%40sirion
In-Reply-To: <vpq7gzph7mi.fsf@bauges.imag.fr>

```
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>:

> 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, 2012-02-14 21:16

Subject: Re: git-latexdiff: Git and Latexdiff working together
Message-ID: <20120214211629.GA23649@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20120214211629.GA23649%40sigill.intra.peff.net
In-Reply-To: <vpq7gzph7mi.fsf@bauges.imag.fr>

```
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, 2012-02-14 23:13

Subject: Re: git-latexdiff: Git and Latexdiff working together
Message-ID: <vpq4nut6maj.fsf@bauges.imag.fr>
URL: https://gitlist.dev/e/vpq4nut6maj.fsf%40bauges.imag.fr
In-Reply-To: <20120214211629.GA23649@sigill.intra.peff.net>

```
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, 2012-02-14 23:31

Subject: Re: git-latexdiff: Git and Latexdiff working together
Message-ID: <20120214233151.GA25651@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20120214233151.GA25651%40sigill.intra.peff.net
In-Reply-To: <vpq4nut6maj.fsf@bauges.imag.fr>

```
On Wed, Feb 15, 2012 at 12:13:40AM +0100, Matthieu Moy wrote:

> 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

```
