latexdiff with git

The program latexdiff is a simple program that can compare the changes of two versions of TeX files and generate a new TeX file with highlights of the changes. The program is shipped with most tex distributions.

There is a lot discussions on how to integrate latexdiff with version control systems like git. If you have your tex documents git-controlled. You want to check the change of two revisions visually (not the standard git-diff for text files but you want see the difference in a pdf file for two tex files). For sophisticated solution integrating with git, you may consider using  git-latexdiff.

A simple solution is to run the command

latexdiff <(git show oldcommit:file.tex) file.tex > diff.tex

and then simply run e.g.

pdflatex -interaction=nonstopmode diff.tex

to see the changes in diff.pdf.

UPDATE: If you run into troubles that some tex environments (e.g. tables) do not diff properly with latexdiff, you could provide a custmized config file. e.g. ld.cfg containing the following information


and run latexdiff as

latexdiff -c ld.cfg <(git show oldcommit:file.tex) file.tex > diff.tex
Categorized as LaTeX

BibTeX with abbreviations in journal names

Once upon a time, I was asked by the journal to provide references with journal names in abbreviations. i.e., Journal of the American Statistical Association should be J. Amer. Statist. Assoc. This is annoying because the journal entries in my BibTeX database are in full names. If I do a simple search and replace, it will be problematic again when other journals ask for full names.

I found a solution (or a workaround, to be precise) with BibTeX. See my BibTeX database page for a detailed explanation.

Others suggest using Biber (A BibTeX replacement for users of BibLaTeX) but I have not spent time on that yet.

Categorized as LaTeX