Wednesday, December 14, 2011

Allow me to recommend latex-diff and latexbatchdiff

I do almost all of my technical writing in LaTeX, and I do revision control on everything with git. Unfortunately, tracking changes in revisions is very difficult in LaTeX. Maybe I make a change to a single word in a paragraph: a naive diff on the .tex file shows the entire line as being changed, and, even worse, then I just have the diff as plaintext, not something I could show a non-LaTeX user.

latexdiff is able to overcome this, automatically generating indications of changes, like Word’s change tracking system: new words show up as blue and underlined, deleted text is red and crossed-out. (How the changes are indicated is configurable, with several default styles to try.) latexdiff has two shortcomings, though. First, if I’m using version control to manage revisions, I have to manually save old .tex files off to the side so that latexdiff can find them. Second, latexdiff only works on single-file LaTeX documents. I like to put each section in its own file.

latexbatchdiff fixes both of these things. I just typed,

latexdiff-git 1ca0 head.tex abstract.tex acknowledgments.tex\
    introduction.tex methods.tex results.tex conclusion.tex

and it generated a marked-up PDF. (1ca0 is the start of a SHA for a previous revision.) It’s fantastic.

No comments:

Post a Comment

Blog Widget by LinkWithin