Skip to contentSkip to conversation

git-latexdiff: Git and Latexdiff working together

DISCUSSION Matthieu Moy 3 participants 5 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

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,

Signature · 2 lines
Matthieu Moy
http://www-verimag.imag.fr/~moy/
#1 lore raw
Quoted 4 lines · Matthieu Moy

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

#2 lore raw
Quoted 4 lines · Jeff King

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.

Signature · 2 lines
Matthieu Moy
http://www-verimag.imag.fr/~moy/
#3 lore raw
Quoted 7 lines · Matthieu Moy
Quoted 4 lines · Jeff King

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.

Quoted 5 lines

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.

Quoted 2 lines

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

#4 lore raw
In reply to Matthieu Moy

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 <[email protected]>:

Quoted 22 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,