Posts Tagged ‘apacite’

Latexdiff is a script that produces a word-by-word diff of two versions of a latex file that can be compiled to mark up additions and deletions.  It generally works well for me except for one important caveat: it doesn’t recognize the citation command syntax from apacite, the package I use to get APA-style citations.  Luckily, being open-source, I could just fork the repository and fix it.

Latexdiff uses a latex-aware difference algorithm that treats latex commands as single “words”. The problem is that apacite allows citations of the form

\cite<text before citation>{AuthorYear}

Normally, a \cite command is only followed by arguments in […] or {…}. Latexdiff sees the < and thinks that the command is over and it can safely split things.  But this results in the \cite command being separated from its arguments in the diff which then refuses to compile.

The fix is easy and should be incorporated into the next version that’s released. But in the meantime, if you’re suffering as I was you can clone my fix:

git clone
cd latexdiff
git checkout anglebracket-cite-command
ln -s latexdiff /usr/local/bin/latexdiff   # or wherever you like